This article guides you through the compilation of a Reiser4 understanding GRUB.
Boot, the Reiser4 partition that you wish to make your GRUB default root. If you have followed the guide to installing a Linux distro on a Reiser4 partition, this will be /dev/sda3. If you have enabled transparent compression, the following will not work.
Download the following files and save them somewhere, like /grub.
grub-0.97.tar.gz from gnu.org
libaal-1.0.5.tar.gz from namesys.com, local copy here,
reiser4progs-1.0.5.tar.gz (not version 1.0.6) from namesys.com, local copy here,
grub-0.97-libaal-1.0.5-reiser4progs-1.0.5.patch.bz2 (this is a combination of many patches).
for a in *.tar.*; do tar -xf $a; done
If like me, you are compiling on a 64-bit machine, then you will need to set the variable CC:
export CC="gcc -m32"
and, if you have followed the above mentioned guide, you already have 64-bit versions of the aal libraries and reiser4progs in /usr/local/. To make sure things do not get mixed up, you need to install to some other destination, eg, /grub/r4. This is done by passing the --prefix=/grub/r4 flag to the configure script.
This is necessary, even if compiling on a 32-bit box. This is because you have the 1.0.6 version of reiser4progs in /usr/local/, but you need to use the 1.0.5 version of reiser4progs to compile GRUB. Once again, you have to keep the different versions separate.
To stop the precompiler and linker using the wrong headers and libraries we add:
export LDFLAGS=-L/grub/r4/lib CPPFLAGS=-I/grub/r4/include
Also, the grub configuration (below) needs to know where we have put things:
Now compile the aal libraries and install them in /grub/r4 (ie, set prefix=/grub/r4).
Now compile the older version of reiser4progs and install in /grub/r4.
Patch grub for Reiser4.
patch -p1 < ../grub-0.97-libaal-1.0.5-reiser4progs-1.0.5.patch
Note the prefix, /usr. Check that grub has built OK.
You should see the files e2fs_stage1_5 fat_stage1_5 ffs_stage1_5 iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 reiser4_stage1_5 reiserfs_stage1_5 ufs2_stage1_5 vstafs_stage1_5 xfs_stage1_5.
If things look OK, then go ahead and OVERWRITE the existing grub programs. Remember, this partition is not presently used to boot your system, and will only be used to boot your system, if the instalation succeeds. Still, whenever dealing with GRUB, it would pay to have a rescue CD/floppy handy (actually, GRUB has always worked like a charm for me).
Now run grub-install.
Remember to change /dev/sda to suit your situation.
The above command sets the booted partition as the default GRUB root (and installs stage1 to the MBR). With the partition numbering of this guide, the default GRUB root will now be /dev/sda3 (it was initially /dev/sda2). The default GRUB root is the partition that GRUB reads the menu list file, /boot/grub/menu.lst, from.
emacs /boot/grub/menu.lst &
Now adjust the menu.lst file on /dev/sda3:
Note, that this is not the same menu.lst file as in the Linux installation guide (that was on /dev/sda2).
Now, reboot and see how things panned out.