1 #!/bin/sh 2 3 # Configuration: 4 if [ -e userinstall-defaults-uml ]; then 5 . "$PWD/userinstall-defaults-uml" 6 elif [ -e /etc/default/userinstall-uml ]; then 7 . /etc/default/userinstall-uml 8 else 9 echo "No defaults found for userinstall (UML)." 1>&2 10 exit 1 11 fi 12 13 if [ ! -e "$PACKAGEROOT" ]; then 14 echo "A package root must first be made using user-setup." 1>&2 15 exit 1 16 fi 17 18 if [ "$1" = '--root' ]; then 19 AS_USER="sudo" 20 fi 21 22 THISDIR=`dirname "$0"` 23 24 if [ ! -e linux ]; then 25 if [ ! -e "$LINUXDIRNAME" ]; then 26 if [ ! -e "$LINUXARCHIVE" ]; then 27 echo "Getting the Linux kernel archive..." 1>&2 28 wget -O "$LINUXARCHIVE" "$LINUXADDRESS" 29 fi 30 31 echo "Unpacking the archive..." 1>&2 32 tar jxf "$LINUXARCHIVE" 33 fi 34 if [ ! -e "$LINUXDIRNAME/linux" ]; then 35 36 # Copy our configuration into the unpacked directory. 37 # Normally we would do this: 38 # make defconfig ARCH=um 39 # make menuconfig ARCH=um 40 # In "File systems", "CD-ROM/DVD Filesystems", press Y for "ISO 9660...". 41 # The supplied configuration file should include this information. 42 echo "Adding configuration..." 1>&2 43 if [ -e "$LINUXDIRNAME/.config" ]; then 44 if [ ! -e "$LINUXDIRNAME/.config.original" ]; then 45 echo "$LINUXDIRNAME/.config -> $LINUXDIRNAME/.config.original" 1>&2 46 mv "$LINUXDIRNAME/.config" "$LINUXDIRNAME/.config.original" 47 fi 48 fi 49 50 echo "uml-linux-build.config -> $LINUXDIRNAME/.config" 51 cp "$THISDIR/uml-linux-build.config" "$LINUXDIRNAME/.config" 52 fi 53 54 # Enter the unpacked directory and build. 55 cd "$LINUXDIRNAME" 56 57 #echo "Patching hostaudio for SDL..." 58 #patch -p0 < ../patches/hostaudio_kern.c.diff 59 60 echo "Building..." 1>&2 61 make ARCH=um 62 63 echo "Making the modules..." 1>&2 64 make modules ARCH=um 65 66 cd .. 67 fi 68 69 echo "Installing the modules..." 1>&2 70 "$THISDIR/uml-access-image" "$AS_USER" make -C "$LINUXDIRNAME" modules_install INSTALL_MOD_PATH="$IMAGEDIR" ARCH=um 71 72 # Now get the executable and remove the build directory. 73 if [ ! -e linux ]; then 74 mv "$LINUXDIRNAME/linux" . 75 fi 76 77 if [ -e linux ]; then 78 echo "To remove the Linux kernel sources, do this:" 1>&2 79 echo "rm -rf '$LINUXDIRNAME'" 1>&2 80 fi