Blame README

Packit d86cd3
This is a small package that may be depended on by any bootloader
Packit d86cd3
installer package to detect other filesystems with operating systems on
Packit d86cd3
them, and work out how to boot other linux installs.
Packit d86cd3
Packit d86cd3
os-prober
Packit d86cd3
---------
Packit d86cd3
Packit d86cd3
All one has to do is Depend on os-prober, and then run the os-prober
Packit d86cd3
command. This command takes no arguments: it will scan all disks available
Packit d86cd3
on the system for other operating systems, and output a list of strings
Packit d86cd3
such as:
Packit d86cd3
Packit d86cd3
 /dev/sda1:Windows NT/2000/XP:WinNT:chain
Packit d86cd3
 ^-------^ ^----------------^ ^---^ ^---^
Packit d86cd3
   part.    OS name for boot  short May change: type of boot loader
Packit d86cd3
            loader's pretty   name  required. Usually there is only
Packit d86cd3
            output                  a 'linux' style bootloader or
Packit d86cd3
                                    a chain one for other partitions
Packit d86cd3
                                    with their own boot sectors.
Packit d86cd3
Packit Service 8d4c46
Tests are executable programs in the directory /usr/libexec/os-probes/. Each
Packit d86cd3
test is called once per partition, with the partition to check as its
Packit d86cd3
parameter, and may output a string as described above, or nothing if it does
Packit d86cd3
not recognise an OS on that partition. Tests return an exit code of 0
Packit d86cd3
if they successfully found an OS, and no further tests will be run on that
Packit d86cd3
partition; or return an exit code of 1 to indicate that no OS was found,
Packit d86cd3
and let the next test run.
Packit d86cd3
Packit d86cd3
Tests that require the partition to be mounted can be placed in
Packit Service 8d4c46
/usr/libexec/os-probes/mounted/. These tests are passed the following
Packit d86cd3
parameters: partition, mount point, filesystem.
Packit d86cd3
Packit d86cd3
Bootloader installer packages will then have to process this output (fairly
Packit d86cd3
trivial) to create valid configuration entries for the bootloader.
Packit d86cd3
Packit d86cd3
Note that os-prober can find other Linux installations, as well as other
Packit d86cd3
operating systems. It does not try to work out all the information needed
Packit d86cd3
to boot Linux (initrd, kernel params, etc). That task is left to
Packit d86cd3
linux-boot-prober.
Packit d86cd3
Packit d86cd3
linux-boot-prober
Packit d86cd3
-----------------
Packit d86cd3
Packit d86cd3
The linux-boot-prober command should be run with a single argument
Packit d86cd3
consisting of a partition that is known to have a linux root filesystem on
Packit d86cd3
it, as returned by the os-prober command. It will try to work out how to
Packit d86cd3
boot that linux installation, and if it is successful, will output one or
Packit d86cd3
more lines in the form:
Packit d86cd3
Packit d86cd3
 /dev/sda2:/dev/sda1:Linux:/vmlinuz:/initrd.gz:root=/dev/sda1
Packit d86cd3
 ^-------^ ^-------^ ^---^ ^------^ ^--------^ ^------------^
Packit d86cd3
   root      boot    label  kernel    initrd    kernel params
Packit d86cd3
   part.     part.
Packit d86cd3
Packit d86cd3
The root partition and boot partition may of course be the same. No guarantee
Packit d86cd3
is made that any partitions referred to in the kernel parameters will still be
Packit d86cd3
in the same place after Debian is installed, or that the /etc/fstab of the
Packit d86cd3
system will be right, or that the system will even boot. The initrd field may
Packit d86cd3
be empty if there is no initrd. The label is whatever label was used in the
Packit d86cd3
boot loader for this linux installation, and it may be quite long or very
Packit d86cd3
short (or nonexistent), and may be inaccurate, confusing, or non-unique. See
Packit d86cd3
TODO for other limitations.
Packit d86cd3
Packit d86cd3
The tests used by linux-boot-prober are in the directory
Packit Service 8d4c46
/usr/libexec/linux-boot-probes/ and also in /usr/libexec/linux-boot-probes/mounted,
Packit d86cd3
and they are called in a similar way as the os-probes described above.
Packit d86cd3
The mounted probes are passed parameters for the root partition, the boot
Packit d86cd3
partition, and the directory the filesystems are mounted in.
Packit d86cd3
Packit d86cd3
linux-boot-prober skips over partitions that are currently mounted on /,
Packit d86cd3
/target, or /target/boot.