Build GRUB 2 on system without GNU tools

Until GRUB is really portable, the easiest (and probably only) way to install GNU GRUB 2 on non-GNU plattforms (well, at least NetBSD/i386, but probably also other *-*-i386. Built successfully on Ubuntu/i386 5.10 with gcc 4.0.2 and with gcc 3.3.3 on NetBSD/i386 3.99.13) might be to use wip/grub2 package from pkgsrc-wip. GRUB from pkgsrc-wip contains some patches that are needed to build GRUB without glibc.

For the systems that don't use pkgsrc as their native package system (everything except NetBSD and DragonFly), it is likely that you will first have to install pkgsrc. See http://pkgsrc.org/ for more information.

Another thing, that you'll need is copy of pkgsrc-wip repository. Download the latest snapshot from http://pkgsrc-wip.sf.net/ and unpack it to your pkgsrc directory.

cd pkgsrc/wip/grub2
make install

Please note, that on non-BSD platforms it is likely that you will have to use bmake instead of make. GRUB will now check out most current source, patch it and install with all its dependencies. Do not forget to read postinstall message.

If the build is successful, then you may want to read TestingOnX86, since next steps are the nearly same as on GNU.

If not, it is likely that patches didn't fit. I update them weekly. To work around it either fix patches or check out sources current at the time when patches were made. Look at the pkgsrc-wip repository to find the date (http://cvs.sourceforge.net/viewcvs.py/pkgsrc-wip/wip/grub2/patches/) and then let pkgsrc pass the right -D flag to cvs: http://ximbiot.com/cvs/manual/cvs-1.11.21/cvs_16.html#SEC117

make clean
make _CVS_CHECKOUT_FLAGS="-PD 2005-12-12" install

Please note, that your modules are in /usr/pkg/share/grub/i386-pc (if not, use pkg_info -L grub2 to find out where they actually are). Also note, that you may have to use /grub instead of /boot/grub on systems where /boot is the native loader's binary (NetBSD).


CategoryDocumentation

GrubWiki: BuildingOnNonGnu (last edited 2008-03-26 13:21:35 by Mac)