Friday, December 10, 2010

About LiLo--principle article

1 General on the boot process on PC, the initial start-up by the BIOS.

When the end of the post (Power-OnSelfTest, POST), the BIOS attempts to read the floppy disk in the first sector, think of it as the boot sector. If no floppy disk drive, try to read the first sector. New BIOS can change this order, first boot from the hard drive. Even boot from the CD. Since most SCSI BIOS support is not available, to boot from a SCSI disk, SCSI adapters to provide his own BIOS. If everything is not found, the old BIOS will start the built-in ROMBASIC or directly print NOROM-BASIC ". The operating system's startup is divided into several steps. As the boot sector is smaller and typically it main task is to read the second loader, second loader then reads the third loader, until the entire operating system is completely read. DOS boot sector: OFSET 0x000 JMPxx Nearjumpintotheprogramcode 0x003 Diskparameters 0x03E ProgramcodeloadingtheDOSkernel 0x1FE 0xAA55 MagicnumberforBIOS visible, the boot sector of the structure is relatively simple. It is always 512 bytes in length. Above, the disk parameters are meaningful only for DOS. It is important that the boot sector from 0 to the end of the magicnumber of BIOS. Start from floppy disk is relatively simple, because there is only one boot sector: first sector. Hard drive is difficult, it is divided into many sections. However, the BIOS simply whether the partition information, it is treated as a floppy disk, hard drive, as are read into the first partition, called: masterbootrecord. (MBR). So the MBR and should be and as specified above for the structure: from 0 to the end of the magicnumber BIOS in the last part of the MBR, partition table. The following figure: OFFSET Lengt 0x000 0x1BEcodeloadingandstartingthebootsectoroftheactive partitian 0x1BE 0x010 partition1 0x1CE 0x010 partition2 0x1DE 0x010 partition3 0x1EE 0x010 partition4 0x1FE 0x0012 0xAA55 Diskparameters each partition information 16 bytes, the structure is as follows: 1BOOT Bootflag: 0 = notactive, 0x80active 1HD Begin: headnumber 2SEC CYL Begin: sectorandcylindernumberofbootsector 1SYSSystemCode: 0x83linux, 0x82linuxswapetc. 1HD End: headnumber 2SEC CYL End: sectorandcylindernumberofbootsector 4lowbyte highbyte Relativesectornumberofstartsector 4lowbyte highbyte Numberofsectorsinthepartition so hard disk can have four partitions. These four partitions are called primary partitions: primaryprititions. If they are not enough, you can set the so-called extended partition. Extended partition contains at least one logical partition. Extended partition of the first sector structure similar to the MBR, partition table, the first table that correspond to the first logical partition. If there is a second logical drive, the partition table of the second table item contains a pointer. The pointer to the first logical partition on the back of an address. This address contains a partition table. The partition table of the first table that correspond to the second logical partitions. This will form a linked list, resulting in an extended partition can have any number of logical partitions. Each primary partitions and an extended area contains a boot sector. The system only available from one of the few places to start. BOOT flag to decide which area is booting. Originally, only primary partitions, so the MS-DOS Fdisk and most similar tools can only activate the primary partition. The MBR code to make the following actions: 1: determine the active partition. 2: use the BIOS, the active partition's boot sector read. 3: go to the boot sector of the 0 position. MBR space sufficient to complete these tasks. As noted above, each partition in theory contains a boot sector, and there's a second hard drive also contains the first similar structure. MBR can accommodate a complex boot program. The so-called bootmanager, dynamic decision the active partition. Linux provides us with lilo 2LILO: thelinuxloader LILO boot sector contains a partition table space, therefore, LILO that can be installed in the MBR, it can be installed on a partition's boot sector. LILO have a DOS boot sector of all functions, but it also can boot logical sector, and the second hard disk is divided intoDistrict. LILO can and other facilitators cooperation (for example: NTloader), so that users can have many choices. (Note: the following headings to prevent ambiguity, use original) 2.1LILOstartedbyMS-DOSMBR if at least one linux primary partition, (non-Exchange areas, and at the end of the first hard disk), then you can install LILO in one of these partitions. When LILO corresponding partition is activated, the boot process is as follows: to read MBR MBR BIOS into active primary partition: the partition that LILO. LILO boot Linux or another operating system. Other OS to boot without LILO is straightforward, activate the partition. There have been no changes to the Linux partitions, very safe. 2.2LILOstartedbyabootmanager if users do not want to delete the old bootmanager or a OSLILO cannot boot, you can consider this approach. 1. If the bootmanager can guide expansion area, there is a good place for LILO. 2. If the bootmanager can guide the second hard disk partition, linux can be installed in a second hard drive. 3 some bootmanager or even boot logical partition, then you can install LILO at the logical partition. Of course, it is necessary to pay attention to the following conditions: 1 some operating systems directly to overwrite the MBR, this will undermine the bootmanager. 2 repartition would undermine the extended partition boot sector, it is possible to reload LILO. When installing a new system, whether you want to reinstall (linux) rely on new bootmanager or LILO boot sector to be cancelled, or the bootmanager is it provides a boot entry. Repartition or partition formatting will delete all LILO and Linux. 2.3LILO occupy the MBR if the whole linux system are on the second hard disk, and the first hard drive does not have an extended partition, then put in MBR LILO only. In this way, the old MBR away, so, before installing LILO, you want the old MBR (including the partition table) to do a backup. DOS has many tools you can complete this task. In linux, so backup: # ddif =/dev/hdaof =/backup/MBRbs = 512count = 1 write will use the command: # ddif =/backup/MBRof =/dev/hdabs = 446count = 1 so that the original MBR is write will but not the partition table. If you also want to recover partition table, then the bs = 512. Notes, in this way, the new partition table will be destroyed! 2.4LILO files and documents related to LILO is usually placed in the/boot/, configuration files in/etc/lilo.conf. Contains the actual boot system information mapping files have/sbin/lilo installation. For any installation, LILO configuration files should be set to suit individual needs. Theconfigurationfile: basically, a configuration file, the configuration file is some variable assignment. Each row contains a flag variable or a variable assignment. configuration file is a special variable assignment is divided into several zones, each zone boot a linux or other OS. following explains common line: boot = device description that a device or a partition that contains the boot sector. If there is no assignment for the boot, the current default value. Compact activation mode, in this mode, LILO to BIOS requests into the adjacent several partitions. This greatly reduces the loading time, particularly from a floppy disk to boot. Delay = tents to 10 seconds to LILO boot first boot configuration before waiting for the user's time. If not defined, the direct boot. Linear make LILO generated linear address instead of the usual Sector/Head/Cylinder mechanism. Linux address mechanism can not rely on the physical structure of the disk. Install = bootsector using specified bootsector write boot sector, the default use/boot/boot.b disktab = disktab disktab class using the specified, the default use/boot/disktab.disktab saved hard physical structure information. Map map = mapile describes the path to the file. Message = file specifies a file, the contents of the file will be in LILO boot is being displayed. If there is no description for the file, then only the "LILO". Verbose = level description LILO's debug level. From 0 (no information) to 5 (all state information). Backup = backupile previous boot sector contents of backup files. The default use/boot/boot.devicenumber force-backup = backupile and backup the same, if backup files exist, to be overwritten. Prompt to specify the user via the keyboard to select a boot kernel. Not be selected by default. Timeout = tents sets a timeout value, in this time must be input from the keyboard, or with the first configuration. Similarly, if the timeout, it no longer has to enter a password. Typically, this takes the default value, infinite. Note: the difference with the timeout delay (joe thinks), the delay is the "LILO" appears after the user must haveEnter the maximum amount of time. Timeout is the user to press any key, the system waits for user selection, two keystrokes the maximum interval of time. Serial = port, set the serial port parameters bpsparitybits. If LILO from that file gets serial port parameters. If one is not valid, that all three parameters are invalid. Port from four standard serial port, select a: 0 corresponds to COM1 or/dev/ttyS0.. Support of baud rate range: 100-9600. All calibration sets are supported (n:none, e:even, o:odd) bits for 7 or 8. The default is serial = 0, 2400n8. Ignore-table let LILO ignores damaged partition table. Fix-table allow LILO will each partition (cylinder/head/sector) addresses into linear address. Typically, the start address from cylinderboudary partition. Some operating systems, will change this. Since LILO can only use its boot sector write to both addresses are consistent partition, incorrect 3D address can be used to correct fix-table. However, this remedy cannot be guaranteed is forever, so heavy partitions to ensure alignment cylinderboudary is the best choice. Password = password for boot configuration settings

No comments:

Post a Comment