Here are the things that I do in order to boot my BLFS system from an external USB drive...
1. Compile a kernel to build in USB support (for core, port, and storage drivers) and initial RAM filesystem support (for booting with UUID or LABEL).
a. USB support...
Code:
...[*] USB support ---> (CONFIG_USB_SUPPORT=y)
|
|...<*> Support for Host-side USB (CONFIG_USB=y)
|...<*> EHCI HCD (USB 2.0) support (CONFIG_USB_EHCI_HCD=y)
|...<*> Generic EHCI driver for a platform device (CONFIG_USB_EHCI_HCD_PLATFORM=y)
|...<*> OHCI HCD (USB 1.1) support (CONFIG_USB_OHCI_HCD=y)
|...<*> OHCI support for PCI-bus USB controllers (CONFIG_USB_OHCI_HCD_PCI=y)
|...<*> Generic OHCI driver for a platform device (CONFIG_USB_OHCI_HCD_PLATFORM=y)
|...<*> UHCI HCD (most Intel and VIA) support (CONFIG_USB_UHCI_HCD=y)
|...<*> USB Mass Storage support (CONFIG_USB_STORAGE=y)
NOTE: The HCD port drivers usually are EHCI for high-speed USB plus either OHCI or UHCI for a fallback to legacy USB.
b. SCSI device support (CONFIG_SCSI) also should be built in (required by USB support)...
Code:
... SCSI device support --->
|
|...-*- SCSI device support (CONFIG_SCSI=y)
|...<*> SCSI disk support (CONFIG_BLK_DEV_SD=y)
|...<*> SCSI CDROM support (CONFIG_BLK_DEV_SR=y)
|...<*> SCSI generic support (CONFIG_CHR_DEV_SG=y)
c. Initial RAM filesystem and RAM disk support...
Code:
....General setup --->
|
|...[*]Initial RAM filesystem and RAM disk (initramfs/initrd) support (CONFIG_BLK_DEV_INITRD=y)
...Device Drivers --->
|
|...[*] Block devices ---> (CONFIG_BLK_DEV=y)
|
|...<*> RAM block device support (CONFIG_BLK_DEV_RAM=y)
|...(16) Default number of RAM disks (CONFIG_BLK_DEV_RAM_COUNT=<integer>)
|...(4096) Default RAM disk size (kbytes) (CONFIG_BLK_DEV_RAM_SIZE=<integer>)
2. Use UUIDs or LABELs for partitions instead of device names which may not be consistent (as you found out).
NOTE: See the swaplabel command for finding or changing a swap partition’s UUID. If swaplabel or Gparted fail work for setting a label or UUID for the swap partition, then use mkswap to recreate the swap area with the -L option to set a label which also will assign a UUID to the new swap partition.
3. Boot the system in the usual way with GRUB 2 but add the kernel parameter rootdelay=5 to avoid a kernel panic caused by the slower response of the USB drive.
4. To boot the USB system directly from the BIOS splashscreen menu (instead of from another system's GRUB), install GRUB in the master boot record of the USB drive in the usual way with grub-install. Edit the USB system’s grub.cfg file for the root filesystem and to add the rootdelay kernel parameter. To boot with UUID or LABEL (a good idea with a hot-plugable USB drive), see the BLFS book chapter on initial RAM filesystems, creating the initrd image file, and editing grub.cfg for the initrd command line. Also replace the typical set root command line with a search command line that uses UUID. My current example...
Code:
# Begin /boot/grub/grub.cfg
set default=0
set timeout=5
menuentry “Linux From Scratch” {
insmod search_fs_uuid
search --no-floppy --fs-uuid --set=root 98790171-5ab5-45c6-9764-096c056918cf
linux /boot/vmlinuz root=UUID=98790171-5ab5-45c6-9764-096c056918cf ro rootfstype=ext4 rootdelay=5
initrd /boot/initrd.img
}
# End /boot/grub/grub.cfg
This stuff is from my notes. The actual locations and/or wording of the kernel config stuff may have changed some, but the idea is still valid.