svn commit: r245061 - user/hrs/releng/release/sparc64
Hiroki Sato
hrs at FreeBSD.org
Sat Jan 5 16:23:19 UTC 2013
Author: hrs
Date: Sat Jan 5 16:23:18 2013
New Revision: 245061
URL: http://svnweb.freebsd.org/changeset/base/245061
Log:
Remove mkisofs dependency in sparc64 boot iso image creation. A fixed
sectors/cylinder (640) and the number of head (1) are used at this moment.
Modified:
user/hrs/releng/release/sparc64/mkisoimages.sh
Modified: user/hrs/releng/release/sparc64/mkisoimages.sh
==============================================================================
--- user/hrs/releng/release/sparc64/mkisoimages.sh Sat Jan 5 15:50:56 2013 (r245060)
+++ user/hrs/releng/release/sparc64/mkisoimages.sh Sat Jan 5 16:23:18 2013 (r245061)
@@ -22,51 +22,69 @@
# resulting ISO image, base-bits-dir contains the image contents and
# extra-bits-dir, if provided, contains additional files to be merged
# into base-bits-dir as part of making the image.
-
-publisher="The FreeBSD Project. http://www.freebsd.org/"
-IMG=/tmp/bootfs
-MNT=/mnt
-
-if [ "x$1" = "x-b" ]; then
- dd if=/dev/zero of=${IMG} bs=512 count=1024
- MD=`mdconfig -a -t vnode -f ${IMG}`
- sunlabel -w -B -b $4/boot/boot1 ${MD} auto
- newfs -O1 -o space -m 0 /dev/${MD}
- mount /dev/${MD} ${MNT}
- mkdir ${MNT}/boot
- cp $4/boot/loader ${MNT}/boot
- umount ${MNT}
- mdconfig -d -u ${MD#md}
- bootable="-B ,,,,${IMG}"
- shift
-else
- bootable=""
-fi
-
if [ $# -lt 3 ]; then
- echo Usage: $0 '[-b] image-label image-name base-bits-dir [extra-bits-dir]'
- rm -f ${IMG}
+ echo Usage: $0 '[-b] image-label image-name base-bits-dir [extra-bits-dir]' > /dev/stderr
exit 1
fi
-type mkisofs 2>&1 | grep " is " >/dev/null
-if [ $? -ne 0 ]; then
- echo The cdrtools port is not installed. Trying to get it now.
- if [ -f /usr/ports/sysutils/cdrtools/Makefile ]; then
- cd /usr/ports/sysutils/cdrtools && make install BATCH=yes && make clean
- else
- if ! pkg_add -r cdrtools; then
- echo "Could not get it via pkg_add - please go install this"
- echo "from the ports collection and run this script again."
- exit 2
- fi
- fi
-fi
-
+case $1 in
+-b) BOPT=$1; shift ;;
+esac
LABEL=$1; shift
NAME=$1; shift
+# Create an ISO image
+publisher="The FreeBSD Project. http://www.freebsd.org/"
echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab
-mkisofs $bootable -r -J -V $LABEL -publisher "$publisher" -o $NAME $*
+makefs -t cd9660 -o rockridge -o label="$LABEL" -o publisher="$publisher" ${NAME}.tmp $*
rm $1/etc/fstab
-rm -f ${IMG}
+
+if [ "x$BOPT" != "x-b" ]; then
+ mv ${NAME}.tmp ${NAME}
+ exit 0
+fi
+TMPIMGDIR=`mktemp -d /tmp/bootfs.XXXXXXXX` || exit 1
+BOOTFSDIR="${TMPIMGDIR}/bootfs"
+BOOTFSIMG="${TMPIMGDIR}/bootfs.img"
+
+# Create a boot filesystem
+mkdir -p "${BOOTFSDIR}/boot"
+cp $4/boot/loader "${BOOTFSDIR}/boot"
+makefs -t ffs -M 512k "${BOOTFSIMG}" "${BOOTFSDIR}"
+dd if=$4/boot/boot1 of="${BOOTFSIMG}" bs=512 conv=notrunc,sync
+
+# Create a boot ISO image
+: ${CYLSIZE:=640}
+ISOSIZE=$(stat -f %z ${NAME}.tmp)
+ISOBLKS=$(( (${ISOSIZE} + 511) / 512 ))
+ISOCYLS=$(( (${ISOBLKS} + (${CYLSIZE} - 1)) / ${CYLSIZE} ))
+
+BOOTFSSIZE=$(stat -f %z "${BOOTFSIMG}")
+BOOTFSBLKS=$(( (${BOOTFSSIZE} + 511) / 512 ))
+BOOTFSCYLS=$(( (${BOOTFSBLKS} + (${CYLSIZE} - 1)) / ${CYLSIZE} ))
+
+dd if=${NAME}.tmp of=${NAME} bs=${CYLSIZE}b conv=notrunc,sync
+dd if=${BOOTFSIMG} of=${NAME} bs=${CYLSIZE}b seek=${ISOCYLS} conv=notrunc,sync
+# The number of alternative cylinders is always 2.
+dd if=/dev/zero of=${NAME} bs=${CYLSIZE}b seek=${ENDCYL} count=2 conv=notrunc,sync
+rm -rf ${NAME}.tmp ${TMPIMGDIR}
+
+# Write VTOC8 label to boot ISO image
+MD=`mdconfig -a -t vnode -f ${NAME}`
+cat <<EOT | sunlabel -R ${MD} /dev/stdin
+text: FreeBSD_Install cyl ${ENDCYL} alt 2 hd 1 sec ${CYLSIZE}
+bytes/sector: 512
+sectors/cylinder: ${CYLSIZE}
+sectors/unit: ${ENDCYL}
+
+8 partitions:
+#
+# Size is in sectors.
+# Offset is in cylinders.
+# size offset tag flag
+# ---------- ---------- ---------- ----
+ c: * 0 backup rm
+ a: ${ISOBLKS} 0 usr rm
+ f: ${BOOTFSBLKS} ${ISOCYLS} root rm
+EOT
+mdconfig -d -u ${MD#md}
More information about the svn-src-user
mailing list