# $Id$ PNAME="grub" PVER="0.97" PBUILD="r19" PCATEGORIE="sys-apps" STATE="unstable" DESCRIPTION="GNU GRUB boot loader." HOMEPAGE="http://www.gnu.org/software/grub/" DEPEND=">= sys-libs/ncurses-5.9" SDEPEND=">= sys-dev/automake-4 >= sys-dev/autoconf-5" SRCFILE="${PNAME}-${PVER}.tar.gz" SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" sminclude mtools SRC_URI=( ftp://alpha.gnu.org/gnu/${PNAME}/${SRCFILE} mirror://${PNAME}/${SRCFILE} mirror://${PNAME}/${PNAME}-${PVER}-splash.patch mirror://${PNAME}/${PNAME}-${PVER}-pic.patch mirror://${PNAME}/${PNAME}-${PVER}-initrdmax.patch mirror://${PNAME}/${PNAME}-${PVER}-nxstack.patch mirror://${PNAME}/${PNAME}-${PVER}-unsigned-addresses.patch mirror://${PNAME}/${PNAME}-${PVER}-ext4-4.patch mirror://${PNAME}/${PNAME}-${PVER}-virtio-blk-support-2.patch mirror://${PNAME}/${PNAME}-${PVER}-gpt.patch mirror://${PNAME}/${PNAME}-${PVER}-i2o.patch mirror://${PNAME}/${PNAME}-${PVER}-intelmac.patch mirror://${PNAME}/${PNAME}-${PVER}-more-raid.patch mirror://${PNAME}/${PNAME}-${PVER}-special-devices.patch mirror://${PNAME}/${PNAME}-${PVER}-inode-size.patch mirror://${PNAME}/${PNAME}-${PVER}-kvm-vda-2.patch mirror://${PNAME}/${PNAME}-${PVER}-netboot-pic.patch mirror://${PNAME}/${PNAME}-${PVER}-netboot-compile-fixes.patch ) # get only 0.xx versions! UP2DATE="updatecmd ftp://alpha.gnu.org/gnu/${PNAME} | grep -- -0.[0-9].* | lasttarball gz" # grub doesn't like CFLAG optimation, # and do you really want that at your bootloader ?? unset CFLAGS unset CXXFLAGS src_prepare() { munpack ${SRCFILE} || die cd ${SRCDIR} # splash support mpatch ${PNAME}-${PVER}-splash.patch || die # fix pic issues mpatch ${PNAME}-${PVER}-pic.patch || die # do not check initrdmax -> we are using more than 4mb mpatch ${PNAME}-${PVER}-initrdmax.patch || die # fix nx issues on x86_64 mpatch ${PNAME}-${PVER}-nxstack.patch || die # fix issues on systems with more than 2gb of ram mpatch ${PNAME}-${PVER}-unsigned-addresses.patch || die # support booting from ext4 filesystems mpatch ${PNAME}-${PVER}-ext4-4.patch || die # handle virtio_blk device names in grub-install mpatch ${PNAME}-${PVER}-virtio-blk-support-2.patch || die # support gpt partition tables mpatch ${PNAME}-${PVER}-gpt.patch || die # support I2O disks mpatch ${PNAME}-${PVER}-i2o.patch || die # support Intel Macs (gateA20) mpatch ${PNAME}-${PVER}-intelmac.patch || die # support cciss and other raid devices mpatch ${PNAME}-${PVER}-more-raid.patch || die # support dev/{ida,cciss,ataraid,rd} devices names mpatch ${PNAME}-${PVER}-special-devices.patch || die # support bigger inode sizes (dynamic/V2 inodes) mpatch ${PNAME}-${PVER}-inode-size.patch || die mpatch ${PNAME}-${PVER}-kvm-vda-2.patch || die # fix pic issues with the net drivers # mpatch ${PNAME}-${PVER}-netboot-pic.patch || die # fix compilation issues # mpatch ${PNAME}-${PVER}-netboot-compile-fixes.patch || die # rebuild makefiles autoreconf --install --force || die } src_compile() { cd ${SRCDIR} # fixes compilation on x86_64; grub cannot build natively on 64bit # building a static grub, with -m32 in this case if [[ ${ARCH} = x86_64 ]] then export CC="gcc -m32" export LDFLAGS="-static" fi # # build netboot grub first # mconfigure \ # --enable-diskless \ # --enable-3c503 \ # --enable-3c507 \ # --enable-3c509 \ # --enable-3c529 \ # --enable-3c595 \ # --enable-3c590x \ # --enable-cs89x0 \ # --enable-davicom \ # --enable-depca \ # --enable-eepro \ # --enable-eepro100 \ # --enable-epic100 \ # --enable-exos205 \ # --enable-ni5210 \ # --enable-lance \ # --enable-ne2100 \ # --enable-ni5010 \ # --enable-ni6510 \ # --enable-natsemi \ # --enable-ne \ # --enable-ns8390 \ # --enable-wd \ # --enable-otulip \ # --enable-rtl8139 \ # --enable-sis900 \ # --enable-sk-g16 \ # --enable-smc9000 \ # --enable-tiara \ # --enable-tulip \ # --enable-via-rhine \ # --enable-w89c840\ # || die # # mmake w89c840_o_CFLAGS="-O" || die # mv stage2/nbgrub ${SRCDIR}/ || die # mv stage2/pxegrub ${SRCDIR}/ || die # mv stage2/stage2 stage2/stage2.netboot || die # # # clean up sources # make clean || die # build the normal grub mconfigure --disable-auto-linux-mem-opt || die mmake || die } src_install() { cd ${SRCDIR} # needed directories minstalldir /boot/grub || die mmake DESTDIR=${BINDIR} install || die local archhost case ${ARCH} in i486) archhost="${CHOST/-linux-gnu/}" archhost="${archhost/i486/i386}" ;; *) archhost="${CHOST/-linux-gnu/}" ;; esac # # install netboot grub # minstallexec nbgrub /usr/$(mlibdir)/grub/${archhost}/ || die # minstallexec pxegrub /usr/$(mlibdir)/grub/${archhost}/ || die # minstallexec stage2/stage2.netboot /usr/$(mlibdir)/grub/${archhost}/ || die # now copying all stage files for i in ${BINDIR}/usr/$(mlibdir)/grub/${archhost}/* do [ -f ${i} ] && cp -p ${i} ${BINDIR}/boot/grub || die ${i} done } preinstall() { mount /boot &> /dev/null } postinstall() { # creates some essential links if [ ! -e ${MROOT}/boot/boot ] then ln -sf . ${MROOT}/boot/boot fi if [ ! -e ${MROOT}/boot/grub/menu.lst ] then ln -sf /boot/grub/grub.conf ${MROOT}/boot/grub/menu.lst fi # creates example grub.conf if [ ! -e ${MROOT}/boot/grub/grub.conf.example ] then cat > ${MROOT}/boot/grub/grub.conf.example << "EOF" default 0 timeout 30 title Magellan-Linux root (hd0,0) kernel (hd0,0)/boot/bzImage root=/dev/hda1 EOF fi # update grub grub --batch --device-map=/boot/grub/device.map &/dev/null; }