- 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]
This commit is contained in:
Hiroki Sato 2013-02-03 10:26:24 +00:00
parent 36b7dde416
commit de17cbcc7e
10 changed files with 212 additions and 254 deletions

View File

@ -27,6 +27,8 @@
# TARGET="machine" to crossbuild world for a different machine type # TARGET="machine" to crossbuild world for a different machine type
# TARGET_ARCH= may be required when a TARGET supports multiple endians # TARGET_ARCH= may be required when a TARGET supports multiple endians
# BUILDENV_SHELL= shell to launch for the buildenv target (def:/bin/sh) # BUILDENV_SHELL= shell to launch for the buildenv target (def:/bin/sh)
# WORLD_FLAGS= additional flags to pass to make(1) during buildworld
# KERNEL_FLAGS= additional flags to pass to make(1) during buildkernel
# #
# The intended user-driven targets are: # The intended user-driven targets are:
@ -245,7 +247,7 @@ BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \
MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \ MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \
COMPILER_TYPE=${COMPILER_TYPE} COMPILER_TYPE=${COMPILER_TYPE}
BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \ BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
${BMAKEENV} ${MAKE} -f Makefile.inc1 \ ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
DESTDIR= \ DESTDIR= \
BOOTSTRAPPING=${OSRELDATE} \ BOOTSTRAPPING=${OSRELDATE} \
SSP_CFLAGS= \ SSP_CFLAGS= \
@ -255,7 +257,7 @@ BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \
# build-tools stage # build-tools stage
TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \
${BMAKEENV} ${MAKE} -f Makefile.inc1 \ ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \
TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \
DESTDIR= \ DESTDIR= \
BOOTSTRAPPING=${OSRELDATE} \ BOOTSTRAPPING=${OSRELDATE} \
@ -288,7 +290,7 @@ WMAKE_COMPILER_TYPE= gcc
WMAKE_COMPILER_TYPE= clang WMAKE_COMPILER_TYPE= clang
.endif .endif
WMAKEENV+= COMPILER_TYPE=${WMAKE_COMPILER_TYPE} WMAKEENV+= COMPILER_TYPE=${WMAKE_COMPILER_TYPE}
WMAKE= ${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP} WMAKE= ${WMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 DESTDIR=${WORLDTMP}
.if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64" .if ${TARGET_ARCH} == "amd64" || ${TARGET_ARCH} == "powerpc64"
# 32 bit world # 32 bit world
@ -378,7 +380,7 @@ IMAKE_MTREE= MTREE_CMD="nmtree ${MTREEFLAGS}"
# kernel stage # kernel stage
KMAKEENV= ${WMAKEENV} KMAKEENV= ${WMAKEENV}
KMAKE= ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} KMAKE= ${KMAKEENV} ${MAKE} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME}
# #
# buildworld # buildworld

View File

@ -34,6 +34,20 @@ TARGET_ARCH?= ${TARGET}
IMAKE= ${MAKE} TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET} IMAKE= ${MAKE} TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}
DISTDIR= dist 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}) .if !exists(${DOCDIR})
NODOC= true NODOC= true
.endif .endif
@ -117,7 +131,7 @@ system: packagesystem
cp reldoc/* release cp reldoc/* release
.endif .endif
# Set up installation environment # 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 sendmail_enable=\"NONE\" > release/etc/rc.conf
echo hostid_enable=\"NO\" >> release/etc/rc.conf echo hostid_enable=\"NO\" >> release/etc/rc.conf
cp ${.CURDIR}/rc.local release/etc cp ${.CURDIR}/rc.local release/etc
@ -142,7 +156,7 @@ bootonly: packagesystem
cp reldoc/* bootonly cp reldoc/* bootonly
.endif .endif
# Set up installation environment # 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 sendmail_enable=\"NONE\" > bootonly/etc/rc.conf
echo hostid_enable=\"NO\" >> bootonly/etc/rc.conf echo hostid_enable=\"NO\" >> bootonly/etc/rc.conf
cp ${.CURDIR}/rc.local bootonly/etc cp ${.CURDIR}/rc.local bootonly/etc
@ -183,4 +197,9 @@ install:
.if defined(DESTDIR) && !empty(DESTDIR) .if defined(DESTDIR) && !empty(DESTDIR)
mkdir -p ${DESTDIR} mkdir -p ${DESTDIR}
.endif .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

View File

@ -39,6 +39,7 @@ fi
LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift
NAME=$1; shift NAME=$1; shift
publisher="The FreeBSD Project. http://www.FreeBSD.org/"
echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab 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 $1/etc/fstab

View File

@ -3,87 +3,66 @@
# generate-release.sh: check out source trees, and build release components with # generate-release.sh: check out source trees, and build release components with
# totally clean, fresh trees. # totally clean, fresh trees.
# #
# Usage: generate-release.sh [-r revision] [-d docrevision] \ # Usage: generate-release.sh svn-branch[@revision] scratch-dir
# [-p portsrevision] svn-branch scratch-dir
# #
# Environment variables: # Environment variables:
# SVNROOT: SVN URL to FreeBSD source repository (by default, # SVNROOTBASE: SVN base URL to FreeBSD repository (svn://svn.freebsd.org)
# svn://svn.freebsd.org/base) # SVNROOTSRC: URL to FreeBSD src tree (${SVNROOTBASE}/base)
# MAKE_FLAGS: optional flags to pass to make (e.g. -j) # SVNROOTDOC: URL to FreeBSD doc tree (${SVNROOTBASE}/doc)
# RELSTRING: optional base name for media images (e.g. FreeBSD-9.0-RC2-amd64) # SVNROOTPORTS:URL to FreeBSD ports tree (${SVNROOTBASE}/ports)
# # BRANCHSRC: branch name of src (svn-branch[@revision])
# Note: Since this requires a chroot, release cross-builds will not work! # 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$ # $FreeBSD$
# #
unset B_ARCH
unset ARCH
unset MACHINE_ARCH
HOST_ARCH=`uname -p`
usage() 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 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 if [ $# -lt 2 ]; then
usage usage
fi fi
: ${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
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"
if [ $(id -u) -ne 0 ]; then if [ $(id -u) -ne 0 ]; then
echo "Needs to be run as root." echo "Needs to be run as root."
exit 1 exit 1
@ -91,103 +70,31 @@ fi
set -e # Everything must succeed set -e # Everything must succeed
case $MAKE_FLAGS in mkdir -p ${CHROOTDIR}/usr/src
*-j*) ${SVN_CMD} co ${SVNROOT}/${BRANCHSRC} ${CHROOTDIR}/usr/src
;; ${SVN_CMD} co ${SVNROOTDOC}/${BRANCHDOC} ${CHROOTDIR}/usr/doc
*) ${SVN_CMD} co ${SVNROOTPORTS}/${BRANCHPORTS} ${CHROOTDIR}/usr/ports
MAKE_FLAGS="$MAKE_FLAGS -j "$(sysctl -n hw.ncpu)
;;
esac
mkdir -p $2/usr/src ${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
svn co ${SVNROOT:-svn://svn.freebsd.org/base}/$1 $2/usr/src $REVISION if [ -d ${CHROOTDIR}/usr/doc ]; then
svn co ${SVNROOT:-svn://svn.freebsd.org/doc}/head $2/usr/doc $DOCREVISION cp /etc/resolv.conf ${CHROOTDIR}/etc/resolv.conf
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
}
build_compat9_port ()
{
chroot ${CHROOTDIR} /bin/sh -c 'make -C /usr/ports/misc/compat9x BATCH=yes install clean'
}
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
}
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; }
}
if [ -d $2/usr/doc ]; then
cp /etc/resolv.conf $2/etc/resolv.conf
# Install docproj to build release documentation # Install docproj to build release documentation
CHROOTDIR="$2" ${CHROOT_CMD} /bin/sh -c \
set +e 'make -C /usr/ports/textproc/docproj \
pkgng_install_docports "${CHROOTDIR}" BATCH=yes \
set -e WITHOUT_SVN=yes \
WITHOUT_JADETEX=yes \
WITHOUT_X11=yes \
WITHOUT_PYTHON=yes \
install'
fi fi
chroot $2 make -C /usr/src $MAKE_FLAGS ${ARCH_FLAGS} buildworld buildkernel ${CHROOT_CMD} ${SETENV} ${CROSSENV} ${WMAKE} buildworld
chroot $2 make -C /usr/src/release ${ARCH_FLAGS} release ${CHROOT_CMD} ${SETENV} ${CROSSENV} ${KMAKE} buildkernel
chroot $2 make -C /usr/src/release install DESTDIR=/R ${CHROOT_CMD} ${SETENV} ${CROSSENV} ${RMAKE} release
${CHROOT_CMD} ${SETENV} ${CROSSENV} ${RMAKE} 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

View File

@ -39,6 +39,7 @@ fi
LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift
NAME=$1; shift NAME=$1; shift
publisher="The FreeBSD Project. http://www.FreeBSD.org/"
echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab 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 $1/etc/fstab

View File

@ -75,8 +75,9 @@ else
BOOTOPTS="" BOOTOPTS=""
fi fi
publisher="The FreeBSD Project. http://www.FreeBSD.org/"
echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $BASE/etc/fstab 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 $BASE/etc/fstab
rm -f $EFIPART rm -f $EFIPART
exit 0 exit 0

View File

@ -39,6 +39,7 @@ fi
LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift
NAME=$1; shift NAME=$1; shift
publisher="The FreeBSD Project. http://www.FreeBSD.org/"
echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab 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 $1/etc/fstab

View File

@ -61,9 +61,9 @@ fi
LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift
NAME=$1; shift NAME=$1; shift
publisher="The FreeBSD Project. http://www.FreeBSD.org/"
echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > $1/etc/fstab 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 $1/etc/fstab
rm /tmp/hfs-boot-block rm /tmp/hfs-boot-block
rm -rf $1/ppc rm -rf $1/ppc

View File

@ -22,51 +22,61 @@
# resulting ISO image, base-bits-dir contains the image contents and # resulting ISO image, base-bits-dir contains the image contents and
# extra-bits-dir, if provided, contains additional files to be merged # extra-bits-dir, if provided, contains additional files to be merged
# into base-bits-dir as part of making the image. # 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 if [ $# -lt 3 ]; then
echo Usage: $0 '[-b] image-label image-name base-bits-dir [extra-bits-dir]' echo Usage: $0 '[-b] image-label image-name base-bits-dir [extra-bits-dir]' > /dev/stderr
rm -f ${IMG}
exit 1 exit 1
fi fi
type mkisofs 2>&1 | grep " is " >/dev/null case $1 in
if [ $? -ne 0 ]; then -b) BOPT=$1; shift ;;
echo The cdrtools port is not installed. Trying to get it now. esac
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
LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift LABEL=`echo $1 | tr '[:lower:]' '[:upper:]'`; shift
NAME=$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 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 $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}

View File

@ -24,7 +24,7 @@
.\" .\"
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd January 31, 2013 .Dd February 3, 2013
.Dt RELEASE 7 .Dt RELEASE 7
.Os .Os
.Sh NAME .Sh NAME
@ -116,26 +116,40 @@ Note that because this uses a chroot, it cannot be used to cross-build
.Fx .Fx
release media. release media.
.Pp .Pp
Environment variables: Optional environment variables:
.Bl -tag -width ".Cm MAKE_FLAGS" .Bl -tag -width ".Cm WORLD_FLAGS"
.It Ev MAKE_FLAGS .It Ev WORLD_FLAGS
This environment variable can be set to pass flags (e.g. -j) to This environment variable can be set to pass flags (e.g. -j) to
.Xr make 1 .Xr make 1
when invoked by the script. when invoked to build a world by the script.
.It Ev SVNROOT .It Ev KERNEL_FLAGS
The location of the FreeBSD SVN source, doc, and ports repositories. This environment variable can be set to pass flags (e.g. -j) to
.Xr make 1
when invoked to build a kernel by the script.
.It Ev SVNROOTBASE
The base part of URL of the FreeBSD SVN repositories.
Defaults to Defaults to
.Pa svn://svn.freebsd.org/base .Pa svn://svn.freebsd.org .
for the source tree, .It Ev SVNROOTSRC
.Pa svn://svn.freebsd.org/ports/head The URL of the FreeBSD SVN source repository.
for the Ports Collection, and Defaults to
.Pa svn://svn.freebsd.org/doc/head .Pa ${SVNROOTBASE}/base .
for the Documentation Project source. .It Ev SVNROOTDOC
.It Ev RELSTRING The URL of the FreeBSD SVN doc repository.
Optional base name for generated media images (e.g. FreeBSD-9.0-RC2-amd64). Defaults to
Defaults to the output of .Pa ${SVNROOTBASE}/doc .
.Ic `uname -s`-`uname -r`-`uname -p` .It Ev SVNROOTPORTS
within the chroot. The URL of the FreeBSD SVN ports repository.
Defaults to
.Pa ${SVNROOTBASE}/ports .
.It Ev BRANCHDOC
The branch name of the FreeBSD SVN doc repository.
Defaults to
.Pa head .
.It Ev BRANCHPORTS
The branch name of the FreeBSD SVN ports repository.
Defaults to
.Pa head .
.El .El
.Sh MAKEFILE TARGETS .Sh MAKEFILE TARGETS
The release makefile The release makefile
@ -155,15 +169,12 @@ platform.
Copy all produced release media to Copy all produced release media to
.Pa ${DESTDIR} . .Pa ${DESTDIR} .
.It Cm cdrom .It Cm cdrom
Builds installation CD-ROM images. On some systems, this may require that Builds installation CD-ROM images.
.Xr mkisofs 8 This may require the
be installed
.Pq Pa sysutils/cdrtools
and possibly that the
.Xr md 4 .Xr md 4
(memory disk) device driver be present in the kernel (memory disk) device driver be present in the kernel
(either by being compiled in or available as a module). This target (either by being compiled in or available as a module).
produces files called This target produces files called
.Pa release.iso .Pa release.iso
and and
.Pa bootonly.iso .Pa bootonly.iso
@ -171,7 +182,8 @@ as its output.
.It Cm memstick .It Cm memstick
Builds an installation memory stick image named Builds an installation memory stick image named
.Pa memstick . .Pa memstick .
Not applicable on all platforms. Requires that the Not applicable on all platforms.
Requires that the
.Xr md 4 .Xr md 4
(memory disk) device driver be present in the kernel (memory disk) device driver be present in the kernel
(either by being compiled in or available as a module). (either by being compiled in or available as a module).
@ -207,27 +219,32 @@ target invoked by
.El .El
.Sh ENVIRONMENT .Sh ENVIRONMENT
Optional variables: Optional variables:
.Bl -tag -width ".Va TARGET_ARCH" .Bl -tag -width ".Ev TARGET_ARCH"
.It Va WORLDDIR .It Ev OSRELEASE
Optional base name for generated media images (e.g. FreeBSD-9.0-RC2-amd64).
Defaults to the output of
.Ic `uname -s`-`uname -r`-`uname -p`
within the chroot.
.It Ev WORLDDIR
Location of a directory containing the src tree. By default, the directory Location of a directory containing the src tree. By default, the directory
above the one containing the makefile above the one containing the makefile
.Pq Pa src . .Pq Pa src .
.It Va PORTSDIR .It Ev PORTSDIR
Location of a directory containing the ports tree. By default, Location of a directory containing the ports tree. By default,
.Pa /usr/ports . .Pa /usr/ports .
If it is unset or cannot be found, ports will not be included in the release. If it is unset or cannot be found, ports will not be included in the release.
.It Va DOCDIR .It Ev DOCDIR
Location of a directory containing the doc tree. By default, Location of a directory containing the doc tree. By default,
.Pa /usr/doc . .Pa /usr/doc .
If it is unset or cannot be found, most documentation will not be included in If it is unset or cannot be found, most documentation will not be included in
the release; see the release; see
.Ev NODOC .Ev NODOC
below. below.
.It Va NOPORTS .It Ev NOPORTS
If defined, the Ports Collection will be omitted from the release. If defined, the Ports Collection will be omitted from the release.
.It Va NOSRC .It Ev NOSRC
If set, do not include system source code in the release. If set, do not include system source code in the release.
.It Va NODOC .It Ev NODOC
If defined, the XML-based documentation from the If defined, the XML-based documentation from the
.Fx .Fx
Documentation Project will not be built. Documentation Project will not be built.
@ -236,33 +253,33 @@ However, the
distribution will still be created with the minimal documentation set distribution will still be created with the minimal documentation set
provided in provided in
.Pa src/share/doc . .Pa src/share/doc .
.It Va TARGET .It Ev TARGET
The target hardware platform. The target hardware platform.
This is analogous to the This is analogous to the
.Dq Nm uname Fl m .Dq Nm uname Fl m
output. output.
This is necessary to cross-build some target architectures. This is necessary to cross-build some target architectures.
For example, cross-building for PC98 machines requires For example, cross-building for PC98 machines requires
.Va TARGET_ARCH Ns = Ns Li i386 .Ev TARGET_ARCH Ns = Ns Li i386
and and
.Va TARGET Ns = Ns Li pc98 . .Ev TARGET Ns = Ns Li pc98 .
If not set, If not set,
.Va TARGET .Ev TARGET
defaults to the current hardware platform. defaults to the current hardware platform.
.It Va TARGET_ARCH .It Ev TARGET_ARCH
The target machine processor architecture. The target machine processor architecture.
This is analogous to the This is analogous to the
.Dq Nm uname Fl p .Dq Nm uname Fl p
output. output.
Set this to cross-build for a different architecture. Set this to cross-build for a different architecture.
If not set, If not set,
.Va TARGET_ARCH .Ev TARGET_ARCH
defaults to the current machine architecture, unless defaults to the current machine architecture, unless
.Va TARGET .Ev TARGET
is also set, in which case it defaults to the appropriate is also set, in which case it defaults to the appropriate
value for that platform. value for that platform.
Typically, one only needs to set Typically, one only needs to set
.Va TARGET . .Ev TARGET .
.El .El
.Sh FILES .Sh FILES
.Bl -tag -compact -width Pa .Bl -tag -compact -width Pa
@ -299,7 +316,6 @@ The following sequence of commands can be used to build a
in a clean environment, including ports and documentation: in a clean environment, including ports and documentation:
.Bd -literal -offset indent .Bd -literal -offset indent
cd /usr/src/release cd /usr/src/release
export SVNROOT=svn://svn.freebsd.org/base
sh generate-release.sh head /local3/release sh generate-release.sh head /local3/release
.Ed .Ed
.Pp .Pp