Linuxdoc Linux Questions
Click here to ask our community of linux experts!
Custom Search
Next Previous Contents

4. Installing hdc to Boot as hda and Using bios=

Lilo allows to map the kernel image from one disk and instruct the BIOS to retrieve it from another disk. For example, it's common for me to install Linux on a disk I connect to hdc (master disk of secondary controller) and boot it as a standalong system on the primary IDE controller of another computer. I copied the installation floppy to a tiny partition, so I can run chroot in a virtual console to install hdc while I use the system to do something else.

The lilo.conf file I use to install Lilo looks like:

# This file must be used from a system running off /dev/hdc
boot = /dev/hdc   # overwrite MBR of hdc
disk = /dev/hdc   # tell how hdc will look like:
   bios = 0x80    #  the bios will see it as first drive
delay = 0
vga = 0

image = /boot/vmlinux  # this is on /dev/hdc1
  root = /dev/hda1     # but at boot it will be hda1
  label = Linux
  read-only

This configuration file must be read by a Lilo running off /dev/hdc1. The Lilo maps that get written the boot sector (/dev/hdc) must refer to the files in /boot (currently installed as hdc); such files will be accessed under hda when this disk will be booted as a standalone system.

I call this configuration file /mnt/etc/lilo.conf.hdc (/mnt is where hdc is mounted during the installation. I install Lilo by invoking ``cd /mnt; chroot . sbin/lilo -C /etc/lilo.conf.hdc''. Refer to the manual page for chroot if this looks magic.

The ``bios='' directive in lilo.conf is used to tell Lilo what the BIOS thinks of your devices. BIOS calls identify floppy disks and hard drives with a number: 0x00 and 0x01 select the floppy drives, 0x80 and the following numbers select hard disks (old BIOS-es can only access two disks). The meaning of ``bios = 0x80 in the previous sample file is therefore ``use 0x80 in your BIOS calls for /dev/hdc''.

This Lilo directive can be handy in other situations, for example when your BIOS is able to boot from SCSI disks instead of IDE ones. When both IDE and SCSI devices are there, Lilo can't tell whether 0x80 will refer to one or the other because the user is able to choose it in the BIOS configuration menus, and the BIOS can't be accessed while Linux is running.

By default, Lilo assumes that IDE drives are mapped first by the BIOS, but this can be overridden by using instructions like these in /etc/lilo.conf:

disk = /dev/sda
  bios = 0x80

Next Previous Contents