[Buildroot] Is grub-bios-setup the way to go to make a bootable CF?

Thomas Petazzoni thomas.petazzoni at free-electrons.com
Fri Jun 27 18:32:24 UTC 2014


Dear Lennart Ramberg,

On Fri, 27 Jun 2014 12:32:03 +0200, Lennart Ramberg wrote:

> I am struggling with making a grub 2-bootable Compact Flash for a BIOS
> based PC target.
> The closest I came so far in the target machine is:
>   grub rescue >
> 
> Then I found 'grub-bios-setup' as a possibly better alternative, but got
> stuck as below.
> Is grub-bios-setup the way to go at all?

Have you checked the detailed instructions available in the help text
of the grub2 package (accessible through xconfig/menuconfig) ? From the
help text:

          Notes on using Grub2 for BIOS-based platforms
          =============================================

          1. Create a disk image
             dd if=/dev/zero of=disk.img bs=1M count=32
          2. Partition it (either legacy or GPT style partitions work)
             cfdisk disk.img
              - Create one partition, type Linux, for the root
                filesystem. The only constraint is to make sure there
                is enough free space *before* the first partition to
                store Grub2. Leaving 1 MB of free space is safe.
          3. Setup loop device and loop partitions
             sudo losetup -f disk.img
             sudo partx -a disk.img
          4. Prepare the root partition
             sudo mkfs.ext3 -L root /dev/loop0p1
             sudo mount /dev/loop0p1 /mnt
             sudo tar -C /mnt -xf output/images/rootfs.tar
             sudo umount /mnt
          5. Install Grub2
             ./output/host/usr/sbin/grub-bios-setup \
                        -b ./output/host/usr/lib/grub/i386-pc/boot.img \
                        -c ./output/images/grub.img -d . /dev/loop0
          6. Your disk.img is ready!

Of course, this help text is about creating a disk image, but it should
apply (with minor changes) to a real device.

Let me know if that works for you!

Best regards,

Thomas Petazzoni
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com



More information about the buildroot mailing list