summaryrefslogtreecommitdiffstats
path: root/release
diff options
context:
space:
mode:
authorhrs <hrs@FreeBSD.org>2013-02-03 10:26:24 +0000
committerhrs <hrs@FreeBSD.org>2013-02-03 10:26:24 +0000
commitaa08976cf0559eb6c97a1886ea652e0f839759e5 (patch)
treec4aff9d9ebb60d6103d10d3c0e6d461bb23c24cf /release
parent08016a40d72d610ac6322ad147f8a8ff7ac0e1e7 (diff)
downloadFreeBSD-src-aa08976cf0559eb6c97a1886ea652e0f839759e5.zip
FreeBSD-src-aa08976cf0559eb6c97a1886ea652e0f839759e5.tar.gz
- Add CHECKSUM.* support in Makefile[1].
- Use ln -fs to create a symlink. - Remove pkgadd for docports. - Use WITHOUT_JADETEX=yes instead of WITH_JADETEX=no. - Add {WORLD,KERNEL}_FLAGS to [BTWK]MAKE. - Use makefs(8) and gpart(8) for sparc64 ISO image[2]. - Add publisher option to makefs(8)[2]. Based on work by: gjb[1] Discussed with: marius, nwhitehorn[2]
Diffstat (limited to 'release')
-rw-r--r--release/Makefile25
-rw-r--r--release/amd64/mkisoimages.sh3
-rwxr-xr-xrelease/generate-release.sh227
-rw-r--r--release/i386/mkisoimages.sh3
-rw-r--r--release/ia64/mkisoimages.sh3
-rw-r--r--release/pc98/mkisoimages.sh3
-rw-r--r--release/powerpc/mkisoimages.sh4
-rw-r--r--release/sparc64/mkisoimages.sh88
8 files changed, 148 insertions, 208 deletions
diff --git a/release/Makefile b/release/Makefile
index 79a3e3f..830e4ea 100644
--- a/release/Makefile
+++ b/release/Makefile
@@ -34,6 +34,20 @@ TARGET_ARCH?= ${TARGET}
IMAKE= ${MAKE} TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}
DISTDIR= dist
+# Define OSRELEASE by using newvars.sh
+.if !defined(OSRELEASE) || empty(OSRELEASE)
+.for _V in TYPE BRANCH REVISION
+${_V}!= eval $$(awk '/^${_V}=/{print}' ${.CURDIR}/../sys/conf/newvers.sh); echo $$${_V}
+.endfor
+.for _V in ${TARGET_ARCH}
+.if !empty(TARGET:M${_V})
+OSRELEASE= ${TYPE}-${REVISION}-${BRANCH}-${TARGET}
+.else
+OSRELEASE= ${TYPE}-${REVISION}-${BRANCH}-${TARGET}-${TARGET_ARCH}
+.endif
+.endfor
+.endif
+
.if !exists(${DOCDIR})
NODOC= true
.endif
@@ -117,7 +131,7 @@ system: packagesystem
cp reldoc/* release
.endif
# Set up installation environment
- ln -s /tmp/bsdinstall_etc/resolv.conf release/etc/resolv.conf
+ ln -fs /tmp/bsdinstall_etc/resolv.conf release/etc/resolv.conf
echo sendmail_enable=\"NONE\" > release/etc/rc.conf
echo hostid_enable=\"NO\" >> release/etc/rc.conf
cp ${.CURDIR}/rc.local release/etc
@@ -142,7 +156,7 @@ bootonly: packagesystem
cp reldoc/* bootonly
.endif
# Set up installation environment
- ln -s /tmp/bsdinstall_etc/resolv.conf bootonly/etc/resolv.conf
+ ln -fs /tmp/bsdinstall_etc/resolv.conf bootonly/etc/resolv.conf
echo sendmail_enable=\"NONE\" > bootonly/etc/rc.conf
echo hostid_enable=\"NO\" >> bootonly/etc/rc.conf
cp ${.CURDIR}/rc.local bootonly/etc
@@ -183,4 +197,9 @@ install:
.if defined(DESTDIR) && !empty(DESTDIR)
mkdir -p ${DESTDIR}
.endif
- cp -a ${IMAGES} ftp ${DESTDIR}/
+ cp -a ftp ${DESTDIR}/
+.for I in ${IMAGES}
+ cp -p ${I} ${DESTDIR}/${OSRELEASE}-${I}
+.endfor
+ cd ${DESTDIR} && sha256 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.SHA256
+ cd ${DESTDIR} && md5 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.MD5
diff --git a/release/amd64/mkisoimages.sh b/release/amd64/mkisoimages.sh
index 105a073..e4093d7 100644
--- a/release/amd64/mkisoimages.sh
+++ b/release/amd64/mkisoimages.sh
@@ -39,6 +39,7 @@ fi
LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift
NAME=$1; shift
+publisher="The FreeBSD Project. http://www.FreeBSD.org/"
echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab
-makefs -t cd9660 $bootable -o rockridge -o label=$LABEL $NAME $*
+makefs -t cd9660 $bootable -o rockridge -o label=$LABEL -o publisher="$publisher" $NAME $*
rm $1/etc/fstab
diff --git a/release/generate-release.sh b/release/generate-release.sh
index b60276a..dbc8427 100755
--- a/release/generate-release.sh
+++ b/release/generate-release.sh
@@ -3,191 +3,98 @@
# generate-release.sh: check out source trees, and build release components with
# totally clean, fresh trees.
#
-# Usage: generate-release.sh [-r revision] [-d docrevision] \
-# [-p portsrevision] svn-branch scratch-dir
+# Usage: generate-release.sh svn-branch[@revision] scratch-dir
#
# Environment variables:
-# SVNROOT: SVN URL to FreeBSD source repository (by default,
-# svn://svn.freebsd.org/base)
-# MAKE_FLAGS: optional flags to pass to make (e.g. -j)
-# RELSTRING: optional base name for media images (e.g. FreeBSD-9.0-RC2-amd64)
-#
-# Note: Since this requires a chroot, release cross-builds will not work!
+# SVNROOTBASE: SVN base URL to FreeBSD repository (svn://svn.freebsd.org)
+# SVNROOTSRC: URL to FreeBSD src tree (${SVNROOTBASE}/base)
+# SVNROOTDOC: URL to FreeBSD doc tree (${SVNROOTBASE}/doc)
+# SVNROOTPORTS:URL to FreeBSD ports tree (${SVNROOTBASE}/ports)
+# BRANCHSRC: branch name of src (svn-branch[@revision])
+# BRANCHDOC: branch name of doc (head)
+# BRANCHPORTS: branch name of ports (head)
+# WORLD_FLAGS: optional flags to pass to buildworld (e.g. -j)
+# KERNEL_FLAGS: optional flags to pass to buildkernel (e.g. -j)
#
# $FreeBSD$
#
-unset B_ARCH
-unset ARCH
-unset MACHINE_ARCH
-
-HOST_ARCH=`uname -p`
-
usage()
{
- echo "Usage: $0 [-a arch] [-r revision] [-d docrevision] [-p portsrevision] svn-branch scratch-dir"
+ echo "Usage: $0 svn-branch[@revision] scratch-dir" 2>&1
exit 1
}
-arch_error ()
-{
- echo "Architecture ${OPTARG} cannot be built on host architecture ${HOST_ARCH}"
- exit 1
-}
-
-REVISION=
-DOCREVISION=
-PORTSREVISION=
-while getopts a:d:r:p: opt; do
- case $opt in
- a)
- case "${OPTARG}" in
- i386|amd64)
- if [ "${HOST_ARCH}" != "amd64" ]; then
- arch_error "${OPTARG}"
- fi
- ;;
- powerpc|powerpc64)
- if [ "${HOST_ARCH}" != "powerpc64" ]; then
- arch_error "${OPTARG}"
- fi
- ;;
- *)
- arch_error "${OPTARG}"
- ;;
- esac
- B_ARCH="$OPTARG"
- ;;
- d)
- DOCREVISION="-r $OPTARG"
- ;;
- r)
- REVISION="-r $OPTARG"
- ;;
- p)
- PORTSREVISION="-r $OPTARG"
- ;;
- \?)
- usage
- ;;
- esac
-done
-shift $(($OPTIND - 1))
-
-# If target architecture is not specified, use hw.machine_arch
-if [ "x${B_ARCH}" == "x" ]; then
- B_ARCH="${HOST_ARCH}"
-fi
-ARCH_FLAGS="ARCH=${B_ARCH} TARGET_ARCH=${B_ARCH}"
-
if [ $# -lt 2 ]; then
usage
fi
-if [ $(id -u) -ne 0 ]; then
- echo "Needs to be run as root."
+: ${SVNROOTBASE:=svn://svn.freebsd.org}
+: ${SVNROOTSRC:=${SVNROOTBASE}/base}
+: ${SVNROOTDOC:=${SVNROOTBASE}/doc}
+: ${SVNROOTPORTS:=${SVNROOTBASE}/ports}
+: ${SVNROOT:=${SVNROOTSRC}} # for backward compatibility
+: ${SVN_CMD:=/usr/local/bin/svn}
+BRANCHSRC=$1
+: ${BRANCHDOC:=head}
+: ${BRANCHPORTS:=head}
+: ${WORLD_FLAGS:=${MAKE_FLAGS}}
+: ${KERNEL_FLAGS:=${MAKE_FLAGS}}
+: ${CHROOTDIR:=$2}
+
+if [ ! -r "${CHROOTDIR}" ]; then
+ echo "${CHROOTDIR}: scratch dir not found."
exit 1
fi
-set -e # Everything must succeed
-
-case $MAKE_FLAGS in
- *-j*)
- ;;
- *)
- MAKE_FLAGS="$MAKE_FLAGS -j "$(sysctl -n hw.ncpu)
- ;;
+CHROOT_CMD="/usr/sbin/chroot ${CHROOTDIR}"
+case ${TARGET} in
+"") ;;
+*) SETENV_TARGET="TARGET=$TARGET" ;;
esac
+case ${TARGET_ARCH} in
+"") ;;
+*) SETENV_TARGET_ARCH="TARGET_ARCH=$TARGET_ARCH" ;;
+esac
+SETENV="env -i PATH=/bin:/usr/bin:/sbin:/usr/sbin"
+CROSSENV="${SETENV_TARGET} ${SETENV_TARGET_ARCH}"
+WMAKE="make -C /usr/src ${WORLD_FLAGS}"
+NWMAKE="${WMAKE} __MAKE_CONF=/dev/null SRCCONF=/dev/null"
+KMAKE="make -C /usr/src ${KERNEL_FLAGS}"
+RMAKE="make -C /usr/src/release"
-mkdir -p $2/usr/src
-
-svn co ${SVNROOT:-svn://svn.freebsd.org/base}/$1 $2/usr/src $REVISION
-svn co ${SVNROOT:-svn://svn.freebsd.org/doc}/head $2/usr/doc $DOCREVISION
-svn co ${SVNROOT:-svn://svn.freebsd.org/ports}/head $2/usr/ports $PORTSREVISION
-
-cd $2/usr/src
-make $MAKE_FLAGS ${ARCH_FLAGS} buildworld
-make $ARCH_FLAGS installworld distribution DESTDIR=$2
-mount -t devfs devfs $2/dev
-trap "umount $2/dev" EXIT # Clean up devfs mount on exit
-
-# Most commands below are run in chroot, so fake getosreldate(3) right now
-OSVERSION=$(grep '#define __FreeBSD_version' $2/usr/include/sys/param.h | awk '{print $3}')
-export OSVERSION
-BRANCH=$(grep '^BRANCH=' $2/usr/src/sys/conf/newvers.sh | awk -F\= '{print $2}')
-BRANCH=`echo ${BRANCH} | sed -e 's,",,g'`
-REVISION=$(grep '^REVISION=' $2/usr/src/sys/conf/newvers.sh | awk -F\= '{print $2}')
-REVISION=`echo ${REVISION} | sed -e 's,",,g'`
-OSRELEASE="${REVISION}-${BRANCH}"
-
-pkgng_install_docports ()
-{
- # Attempt to install docproj port from pkgng package.
- chroot ${CHROOTDIR} /bin/sh -c 'env ASSUME_ALWAYS_YES=1 /usr/sbin/pkg install -y docproj-nojadetex'
- # Check if docproj was installed, since pkg(8) returns '0' if unable
- # to install a package from the repository. If it is not installed,
- # fallback to installing using pkg_add(1).
- chroot ${CHROOTDIR} /bin/sh -c '/usr/sbin/pkg info -q docproj-nojadetex' || \
- pkgadd_install_docports
-}
+if [ $(id -u) -ne 0 ]; then
+ echo "Needs to be run as root."
+ exit 1
+fi
-build_compat9_port ()
-{
- chroot ${CHROOTDIR} /bin/sh -c 'make -C /usr/ports/misc/compat9x BATCH=yes install clean'
-}
+set -e # Everything must succeed
-pkgadd_install_docports ()
-{
- # Attempt to install docproj package with pkg_add(1).
- # If not successful, build the docproj port.
- if [ "${REVISION}" == "10.0" ]; then
- # Packages for 10-CURRENT are still located in the 9-CURRENT
- # directory. Override environment to use correct package
- # location if building for 10-CURRENT.
- PACKAGESITE="ftp://ftp.freebsd.org/pub/FreeBSD/ports/${B_ARCH}/packages-9-current/Latest/"
- export PACKAGESITE
- PACKAGEROOT="ftp://ftp.freebsd.org/pub/FreeBSD/ports/${B_ARCH}/packages-9-current/"
- export PACKAGEROOT
- PKG_PATH="ftp://ftp.freebsd.org/pub/FreeBSD/ports/${B_ARCH}/packages-9-current/All/"
- export PKG_PATH
- build_compat9_port
- fi
- chroot ${CHROOTDIR} /bin/sh -c '/usr/sbin/pkg_add -r docproj-nojadetex' || \
- build_docports
-}
+mkdir -p ${CHROOTDIR}/usr/src
+${SVN_CMD} co ${SVNROOT}/${BRANCHSRC} ${CHROOTDIR}/usr/src
+${SVN_CMD} co ${SVNROOTDOC}/${BRANCHDOC} ${CHROOTDIR}/usr/doc
+${SVN_CMD} co ${SVNROOTPORTS}/${BRANCHPORTS} ${CHROOTDIR}/usr/ports
-build_docports()
-{
- # Could not install textproc/docproj from pkg(8) or pkg_add(1). Build
- # the port as final fallback.
- chroot ${CHROOTDIR} /bin/sh -c 'make -C /usr/ports/textproc/docproj BATCH=yes WITHOUT_SVN=yes WITH_JADETEX=no WITHOUT_X11=yes WITHOUT_PYTHON=yes install clean' || \
- { echo "*** Could not build the textproj/docproj port. Exiting."; exit 2; }
-}
+${SETENV} ${NWMAKE} -C ${CHROOTDIR}/usr/src ${WORLD_FLAGS} buildworld
+${SETENV} ${NWMAKE} -C ${CHROOTDIR}/usr/src installworld distribution DESTDIR=${CHROOTDIR}
+mount -t devfs devfs ${CHROOTDIR}/dev
+trap "umount ${CHROOTDIR}/dev" EXIT # Clean up devfs mount on exit
-if [ -d $2/usr/doc ]; then
- cp /etc/resolv.conf $2/etc/resolv.conf
+if [ -d ${CHROOTDIR}/usr/doc ]; then
+ cp /etc/resolv.conf ${CHROOTDIR}/etc/resolv.conf
# Install docproj to build release documentation
- CHROOTDIR="$2"
- set +e
- pkgng_install_docports "${CHROOTDIR}"
- set -e
+ ${CHROOT_CMD} /bin/sh -c \
+ 'make -C /usr/ports/textproc/docproj \
+ BATCH=yes \
+ WITHOUT_SVN=yes \
+ WITHOUT_JADETEX=yes \
+ WITHOUT_X11=yes \
+ WITHOUT_PYTHON=yes \
+ install'
fi
-chroot $2 make -C /usr/src $MAKE_FLAGS ${ARCH_FLAGS} buildworld buildkernel
-chroot $2 make -C /usr/src/release ${ARCH_FLAGS} release
-chroot $2 make -C /usr/src/release install DESTDIR=/R
-
-if [ "x${OSVERSION}" == "x" ]; then
- OSRELEASE=`chroot $2 uname -r`
-fi
-
-: ${RELSTRING=`chroot $2 uname -s`-${OSRELEASE}-${B_ARCH}}
-
-cd $2/R
-for i in release.iso bootonly.iso memstick; do
- mv $i $RELSTRING-$i
-done
-sha256 $RELSTRING-* > CHECKSUM.SHA256
-md5 $RELSTRING-* > CHECKSUM.MD5
-
+${CHROOT_CMD} ${SETENV} ${CROSSENV} ${WMAKE} buildworld
+${CHROOT_CMD} ${SETENV} ${CROSSENV} ${KMAKE} buildkernel
+${CHROOT_CMD} ${SETENV} ${CROSSENV} ${RMAKE} release
+${CHROOT_CMD} ${SETENV} ${CROSSENV} ${RMAKE} install DESTDIR=/R
diff --git a/release/i386/mkisoimages.sh b/release/i386/mkisoimages.sh
index 105a073..e4093d7 100644
--- a/release/i386/mkisoimages.sh
+++ b/release/i386/mkisoimages.sh
@@ -39,6 +39,7 @@ fi
LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift
NAME=$1; shift
+publisher="The FreeBSD Project. http://www.FreeBSD.org/"
echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab
-makefs -t cd9660 $bootable -o rockridge -o label=$LABEL $NAME $*
+makefs -t cd9660 $bootable -o rockridge -o label=$LABEL -o publisher="$publisher" $NAME $*
rm $1/etc/fstab
diff --git a/release/ia64/mkisoimages.sh b/release/ia64/mkisoimages.sh
index 55b1640..b5cec32 100644
--- a/release/ia64/mkisoimages.sh
+++ b/release/ia64/mkisoimages.sh
@@ -75,8 +75,9 @@ else
BOOTOPTS=""
fi
+publisher="The FreeBSD Project. http://www.FreeBSD.org/"
echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $BASE/etc/fstab
-makefs -t cd9660 $BOOTOPTS -o rockridge -o label=$LABEL $NAME $BASE $*
+makefs -t cd9660 $BOOTOPTS -o rockridge -o label=$LABEL -o publisher="$publisher" $NAME $BASE $*
rm $BASE/etc/fstab
rm -f $EFIPART
exit 0
diff --git a/release/pc98/mkisoimages.sh b/release/pc98/mkisoimages.sh
index 68f2196..5a19b4d 100644
--- a/release/pc98/mkisoimages.sh
+++ b/release/pc98/mkisoimages.sh
@@ -39,6 +39,7 @@ fi
LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift
NAME=$1; shift
+publisher="The FreeBSD Project. http://www.FreeBSD.org/"
echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab
-makefs -t cd9660 $bootable -o rockridge -o label=$LABEL $NAME $*
+makefs -t cd9660 $bootable -o rockridge -o label=$LABEL -o publisher="$publisher" $NAME $*
rm $1/etc/fstab
diff --git a/release/powerpc/mkisoimages.sh b/release/powerpc/mkisoimages.sh
index 6bd29a7..7ba4649 100644
--- a/release/powerpc/mkisoimages.sh
+++ b/release/powerpc/mkisoimages.sh
@@ -61,9 +61,9 @@ fi
LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift
NAME=$1; shift
+publisher="The FreeBSD Project. http://www.FreeBSD.org/"
echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab
-makefs -t cd9660 $bootable -o rockridge -o label=$LABEL $NAME $*
+makefs -t cd9660 $bootable -o rockridge -o label=$LABEL -o publisher="$publisher" $NAME $*
rm $1/etc/fstab
rm /tmp/hfs-boot-block
rm -rf $1/ppc
-
diff --git a/release/sparc64/mkisoimages.sh b/release/sparc64/mkisoimages.sh
index 9ae6dcf..82cadab 100644
--- a/release/sparc64/mkisoimages.sh
+++ b/release/sparc64/mkisoimages.sh
@@ -22,51 +22,61 @@
# 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=`echo $1 | tr '[:lower:]' '[:upper:]'`; 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 -B be -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 -B be -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}))
+
+ENDCYL=$((${ISOCYLS} + ${BOOTFSCYLS}))
+NSECTS=$((${ENDCYL} * 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 -S 512 -y 1 -x ${CYLSIZE} -f ${NAME}`
+gpart create -s VTOC8 ${MD}
+# !4: usr, for ISO image part
+gpart add -i 1 -s $((${ISOCYLS} * ${CYLSIZE} * 512))b -t \!4 ${MD}
+# !2: root, for bootfs part.
+gpart add -i 6 -s $((${BOOTFSCYLS} * ${CYLSIZE} * 512))b -t \!2 ${MD}
+mdconfig -d -u ${MD#md}
OpenPOWER on IntegriCloud