lLFS on USB?
gazza1z at yahoo.co.uk
Sun Mar 7 09:53:58 PST 2010
clydew at clydew.org wrote:
> Is it possible to build Linux from Scratch on a USB Flash Drive. I
> did build it there but am having a time getting Grub to recognize it.
Yes I built LFS-6.5 on my desktop and transfered it to a USB drive with
Building directly on the usb drive is slow and not necessary.
Don't do the rsync while booted into LFS.
You need the USB stuff built into the kernel as well as the filesystem (
I used ext2) and necessary hardware drivers, not as modules.
The sequence should go something like the following:
partition and format the usb drive
mount the the drive
mount /dev/sdXn <mount point>
rsync -var /mnt/lfs/ <mount point/>
install grub to the usb drive MBR
Then setup /boot
The following is from my bootable usb thumb drive (mount at /media/LFS):
/boot should look like this
~$ ls /media/LFS/boot/
System.map-22.214.171.124 config-126.96.36.199-2010-02-28 lfskernel-188.8.131.52
~$ ls /media/LFS/boot/grub
default ffs_stage1_5 minix_stage1_5 ufs2_stage1_5
device.map iso9660_stage1_5 reiserfs_stage1_5 vstafs_stage1_5
e2fs_stage1_5 jfs_stage1_5 stage1 xfs_stage1_5
fat_stage1_5 menu.lst stage2
/boot/grub/menu.lst should be like this
# Begin /boot/grub/menu.lst
# By default boot the first menu entry.
# Allow 30 seconds before booting the default.
# Use prettier colors.
color green/black light-green/black
# The first entry is for LFS.
title LFS 6.5
kernel /boot/lfskernel-184.108.40.206 ro rootdelay=10
I have built 4 LFS systems directly on to USB sticks. The first time It took me about 20 goes to compile the kernel finally doing it more by luck than judgement, by enabling every CONFIG entry that had the letters USB in it. I always build a monolithic kernel first to eliminate any problems with modules that might occur. Of course once you have a bootable system then you can start modulising the kernel.
My grub entry for my LFS6.4 stick is:
title Linux From Scratch 6.4 Kernel 220.127.116.11
kernel /boot/lfskernel-18.104.22.168 root=/dev/uba1
On all my builds the "root=" part always points to /dev/uba1 Hope this helps.
Hope this helps,
More information about the lfs-support