A stated reason for not including grub in the current CLFS Sysroot guide, is
that the method for installing grub is not known. This email attempts to offer
a solution.
First, I tried to install grub natively much like shadow is. After softening
my head (beating it against a brick wall), I realized this was the most
difficult path, and not likely headed for a successful outcome.
So this naturally led me back to the grub manual. And of course the easy
solution was right there. The only reason I didn't like the solution, is
because I couldn't script the actual installation (along with the compilation).
The simple solution is this:
Compile grub along with all the other apps, then create a grub boot disk to
perform the actual install. I tested this on my laptop, and it worked like a
champ. This is the detail:
1. Added Grub installation. I inserted it after the kernel installation, but
It could go anywhere. My example is based on an ext2 boot partition, you'd
want to copy the 1_5 file that matches your filesystem.
patch -Np1 -i ../grub-0.97-fixes-1.patch
./configure --prefix=/usr \
--build=${CLFS_HOST} --host=${CLFS_TARGET}
make
make DESTDIR=${CLFS} install
mkdir -v ${CLFS}/boot/grub
cp -v ${CLFS}/usr/lib/grub/*/stage{1,2} ${CLFS}/boot/grub
cp -v ${CLFS}/usr/lib/grub/*/e2fs_stage1_5 ${CLFS}/boot/grub
2. Added menu.lst. This was my method. Note that I used a few variables the
book doesn't include.
echo "#
# This entry is for CLFS sysroot.
title ${CLFS_VERSION}
root (hd0,0)
kernel /clfskernel-${KERN_VERS} root=/dev/${ROOT_PART}" >
${CLFS}/boot/grub/menu.lst
2. Prepare grub boot medium. The grub manual gives directions for preparing a
grub boot disk from floppy, and cdrom. I elected to use a spare flashdrive
that wasn't busy, as I am able to boot from USB. This is how I did it.
a. Identify device, block count, and size of USB flashdrive. I used a 128M
sized model because I didn't have anything smaller. Insert the flashdrive into
a running linux system (used LiveCD) with a terminal open. Note the block
count and size. Once the device settled I learned that my particular device
reported as sda, had 254208 blocks at 512 bytes each.
b. Use dd to zero out the flashdrive. Using the above information these are
the commands I used:
dd if=/dev/zero of=/dev/sda
c. Use dd to install grub to the grub boot flashdrive. NOTE: Replace
i386-pc with your architecture below if different.
cd ${CLFS}/usr/lib/grub/i386-pc
dd if=stage1 of=/dev/sda bs=512 count=1
dd if=stage2 of=/dev/sda bs=512 seek=1
3. Install grub. Insert the freshly made grub boot flashdrive into the target
machine and boot the flashdrive (this assumes you are able to boot from USB).
In my case, I just left it in the laptop and rebooted. Once the target machine
boots into the grub prompt, simply enter the normal root and setup commands.
I'll point out that the first device is probably going to be the flashdrive.
These are the commands I used to install grub:
> root (hd1,0) # remember, hd0 was identified as the flashdrive, and I use a
separate boot partition.
> setup (hd1)
4. Reboot into the freshly installed system using Ctrl-Alt-Del. I guess
'quit' doesn't work, because there's nothing to quit to.
Hope this is helpful.
Harvey
____________________________________________________________________________________
Want to start your own business?
Learn how on Yahoo! Small Business.
http://smallbusiness.yahoo.com/r-index
_______________________________________________
Clfs-dev mailing list
[email protected]
http://lists.cross-lfs.org/cgi-bin/mailman/listinfo/clfs-dev