Difference between revisions of "LILO Overview"
(Initial first portion; saving to prevent accidental loss.) |
m (→Using LILO: Improved content.) |
||
Line 9: | Line 9: | ||
When LILO is installed on a drive or partition, LILO will provide a menu at boot time. This menu typically shows a list of available operating system kernels and/or operating systems from which a user may select. On embedded systems, this menu is typically streamlined down to a very simple interface. | When LILO is installed on a drive or partition, LILO will provide a menu at boot time. This menu typically shows a list of available operating system kernels and/or operating systems from which a user may select. On embedded systems, this menu is typically streamlined down to a very simple interface. | ||
− | When LILO is configured with a timeout, as it usually is, a user may simply wait for the duration of the timeout for LILO to boot the operating system and kernel which have been configured as default for the system. If the user doesn't wish for the default to boot, the user may press the enter key before the timeout duration has expired to access alternative options. | + | When LILO is configured with a timeout, as it usually is, a user may simply wait for the duration of the timeout for LILO to boot the operating system and kernel which have been configured as default for the system. If the user doesn't wish for the default to boot, the user may press any key other than the enter key before the timeout duration has expired to access alternative options. If the user presses enter during the timeout delay, the timeout immediately expires and the boot process continues with the default configured OS and kernel. The default boot process starts as shown here: |
− | + | <syntaxhighlight lang="text"> | |
+ | LILO 22.8 boot: | ||
+ | Loading emac-oe................................................ | ||
+ | BIOS data check successful | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | Pressing the TAB key will show a list of available OS configurations to boot. Usually, there will only be one available. | ||
+ | |||
+ | <syntaxhighlight lang="text"> | ||
+ | LILO 22.8 boot: | ||
+ | emac-oe | ||
+ | boot: | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | Typing the name of the OS configuration (the OS + kernel) will boot the system with that configuration. | ||
+ | |||
+ | <syntaxhighlight lang="text"> | ||
+ | LILO 22.8 boot: | ||
+ | emac-oe | ||
+ | boot: emac-oe | ||
+ | Loading emac-oe................................................ | ||
+ | BIOS data check successful | ||
+ | EMAC OpenEmbedded Linux 4.0 (stable-2009) | ||
+ | Some code contained within Copyright 2008-2010 EMAC, Inc. | ||
+ | |||
+ | emac 2009-stable vortex86 ttyS0 | ||
+ | |||
+ | vortex86 login: | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | Once the system has booted to the login prompt, the user may log into the system as usual. On EMAC products, the default password for the root account is <code>emac_inc</code>. Please see [[System_Log_In| System Log In]] for more information regarding the login process. | ||
+ | |||
+ | ====Additional Abilities of LILO==== | ||
+ | |||
+ | In addition to the normal boot selection described above, LILO is also able to pass arguments to the Linux kernel for booting. These arguments can be useful for enabling output of boot messages, configuring a video driver, and configuring a good number of other things which can accept kernel command line configuration options. | ||
+ | |||
+ | For example, the <code>console=ttyS0,115200</code> option can be passed to a kernel to enable boot message output to the serial console: | ||
+ | |||
+ | <syntaxhighlight lang="text"> | ||
+ | LILO 22.8 boot: | ||
+ | emac-oe | ||
+ | boot: emac-oe console=ttyS0,115200 | ||
+ | Loading emac-oe................................................ | ||
+ | BIOS data check successful | ||
+ | Linux version 2.6.30.10 (mdean@engineering0) (gcc version 4.2.4) #1 PREEMPT Fri Feb 1 18:38:41 CST 2013 | ||
+ | KERNEL supported cpus: | ||
+ | Intel GenuineIntel | ||
+ | AMD AuthenticAMD | ||
+ | NSC Geode by NSC | ||
+ | Cyrix CyrixInstead | ||
+ | Centaur CentaurHauls | ||
+ | Transmeta GenuineTMx86 | ||
+ | Transmeta TransmetaCPU | ||
+ | UMC UMC UMC UMC | ||
+ | CPU: vendor_id 'Vortex86 SoC' unknown, using generic init. | ||
+ | ... | ||
+ | ... | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | |||
+ | Other arguments to the kernel are passed in a similar manner. The available options to pass will depend on the specific configuration of the kernel LILO is booting. | ||
===Installing LILO=== | ===Installing LILO=== |
Revision as of 15:57, 27 November 2013
Contents
The LInux LOader - LILO
LILO is a bootloader which was created for Linux. LILO was the default bootloader used for most desktop and server distributions for many years. It is still used on x86 embedded systems because it provides everything an embedded system needs to boot into embedded Linux.
Using LILO
When LILO is installed on a drive or partition, LILO will provide a menu at boot time. This menu typically shows a list of available operating system kernels and/or operating systems from which a user may select. On embedded systems, this menu is typically streamlined down to a very simple interface.
When LILO is configured with a timeout, as it usually is, a user may simply wait for the duration of the timeout for LILO to boot the operating system and kernel which have been configured as default for the system. If the user doesn't wish for the default to boot, the user may press any key other than the enter key before the timeout duration has expired to access alternative options. If the user presses enter during the timeout delay, the timeout immediately expires and the boot process continues with the default configured OS and kernel. The default boot process starts as shown here:
LILO 22.8 boot:
Loading emac-oe................................................
BIOS data check successful
Pressing the TAB key will show a list of available OS configurations to boot. Usually, there will only be one available.
LILO 22.8 boot:
emac-oe
boot:
Typing the name of the OS configuration (the OS + kernel) will boot the system with that configuration.
LILO 22.8 boot:
emac-oe
boot: emac-oe
Loading emac-oe................................................
BIOS data check successful
EMAC OpenEmbedded Linux 4.0 (stable-2009)
Some code contained within Copyright 2008-2010 EMAC, Inc.
emac 2009-stable vortex86 ttyS0
vortex86 login:
Once the system has booted to the login prompt, the user may log into the system as usual. On EMAC products, the default password for the root account is emac_inc
. Please see System Log In for more information regarding the login process.
Additional Abilities of LILO
In addition to the normal boot selection described above, LILO is also able to pass arguments to the Linux kernel for booting. These arguments can be useful for enabling output of boot messages, configuring a video driver, and configuring a good number of other things which can accept kernel command line configuration options.
For example, the console=ttyS0,115200
option can be passed to a kernel to enable boot message output to the serial console:
LILO 22.8 boot:
emac-oe
boot: emac-oe console=ttyS0,115200
Loading emac-oe................................................
BIOS data check successful
Linux version 2.6.30.10 (mdean@engineering0) (gcc version 4.2.4) #1 PREEMPT Fri Feb 1 18:38:41 CST 2013
KERNEL supported cpus:
Intel GenuineIntel
AMD AuthenticAMD
NSC Geode by NSC
Cyrix CyrixInstead
Centaur CentaurHauls
Transmeta GenuineTMx86
Transmeta TransmetaCPU
UMC UMC UMC UMC
CPU: vendor_id 'Vortex86 SoC' unknown, using generic init.
...
...
Other arguments to the kernel are passed in a similar manner. The available options to pass will depend on the specific configuration of the kernel LILO is booting.
Installing LILO
Installing Onto the Local Machine
Before LILO can be used to boot a system, it must be installed on the boot device. It must also be reinstalled any time the configuration is changed, or the new configuration will not take effect. Fortunately, installing LILO is easy.
The easiest way to install LILO on the local system's Master Boot Record with the default configuration file (/etc/lilo.conf
), is to type:
root@oe:/# lilo
Unfortunately, you probably don't normally want to install LILO this way. This method works well for desktops and servers, but is often not what you want on an embedded system. There are exceptions, though, such as when you are working in a console on the embedded machine itself, and it has the LILO configuration in /etc/lilo.conf
. If you have the configuration file somewhere else, however, you will need to type:
root@oe:/# lilo -C /etc/alternate_lilo_configuration_file.conf
The -C
(capital C) switch tells lilo
to use the configuration file specified after the switch when installing itself.
Installing LILO Onto a Removable Drive
Unfortunately, the last method shown above is still not what you need to do when your embedded machine's root drive is not in the running embedded system. If you have a Compact Flash disk, for instance, containing your Linux filesystem, and it is mounted on your desktop Linux development machine, you will need to jump through a few hoops to install the bootloader onto the Compact Flash card. This method is usually necessary when you don't yet have a bootable disk for your embedded machine.
The following steps will need to be performed to install LILO onto a removable drive:
-
Mount the drive.
On many Linux desktops, a memory card will be automounted when it is inserted. While this is a nice convenience feature for most users, it comes at the expense of developers. This automount feature can be a source of frustration for those who haven't already found a way around the issues it causes.
Fortunately, we at EMAC have already found a method which works reliably on our recommended Linux distribution, Ubuntu 12.04 LTS, and have documented it here. On other systems, such as Debian, a workaround may not be needed. If your system does not automount, see below.
Workaround for Ubuntu's Automounter
-
Insert the flash card into your card reader, and wait for the file browser window to appear. If a messagebox appears asking you to choose what to do, tell it to open a file browser for browsing the files on the card.
-
Keep the file browser window open, and stash it away for later use.
-
Open a terminal and create a
/mnt/cfcard
directory, if it does not exist: user@ubuntu:/# mkdir /mnt/cfcard -
Find out the device name of the card by looking for where the card was mounted. The file browser window will list the name of the card under Devices in the left pane. Often times, the name will be EMAC_OE. Look for this name in the output of the
df
command:user@ubuntu:/# df -hT | grep EMAC /dev/sdb1 ext3 3.7G 223M 3.3G 7% /media/EMAC_OE
-
From the output of this command, we can see that the
/media/EMAC_OE
mountpoint was mounted onto the/dev/sdb1
device. Therefore, this is the device in which we're interested. -
Mount the device on the directory from step i, without unmounting it first:
user@ubuntu:/# mount /dev/sdb1 /mnt/cfcard user@ubuntu:/#
-
Now, switch to the root user account (if you aren't already root) and copy the device node files into the destination filesystem. The device node file will be needed so that LILO will be able to talk to the flash card. NOTE: Use your user's password to switch to root if you use the method shown here:
user@ubuntu:/# sudo su [sudo] password for user: root@ubuntu:/# cd /mnt/cfcard root@ubuntu:/mnt/cfcard# root@ubuntu:/mnt/cfcard# cp -a /dev/sdb* dev/ root@ubuntu:/mnt/cfcard#
-
Now, use the
chroot
command to make the directory where you mounted the card the effective root directory for your terminal session:root@ubuntu:/mnt/cfcard# chroot . root@ubuntu:/#
-
Now that you're effectively running inside the filesystem on the flash card, you are able to run LILO to install the bootloader. First, be sure to double check to ensure that the configuration file you're using points to the correct device node (in this example,
/dev/sdb1
) so that you don't overwrite the bootloader on your desktop. If you overwrite the bootloader on your desktop, it will render your desktop system unbootable! So, make sure to double check first. -
When you are sure you're using the right device node, run LILO to install the bootloader:The warning, in this case, is normal. It appears because you're in a fake "running system," which means the virtual files in the
root@ubuntu:/# lilo -C /etc/lilo.conf.boot Warning: '/proc/partitions' does not exist, disk scan bypassed Added emac-oe * One warning was issued. root@ubuntu:/#
/proc/
filesystem aren't mounted and able to provide information; hence, the non-existence of the/proc/partitions
file. -
Now, you need to umount the device:
root@ubuntu:/# exit root@ubuntu:/mnt/cfcard# cd .. root@ubuntu:/mnt# umount cfcard root@ubuntu:/mnt# exit user@ubuntu:/#
-
Retrieve the file browser you stashed away earlier, and unmount the automounted directory for the card by clicking on the eject symbol next to the name of the device in the left pane.
Installing on Linux Systems Which do not Automount the Card
-