Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

So I have a 512MB flash chip used in an embedded system with the following partition table:

p1: 32MB boot partition
p2: 200MB recovery partition
p3: 200MB normal partition

I'm using buildroot on my ubuntu (development) box to compile the 200MB ext2 image for the "normal" parition. At this point on my dev box I dd the image created from buildroot to the flash chip (plugged in with an ide to usb connector on /dev/sdd):

dd if=./output/images/rootfs.ext2 of=/dev/sdd3

OK, fine this works and I can mount /dev/sdd3 and see the entire filesystem that the embedded device will use.

Now, I want to install grub on this flash chip and am lost on how to do this. I've tried:

grub-install /dev/sdd

But when I plug the flash chip into my embedded device and turn it on, grub won't load (just sits at a black screen with blinking cursor--no error).

share|improve this question

2 Answers 2

up vote 3 down vote accepted

With a lot of searching and a lot of guess and check I came upon the solution to my problem:

First dd rootfs image buildroot creates:

sudo dd if=./output/images/rootfs.ext2 of=/dev/sdd3

Then, copy /boot from sdd3 to sdd1, create a menu.lst file, and copy over bzImage.

Finally, run grub:

sudo grub --device-map=/dev/null
> device (hd0) /dev/sdd
> root (hd0,0)
> setup (hd0)
> quit

Plug the drive into the system and everything loads.

share|improve this answer

You need to inform Grub that your disk will be the primary hard disk in the new system, and to let it know where to find the part of the bootloader that doesn't fit in the boot sector. Grub calls the correspondence between the boot-time disk designations and the disk designations in the running operating system as the device map.

I think you'll get a working bootloader if you edit /media/sdd3/boot/grub/device.map to contain

(hd0) /dev/sdd

then run grub-install --root-directory=/media/sdd3/boot/grub/device.map.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.