ga ho gazza1z at yahoo.co.uk
Sun Mar 7 01:28:32 PST 2010

Message: 6
Date: Sat, 06 Mar 2010 22:54:01 -0500
From: Baho Utot <baho-utot at columbus.rr.com>
Subject: Re: LFS on USB?
To: LFS Support List <lfs-support at linuxfromscratch.org>
Message-ID: <4B932359.3010605 at columbus.rr.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

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-         config-  lfskernel-
config-  grub/

~$ 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.
default 0

# Allow 30 seconds before booting the default.
timeout 30

# Use prettier colors.
color green/black light-green/black

# The first entry is for LFS.
title LFS 6.5
root (hd0,0)
kernel /boot/lfskernel- 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
root (hd0,0)
kernel /boot/lfskernel- root=/dev/uba1

On all my builds the "root=" part always points to /dev/uba1 Hope this helps.

Hope this helps,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxfromscratch.org/pipermail/lfs-support/attachments/20100307/f37b28d5/attachment.html>

More information about the lfs-support mailing list