From de17cbcc7e377f7c8412dc2f3c20a2de48af4dfb Mon Sep 17 00:00:00 2001 From: Hiroki Sato Date: Sun, 3 Feb 2013 10:26:24 +0000 Subject: [PATCH] - 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] --- Makefile.inc1 | 10 +- release/Makefile | 25 +++- release/amd64/mkisoimages.sh | 3 +- release/generate-release.sh | 227 ++++++++++----------------------- release/i386/mkisoimages.sh | 3 +- release/ia64/mkisoimages.sh | 3 +- release/pc98/mkisoimages.sh | 3 +- release/powerpc/mkisoimages.sh | 4 +- release/sparc64/mkisoimages.sh | 88 +++++++------ share/man/man7/release.7 | 100 +++++++++------ 10 files changed, 212 insertions(+), 254 deletions(-) diff --git a/Makefile.inc1 b/Makefile.inc1 index d5f6f2e281f7..34369a851e71 100644 --- a/Makefile.inc1 +++ b/Makefile.inc1 @@ -27,6 +27,8 @@ # TARGET="machine" to crossbuild world for a different machine type # TARGET_ARCH= may be required when a TARGET supports multiple endians # 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: @@ -245,7 +247,7 @@ BMAKEENV= INSTALL="sh ${.CURDIR}/tools/install.sh" \ MAKEFLAGS="-m ${.CURDIR}/tools/build/mk ${.MAKEFLAGS}" \ COMPILER_TYPE=${COMPILER_TYPE} BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \ - ${BMAKEENV} ${MAKE} -f Makefile.inc1 \ + ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ DESTDIR= \ BOOTSTRAPPING=${OSRELDATE} \ SSP_CFLAGS= \ @@ -255,7 +257,7 @@ BMAKE= MAKEOBJDIRPREFIX=${WORLDTMP} \ # build-tools stage TMAKE= MAKEOBJDIRPREFIX=${OBJTREE} \ - ${BMAKEENV} ${MAKE} -f Makefile.inc1 \ + ${BMAKEENV} ${MAKE} ${WORLD_FLAGS} -f Makefile.inc1 \ TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ DESTDIR= \ BOOTSTRAPPING=${OSRELDATE} \ @@ -288,7 +290,7 @@ WMAKE_COMPILER_TYPE= gcc WMAKE_COMPILER_TYPE= clang .endif 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" # 32 bit world @@ -378,7 +380,7 @@ IMAKE_MTREE= MTREE_CMD="nmtree ${MTREEFLAGS}" # kernel stage KMAKEENV= ${WMAKEENV} -KMAKE= ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} +KMAKE= ${KMAKEENV} ${MAKE} ${KERNEL_FLAGS} KERNEL=${INSTKERNNAME} # # buildworld diff --git a/release/Makefile b/release/Makefile index 79a3e3fd3b1e..830e4ea04ddb 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 105a07395fc2..e4093d74e4c9 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 b60276a85f80..dbc8427507d6 100755 --- a/release/generate-release.sh +++ b/release/generate-release.sh @@ -3,87 +3,66 @@ # 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 +: ${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 echo "Needs to be run as root." exit 1 @@ -91,103 +70,31 @@ fi set -e # Everything must succeed -case $MAKE_FLAGS in - *-j*) - ;; - *) - MAKE_FLAGS="$MAKE_FLAGS -j "$(sysctl -n hw.ncpu) - ;; -esac +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 -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 -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 -} - -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 +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 105a07395fc2..e4093d74e4c9 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 55b1640ec741..b5cec3271940 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 68f219638d1c..5a19b4d6ea27 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 6bd29a73eee3..7ba464965542 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 9ae6dcfd71ca..82cadab93a92 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} diff --git a/share/man/man7/release.7 b/share/man/man7/release.7 index bad69aa53238..8216eeff787e 100644 --- a/share/man/man7/release.7 +++ b/share/man/man7/release.7 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 31, 2013 +.Dd February 3, 2013 .Dt RELEASE 7 .Os .Sh NAME @@ -116,26 +116,40 @@ Note that because this uses a chroot, it cannot be used to cross-build .Fx release media. .Pp -Environment variables: -.Bl -tag -width ".Cm MAKE_FLAGS" -.It Ev MAKE_FLAGS +Optional environment variables: +.Bl -tag -width ".Cm WORLD_FLAGS" +.It Ev WORLD_FLAGS This environment variable can be set to pass flags (e.g. -j) to .Xr make 1 -when invoked by the script. -.It Ev SVNROOT -The location of the FreeBSD SVN source, doc, and ports repositories. +when invoked to build a world by the script. +.It Ev KERNEL_FLAGS +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 -.Pa svn://svn.freebsd.org/base -for the source tree, -.Pa svn://svn.freebsd.org/ports/head -for the Ports Collection, and -.Pa svn://svn.freebsd.org/doc/head -for the Documentation Project source. -.It Ev RELSTRING -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. +.Pa svn://svn.freebsd.org . +.It Ev SVNROOTSRC +The URL of the FreeBSD SVN source repository. +Defaults to +.Pa ${SVNROOTBASE}/base . +.It Ev SVNROOTDOC +The URL of the FreeBSD SVN doc repository. +Defaults to +.Pa ${SVNROOTBASE}/doc . +.It Ev SVNROOTPORTS +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 .Sh MAKEFILE TARGETS The release makefile @@ -155,15 +169,12 @@ platform. Copy all produced release media to .Pa ${DESTDIR} . .It Cm cdrom -Builds installation CD-ROM images. On some systems, this may require that -.Xr mkisofs 8 -be installed -.Pq Pa sysutils/cdrtools -and possibly that the +Builds installation CD-ROM images. +This may require the .Xr md 4 (memory disk) device driver be present in the kernel -(either by being compiled in or available as a module). This target -produces files called +(either by being compiled in or available as a module). +This target produces files called .Pa release.iso and .Pa bootonly.iso @@ -171,7 +182,8 @@ as its output. .It Cm memstick Builds an installation memory stick image named .Pa memstick . -Not applicable on all platforms. Requires that the +Not applicable on all platforms. +Requires that the .Xr md 4 (memory disk) device driver be present in the kernel (either by being compiled in or available as a module). @@ -207,27 +219,32 @@ target invoked by .El .Sh ENVIRONMENT Optional variables: -.Bl -tag -width ".Va TARGET_ARCH" -.It Va WORLDDIR +.Bl -tag -width ".Ev TARGET_ARCH" +.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 above the one containing the makefile .Pq Pa src . -.It Va PORTSDIR +.It Ev PORTSDIR Location of a directory containing the ports tree. By default, .Pa /usr/ports . 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, .Pa /usr/doc . If it is unset or cannot be found, most documentation will not be included in the release; see .Ev NODOC below. -.It Va NOPORTS +.It Ev NOPORTS 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. -.It Va NODOC +.It Ev NODOC If defined, the XML-based documentation from the .Fx Documentation Project will not be built. @@ -236,33 +253,33 @@ However, the distribution will still be created with the minimal documentation set provided in .Pa src/share/doc . -.It Va TARGET +.It Ev TARGET The target hardware platform. This is analogous to the .Dq Nm uname Fl m output. This is necessary to cross-build some target architectures. For example, cross-building for PC98 machines requires -.Va TARGET_ARCH Ns = Ns Li i386 +.Ev TARGET_ARCH Ns = Ns Li i386 and -.Va TARGET Ns = Ns Li pc98 . +.Ev TARGET Ns = Ns Li pc98 . If not set, -.Va TARGET +.Ev TARGET defaults to the current hardware platform. -.It Va TARGET_ARCH +.It Ev TARGET_ARCH The target machine processor architecture. This is analogous to the .Dq Nm uname Fl p output. Set this to cross-build for a different architecture. If not set, -.Va TARGET_ARCH +.Ev TARGET_ARCH defaults to the current machine architecture, unless -.Va TARGET +.Ev TARGET is also set, in which case it defaults to the appropriate value for that platform. Typically, one only needs to set -.Va TARGET . +.Ev TARGET . .El .Sh FILES .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: .Bd -literal -offset indent cd /usr/src/release -export SVNROOT=svn://svn.freebsd.org/base sh generate-release.sh head /local3/release .Ed .Pp