LILO Mini-HOWTO This file describes some typical LILO installations. It's intended as a supplement to the LILO User's Guide. I think examples are informative even if your setup isn't much like mine. I hope this saves you trouble. Cameron Spitzer, cls@truffula.sj.ca.us Example 1: ------- -- I have two IDE drives, and a SCSI drive. The SCSI drive can't be seen from BIOS. The Linux Loader, LILO, uses BIOS calls and can only see drives that BIOS can see. My stupid AMI BIOS will only boot from "A:" or "C:" My root file system is on a partition on the SCSI drive. The solution: Store the kernel, map file, and chain loader in a Linux partition on the first IDE. Notice that it is not necessary to keep your kernel on your root partition. The second partition on my first IDE (/dev/hda2) is mounted on /u2. Here is the /etc/lilo.conf file I used. # Install LILO's boot record as Master Boot Record # on the first IDE. # boot = /dev/hda # /sbin/lilo (the installer) copies the LILO boot record from the # following file to the MBR location. install = /u2/etc/lilo/boot.b # # I wrote a verbose boot menu. LILO finds it here. message = /u2/etc/lilo/message # The installer will build the following file. # It tells the boot-loader where the blocks of the kernels are. map = /u2/etc/lilo/map compact prompt # Wait 10 seconds, then boot the 1.2.1 kernel by default. timeout = 100 # The kernel is stored where BIOS can see it by doing this: # cp -p /usr/src/linux/arch/i386/boot/zImage /u2/z1.2.1 image = /u2/z1.2.1 label = 1.2.1 # LILO tells the kernel to mount the first SCSI partition as root. # BIOS does not have to be able to see it. root = /dev/sda1 # This partition will be checked and remounted by /etc/rc.d/rc.S read-only # The same kernel can be told to mount a different partition as # root instead. I have an emergency root setup on /u2. image = /u2/z1.2.1 label = 1.2.1-hda2 root = /dev/hda2 read-only # I kept an old Slackware kernel lying around in case I built a # kernel that doesn't work. I actually needed this once. image = /u2/z1.0.9 label = 1.0.9 root = /dev/sda1 read-only # My DR-DOS 6 partition. other = /dev/hda1 loader=/u2/etc/lilo/chain.b label = dos alias = m Example 2: ------- -- The system in my office has a 1GB IDE drive. The BIOS can only see the first 504 MB of the IDE. (Where MB means 2**10 bytes, not 10**6 bytes.) So I have MS-DOS on a 350 MB partition /dev/hda1 and my Linux root on a 120 MB partition /dev/hda2. MS-DOS was unable to install itself correctly when the drive was fresh. Novell DOS 7 had the same problem. Luckily for me, "Options by IBM" forgot to put the "OnTrack" diskette in the box with the drive. The drive was supposed to come with a product called "OnTrack Disk Manager." If you only have MSDOS, I guess you have to use it. So I made a partition table with Linux' fdisk. MSDOS-6.2 refused to install itself in /dev/hda1. It said something like 'this release of MS-DOS is for new installations. Your computer already has MS-DOS [which was wrong, the drive was fresh] so you need to get an upgrade release from your dealer.' What a crock! So I ran Linux' fdisk again and deleted partition 1 from the table. This satisfied MS-DOS 6.2 which proceeded to create the exact same partition 1 I had just deleted and installed itself. MS-DOS 6.2 wrote its Master Boot Record on the drive, but it couldn't boot. Luckily I had a Slackware kernel on floppy (made by the Slackware installation program "setup"), so I booted Linux and wrote LILO over MS-DOS' broken MBR. This works. Here is the /etc/lilo.conf file I used: boot = /dev/hda map = /lilo-map delay = 100 ramdisk = 0 # Turns off the ramdisk in the Slackware kernel timeout = 100 prompt disk = /dev/hda # BIOS only sees first 500 MB. bios=0x80 # specifies the first IDE. sectors = 63 # get these numbers from your drive's documentation. heads = 16 cylinders = 2100 image = /vmlinuz append = "hd=2100,16,63" # This may be redundant. root = /dev/hda2 label = linux read-only vga = extended other = /dev/hda1 label = msdos table = /dev/hda loader = /boot/chain.b ## end After I installed these systems, I verified that the partition containing the zImage, boot.b, map, chain.b, and message files can use an msdos file system, as long as it is not "stackered" or "doublespaced." So I could have made the DOS partition on /dev/hda1 500 MB. I have also learned that "OnTrack" would have written a partition table starting a few dozen bytes into the drive, instead of at the beginning, and it is possible to hack the Linux IDE driver to work around this problem. But installing would have been impossible with the precompiled Slackware kernel. Eventually, IBM sent me an "OnTrack" diskette. I called OnTrack's technical support. They told me Linux is broken because Linux doesn't use BIOS. I gave their diskette away. Example 3: ------- -- Next, I installed Windows-95 on my office system. It blew away my nice LILO MBR, but it left my Linux partitions alone. Kernels take a long time to load from floppy, so I made a floppy with a working LILO setup on it, which could boot my kernel from the IDE. I made the lilo floppy like so: fdformat /dev/fd0H1440 # lay tracks on virgin diskette mkfs /dev/fd0 1440 # make file system of type minix mkdir /3 # make a place to mount it mount /dev/fd0 /3 cp -p /boot/chain.b /3 # copy the chain loader over lilo -C /etc/lilo.flop # install LILO and the map on the diskette. umount /3 Notice that the diskette MUST BE MOUNTED WHEN YOU RUN THE INSTALLER so that lilo can write its map file properly. This file is /etc/lilo.flop. It's almost the same as the last one: # Makes a floppy that can boot kernels from HD. boot = /dev/fd0 map = /3/lilo-map delay = 100 ramdisk = 0 # Turns off the ramdisk in the Slackware kernel timeout = 100 prompt disk = /dev/hda # 1 GB IDE, BIOS only sees first 500 MB. bios=0x80 sectors = 63 heads = 16 cylinders = 2100 image = /vmlinuz append = "hd=2100,16,63" root = /dev/hda2 label = linux read-only vga = extended other = /dev/hda1 label = msdos table = /dev/hda loader = /3/chain.b ## end Finally, I needed MS-DOS 6.2 on my office system, but I didn't want to touch the first drive. I added a SCSI controller and drive, made an msdos file system on it with Linux' mkdosfs, and Windows-95 sees it as "D:". But of course MSDOS will not boot off of D:. This is not a problem when you have LILO. I added other = /dev/sda1 label = d6.2 table = /dev/sda loader = /boot/any_d.b to the lilo.conf in Example 2. MSDOS-6.2 runs, and it thinks it is on C: and Windows-95 is on D:.