paul@31 | 1 | #!/bin/sh |
paul@31 | 2 | |
paul@63 | 3 | # Copyright (C) 2011, 2012, 2013 Paul Boddie <paul@boddie.org.uk> |
paul@63 | 4 | # |
paul@63 | 5 | # This program is free software; you can redistribute it and/or modify it under |
paul@63 | 6 | # the terms of the GNU General Public License as published by the Free Software |
paul@63 | 7 | # Foundation; either version 3 of the License, or (at your option) any later |
paul@63 | 8 | # version. |
paul@63 | 9 | # |
paul@63 | 10 | # This program is distributed in the hope that it will be useful, but WITHOUT |
paul@63 | 11 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
paul@63 | 12 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
paul@63 | 13 | # details. |
paul@63 | 14 | # |
paul@63 | 15 | # You should have received a copy of the GNU General Public License along with |
paul@63 | 16 | # this program. If not, see <http://www.gnu.org/licenses/>. |
paul@63 | 17 | |
paul@31 | 18 | if [ ! "$1" ]; then |
paul@31 | 19 | echo "Need an image directory for the UML system." 1>&2 |
paul@31 | 20 | exit 1 |
paul@31 | 21 | fi |
paul@31 | 22 | |
paul@31 | 23 | IMAGEDIR=$1 |
paul@31 | 24 | |
paul@31 | 25 | echo "Creating special UML devices..." 1>&2 |
paul@31 | 26 | if [ ! -e "$IMAGEDIR/dev/ubda" ]; then |
paul@31 | 27 | for i in `seq 0 7`; do |
paul@31 | 28 | let=$(echo $i|tr '0-7' 'a-z') |
paul@31 | 29 | mknod "$IMAGEDIR/dev/ubd$let" b 98 $((16 * $i)) |
paul@31 | 30 | for p in `seq 1 16`; do |
paul@31 | 31 | mknod "$IMAGEDIR/dev/ubd$let$p" b 98 $((16 * $i + $p)) |
paul@31 | 32 | done |
paul@31 | 33 | done |
paul@31 | 34 | fi |
paul@31 | 35 | |
paul@31 | 36 | echo "Initialising device files..." 1>&2 |
paul@58 | 37 | /usr/sbin/chroot "$IMAGEDIR" /bin/sh -c 'mount -t proc proc /proc; cd /dev; ./MAKEDEV generic; umount /proc' |