1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/uml-linux-build Mon Jul 11 02:16:57 2011 +0200
1.3 @@ -0,0 +1,76 @@
1.4 +#!/bin/sh
1.5 +
1.6 +# Configuration:
1.7 +if [ -e userinstall-defaults-uml ]; then
1.8 + . "$PWD/userinstall-defaults-uml"
1.9 +elif [ -e /etc/default/userinstall-uml ]; then
1.10 + . /etc/default/userinstall-uml
1.11 +else
1.12 + echo "No defaults found for userinstall (UML)." 1>&2
1.13 + exit 1
1.14 +fi
1.15 +
1.16 +if [ ! -e "$PACKAGEROOT" ]; then
1.17 + echo "A package root must first be made using user-setup." 1>&2
1.18 + exit 1
1.19 +fi
1.20 +
1.21 +THISDIR=`dirname "$0"`
1.22 +
1.23 +if [ ! -e linux ]; then
1.24 + if [ ! -e "$LINUXDIRNAME" ]; then
1.25 + if [ ! -e "$LINUXARCHIVE" ]; then
1.26 + echo "Getting the Linux kernel archive..." 1>&2
1.27 + wget -O "$LINUXARCHIVE" "$LINUXADDRESS"
1.28 + fi
1.29 +
1.30 + echo "Unpacking the archive..." 1>&2
1.31 + tar jxf "$LINUXARCHIVE"
1.32 + fi
1.33 + if [ ! -e "$LINUXDIRNAME/linux" ]; then
1.34 +
1.35 + # Copy our configuration into the unpacked directory.
1.36 + # Normally we would do this:
1.37 + # make defconfig ARCH=um
1.38 + # make menuconfig ARCH=um
1.39 + # In "File systems", "CD-ROM/DVD Filesystems", press Y for "ISO 9660...".
1.40 + # The supplied configuration file should include this information.
1.41 + echo "Adding configuration..." 1>&2
1.42 + if [ -e "$LINUXDIRNAME/.config" ]; then
1.43 + if [ ! -e "$LINUXDIRNAME/.config.original" ]; then
1.44 + echo "$LINUXDIRNAME/.config -> $LINUXDIRNAME/.config.original" 1>&2
1.45 + mv "$LINUXDIRNAME/.config" "$LINUXDIRNAME/.config.original"
1.46 + fi
1.47 + fi
1.48 +
1.49 + echo "uml-linux-build.config -> $LINUXDIRNAME/.config"
1.50 + cp "$THISDIR/uml-linux-build.config" "$LINUXDIRNAME/.config"
1.51 + fi
1.52 +
1.53 + # Enter the unpacked directory and build.
1.54 + cd "$LINUXDIRNAME"
1.55 +
1.56 + #echo "Patching hostaudio for SDL..."
1.57 + #patch -p0 < ../patches/hostaudio_kern.c.diff
1.58 +
1.59 + echo "Building..." 1>&2
1.60 + make ARCH=um
1.61 +
1.62 + # Mount the root filesystem and install the modules.
1.63 + echo "Making the modules..." 1>&2
1.64 + make modules ARCH=um
1.65 +
1.66 + echo "Installing the modules..." 1>&2
1.67 + make modules_install INSTALL_MOD_PATH="$PACKAGEROOT" ARCH=um
1.68 + cd ..
1.69 +fi
1.70 +
1.71 +# Now get the executable and remove the build directory.
1.72 +if [ ! -e linux ]; then
1.73 + mv "$LINUXDIRNAME/linux" .
1.74 +fi
1.75 +
1.76 +if [ -e linux ]; then
1.77 + echo "To remove the Linux kernel sources, do this:" 1>&2
1.78 + echo "rm -rf '$LINUXDIRNAME'" 1>&2
1.79 +fi