Free Web Space | BlueHost Review  


Homepage: http://linuxhelp.150m.com/


Compiling (GRUB) from an RPM Source Package.


SuSE has a well-developed grub-splash, so I downloaded the latest SuSE source package grub-0.97-82.src.rpm from here. After opening the archive, I was surprised to find that the RPM format (like Deb source packages & others) contained a compile recipe. I will show you how to use this recipe to compile GRUB (patched for the grub-splash) for a 32-bit SuSE system and a 64-bit Debian system. All of what follows was learned from here, so go there for further instruction.

You need to create the following directories as the rpm program often refuses to do so.

 mkdir -p /usr/src/packages/{BUILD,RPMS,SOURCES,SPECS,SRPMS}   (SuSE)
 mkdir -p /usr/src/redhat/{BUILD,RPMS,SOURCES,SPECS,SRPMS}   (Red Hat)
 mkdir -p /usr/src/rpm/{BUILD,RPMS,SOURCES,SPECS,SRPMS}   (Debian)

Now use rpm to install the source package (-vv = very verbose).

 rpm -ivv grub-0.97-82.src.rpm

into the above mentioned directories. Change directory:

 cd /usr/src/packages/SPECS   (SuSE)
 cd /usr/src/rpm/SPECS/   (Debian)

Before continuing you need to adjust the specification file grub.spec

 emacs grub.spec &

For SuSE change -fno-stack-protector to -fno-stack-limit (or perhaps just delete -fno-stack-protector).

For Debian, comment out the line (i.e., add a # at the line's beginning):

BuildRequires: gcc-32bit glibc-devel-32bit ncurses-32bit ncurses-devel-32bit

Now compile the source according to the recipe in grub.spec.

 rpmbuild -ba grub.spec

This will produce the binary RPM package:

/usr/src/packages/RPMS/i586/grub-0.97-82.i586.rpm

on SuSE. You can now install the package as usual. And the package:

/usr/src/rpm/RPMS/x86_64/grub-0.97-82.x86_64.rpm

on Debian. On Debian, you need to convert it to a DEB package:

 alien --to-deb grub-0.97-82.x86_64.rpm

which generates the package:

grub_0.97-83_amd64.deb

which can now be installed as usual. GRUB will be installed but not setup. Now run

 alien --scripts --to-deb grub-0.97-82.x86_64.rpm

The --scripts option adds scripts derived from the grub.spec file. They are unlikely to work for Debian, however, they will give you some guidance as to how to setup GRUB manually. So extract the scripts from the package and have a read of them. These, and the GRUB manual and the grub.spec file, should be sufficient to get GRUB setup.

Another option, is to grab the Debian setup scripts from the standard Debian GRUB package and graft them into your DEB package.

The configure option chosen by the grub.spec file was:

./configure --prefix=/usr --infodir=/usr/share/info \
--mandir=/usr/share/man --datadir=/usr/lib \
--disable-auto-linux-mem-opt --enable-diskless \
--enable-3c503 --enable-3c507 --enable-3c509 \
--enable-3c529 --enable-3c595 --enable-3c90x \
--enable-cs89x0 --enable-davicom --enable-depca \
--enable-eepro --enable-eepro100 --enable-epic100 \
--enable-exos205 --enable-lance --enable-ne \
--enable-ne2100 --enable-ni5000 --enable-ni5200 \
--enable-ni6500 --enable-ns8390 --enable-rtl8139 \
--enable-sk-g16 --enable-smc9000 --enable-tiara \
--enable-tulip --enable-via-rhine --enable-w89c840 --enable-wd