The Loopback Root Filesystem HOWTO: Booting the System

Next Previous Contents

## 4. Booting the System

To boot from this new root device all that is required is that the floppy disk prepared as described above is inserted for the PC to boot from.

You will see the following sequence of events.

1. DOS boots
2. AUTOEXEC.BAT starts
3. LOADLIN is run
4. The Linux kernel is copied into memory
5. The initial ramdisk is copied into memory
6. The Linux kernel is started running
7. The `/linuxrc` file on the initial ramdisk is run
8. The DOS partition is mounted and the root and swap devices set up
9. The boot sequence continues from the loopback device

When this is complete you can remove the boot floppy and use the Linux system.

## 4.1 Possible Problems With Solutions

There are a number of stages where this process could fail, I will try to explain what they are and what to check.

DOS booting is easy to recognise by the message that it prints `MS-DOS Starting ...` on the screen. If this is not seen then the floopy disk is either not-bootable or the PC is not bootable from the floppy disk drive.

When the `AUTOEXEC.BAT` file is run the commands in it should be echoed to the screen by default. In this case there is just the single line in the file that starts `LOADLIN`.

When `LOADLIN` executes it will do two very visible things, firstly it will load the kernel into memory, secondly it will copy the ramdisk into memory. Both of these are indicated by a `Loading...` message.

The kernel starts by uncompressing itself, this can give crc errors if the kernel image is corrupted. Then it will start running the initialisation sequence which is very verbose with diagnostic messages. Loading of the initial ramdisk device is also visible during this phase.

When the `/linuxrc` file is run there is no diagnostic messages, but you can add these yourself as an aid to debugging. If this stage fails to set up the loopback device as the root device then you may see a message that there is no root device and the kernel aborts.

The normal boot sequence of the new root device will now continue and this is quite verbose. There may be problems about the root device being mounted read-write, but the `LOADLIN` command line option '`ro`' should stop that. Other problems that can occur are that the boot sequence is confused about where the root device is, this is probably due to a problem with `/etc/fstab`.

When the boot sequence has completed, the remaining problem is that programs are confused about whether the DOS partition is mounted or not. This is why it is a good idea to use the fake mount command described earlier. This makes life a lot easier if you want to access the files on the DOS device.

## 4.2 Reference Documents

The documents that I used to create my first loopback root filesystem were:

- The Linux kernel source, in particular `init/main.c`
- The Linux kernel documentation, in particular `Documentation/initrd.txt` and `Documentation/ramdisk.txt`.
- The `LILO` documentation.
- The `LOADLIN` documentation

Next Previous Contents