Prepping a CF with grub for a wrap

From ME2000

Jump to: navigation, search

Contents

Introduction

This howto takes you through prepping a Compact Flash card with the GRUB bootloader for use in a wrap board. It assumes that you have (or will have) a bzImage kernel and a rootfs.gz compressed root filesystem to add to the cf. Test files are provided at the bottom of this page.

The Detail

First, fdisk the CF, and make a single e2fs partition on the CF as partition 1. /dev/hdc happens to be where my laptop sees the Compact Flash card when I insert it into a CF to PCMCIA adapter, and then into the laptop.

fdisk /dev/hdc1

Do a mke2fs on it as well.

mke2fs /dev/hdc1

At this stage, it cant to do an fsck. Reduces complaining when the kernel is booting due to unchecked filesystems.

fsck /dev/hdc1

Then mount the filesystem

mount /dev/hdc1 /mnt

We have to mount the file system because we tell grub to use the mountpoint as a location to install the grub files. Now we can install grub on the CF. This installs an MBR (Master Boot Record) on the CF, and also writes the various boot stages of the grub loader to the /mnt/boot/grub directory

grub-install --no-floppy --root-directory=/mnt /dev/hdc

Next, check the /mnt/boot/grub/device.map

On my laptop, I ended up with a device.map as

(hd0)   /dev/hda
(hd1)   /dev/hdc

This is not what we want when booting on the wrap, so we change it to just

(hd0)   /dev/hda

Now, to add the mnt/boot/grub/menu.lst file. Open a new menu.lst file, and insert the following contents

serial --unit=0 --speed=38400 --word=8 --parity=no --stop=1
terminal --timeout=10 serial

default 0
timeout 5

title   ME2000v3
root    (hd0,0)
kernel /bzImage init=/initrd root=/dev/ram0 rw console=ttyS0,38400n8 reboot=bios
initrd /rootfs.gz
boot

As you can see on the kernel line, the boot sequence expects a bzImage kernel file and a rootfs.gz compressed root filesystem file in /

So, copy the bzImage and rootfs.gz that you prepared earlier to /mnt. Then insert into the Wrap, and see how you go. If all goes well, you'll see the grub meny on the serial port at 38400 baud (n81). If things go even better, then your kernel will boot and mount the rootfs, and bring up your distro.

Conclusion

Gone is syslinux, DOS, and it's 8.3 filesystem limitation. Welcome to GRUB.


EndNote

If you're connected to IrishWAN, you could use the following for testing:

bzImage

rootgfs.gz

Personal tools