About LILO - principle

xiaoxiao2021-03-06  39

1 General boot boot process.

On the PC, the initial startup was completed by the BIOS. When the boot self-test is over, Power-on Self Test, POST,

BIOS attempts to read into the first sector of the floppy disk, regard it as the boot sector. If there is no flush, try reading the hard disk.

The first sector. New BIOS can change this order, start from the hard drive. Even from the CD. due to

Most BIOS does not provide SCSI support, to start from SCSI disk, SCSI adapter provides himself

Bios. If nothing can be found, the old BIOS will launch built-in ROM Basic, or print "NO"

Rom-Basic.

The operating system starts a few steps. Since the boot sector is small, it usually its main task is to read the second

Loader, the second Loader reads the third Loader until the entire operating system is fully read.

DOS boot area:

Offset

0x000 JMP XX Near Jump INTO The Program Code

0x003 Disk Parameters

0x03e Program Code Loading The Dos Kernel

0x1fe 0xaa55 Magic Number for BIOS

It can be seen that the structure of the guiding area is relatively simple. Its length is always 512 bytes. Above, disk parameters

Only meaningful for DOS. It is important that the boot area starts from 0 and ends with BIOS's Magic Number.

It is relatively simple from the floppy disk because there is only one guiding sector: the first sector. Hard disk is difficult,

It is divided into many partitions. However, the BIOS is at all regardless of partition information, it is like a hard disk as a floppy disk.

Still reading the first partition, called: Master Boot Record. (MBR).

Therefore, MBR should also be the same as the structure described above: starting from 0, ending with BIOS's Magic Number

At the last part of the MBR, there is a partition table. As shown below:

Offset length

0x000 0x1be code loading and starting the boot sector of the agent

partitian

0x1be 0x010 partition1

0x1ce 0x010 partition2

0x1de 0x010 partition3

0x1ee 0x010 partition4

0x1fe 0x0012 0xAa55 Disk Parameters

Each partition information accounts for 16 bytes, the structure is as follows:

1 Boot Boot Flag: 0 = Not Active, 0x80 Active

1 HD Begin: Head Number

2 Sec Cyl Begin: Sec and Cylinder Number of Boot Sector

1 Sys system code: 0x83 Linux, 0x82 Linux swap etc.

1 hd end: Head Number

2 Sec Cyl end: Sector and cylinder number of boot sector

4 Low Byte High Byte Relative Sector Number of Start Sector

4 Low Byte High byte Number of Sectors in the Partition

Therefore, the hard disk can have 4 partitions. These four partitions are called primary partitions: primary prititions. If it

They are not sufficient, so-called extension partitions can be set. The extension partition contains at least one logical partition. Expand

The first sector structure of the partition is similar to the MBR, and its first entry of its partition table corresponds to the first logical partition. If there is a second logical partition, the second entry of the partition table contains a pointer. This pointer points

One address behind the first logical partition. This address contains a partition table. The first entry of the partition table

Corresponding to the second logical partition. This makes up a linked list to extend the partitions can have any logical points.

Area.

Each primary partition and extension zone contain a guiding sector. The system can only start from one of these places.

Boot flag determines which area is booted.

It turns out that there is only the primary partition, so MS-DOS's FDISK and most similar tools can only activate the primary partition ..

The MBR code is to do the following:

1: Determine the activity partition.

2: Use the BIOS to read the active partition start sector.

3: Skip 0 where you start the sector.

MBR's space is enough to complete these work. As mentioned above, each partition theory contains a guiding sector,

Moreover, the second hard disk existing also includes and the first similar structure. MBR can accommodate a complex

Boot procedure. The so-called Boot Manager, dynamic decision activity partition. Linux provides us with Lilo

2 LILO: The Linux Loader

The LILO boot sector includes a space for a partition table, so LILO can be installed in the MBR, or

Put the guiding sector in a partition. LILO has all the features of the DOS boot sector, and it can also boot

Logical sector and second hard disk partition. LILO can also cooperate with additional guides (for example: NT loader), so

Users can have a lot of choices.

(Note: The following titles are to prevent ambiguity, using the original text)

2.1 LILO Started by MS-DOS MBR

If the system has at least one Linux primary partition, (non-exchanging area, on the first hard disk), then LILO can

One of these partitions is installed in these partitions. The boot process is as follows when the LILO corresponds to the partition.

BIOS read into MBR

MBR is read into the active primary partition: the partition where LILO is located.

LILO boots Linux or additional operating systems.

To guide other OS and do not use LILO very simple, activate the partition. There is no change in the Linux partition, very safe.

2.2 LILO Started by a boot manager

If the user does not want to delete the old boot manager, or an OS LILO cannot boot, it can be considered.

1. If Boot Manager can guide the extension area, it is a good place to LILO.

2. If Boot Manager can guide the second hard disk partition, Linux can be mounted on the second hard disk.

3 Some boot manager can even boot logical partitions, which can be installed on logical partitions.

Of course, pay attention to the following situation:

1 Some operating systems directly rewrite MBR, which will destroy the original Boot Manager.

2 Re-dividing will destroy the guiding sector of the extended partition, which is LILO might want to reload.

When installing a new system, whether to reinstall (Linux) rely on new boot manager, or lilo

The guide sector is logged out, or boot manager provides a boot item. Re-partition or partition formatting will

Lilo and Linux are all deleted.

2.3 LILO occupies MBR

If the entire Linux system is on the second hard disk, and the first hard disk does not expand partition, then LILO is only equipped.

On the MBR. In this way, the old MBR will be rushed out, so before installing LILO, the old MBR (including partition

Table) Do a backup. There are many tools in DOS to accomplish this task. Under Linux, this backup: # DD if = / dev / hda of = / backup / mbr bs = 512 count = 1

Write the command:

# DD if = / backup / MBR of = / dev / hda BS = 446 count = 1

Thus, the original MBR is written but does not include a partition table. If the partition table is also restored, BS = 512.

Note that this is destroyed!

2.4 LILO file

Documents related to LILO are usually placed in / boot / under, profile lilo.conf is in / etc /. Contains actual

The mapping file for boot system information has / sbin / lilo installation. For any LILO installation, the configuration file should be set

Set to fit personal needs.

The Configuration File: Profile

Basically, the profile is some variable assignment. Each line contains a flag variable or a variable assignment.

The configuration file is divided into several districts by special variables, and one Linux or other OS is booted each zone.

The common line is explained below:

Boot = Device

Description that device or which partition contains the boot sector. If you do not assign a value to the Boot, take the current default.

Compact

A mode is activated. In this mode, LILO requests to read several partitions to the BIOS. This is very

Shorten the load time, especially from the floppy disk.

DELAY = TENTHS

In 10 seconds, it specifies that the LILO should wait for the user to wait for the user before booting the first boot configuration. If there is no definition,

Guide directly.

Linear

Make the LILO to generate a linear address without using the usual sector / head / cylinder mechanism. Linux address mechanism

Can not rely on the physical structure of the disk.

INSTALL = Boot Sector

Write the boot sector using the specified Boot Sector, default /boot/boot.b

Disktab = disktab

Use the specified Disktab, default usage /boot/disktab.disktab saves the hard disk physical structure information.

Map = map file

Describe the path to the map file.

Message = file

Set a file that will be displayed in LILO boot. If this file is not explained, then

Only "LILO" will appear.

Verbose = Level

Note LILO's debug level. From 0 (not displayed) to 5 (all status information).

Backup = backup file

Previously guide the backup file of the sector content. By default /boot/boot.device number

Force-backup = backup file

The same as Backup, which is overwritten if the backup file exists.

Prompt

Specifies that you want to select the kernel you want to boot by the keyboard. Will you choose from.

Timeout = TENTHS

Set a timeout value, you must have a keyboard input within this time, otherwise the first configuration is used. Similar, if you are super

When you can no longer enter your password. In general, the default value is infinite.

Note: Dory with Timeout (Joe believes), DELAY is "LILO" after the user must have

The maximum time input is entered. Timeout is the user after the user is pressed, the system is waiting to select, the user

The maximum interval of the two keystrokes.

Serial = Port, BPS Parity Bits

Set the serial parameters. If LILO will get serial parameters from this file. If one is invalid, all three parameters are invalid. Port selects one from four standard serial ports: 0 corresponds to COM1 or

/ dev / ttys0 .. The supported baud rate range is: 100-9600. All verification settings support

(N: NONE, E: Even, o: odd)

Bits are 7 or 8. The default is serial = 0,2400n8.

Ignore-Table

Let LILO ignore the destroyed partition table.

FIX-TABLE

Allow LILO to convert each partition (Sector / Head / Cylinder) address to a linear address. usually,

The partition address begins with Cylinder Boudary. Some operating systems will change this. Because LILO can only

Write its starting sector on a partition that is consistent with both addresses, and incorrect 3D addresses can be used with fix-table

Correct. However, this correction cannot be guaranteed forever, so the zone is to ensure alignment cylinder

Boudary is the best choice.

Password = password

Set Password for boot configuration

Restricted

Relax on Password. Only if the user wants to pass the additional startup parameters to the kernel, password needs Password.

Optional

Allows the configuration of the kernels that have erroneous, or do not exist, if Optional, LILO encounters this

The situation will print some error messages and exit.

Each configuration boot from the LILO starts from the Image line.

Image = kernel

Label = name

Image contains the kernel to boot. Label is selected for the user. Image line usually points to a device,

For example, / dev / fd0, you can find the range of the kernel to indicate in Range.

Range = Range

Range can be represented by Start Sector -End Sector or Start Sector Length. E.g:

Image = / dev / fd0

Label = Floppy

Range = 1 512

The following variables are assigned:

Append = string

Pass String to the kernel as the boot parameters. For example, hardware parameters.

Literal = String

And Append is not much. However, he will rush away the original setting. So you can't be explained globally.

Ramdisk = Size

Set the size of the RAM DISK.

Read-only

Read-Write

Set the way root file system access method.

root = device

Set the device where the root file system exists.

VGA = MODE

Screen settings. Possible modes are: Normal, Extended and Ask.

The following settings are for other operating systems:

Loader = loadinger

Significant files used to guide the operating system. The default is /boot/chain.b. In addition, LILO is included

Lower Loader:

OS2_D.B can guide OS / 2 from the second hard disk

Any_d.b attempts to reverse the order of the two hard drives before booting the operating system, so that the second hard disk can be guided

The OS on.

Table = Device

Describes a device that holds the OS that is booted on a partition of the device. If it does not explain Table,

LILO will not pass the information to Osunafe to boot

Turn off the check of the OS to be booted. This setting is only used when you want to boot from a floppy disk. No setting,

Each time the Map Installer starts running, the boot disk is inserted into the floppy drive.

The disktab file

The DiskTab file contains physical structure information for devices to be booted by LILO. Usually, this information can be driven from the device

Dynamic sequence. So, only this method will not use the DiskTab file when it is not. In this case, if

If the file cannot be used, LILO report error message: geo_query_dev hdio_getgeo (dev ...)

or

HDIO_REQ NOT Supported for your Sisi Controller

Please use / boot / disktab

Then, physical structural information must be entered by hand.

# / Boot / distab-lilo parameter TABLE

#

#This Table Contains The Geometry Parameters for SCSI AND

# Ide disks, Which can not be recognized automaticly

# Entries in this Table Overwrite Recognized Parameters!

#

# Dev. BIOS SECS / Heads / Cylin - Par.

# Num. Code TRACK CYLIN. DERS. OFFSET

Optional

# 0x800 0x80 32 64 202 0 # / dev / sda

Each domain meanings is as follows:

0x800

Equipment number. Compose by the main side and standby number.

Equipment number. Compose by the main side and standby number.

0x80

The BIOS code of the device. The first hard disk of the 0x80 code system. 0x81 second,. . . .

All partitions on the same hard drive are the same.

32, 64, 203

Sector number (each track)

Number of HEADS

Number of CYLINDERS

0

The beginning of the partition. You can also read from the partition table, so you may not explain.

2.5 LILO boot information

During the startup process, LILO will display 'lilo' if the LILO error exits, can determine the system according to the display

Reason for error.

No information: LILO is not read at all, no LILO, or the partition resides in Lilo is not activated.

The first part of Lnumber: LILO is read and started. However, the second part cannot be read. Behind

The figures indicate the reason for the error. This may be due to the physical error or incorrect physical structure information of the hard disk.

The first part of Li: LILO can be read into the second part, and the second part is performed. This may be

Indeed by physical structure information or reinstalling Boot.b without running LILO.

The second part of LILO is started, but it cannot be read from the Map file to Descriptor Tables.

This illustrates incorrect physical structural information or physical errors.

The second part of lil ?: lilo is read to an incorrect address. Reason with Li

Lil-: Descriptor Tables is wrong. This may be incorrect physical structure information or reloading

Map file without running LILO to reinstall.

转载请注明原文地址:https://www.9cbs.com/read-76977.html

New Post(0)