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 PROGNAME=`basename "$0"` 14 15 if [ ! "$1" ] || [ "$1" = '--help' ]; then 16 echo "Usage: $PROGNAME <memory-with-unit> [ --net ] [ --initrd <initrd-file> <filesystem-image> ]" 1>&2 17 exit 1 18 fi 19 20 UML_MEMORY="$1" 21 22 # Discard the memory argument. 23 24 shift 1 25 26 # Test for networking. 27 28 if [ "$1" = '--net' ]; then 29 UML_NETWORKING="$NETDEVICE=tuntap,$TUNDEVICE,fe:fd:0:0:0:1,$HOSTADDRESS" 30 xhost +"$GUESTADDRESS" 31 shift 1 32 fi 33 34 # Test for initrd. 35 36 if [ "$1" = '--initrd' ]; then 37 shift 1 38 INITRD_OPTIONS="initrd=$1 root=/dev/ram load_ramdisk=1 ubd2=$2" 39 shift 2 40 else 41 INITRD_OPTIONS= 42 fi 43 44 # Now we start the virtual machine... 45 46 ./linux ubd0="$IMAGE" rw ubd1="$SWAPIMAGE" rw mem="$UML_MEMORY" con0=fd:0,fd:1 con=pts "$UML_NETWORKING" $INITRD_OPTIONS $*