#!/bin/bash # grub.brew # Build GRUB for RISC OS # by Stuart Winter # Please see changelog.txt for revisions to this package's build script history. PACKAGE=grub-riscos #VERSION=2_cvs VERSION=1.91 BUILD=1 KERNELVERSION=2.6.23.17 # This is useful for when building multiple versions with test Kernels: #PKGFILE=slackb-$PACKAGE-$VERSION-$BUILD-linux$KERNELVERSION-$( date "+%d-%b-%Y" ).zip # This is the name of the release version: PKGFILE=slackb.zip # Drag in the build kit: source /usr/share/slackdev/buildkit.sh # We require Ruby since it's used in some of the makefiles slackcheckpkgdeps ruby || installpkg $PKGSTORE/d/ruby-*.tgz slackcheckpkgdeps ruby || exit 99 # Record toolchain & other info for the build log: slackbuildinfo # Paths to skeleton port's source & real Slackware source tree: export PORTCWD=$PWD # Temporary build locations: export TMPBUILD=$TMP/build-$PACKAGE export PKG=$TMP/package-$PACKAGE mkpkgdirs # Delete & re-create temporary directories then cd into $TMPBUILD # Extract source: #tar jxvvf $PORTCWD/sources/grub2-20051007.tar.bz2 tar xvvf $PORTCWD/sources/grub-$VERSION.tar.gz cd grub* slackhousekeeping # Apply Timothy Baldwin's Acorn/RISC OS patches: #zcat $PORTCWD/sources/grub2-patch3.diff.gz | patch -p1 --verbose || failpatch #zcat $PORTCWD/sources/grub2-patch4.diff.gz | patch -p1 --verbose || failpatch #zcat $PORTCWD/sources/grub2-patch5.diff.gz | patch -p1 --verbose || failpatch #zcat $PORTCWD/sources/grub2-patch6.diff.gz | patch -p1 --verbose || failpatch #zcat $PORTCWD/sources/grub2-patch6-remainder.diff.gz | patch -p1 --verbose || failpatch #zcat $PORTCWD/sources/grub2-patch7.diff.gz | patch -p1 --verbose || failpatch #zcat $PORTCWD/sources/grub2-patch8.diff.gz | patch -p1 --verbose || failpatch ## Debugging stuff: ##zcat $PORTCWD/tim/grub2-patch_Stuart_Winter1.diff.gz | patch -p1 --verbose || failpatch # Updated 03-May-2006: zcat $PORTCWD/sources/grub2-patch17.diff.gz | patch -p1 --verbose || failpatch zcat $PORTCWD/sources/grub2-patch11.diff.gz | patch -p1 --verbose || failpatch zcat $PORTCWD/sources/grub2-patch-mg2.diff.gz | patch -p1 --verbose || failpatch zcat $PORTCWD/sources/grub2-patch14c.diff.gz | patch -p1 --verbose || failpatch zcat $PORTCWD/sources/grub2-patch12c.diff.gz | patch -p1 --verbose || failpatch zcat $PORTCWD/sources/grub2-patch3c.diff.gz | patch -p1 --verbose || failpatch zcat $PORTCWD/sources/grub2-patch6c.diff.gz | patch -p1 --verbose || failpatch zcat $PORTCWD/sources/grub2-patch10b.diff.gz | patch -p1 --verbose || failpatch zcat $PORTCWD/sources/grub2-patch18.diff.gz | patch -p1 --verbose || failpatch # # ARMedslack patches. Most of these have not been sent to Tim because I either # they aren't proper fixes - just fudges, or because they are ARMedslack specific. # # Fix the GRUB menu text - otherwise it says "use the eys to.." patch --verbose -p0 < $PORTCWD/sources/armedslack-cursorkeysmessage.patch || failpatch # Remove a space from 'Booting ' ''. Details details :) patch --verbose -p0 < $PORTCWD/sources/armedslack-menu-booting.diff || failpatch # Fix RISC OS 4 booting problem: patch --verbose -p1 < $PORTCWD/sources/armedslack-RO4-ram.diff || failpatch #Patched GRUB to use a config file named # 'grubcfg' rather than 'grub.cfg'. This allows us to have set the RISC OS # file type to 'text' so that it can be double-clicked and opened directly # from the CD into a text editor. patch --verbose -p1 < $PORTCWD/sources/armedslack-grub.config.diff || failpatch # Configure: sh autogen.sh ./configure \ --prefix=/ \ --build=arm || failconfig # Build: make $NUMJOBS || failmake # Install into package framework: make install DESTDIR=$PKG || failinstall # Copy the Utils - useful for Debugging GRUB on RISC OS: # Uncomment these two lines if anybody ever needs a debugging version of # 'slackb'. #mkdir -p $PKG/grub-debug-utils #cp -fa util/arm/* $PKG/grub-debug-utils # Make the directory structure for packaging under RISC OS: cd $PKG # Move the good stuff somewhere safe: mv share/grub/arm-RISC_OS $TMPBUILD # Delete the junk: rm -rf share sbin bin # Copy the pre-made RISC OS tree: cp -favv $PORTCWD/riscos-tree/* . # Copy GRUB into the installer and boot loader applications: cp -favv $TMPBUILD/arm-RISC_OS '!SlackBt/!GRUB' # Install the pre-made ARMedslack config files # and setting the RISC OS file type as &fff ('Text'): mv -f slackboot.grub.cfg '!SlackBt/!GRUB/grubcfg,fff' # Grab the latest RiscPC Kernel from the Kernel package in the a/ series # and install it into the RISC OS applications: # We use 'Unix Ex' (&FE6) as the RISC OS file type. We probably shouldn't # since the Kernel isn't a UNIX executable, but it's the closest thing I # could find in the standard RISC OS 4.02 File$Type list that described the # type of file. ( set -x tar-1.13 vvfOxz $PKGSTORE/a/kernel_riscpc-$KERNELVERSION-*.tgz 'boot/zImage-*' > '!SlackBt/zImage,fe6' ) # Copy the latest initrd image into the installer application: cp -vvfa $PORTCWD/../../../isolinux/initrd.img '!SlackBt/' # Create RISC OS zip file: this isn't the name we ship - we ship 'slackb.zip' so that # it fits into the 10 character pre-RISC OS 4 FileCore filename length limit. # The long file name is just for reference when testing and to avoid overwriting # a working version of the bootware. # Note the additional , option to zip: this is the patched zip which has # support for RISC OS file types. rm -f $PKGSTORE/../bootware/riscpc/$PKGFILE zip -,r9 $PKGSTORE/../bootware/riscpc/$PKGFILE . # Now make a copy, including the RISC OS file types, inside the bootware directory -- this # allows the patched mkisofs to use the archimedes extensions. # We include slackb.zip & this unpacked tree incase there's a problem with # filesystem on the ISO, or with RISC OS. rm -vrf $PKGSTORE/../bootware/riscpc/*SlackBt* cp -favv '!SlackBt' $PKGSTORE/../bootware/riscpc/ install -vpm644 $PORTCWD/riscos-tree/README.txt $PKGSTORE/../bootware/riscpc/ echo "Now boot into RISC OS and try $PKGFILE" # EOF