Let's talk about LIlo.

Source: Internet
Author: User
Tags ide hard drive
Article title: LIlo introduction. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Author: answer
  
LINUX and LILO
Linux boot can adopt multiple methods, and its Loader LILO (Linux Loader)
Is a flexible boot loader, compared with other commonly used boot loader, LILO
The guiding method is more artistic and its in-depth understanding will help us conveniently
It handles multiple systems, network boot, large hard disks, large memory, and many other difficult problems.
I. LILO's guiding mechanism
  
As we all know, the initial startup of a computer is controlled by the BIOS.
(Such as memory and keyboard) after initialization, it will try to load the master boot record of the hard disk
(MBR) or the boot sector of the floppy disk.
  
MBR can be run in two ways. one is to locate the active partition and load the corresponding
Boot sector, and then the boot sector completes the loading of basic components of the operating system in the zone
The second is to directly load information from a specified partition and load any partition through it.
Operating system, such as LILO, OS/2 boot loader, and Partition Magic.
Programs can be configured in this way.
  
The boot sector of a floppy disk is equivalent to the boot sector of the active partition of the hard disk.
The operating system on the floppy disk.
  
As you can see, you only need to install LILO on the MBR, active partition, or boot floppy disk,
Then LILO can take control of the computer and complete the subsequent boot process. LILO
Build a bootstrap table address encoding so that its bootstrap can be located in Linux
Core file. this address encoding can be performed in the cylindrical/head/sector (CHS) mode.
Uses the LBA linear block number mode, so even for some SCSI control programs LILO
It works well.
  
After LILO locates the configuration file and goes through the pre-boot process, a prompt is displayed:
LILO boot:
  
In this case, the system allows you to boot different operating systems or different kernel configurations,
Press the Tab key to display the option list, and then enter the option or press enter to select the default configuration.
If you choose to boot Linux, you can also directly pass parameters to the system kernel.
  
LILO is more flexible than the boot loader of other systems.
The guide method is also more colorful.
  
● When LILO is installed on the MBR, active partition, or boot floppy disk of the hard disk
The replacement of the original boot program, which can guide Linux and other operations on any partition of any hard disk
System;
  
● Apart from the boot sector, it does not have any hidden files and does not need to use specific scores.
The configuration file can be stored in any partition or even in a zone unrelated to Linux.
Under a subdirectory of the DOS partition;
  
● It can guide several different kernel configurations, or even several different kernels;
  
● It can guide multiple Linux versions on the same host program;
  
● It can boot Linux from the network.
  
LILO's flexibility makes its configuration quite complex. when multiple systems coexist,
We recommend that you first install other operating systems and then install Linux. in this way, set LILO
System guidance is relatively simple.
    
II. several important LILO boot parameters
  
There are many LILO bootstrap parameters. here we will only introduce some important parameters.
.
1. "boot ="
  
This parameter indicates the name of the device that contains the boot sector (for example,/dev/had ).
Then, read the boot sector from the current root partition.
  
2. "root ="
  
This parameter indicates which device is used as the root file system during kernel startup.
The value is the device name of the root file system when the kernel is constructed. the available device names include:
  
(1)/dev/hdaN ~ /Dev/hddN: ST-506 compatible hard drive, N partitions from a to d
(2)/dev/sdaN ~ /Dev/sdeN: SCSI compatible hard disk, N partitions from a to e
(3)/dev/xdaN ~ /Dev/xdbN: XT compatible hard disk, N partitions from a to B
(4)/dev/fdN: floppy disk, A :( N = 0) or B :( N = 1)
(5)/dev/nfs: Mark of the root file system obtained by the network
  
3. "nfsroot ="
If you need to use NFS to provide the root file system to boot a diskless workstation, this parameter is the kernel
Specifies the machine program, directory, and NFS where the network root file system is located. the format is nfsroot =
(<Server_ip> :) <root_dir> (, nfs_options> 〉)
  
4. "nfsaddrs ="
Set the network interface addresses required for network communication. If this parameter is not set, the kernel will
Try to use the Reverse Address Resolution Protocol (RARP) or the startup protocol (BOOTP) to find these parameters,
The format is:
  
Nfsaddrs = <client IP address>: <server IP address>: <gateway IP address>: <subnet mask> 〉:
<Client name>: <network device name>: <auto> 〉
  
5. "image ="
Specify the Linux kernel file.
  
6. "delay ="
Set the waiting time before the first image is booted.
  
7. "disk ="
This parameter defines non-standard parameters for a special hard disk.
  
8. "append ="
To pass an optional parameter line to the kernel, a typical application is
Automatically recognized hard disk parameters, such as: append = "hd = 64, 32, 202"
  
9. "label ="
This parameter specifies a name for each image for selection during boot.
  
10. "read-only"
Set to mount the root file system in read-only mode for file system consistency check (fsck)
.
  
11. "install ="
Install a specified file as the new boot sector. The default value is/boot. B.
  
12. "loader ="
The chain loader used. the default value is/boot/chain. B,
This option is required if it is not started from the first hard disk or a floppy disk.
  
13. "table ="
Indicates the name of the device that contains the partition table. If this parameter is ignored, the boot loader does not
Partitions can be transferred to the operating system that has been guided. When the partition table to which this parameter points is modified
You must re-run/sbin/lilo.
  
14. "init ="
The program executed during kernel initialization. The process is init, getty, rc, and sh,
Linux kernel versions earlier than 1.3.43 can execute the command lines described in/sbin/init. if
If a problem occurs during the boot process, you can set init =/bin/sh to directly jump to Shell.
  
15. "ramdisk_start ="
Because the kernel cannot be placed in a compressed memory file system image
Enough and compressed memory images are placed in a floppy disk and "ramdisk_start = <offset>" is added to the kernel?
Start execution.
  
16. "mem ="
One of the purposes of this parameter is to specify the amount of memory used for Linux: for example, mem = 96 MB,
The second objective is to specify mem = nopentium to tell the kernel not to use a 4 MB paging table.
  
17. "vga ="
Set the display mode, such as 80x50 and 132x44.
    
III. typical LILO configuration methods
  
Generally, the installation program of Linux can complete the installation configuration of LILO,
So as to better solve the problem of multi-system boot, if the system cannot automatically complete this configuration
By manually modifying the configuration file/etc/lilo. conf.
.
  
1. when the system can automatically complete the configuration
  
There is only one suggestion for this situation: install LILO on the root of the Linux partition,
Rather than MBR. Assume that DOS, Windows, and hda2 are installed in hda1.
If Linux is installed, the content of/etc/lilo. conf is roughly as follows:
  
Boot =/dev/hda2 # specify the boot location compact delay = 50 # latency 5 seconds root = current
# Root in the current partition image =/boot/vmlinuz # specify the linux kernel file label = linux
# Use linux as the representative name other =/dev/hda1 # partition where other operating systems are located table =/dev/had
# Specify the hard disk label = dos that contains the partition table # use dos as the representative name
  
2. when the system cannot automatically complete the configuration
  
There are two situations where the system cannot automatically complete the configuration:
(1) the BIOS cannot directly view the Linux root partition;
(2) the BIOS can only read and write the first 504 MB of the standard IDE hard disk.
  
At this time, you must follow the most basic principle: Build a BIOS that can be accessed less
Linux partitions, including kernel files, ing files, and chain loaders.
While the root can be another independent partition. For other configuration details, I
You can use the following examples to describe.
  
  
Example 1: The main hard disk is the IDE interface, the second hard disk is the SCSI interface, and the root file is in the SCSI
.
  
Countermeasure: divide a small Linux partition on the IDE hard disk (/dev/hda2 ),
It contains the basic file and is mounted to the master of/u2, its configuration file/etc/lilo. conf
Content:
  
Boot =/dev/had # mbr installed in the main ide by lilo
Install =/u2/etc/lilo/boot. B # install lilo boot records from boot. B
Map =/u2/etc/lilo/map # The installer creates this ing file, telling the boot loader the location of the kernel block
Compact
Timeout = 50
Image =/u2/vmlinuz # The kernel file should be copied to/u2 in advance
Label = linux
Root =/dev/sda1 # tell the kernel root system to read-only on the scsi hard disk
Other =/dev/hda1
Loader =/u2/etc/lilo/chain. B # specify the loader label = dos
  
Example 2: Linux and DOS/Windows must be installed on a standard IDE hard drive.
For large hard drive problems, many people only know the limit of less than 1024 cylinders, but do not know
Why can only recognize the first 504 MB of standard IDE hard drive.
  
In fact, the int13 call of the BIOS uses the CHS encoding of three single-bit tuples, with 10 bits as the column
Face number, 8 bits are the head number, and 6 bits are the fan area number. The possible cylindrical number is 0 ~ 1023,
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.