Portable LFS Hint

Techno Hacker technohacker1995 at gmail.com
Fri Feb 5 00:49:16 PST 2016

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxfromscratch.org/pipermail/hints/attachments/20160205/6de9b340/attachment.html>
-------------- next part --------------
AUTHOR: Technohacker <technohacker1995 at gmail.com>

DATE: 2016-02-04

LICENSE: GNU Free Documentation License Version 1.2

SYNOPSIS: Building an LFS System that will work portably (on removable media)

This hint gives some tips on installing an LFS system on removable media
(ex. USB Flash Storage)

Just some basic Linux knowledge

Since the LFS system needs to work on multiple computers, you can't rely on the 
/dev/sdXY format of specifying the root device because that can specify a
different device altogether. So, to specify which device to mount as root, it's
recommended to use either the UUID or the label of the partition (preferably the
UUID as that is always unique). To do so, replace the following line in

/dev/sdXY	/	...

with (for UUID):

UUID=[partition uuid]	/	...

or (for label):

LABEL=[partition label]	/	...

To get the UUID: dumpe2fs /dev/sdXY | grep UUID
To get the label: e2label /dev/sdXY

Just like fstab, GRUB can also use a UUID or label to choose the root device.
just specify 'root=UUID=<uuid>' or 'root=LABEL=<label>'.

Another important kernel command-line option is rootdelay. It tells the kernel
to wait a few seconds before it mounts the root partition. This is vital for USB
systems because the SCSI subsystem needs a little time to initialise USB devices
If 'rootdelay' isnt specified, the kernel tries to mount the root FS but
eventually panics because the device isnt initialised yet. So, to tell the
kernel to wait for the device to be initialised, add 'rootdelay=<seconds>' to
the GRUB config file.

	Linux Kernel
Another thing to do (if you plan on using this on many systems) is to build a
modular kernel so that the kernel can find the necessary drivers. Steps are
available in this hint:

  * Initial hint.

More information about the hints mailing list