11 MACHINE
=${1:+"-m $1"}; shift
21 # If we've been told to, compute the required file system size
22 # and average inode size automatically.
24 if [ ${FSSIZE} -eq 0 -a ${FSLABEL} = "auto" ]; then
25 roundup
() echo $
((($1+$2-1)-($1+$2-1)%$2))
26 nf
=$
(find ${FSPROTO} |
wc -l)
27 sk
=$
(du
-sk ${FSPROTO} |cut
-f1)
28 FSINODE
=$
(roundup $
(($sk*1024/$nf)) ${FSINODE})
29 FSSIZE
=$
(roundup $
(($sk*12/10)) 1024)
33 if [ "x$VNDEVICE" = "x" ] ; then
36 u
=`expr $VNDEVICE : 'vn\([0-9]*\)' || true`
40 mknod
/dev
/rvnn
${u} c
43 `expr 65538 + $u '*' 8`
41 mknod
/dev
/rvnn
${u}c c
43 `expr 2 + $u '*' 8`
42 mknod
/dev
/vnn
${u} b
15 `expr 65538 + $u '*' 8`
43 mknod
/dev
/vnn
${u}c b
15 `expr 2 + $u '*' 8`
45 umount
/dev
/${VNDEVICE} 2>/dev
/null || true
46 umount
${MNT} 2>/dev
/null || true
47 vnconfig
-u /dev
/r
${VNDEVICE} 2>/dev
/null || true
49 vnconfig
-s labels
-c /dev
/r
${VNDEVICE} ${FSIMG}
51 trap "umount ${MNT}; vnconfig -u /dev/r${VNDEVICE}; rm -f /dev/*vnn*" EXIT
53 disklabel
-w ${BOOT} ${VNDEVICE} ${FSLABEL}
54 newfs
-i ${FSINODE} -o space
-m 0 /dev
/r
${VNDEVICE}c
56 mount
/dev
/${VNDEVICE}c
${MNT}
60 if [ "x${MDDEVICE}" != "x" ] ; then
61 umount
/dev
/${MDDEVICE} 2>/dev
/null || true
62 umount
${MNT} 2>/dev
/null || true
63 mdconfig
-d -u ${MDDEVICE} 2>/dev
/null || true
66 MDDEVICE
=`mdconfig -a -t vnode -f ${FSIMG}`
67 if [ ! -c /dev
/${MDDEVICE} ] ; then
68 echo "No /dev/$MDDEVICE" 1>&2
72 trap "umount ${MNT}; mdconfig -d -u ${MDDEVICE}" EXIT
74 if [ "x${DISKLABEL}" != "x" ] ; then
75 ${DISKLABEL} ${MACHINE} -w ${BOOT} ${MDDEVICE} ${FSLABEL}
76 newfs
-O1 -i ${FSINODE} -o space
-m 0 /dev
/${MDDEVICE}c
77 mount
/dev
/${MDDEVICE}c
${MNT}
79 newfs
-O1 -i ${FSINODE} -o space
-m 0 /dev
/${MDDEVICE}
80 mount
/dev
/${MDDEVICE} ${MNT}
85 dd of
=${FSIMG} if=/dev
/zero count
=${FSSIZE} bs
=1k
2>/dev
/null
88 # We don't have any bootblocks on ia64. Note that -B implies -r,
89 # so we have to specifically specify -r when we don't have -B.
90 # bsdlabel fails otherwise.
94 if [ -f "${RD}/trees/base/boot/boot1" ]; then
95 BOOT
="-B -b ${RD}/trees/base/boot/boot1"
96 if [ -f "${RD}/trees/base/boot/boot2" ]; then
97 BOOT
="${BOOT} -s ${RD}/trees/base/boot/boot2"
105 if [ -f "${RD}/trees/base/boot/boot" ]; then
106 BOOT
="-B -b ${RD}/trees/base/boot/boot"
114 if [ -d ${FSPROTO} ]; then
115 (set -e && cd ${FSPROTO} && find .
-print |
cpio -dump ${MNT})
117 cp -p ${FSPROTO} ${MNT}
122 set `df -ki ${MNT} | tail -1`
124 echo "*** File system is ${FSSIZE} K, $4 left"
125 echo "*** ${FSINODE} bytes/inode, $7 left"