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 if [ ! "$1" ]; then 19 echo "Need an image directory for the UML system." 1>&2 20 exit 1 21 fi 22 23 IMAGEDIR=$1 24 25 echo "Creating special UML devices..." 1>&2 26 if [ ! -e "$IMAGEDIR/dev/ubda" ]; then 27 for i in `seq 0 7`; do 28 let=$(echo $i|tr '0-7' 'a-z') 29 mknod "$IMAGEDIR/dev/ubd$let" b 98 $((16 * $i)) 30 for p in `seq 1 16`; do 31 mknod "$IMAGEDIR/dev/ubd$let$p" b 98 $((16 * $i + $p)) 32 done 33 done 34 fi 35 36 echo "Initialising device files..." 1>&2 37 /usr/sbin/chroot "$IMAGEDIR" /bin/sh -c 'mount -t proc proc /proc; cd /dev; ./MAKEDEV generic; umount /proc'