[oe] Cross-platform grub?

Peter Chubb peter.chubb at nicta.com.au
Fri Aug 28 00:37:36 UTC 2009


Hi,
	I'm working on a system that ends up with a bootable disk
image, for now for qemu, but also for pxe-booting.  It uses the grub
shell to make the image bootable, with a script that looks something
like the appended.  This works fine iff we're running on the same
architecture as the target (i.e., 32-bit x86).  There is no
grub-native target, and looking at the grub source there's not going to be.
I want to be able to build on systems without grub-legacy installed,
such as power-PC, or Itanium.

	Is there any work being done on grub-2?  Or any other way of
making a grub-shell-like thingy for making bootable disks for x86 from
an arbitrary host?


-- Script excerpt

# create sparse file of appropriate size
dd if=/dev/zero of="$1" bs=512b seek=$sz count=1

# Set up mtools-native
echo "drive c: file=\"$1\" partition=1" > mtoolsrc
export MTOOLSRC=mtoolsrc

mpartition -I c:
mpartition -c -t $CYLINDERS -h 16 -s 63 c:
mformat c:
mmd c:/boot
mmd c:/boot/grub

# Install grub
mcopy "${GRUB}/stage1" c:/boot/grub
mcopy "${GRUB}/stage2" c:/boot/grub
mcopy "${GRUB}/fat_stage1_5" c:/boot/grub
echo "(hd0) $1" > bmap
echo -e "geometry (hd0) $CYLINDERS 16 63\nroot (hd0,0)\nsetup (hd0)" |
	 grub --device-map=bmap --batch



--
Dr Peter Chubb        www.nicta.com.au      peter DOT chubb AT nicta.com.au
http://www.ertos.nicta.com.au           ERTOS within National ICT Australia
From Imagination to Impact                       Imagining the (ICT) Future




More information about the Openembedded-devel mailing list