1 #!/bin/sh 2 3 # Copyright (C) 2011, 2012, 2013 Paul Boddie <paul@boddie.org.uk> 4 # 5 # This program is free software; you can redistribute it and/or modify it under 6 # the terms of the GNU General Public License as published by the Free Software 7 # Foundation; either version 3 of the License, or (at your option) any later 8 # version. 9 # 10 # This program is distributed in the hope that it will be useful, but WITHOUT 11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 12 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 13 # details. 14 # 15 # You should have received a copy of the GNU General Public License along with 16 # this program. If not, see <http://www.gnu.org/licenses/>. 17 18 # Configuration: 19 if [ -e userinstall-defaults-uml ]; then 20 . "$PWD/userinstall-defaults-uml" 21 elif [ -e /etc/default/userinstall-uml ]; then 22 . /etc/default/userinstall-uml 23 else 24 echo "No defaults found for userinstall (UML)." 1>&2 25 exit 1 26 fi 27 28 if [ ! -e "$PACKAGEROOT" ]; then 29 echo "A package root must first be made using user-setup." 1>&2 30 exit 1 31 fi 32 33 if [ "$1" = '--root' ]; then 34 AS_USER="sudo" 35 fi 36 37 THISDIR=`dirname "$0"` 38 39 if [ ! -e linux ]; then 40 if [ ! -e "$LINUXDIRNAME" ]; then 41 if [ ! -e "$LINUXARCHIVE" ]; then 42 echo "Getting the Linux kernel archive..." 1>&2 43 wget -O "$LINUXARCHIVE" "$LINUXADDRESS" 44 fi 45 46 echo "Unpacking the archive..." 1>&2 47 tar jxf "$LINUXARCHIVE" 48 fi 49 if [ ! -e "$LINUXDIRNAME/linux" ]; then 50 51 # Copy our configuration into the unpacked directory. 52 # Normally we would do this: 53 # make defconfig ARCH=um 54 # make menuconfig ARCH=um 55 # In "File systems", "CD-ROM/DVD Filesystems", press Y for "ISO 9660...". 56 # The supplied configuration file should include this information. 57 echo "Adding configuration..." 1>&2 58 if [ -e "$LINUXDIRNAME/.config" ]; then 59 if [ ! -e "$LINUXDIRNAME/.config.original" ]; then 60 echo "$LINUXDIRNAME/.config -> $LINUXDIRNAME/.config.original" 1>&2 61 mv "$LINUXDIRNAME/.config" "$LINUXDIRNAME/.config.original" 62 fi 63 fi 64 65 echo "uml-linux-build.config -> $LINUXDIRNAME/.config" 66 cp "$THISDIR/uml-linux-build.config" "$LINUXDIRNAME/.config" 67 fi 68 69 # Enter the unpacked directory and build. 70 cd "$LINUXDIRNAME" 71 72 #echo "Patching hostaudio for SDL..." 73 #patch -p0 < ../patches/hostaudio_kern.c.diff 74 75 echo "Building..." 1>&2 76 make ARCH=um 77 78 echo "Making the modules..." 1>&2 79 make modules ARCH=um 80 81 cd .. 82 fi 83 84 echo "Installing the modules..." 1>&2 85 "$THISDIR/uml-access-image" $AS_USER make -C "$LINUXDIRNAME" modules_install INSTALL_MOD_PATH="$IMAGEDIR" ARCH=um 86 87 # Now get the executable and remove the build directory. 88 if [ ! -e linux ]; then 89 mv "$LINUXDIRNAME/linux" . 90 fi 91 92 if [ -e linux ]; then 93 echo "To remove the Linux kernel sources, do this:" 1>&2 94 echo "rm -rf '$LINUXDIRNAME'" 1>&2 95 fi