Index: head/release/Makefile =================================================================== --- head/release/Makefile (revision 277457) +++ head/release/Makefile (revision 277458) @@ -1,364 +1,304 @@ # $FreeBSD$ # # Makefile for building releases and release media. # # User-driven targets: # cdrom: Builds release CD-ROM media (disc1.iso) # dvdrom: Builds release DVD-ROM media (dvd1.iso) # memstick: Builds memory stick image (memstick.img) # mini-memstick: Builds minimal memory stick image (mini-memstick.img) # ftp: Sets up FTP distribution area (ftp) # release: Build all media and FTP distribution area -# install: Copies all release media into ${DESTDIR} +# install: Invokes the release-install and vm-install targets +# release-install: Copies all release installation media into ${DESTDIR} +# vm-install: Copies all virtual machine images into ${DESTDIR} # # Variables affecting the build process: # WORLDDIR: location of src tree -- must have built world and default kernel # (by default, the directory above this one) # PORTSDIR: location of ports tree to distribute (default: /usr/ports) # DOCDIR: location of doc tree (default: /usr/doc) # NOPKG: if set, do not distribute third-party packages # NOPORTS: if set, do not distribute ports tree # NOSRC: if set, do not distribute source tree # NODOC: if set, do not generate release documentation # WITH_DVD: if set, generate dvd1.iso # WITH_COMPRESSED_IMAGES: if set, compress installation images with xz(1) # (uncompressed images are not removed) # WITH_VMIMAGES: if set, build virtual machine images with the release # WITH_COMPRESSED_VMIMAGES: if set, compress virtual machine disk images # with xz(1) (extremely time consuming) +# WITH_CLOUDWARE: if set, build cloud hosting disk images with the release # TARGET/TARGET_ARCH: architecture of built release # WORLDDIR?= ${.CURDIR}/.. PORTSDIR?= /usr/ports DOCDIR?= /usr/doc RELNOTES_LANG?= en_US.ISO8859-1 XZCMD?= /usr/bin/xz .if !defined(TARGET) || empty(TARGET) TARGET= ${MACHINE} .endif .if !defined(TARGET_ARCH) || empty(TARGET_ARCH) .if ${TARGET} == ${MACHINE} TARGET_ARCH= ${MACHINE_ARCH} .else TARGET_ARCH= ${TARGET} .endif .endif 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} VOLUME_LABEL= ${REVISION:C/[.-]/_/g}_${BRANCH:C/[.-]/_/g}_${TARGET} .else OSRELEASE= ${TYPE}-${REVISION}-${BRANCH}-${TARGET}-${TARGET_ARCH} VOLUME_LABEL= ${REVISION:C/[.-]/_/g}_${BRANCH:C/[.-]/_/g}_${TARGET_ARCH} .endif .endfor .endif .if !defined(VOLUME_LABEL) || empty(VOLUME_LABEL) VOLUME_LABEL= FreeBSD_Install .endif .if !exists(${DOCDIR}) NODOC= true .endif .if !exists(${PORTSDIR}) NOPORTS= true .endif EXTRA_PACKAGES= .if !defined(NOPORTS) EXTRA_PACKAGES+= ports.txz .endif .if !defined(NOSRC) EXTRA_PACKAGES+= src.txz .endif .if !defined(NODOC) EXTRA_PACKAGES+= reldoc .endif RELEASE_TARGETS= ftp IMAGES= .if exists(${.CURDIR}/${TARGET}/mkisoimages.sh) RELEASE_TARGETS+= cdrom IMAGES+= disc1.iso bootonly.iso . if defined(WITH_DVD) && !empty(WITH_DVD) RELEASE_TARGETS+= dvdrom IMAGES+= dvd1.iso . endif .endif .if exists(${.CURDIR}/${TARGET}/make-memstick.sh) RELEASE_TARGETS+= memstick.img RELEASE_TARGETS+= mini-memstick.img IMAGES+= memstick.img IMAGES+= mini-memstick.img .endif -VMTARGETS= vm-base vm-image -VMFORMATS?= vhd vmdk qcow2 raw -VMSIZE?= 20G -VMBASE?= vm -AZURECONF?= ${.CURDIR}/tools/azure.conf - CLEANFILES= packagesystem *.txz MANIFEST system ${IMAGES} .if defined(WITH_COMPRESSED_IMAGES) && !empty(WITH_COMPRESSED_IMAGES) . for I in ${IMAGES} CLEANFILES+= ${I}.xz . endfor .endif .if defined(WITH_DVD) && !empty(WITH_DVD) CLEANFILES+= pkg-stage .endif -.if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES) -CLEANFILES+= ${VMBASE}.img -. for FORMAT in ${VMFORMATS} -CLEANFILES+= ${VMBASE}.${FORMAT} -. endfor -.endif CLEANDIRS= dist ftp release bootonly dvd -.if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES) -CLEANDIRS+= ${VMTARGETS} -.endif -.if exists(${.CURDIR}/${TARGET}/mk-azure.sh) -CLEANFILES+= ${OSRELEASE}.vhd \ - ${OSRELEASE}.vhd.raw \ - azure.img -CLEANDIRS+= vm-azure -.endif beforeclean: chflags -R noschg . .include clean: beforeclean base.txz: mkdir -p ${DISTDIR} cd ${WORLDDIR} && ${IMAKE} distributeworld DISTDIR=${.OBJDIR}/${DISTDIR} # Set up mergemaster root database sh ${.CURDIR}/scripts/mm-mtree.sh -m ${WORLDDIR} -F \ "TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}" -D "${.OBJDIR}/${DISTDIR}/base" etcupdate extract -B -M "TARGET_ARCH=${TARGET_ARCH} TARGET=${TARGET}" \ -s ${WORLDDIR} -d "${.OBJDIR}/${DISTDIR}/base/var/db/etcupdate" # Package all components cd ${WORLDDIR} && ${IMAKE} packageworld DISTDIR=${.OBJDIR}/${DISTDIR} mv ${DISTDIR}/*.txz . kernel.txz: mkdir -p ${DISTDIR} cd ${WORLDDIR} && ${IMAKE} distributekernel packagekernel DISTDIR=${.OBJDIR}/${DISTDIR} mv ${DISTDIR}/kernel*.txz . src.txz: mkdir -p ${DISTDIR}/usr ln -fs ${WORLDDIR} ${DISTDIR}/usr/src cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/src.txz --exclude .svn --exclude .zfs \ --exclude .git --exclude @ --exclude usr/src/release/dist usr/src ports.txz: mkdir -p ${DISTDIR}/usr ln -fs ${PORTSDIR} ${DISTDIR}/usr/ports cd ${DISTDIR} && tar cLvJf ${.OBJDIR}/ports.txz \ --exclude .git --exclude .svn \ --exclude usr/ports/distfiles --exclude usr/ports/packages \ --exclude 'usr/ports/INDEX*' --exclude work usr/ports reldoc: cd ${.CURDIR}/doc && ${MAKE} all install clean 'FORMATS=html txt' \ INSTALL_COMPRESSED='' URLS_ABSOLUTE=YES DOCDIR=${.OBJDIR}/rdoc mkdir -p reldoc .for i in hardware readme relnotes errata ln -f rdoc/${RELNOTES_LANG}/${i}/article.txt reldoc/${i:tu}.TXT ln -f rdoc/${RELNOTES_LANG}/${i}/article.html reldoc/${i:tu}.HTM .endfor cp rdoc/${RELNOTES_LANG}/readme/docbook.css reldoc system: packagesystem # Install system mkdir -p release cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \ DESTDIR=${.OBJDIR}/release MK_RESCUE=no MK_KERNEL_SYMBOLS=no \ MK_PROFILE=no MK_SENDMAIL=no MK_TESTS=no MK_LIB32=no \ MK_DEBUG_FILES=no # Copy distfiles mkdir -p release/usr/freebsd-dist for dist in MANIFEST $$(ls *.txz | grep -v -- '-dbg'); \ do cp $${dist} release/usr/freebsd-dist; \ done # Copy documentation, if generated .if !defined(NODOC) cp reldoc/* release .endif # Set up installation environment 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 echo debug.witness.trace=0 >> release/etc/sysctl.conf echo vfs.mountroot.timeout=\"10\" >> release/boot/loader.conf cp ${.CURDIR}/rc.local release/etc touch ${.TARGET} bootonly: packagesystem # Install system mkdir -p bootonly cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \ DESTDIR=${.OBJDIR}/bootonly MK_AMD=no MK_AT=no \ MK_GAMES=no MK_GROFF=no \ MK_INSTALLLIB=no MK_LIB32=no MK_MAIL=no \ MK_NCP=no MK_TOOLCHAIN=no MK_PROFILE=no \ MK_INSTALLIB=no MK_RESCUE=no MK_DICT=no \ MK_KERNEL_SYMBOLS=no MK_TESTS=no MK_DEBUG_FILES=no # Copy manifest only (no distfiles) to get checksums mkdir -p bootonly/usr/freebsd-dist cp MANIFEST bootonly/usr/freebsd-dist # Copy documentation, if generated .if !defined(NODOC) cp reldoc/* bootonly .endif # Set up installation environment 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 echo debug.witness.trace=0 >> bootonly/etc/sysctl.conf echo vfs.mountroot.timeout=\"10\" >> bootonly/boot/loader.conf cp ${.CURDIR}/rc.local bootonly/etc dvd: # Install system mkdir -p ${.TARGET} cd ${WORLDDIR} && ${IMAKE} installkernel installworld distribution \ DESTDIR=${.OBJDIR}/${.TARGET} MK_RESCUE=no MK_KERNEL_SYMBOLS=no \ MK_TESTS=no MK_DEBUG_FILES=no # Copy distfiles mkdir -p ${.TARGET}/usr/freebsd-dist for dist in MANIFEST $$(ls *.txz | grep -v -- '-dbg'); \ do cp $${dist} ${.TARGET}/usr/freebsd-dist; \ done # Copy documentation, if generated .if !defined(NODOC) cp reldoc/* ${.TARGET} .endif # Set up installation environment ln -fs /tmp/bsdinstall_etc/resolv.conf ${.TARGET}/etc/resolv.conf echo sendmail_enable=\"NONE\" > ${.TARGET}/etc/rc.conf echo hostid_enable=\"NO\" >> ${.TARGET}/etc/rc.conf echo debug.witness.trace=0 >> ${.TARGET}/etc/sysctl.conf echo vfs.mountroot.timeout=\"10\" >> ${.TARGET}/boot/loader.conf cp ${.CURDIR}/rc.local ${.TARGET}/etc touch ${.TARGET} release.iso: disc1.iso disc1.iso: system sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b ${VOLUME_LABEL}_CD ${.TARGET} release dvd1.iso: dvd pkg-stage sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b ${VOLUME_LABEL}_DVD ${.TARGET} dvd bootonly.iso: bootonly sh ${.CURDIR}/${TARGET}/mkisoimages.sh -b ${VOLUME_LABEL}_BO ${.TARGET} bootonly memstick: memstick.img memstick.img: system sh ${.CURDIR}/${TARGET}/make-memstick.sh release ${.TARGET} mini-memstick: mini-memstick.img mini-memstick.img: system sh ${.CURDIR}/${TARGET}/make-memstick.sh bootonly ${.TARGET} packagesystem: base.txz kernel.txz ${EXTRA_PACKAGES} sh ${.CURDIR}/scripts/make-manifest.sh *.txz > MANIFEST touch ${.TARGET} pkg-stage: .if !defined(NOPKG) env REPOS_DIR=${.CURDIR}/pkg_repos/ \ sh ${.CURDIR}/scripts/pkg-stage.sh mkdir -p ${.OBJDIR}/dvd/packages/repos/ cp ${.CURDIR}/scripts/FreeBSD_install_cdrom.conf \ ${.OBJDIR}/dvd/packages/repos/ .endif touch ${.TARGET} cdrom: disc1.iso bootonly.iso dvdrom: dvd1.iso ftp: packagesystem rm -rf ftp mkdir -p ftp cp *.txz MANIFEST ftp release: ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} obj ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${RELEASE_TARGETS} .if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES) ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${VMTARGETS} .endif +.if defined(WITH_CLOUDWARE) && !empty(WITH_CLOUDWARE) && !empty(CLOUDWARE) + ${MAKE} -C ${.CURDIR} ${.MAKEFLAGS} ${CLOUDTARGETS} +.endif -install: +install: release-install vm-install + +release-install: .if defined(DESTDIR) && !empty(DESTDIR) mkdir -p ${DESTDIR} .endif cp -a ftp ${DESTDIR}/ .for I in ${IMAGES} cp -p ${I} ${DESTDIR}/${OSRELEASE}-${I} . if defined(WITH_COMPRESSED_IMAGES) && !empty(WITH_COMPRESSED_IMAGES) ${XZCMD} -k ${DESTDIR}/${OSRELEASE}-${I} . endif .endfor cd ${DESTDIR} && sha256 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.SHA256 cd ${DESTDIR} && md5 ${OSRELEASE}* > ${DESTDIR}/CHECKSUM.MD5 -.if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES) - mkdir -p ${DESTDIR}/vmimages -. for FORMAT in ${VMFORMATS} - cp -p ${VMBASE}.${FORMAT} \ - ${DESTDIR}/vmimages/${OSRELEASE}.${FORMAT} -. endfor -. if defined(WITH_COMPRESSED_VMIMAGES) && !empty(WITH_COMPRESSED_VMIMAGES) -# This is very time consuming, so defer it after the images are moved to -# the DESTDIR. -. for FORMAT in ${VMFORMATS} - # Don't keep the originals. There is a copy in ${.OBJDIR} if needed. - ${XZCMD} ${DESTDIR}/vmimages/${OSRELEASE}.${FORMAT} -. endfor -. endif - cd ${DESTDIR}/vmimages && sha256 ${OSRELEASE}* > \ - ${DESTDIR}/vmimages/CHECKSUM.SHA256 - cd ${DESTDIR}/vmimages && md5 ${OSRELEASE}* > \ - ${DESTDIR}/vmimages/CHECKSUM.MD5 -.endif -vm-base: -.if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES) -. if exists(${.CURDIR}/${TARGET}/mk-vmimage.sh) - env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ - ${.CURDIR}/${TARGET}/mk-vmimage.sh ${.TARGET} \ - ${VMBASE}.img ${WORLDDIR} ${.OBJDIR}/${.TARGET} ${VMSIZE} -. endif -.endif - touch ${.TARGET} - -vm-image: vm-base -.if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES) -. if exists(${.CURDIR}/${TARGET}/mk-vmimage.sh) -. for FORMAT in ${VMFORMATS} - env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ - ${.CURDIR}/${TARGET}/mk-vmimage.sh ${.TARGET} \ - ${VMBASE}.img ${FORMAT} ${VMBASE}.${FORMAT} -. endfor -. endif -.endif - touch ${.TARGET} - -vm-azure: -.if exists(${.CURDIR}/${TARGET}/mk-azure.sh) - env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} AZURECONF=${AZURECONF} \ - ${.CURDIR}/${TARGET}/mk-azure.sh ${.TARGET} azure.img \ - ${WORLDDIR} ${.TARGET} ${VMSIZE} ${OSRELEASE}.vhd -.endif - touch ${.TARGET} +.include "${.CURDIR}/Makefile.vm" Index: head/release/Makefile.vm =================================================================== --- head/release/Makefile.vm (nonexistent) +++ head/release/Makefile.vm (revision 277458) @@ -0,0 +1,111 @@ +# +# $FreeBSD$ +# +# +# Makefile for building virtual machine and cloud provider disk images. +# + +VMTARGETS= vm-image +VMFORMATS?= vhd vmdk qcow2 raw +VMSIZE?= 20G +VMBASE?= vm + +VHD_DESC= Azure, VirtualPC, Hyper-V, Xen disk image +VMDK_DESC= VMWare, VirtualBox disk image +QCOW2_DESC= Qemu, KVM disk image +RAW_DESC= Unformatted raw disk image + +CLOUDWARE?= AZURE \ + GCE \ + OPENSTACK +AZURE_FORMAT= vhdf +AZURE_DESC= Microsoft Azure platform image +GCE_FORMAT= raw +GCE_DESC= Google Compute Engine image +OPENSTACK_FORMAT=qcow2 +OPENSTACK_DESC= OpenStack platform image + +.if defined(WITH_CLOUDWARE) && !empty(WITH_CLOUDWARE) && !empty(CLOUDWARE) +. for _CW in ${CLOUDWARE} +CLOUDTARGETS+= vm-${_CW:tl} +CLEANDIRS+= vm-${_CW:tl} +CLEANFILES+= ${_CW:tl}.img \ + ${_CW:tl}.${${_CW:tu}_FORMAT} \ + ${_CW:tl}.${${_CW:tu}_FORMAT}.raw +${_CW:tu}IMAGE= ${_CW:tl}.${${_CW:tu}_FORMAT} +. if exists(${.CURDIR}/tools/${_CW:tl}.conf) && !defined(${_CW:tu}CONF) +${_CW:tu}CONF?= ${.CURDIR}/tools/${_CW:tl}.conf +. endif + +vm-${_CW:tl}: + mkdir -p ${.OBJDIR}/${.TARGET} + env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ + ${.CURDIR}/scripts/mk-vmimage.sh \ + -C ${.CURDIR}/tools/vmimage.subr -d ${.OBJDIR}/${.TARGET} \ + -i ${.OBJDIR}/${_CW:tl}.img -s ${VMSIZE} -f ${${_CW}_FORMAT} \ + -S ${WORLDDIR} -o ${.OBJDIR}/${${_CW}IMAGE} -c ${${_CW}CONF} + touch ${.TARGET} +. endfor +.endif + +.if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES) +CLEANDIRS+= ${VMTARGETS} +CLEANFILES+= ${VMBASE}.img +. for FORMAT in ${VMFORMATS} +CLEANFILES+= ${VMBASE}.${FORMAT} +. endfor +.endif + +vm-base: vm-image + +vm-image: +.if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES) +. for FORMAT in ${VMFORMATS} + mkdir -p ${.OBJDIR}/${.TARGET} + env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} \ + ${.CURDIR}/scripts/mk-vmimage.sh \ + -C ${.CURDIR}/tools/vmimage.subr -d ${.OBJDIR}/${.TARGET} \ + -i ${.OBJDIR}/${VMBASE}.img -s ${VMSIZE} -f ${FORMAT} \ + -S ${WORLDDIR} -o ${.OBJDIR}/${VMBASE}.${FORMAT} +. endfor +.endif + touch ${.TARGET} + +vm-cloudware: ${CLOUDTARGETS} + +list-vmtargets: list-cloudware + @${ECHO} + @${ECHO} "Supported virtual machine disk image formats:" +.for FORMAT in ${VMFORMATS:tu} + @${ECHO} " ${FORMAT:tl}: ${${FORMAT}_DESC}" +.endfor + +list-cloudware: +.if !empty(CLOUDWARE) + @${ECHO} + @${ECHO} "Supported cloud hosting provider images:" +. for _CW in ${CLOUDWARE} + @${ECHO} " ${_CW:tu}: ${${_CW:tu}_DESC}" +. endfor +.endif + +vm-install: +.if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES) + mkdir -p ${DESTDIR}/vmimages +. for FORMAT in ${VMFORMATS} + cp -p ${VMBASE}.${FORMAT} \ + ${DESTDIR}/vmimages/${OSRELEASE}.${FORMAT} +. endfor +. if defined(WITH_COMPRESSED_VMIMAGES) && !empty(WITH_COMPRESSED_VMIMAGES) +# This is very time consuming, so defer it after the images are moved to +# the DESTDIR. +. for FORMAT in ${VMFORMATS} + # Don't keep the originals. There is a copy in ${.OBJDIR} if needed. + ${XZCMD} ${DESTDIR}/vmimages/${OSRELEASE}.${FORMAT} +. endfor +. endif + cd ${DESTDIR}/vmimages && sha256 ${OSRELEASE}* > \ + ${DESTDIR}/vmimages/CHECKSUM.SHA256 + cd ${DESTDIR}/vmimages && md5 ${OSRELEASE}* > \ + ${DESTDIR}/vmimages/CHECKSUM.MD5 +.endif Property changes on: head/release/Makefile.vm ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/release/amd64/mk-vmimage.sh =================================================================== --- head/release/amd64/mk-vmimage.sh (revision 277457) +++ head/release/amd64/mk-vmimage.sh (nonexistent) @@ -1,197 +0,0 @@ -#!/bin/sh -#- -# Copyright (c) 2014 The FreeBSD Foundation -# All rights reserved. -# -# This software was developed by Glen Barber under sponsorship -# from the FreeBSD Foundation. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# mk-vmimage.sh: Create virtual machine disk images in various formats. -# -# $FreeBSD$ -# - -PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin" -export PATH - -usage_vm_base() { - echo -n "$(basename ${0}) vm-base " - echo " " - return 0 -} - -usage_vm_image() { - echo -n "$(basename ${0}) vm-image " - echo " " - return 0 -} - -usage() { - echo "Usage:" - echo "$(basename ${0}) [vm-base|vm-image] [...]" - echo - usage_vm_base - echo - usage_vm_image - exit 1 -} - -panic() { - msg="${@}" - printf "${msg}\n" - if [ ! -z "${mddev}" ]; then - mdconfig -d -u ${mddev} - fi - case ${cmd} in - vm-base) - # If the vm-base target fails, the vm-image target - # cannot possibly succeed. Touch the .TARGET file - # so it is not attempted. - touch vm-image - ;; - *) - # FALLTHROUGH - ;; - esac - # Do not allow one failure case to chain through any remaining image - # builds. - return 1 -} - -vm_create_baseimage() { - # Creates the UFS root filesystem for the virtual machine disk, - # written to the formatted disk image with mkimg(1). - # - # Arguments: - # vm-base - - VMBASE="${1}" - WORLDDIR="${2}" - DESTDIR="${3}" - VMSIZE="${4}" - - if [ -z "${VMBASE}" -o -z "${WORLDDIR}" -o -z "${DESTDIR}" \ - -o -z "${VMSIZE}" ]; then - usage - fi - - i=0 - mkdir -p ${DESTDIR} - truncate -s ${VMSIZE} ${VMBASE} - mddev=$(mdconfig -f ${VMBASE}) - newfs -j /dev/${mddev} - mount /dev/${mddev} ${DESTDIR} - cd ${WORLDDIR} && \ - make DESTDIR=${DESTDIR} \ - installworld installkernel distribution || \ - panic "\n\nCannot install the base system to ${DESTDIR}." - chroot ${DESTDIR} /usr/bin/newaliases - echo '# Custom /etc/fstab for FreeBSD VM images' \ - > ${DESTDIR}/etc/fstab - echo '/dev/gpt/rootfs / ufs rw 2 2' \ - >> ${DESTDIR}/etc/fstab - echo '/dev/gpt/swapfs none swap sw 0 0' \ - >> ${DESTDIR}/etc/fstab - sync - while ! umount ${DESTDIR}; do - i=$(( $i + 1 )) - if [ $i -ge 10 ]; then - # This should never happen. But, it has happened. - msg="Cannot umount(8) ${DESTDIR}\n" - msg="${msg}Something has gone horribly wrong." - panic "${msg}" - fi - sleep 1 - done - - return 0 -} - -vm_create_vmdisk() { - # Creates the virtual machine disk image from the raw disk image. - # - # Arguments: - # vm-image " - - VMBASE="${1}" - FORMAT="${2}" - VMIMAGE="${3}" - - if [ -z "${VMBASE}" -o -z "${FORMAT}" -o -z "${VMIMAGE}" ]; then - usage - fi - - mkimg_version=$(mkimg --version 2>/dev/null | awk '{print $2}') - - # We need mkimg(1) '--version' output, at minimum, to be able to - # tell what virtual machine disk image formats are available. - # Bail if mkimg(1) reports an empty '--version' value. - if [ -z "${mkimg_version}" ]; then - msg="Cannot determine mkimg(1) version.\n" - msg="${msg}Cannot continue without a known mkimg(1) version." - panic "${msg}" - fi - - if ! mkimg --formats 2>/dev/null | grep -q ${FORMAT}; then - panic "'${FORMAT}' is not supported by this mkimg(1).\n" - fi - - case ${FORMAT} in - vhd) - mkimg_format=vhdf - ;; - *) - mkimg_format=${FORMAT} - ;; - esac - - mkimg -f ${mkimg_format} -s gpt \ - -b /boot/pmbr -p freebsd-boot/bootfs:=/boot/gptboot \ - -p freebsd-swap/swapfs::1G \ - -p freebsd-ufs/rootfs:=${VMBASE} \ - -o ${VMIMAGE} - - return 0 -} - -main() { - cmd="${1}" - shift 1 - - case ${cmd} in - vm-base) - eval vm_create_baseimage "$@" || return 0 - ;; - vm-image) - eval vm_create_vmdisk "$@" || return 0 - ;; - *|\?) - usage - ;; - esac - - return 0 -} - -main "$@" Property changes on: head/release/amd64/mk-vmimage.sh ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/release/amd64/mk-azure.sh =================================================================== --- head/release/amd64/mk-azure.sh (revision 277457) +++ head/release/amd64/mk-azure.sh (nonexistent) @@ -1,173 +0,0 @@ -#!/bin/sh -#- -# Copyright (c) 2014 The FreeBSD Foundation -# All rights reserved. -# -# This software was developed by Glen Barber under sponsorship -# from the FreeBSD Foundation. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# mk-azure.sh: Create virtual machine disk images for Microsoft Azure -# -# $FreeBSD$ -# - -export PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin" - -usage() { - echo "Usage:" - echo -n "$(basename ${0}) vm-azure " - echo " " - exit 1 -} - -panic() { - msg="${@}" - printf "${msg}\n" - if [ ! -z "${mddev}" ]; then - mdconfig -d -u ${mddev} - fi - # Do not allow one failure case to chain through any remaining image - # builds. - exit 0 -} - -vm_create_azure() { - # Arguments: - # vm-azure - - VMBASE="${1}" - WORLDDIR="${2}" - DESTDIR="${3}" - VMSIZE="${4}" - VMIMAGE="${5}" - - if [ -z "${VMBASE}" -o -z "${WORLDDIR}" -o -z "${DESTDIR}" \ - -o -z "${VMSIZE}" -o -z "${VMIMAGE}" ]; then - usage - fi - - trap "umount ${DESTDIR}/dev ${DESTDIR}" INT QUIT TRAP ABRT TERM - - i=0 - mkdir -p ${DESTDIR} - truncate -s ${VMSIZE} ${VMBASE} - mddev=$(mdconfig -f ${VMBASE}) - newfs -j /dev/${mddev} - mkdir -p ${DESTDIR} - mount /dev/${mddev} ${DESTDIR} - make -C ${WORLDDIR} DESTDIR=$(realpath ${DESTDIR}) \ - installworld installkernel distribution || \ - panic 1 "\n\nCannot install the base system to ${DESTDIR}." - mount -t devfs devfs ${DESTDIR}/dev - chroot ${DESTDIR} /usr/bin/newaliases - echo '# Custom /etc/fstab for FreeBSD VM images' \ - > ${DESTDIR}/etc/fstab - echo '/dev/gpt/rootfs / ufs rw 2 2' \ - >> ${DESTDIR}/etc/fstab - # Although a swap partition is created, it is not used in Azure. - echo '#/dev/gpt/swapfs none swap sw 0 0' \ - >> ${DESTDIR}/etc/fstab - - chroot ${DESTDIR} /etc/rc.d/ldconfig forcestart - chroot ${DESTDIR} env ASSUME_ALWAYS_YES=yes /usr/sbin/pkg bootstrap -y - chroot ${DESTDIR} env ASSUME_ALWAYS_YES=yes /usr/sbin/pkg install -y \ - python python2 python27 py27-asn1 sudo bash - if [ ! -z "${VM_EXTRA_PACKAGES}" ]; then - chroot ${DESTDIR} env ASSUME_ALWAYS_YES=yes /usr/sbin/pkg install -y \ - ${VM_EXTRA_PACKAGES} - fi - - fetch -o ${DESTDIR}/usr/sbin/waagent \ - http://people.freebsd.org/~gjb/waagent - chmod +x ${DESTDIR}/usr/sbin/waagent - rm -f ${DESTDIR}/etc/resolv.conf - chroot ${DESTDIR} /usr/sbin/waagent -verbose -install - yes | chroot ${DESTDIR} /usr/sbin/waagent -deprovision - echo 'sshd_enable="YES"' > ${DESTDIR}/etc/rc.conf - echo 'ifconfig_hn0="SYNCDHCP"' >> ${DESTDIR}/etc/rc.conf - echo 'waagent_enable="YES"' >> ${DESTDIR}/etc/rc.conf - - echo 'console="comconsole vidconsole"' >> ${DESTDIR}/boot/loader.conf - echo 'comconsole_speed="115200"' >> ${DESTDIR}/boot/loader.conf - - if [ ! -z "${VM_RC_LIST}" ]; then - for _rcvar in ${VM_RC_LIST}; do - echo ${_rcvar}_enable="YES" >> ${DESTDIR}/etc/rc.conf - done - fi - - sync - - while ! umount ${DESTDIR}/dev ${DESTDIR}; do - i=$(( $i + 1 )) - if [ $i -ge 10 ]; then - # This should never happen. But, it has happened. - msg="Cannot umount(8) ${DESTDIR}\n" - msg="${msg}Something has gone horribly wrong." - panic 1 "${msg}" - fi - sleep 1 - done - - echo "Creating image... Please wait." - - mkimg -f vhdf -s gpt \ - -b /boot/pmbr -p freebsd-boot/bootfs:=/boot/gptboot \ - -p freebsd-swap/swapfs::1G \ - -p freebsd-ufs/rootfs:=${VMBASE} \ - -o ${VMIMAGE}.raw - - if [ ! -x "/usr/local/bin/qemu-img" ]; then - env ASSUME_ALWAYS_YES=yes pkg install -y emulators/qemu-devel - fi - - size=$(qemu-img info -f raw --output json ${VMIMAGE}.raw | awk '/virtual-size/ {print $2}' | tr -d ',') - size=$(( ( ${size} / ( 1024 * 1024 ) + 1 ) * ( 1024 * 1024 ) )) - qemu-img resize ${VMIMAGE}.raw ${size} - qemu-img convert -f raw -o subformat=fixed -O vpc ${VMIMAGE}.raw ${VMIMAGE} - - return 0 -} - -main() { - cmd="${1}" - shift 1 - - if [ -e "${AZURECONF}" -a ! -c "${AZURECONF}" ]; then - . ${AZURECONF} - fi - - case ${cmd} in - vm-azure) - eval vm_create_azure "$@" || return 0 - ;; - *|\?) - usage - ;; - esac - - return 0 -} - -main "$@" Property changes on: head/release/amd64/mk-azure.sh ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/release/i386/mk-vmimage.sh =================================================================== --- head/release/i386/mk-vmimage.sh (revision 277457) +++ head/release/i386/mk-vmimage.sh (nonexistent) @@ -1,197 +0,0 @@ -#!/bin/sh -#- -# Copyright (c) 2014 The FreeBSD Foundation -# All rights reserved. -# -# This software was developed by Glen Barber under sponsorship -# from the FreeBSD Foundation. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# mk-vmimage.sh: Create virtual machine disk images in various formats. -# -# $FreeBSD$ -# - -PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin" -export PATH - -usage_vm_base() { - echo -n "$(basename ${0}) vm-base " - echo " " - return 0 -} - -usage_vm_image() { - echo -n "$(basename ${0}) vm-image " - echo " " - return 0 -} - -usage() { - echo "Usage:" - echo "$(basename ${0}) [vm-base|vm-image] [...]" - echo - usage_vm_base - echo - usage_vm_image - exit 1 -} - -panic() { - msg="${@}" - printf "${msg}\n" - if [ ! -z "${mddev}" ]; then - mdconfig -d -u ${mddev} - fi - case ${cmd} in - vm-base) - # If the vm-base target fails, the vm-image target - # cannot possibly succeed. Touch the .TARGET file - # so it is not attempted. - touch vm-image - ;; - *) - # FALLTHROUGH - ;; - esac - # Do not allow one failure case to chain through any remaining image - # builds. - return 1 -} - -vm_create_baseimage() { - # Creates the UFS root filesystem for the virtual machine disk, - # written to the formatted disk image with mkimg(1). - # - # Arguments: - # vm-base - - VMBASE="${1}" - WORLDDIR="${2}" - DESTDIR="${3}" - VMSIZE="${4}" - - if [ -z "${VMBASE}" -o -z "${WORLDDIR}" -o -z "${DESTDIR}" \ - -o -z "${VMSIZE}" ]; then - usage - fi - - i=0 - mkdir -p ${DESTDIR} - truncate -s ${VMSIZE} ${VMBASE} - mddev=$(mdconfig -f ${VMBASE}) - newfs -j /dev/${mddev} - mount /dev/${mddev} ${DESTDIR} - cd ${WORLDDIR} && \ - make DESTDIR=${DESTDIR} \ - installworld installkernel distribution || \ - panic "\n\nCannot install the base system to ${DESTDIR}." - chroot ${DESTDIR} /usr/bin/newaliases - echo '# Custom /etc/fstab for FreeBSD VM images' \ - > ${DESTDIR}/etc/fstab - echo '/dev/gpt/rootfs / ufs rw 2 2' \ - >> ${DESTDIR}/etc/fstab - echo '/dev/gpt/swapfs none swap sw 0 0' \ - >> ${DESTDIR}/etc/fstab - sync - while ! umount ${DESTDIR}; do - i=$(( $i + 1 )) - if [ $i -ge 10 ]; then - # This should never happen. But, it has happened. - msg="Cannot umount(8) ${DESTDIR}\n" - msg="${msg}Something has gone horribly wrong." - panic "${msg}" - fi - sleep 1 - done - - return 0 -} - -vm_create_vmdisk() { - # Creates the virtual machine disk image from the raw disk image. - # - # Arguments: - # vm-image " - - VMBASE="${1}" - FORMAT="${2}" - VMIMAGE="${3}" - - if [ -z "${VMBASE}" -o -z "${FORMAT}" -o -z "${VMIMAGE}" ]; then - usage - fi - - mkimg_version=$(mkimg --version 2>/dev/null | awk '{print $2}') - - # We need mkimg(1) '--version' output, at minimum, to be able to - # tell what virtual machine disk image formats are available. - # Bail if mkimg(1) reports an empty '--version' value. - if [ -z "${mkimg_version}" ]; then - msg="Cannot determine mkimg(1) version.\n" - msg="${msg}Cannot continue without a known mkimg(1) version." - panic "${msg}" - fi - - if ! mkimg --formats 2>/dev/null | grep -q ${FORMAT}; then - panic "'${FORMAT}' is not supported by this mkimg(1).\n" - fi - - case ${FORMAT} in - vhd) - mkimg_format=vhdf - ;; - *) - mkimg_format=${FORMAT} - ;; - esac - - mkimg -f ${mkimg_format} -s gpt \ - -b /boot/pmbr -p freebsd-boot/bootfs:=/boot/gptboot \ - -p freebsd-swap/swapfs::1G \ - -p freebsd-ufs/rootfs:=${VMBASE} \ - -o ${VMIMAGE} - - return 0 -} - -main() { - cmd="${1}" - shift 1 - - case ${cmd} in - vm-base) - eval vm_create_baseimage "$@" || return 0 - ;; - vm-image) - eval vm_create_vmdisk "$@" || return 0 - ;; - *|\?) - usage - ;; - esac - - return 0 -} - -main "$@" Property changes on: head/release/i386/mk-vmimage.sh ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/release/i386/mk-azure.sh =================================================================== --- head/release/i386/mk-azure.sh (revision 277457) +++ head/release/i386/mk-azure.sh (nonexistent) @@ -1,173 +0,0 @@ -#!/bin/sh -#- -# Copyright (c) 2014 The FreeBSD Foundation -# All rights reserved. -# -# This software was developed by Glen Barber under sponsorship -# from the FreeBSD Foundation. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. -# -# mk-azure.sh: Create virtual machine disk images for Microsoft Azure -# -# $FreeBSD$ -# - -export PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin" - -usage() { - echo "Usage:" - echo -n "$(basename ${0}) vm-azure " - echo " " - exit 1 -} - -panic() { - msg="${@}" - printf "${msg}\n" - if [ ! -z "${mddev}" ]; then - mdconfig -d -u ${mddev} - fi - # Do not allow one failure case to chain through any remaining image - # builds. - exit 0 -} - -vm_create_azure() { - # Arguments: - # vm-azure - - VMBASE="${1}" - WORLDDIR="${2}" - DESTDIR="${3}" - VMSIZE="${4}" - VMIMAGE="${5}" - - if [ -z "${VMBASE}" -o -z "${WORLDDIR}" -o -z "${DESTDIR}" \ - -o -z "${VMSIZE}" -o -z "${VMIMAGE}" ]; then - usage - fi - - trap "umount ${DESTDIR}/dev ${DESTDIR}" INT QUIT TRAP ABRT TERM - - i=0 - mkdir -p ${DESTDIR} - truncate -s ${VMSIZE} ${VMBASE} - mddev=$(mdconfig -f ${VMBASE}) - newfs -j /dev/${mddev} - mkdir -p ${DESTDIR} - mount /dev/${mddev} ${DESTDIR} - make -C ${WORLDDIR} DESTDIR=$(realpath ${DESTDIR}) \ - installworld installkernel distribution || \ - panic 1 "\n\nCannot install the base system to ${DESTDIR}." - mount -t devfs devfs ${DESTDIR}/dev - chroot ${DESTDIR} /usr/bin/newaliases - echo '# Custom /etc/fstab for FreeBSD VM images' \ - > ${DESTDIR}/etc/fstab - echo '/dev/gpt/rootfs / ufs rw 2 2' \ - >> ${DESTDIR}/etc/fstab - # Although a swap partition is created, it is not used in Azure. - echo '#/dev/gpt/swapfs none swap sw 0 0' \ - >> ${DESTDIR}/etc/fstab - - chroot ${DESTDIR} /etc/rc.d/ldconfig forcestart - chroot ${DESTDIR} env ASSUME_ALWAYS_YES=yes /usr/sbin/pkg bootstrap -y - chroot ${DESTDIR} env ASSUME_ALWAYS_YES=yes /usr/sbin/pkg install -y \ - python python2 python27 py27-asn1 sudo bash - if [ ! -z "${VM_EXTRA_PACKAGES}" ]; then - chroot ${DESTDIR} env ASSUME_ALWAYS_YES=yes /usr/sbin/pkg install -y \ - ${VM_EXTRA_PACKAGES} - fi - - fetch -o ${DESTDIR}/usr/sbin/waagent \ - http://people.freebsd.org/~gjb/waagent - chmod +x ${DESTDIR}/usr/sbin/waagent - rm -f ${DESTDIR}/etc/resolv.conf - chroot ${DESTDIR} /usr/sbin/waagent -verbose -install - yes | chroot ${DESTDIR} /usr/sbin/waagent -deprovision - echo 'sshd_enable="YES"' > ${DESTDIR}/etc/rc.conf - echo 'ifconfig_hn0="SYNCDHCP"' >> ${DESTDIR}/etc/rc.conf - echo 'waagent_enable="YES"' >> ${DESTDIR}/etc/rc.conf - - echo 'console="comconsole vidconsole"' >> ${DESTDIR}/boot/loader.conf - echo 'comconsole_speed="115200"' >> ${DESTDIR}/boot/loader.conf - - if [ ! -z "${VM_RC_LIST}" ]; then - for _rcvar in ${VM_RC_LIST}; do - echo ${_rcvar}_enable="YES" >> ${DESTDIR}/etc/rc.conf - done - fi - - sync - - while ! umount ${DESTDIR}/dev ${DESTDIR}; do - i=$(( $i + 1 )) - if [ $i -ge 10 ]; then - # This should never happen. But, it has happened. - msg="Cannot umount(8) ${DESTDIR}\n" - msg="${msg}Something has gone horribly wrong." - panic 1 "${msg}" - fi - sleep 1 - done - - echo "Creating image... Please wait." - - mkimg -f vhdf -s gpt \ - -b /boot/pmbr -p freebsd-boot/bootfs:=/boot/gptboot \ - -p freebsd-swap/swapfs::1G \ - -p freebsd-ufs/rootfs:=${VMBASE} \ - -o ${VMIMAGE}.raw - - if [ ! -x "/usr/local/bin/qemu-img" ]; then - env ASSUME_ALWAYS_YES=yes pkg install -y emulators/qemu-devel - fi - - size=$(qemu-img info -f raw --output json ${VMIMAGE}.raw | awk '/virtual-size/ {print $2}' | tr -d ',') - size=$(( ( ${size} / ( 1024 * 1024 ) + 1 ) * ( 1024 * 1024 ) )) - qemu-img resize ${VMIMAGE}.raw ${size} - qemu-img convert -f raw -o subformat=fixed -O vpc ${VMIMAGE}.raw ${VMIMAGE} - - return 0 -} - -main() { - cmd="${1}" - shift 1 - - if [ -e "${AZURECONF}" -a ! -c "${AZURECONF}" ]; then - . ${AZURECONF} - fi - - case ${cmd} in - vm-azure) - eval vm_create_azure "$@" || return 0 - ;; - *|\?) - usage - ;; - esac - - return 0 -} - -main "$@" Property changes on: head/release/i386/mk-azure.sh ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:executable ## -1 +0,0 ## -* \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/release/release.conf.sample =================================================================== --- head/release/release.conf.sample (revision 277457) +++ head/release/release.conf.sample (revision 277458) @@ -1,100 +1,108 @@ #!/bin/sh # # $FreeBSD$ # ## Redefine environment variables here to override prototypes ## defined in release.sh. #load_chroot_env() { } #load_target_env() { } ## Set the directory within which the release will be built. CHROOTDIR="/scratch" ## Set the svn host. SVNROOT="svn://svn.FreeBSD.org/" ## Set the src/, ports/, and doc/ branches or tags. SRCBRANCH="base/head@rHEAD" DOCBRANCH="doc/head@rHEAD" PORTBRANCH="ports/head@rHEAD" ## Run svn co --force for src checkout. #SRC_FORCE_CHECKOUT=yes ## Sample configuration for using git instead of svn. #VCSCMD="/usr/local/bin/git clone --branch master" #SVNROOT="" #SRCBRANCH="https://github.com/freebsd/freebsd" #DOCBRANCH="https://github.com/freebsd/freebsd-doc" #PORTBRANCH="https://github.com/freebsd/freebsd-ports" ## Set to override the default target architecture. #TARGET="amd64" #TARGET_ARCH="amd64" #KERNEL="GENERIC" ## Multiple kernels may be set. #KERNEL="GENERIC XENHVM" ## Set to specify a custom make.conf and/or src.conf #MAKE_CONF="/etc/local/make.conf" #SRC_CONF="/etc/local/src.conf" ## Set to use make(1) flags. #MAKE_FLAGS="-s" ## Set to use world- and kernel-specific make(1) flags. #WORLD_FLAGS="-j $(sysctl -n hw.ncpu)" #KERNEL_FLAGS="-j $(( $(( $(sysctl -n hw.ncpu) + 1 )) / 2 ))" ## Set miscellaneous 'make release' settings. #NODOC= #NOPORTS= #WITH_DVD= #WITH_COMPRESSED_IMAGES= ## Set when building embedded images. #EMBEDDEDBUILD= ## Set to skip the chroot environment buildworld/installworld/distribution ## step if it is expected the build environment will exist via alternate ## means. #CHROOTBUILD_SKIP= ## Set to a non-empty value skip checkout or update of /usr/src in ## the chroot. This is intended for use when /usr/src already exists. #SRC_UPDATE_SKIP= ## Set to a non-empty value skip checkout or update of /usr/doc in ## the chroot. This is intended for use when /usr/doc already exists. #DOC_UPDATE_SKIP= ## Set to a non-empty value skip checkout or update of /usr/ports in ## the chroot. This is intended for use when /usr/ports already exists. #PORTS_UPDATE_SKIP= ## Set to pass additional flags to make(1) for the build chroot setup, such ## as TARGET/TARGET_ARCH. #CHROOT_MAKEENV= ## Set to a non-empty value to build virtual machine images as part of the ## release build. #WITH_VMIMAGES= ## Set to a non-empty value to compress virtual machine images with xz(1) ## as part of the release build. #WITH_COMPRESSED_VMIMAGES= ## If WITH_VMIMAGES is set to a non-empty value, this is the name of the ## file to use for the installed userland/kernel. #VMBASE="vm" ## If WITH_VMIMAGES is set to a non-empty value, this is the size of the ## virtual machine disk filesystem. Valid size values are described in ## the truncate(1) manual page. #VMSIZE="20G" ## If WITH_VMIMAGES is set to a non-empty value, this is a list of disk ## image formats to create. Valid values are listed in the mkimg(1) ## manual page, as well as 'mkimg --formats' output. #VMFORMATS="vhdf vmdk qcow2 raw" + +## Set to a non-empty value to build virtual machine images for various +## cloud providers as part of the release build. +#WITH_CLOUDWARE= + +## If WITH_CLOUDWARE is set to a non-empty value, this is a list of providers +## to create disk images. +#CLOUDWARE="AZURE OPENSTACK" Index: head/release/release.sh =================================================================== --- head/release/release.sh (revision 277457) +++ head/release/release.sh (revision 277458) @@ -1,283 +1,288 @@ #!/bin/sh #- # Copyright (c) 2013, 2014 The FreeBSD Foundation # Copyright (c) 2013 Glen Barber # Copyright (c) 2011 Nathan Whitehorn # All rights reserved. # # Portions of this software were developed by Glen Barber # under sponsorship from the FreeBSD Foundation. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # # release.sh: check out source trees, and build release components with # totally clean, fresh trees. # Based on release/generate-release.sh written by Nathan Whitehorn # # $FreeBSD$ # PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin" export PATH # Prototypes that can be redefined per-chroot or per-target. load_chroot_env() { } load_target_env() { } # The directory within which the release will be built. CHROOTDIR="/scratch" RELENGDIR="$(realpath $(dirname $(basename ${0})))" # The default version control system command to obtain the sources. VCSCMD="svn checkout" # The default svn checkout server, and svn branches for src/, doc/, # and ports/. SVNROOT="svn://svn.FreeBSD.org/" SRCBRANCH="base/head@rHEAD" DOCBRANCH="doc/head@rHEAD" PORTBRANCH="ports/head@rHEAD" # Set for embedded device builds. EMBEDDEDBUILD= # Sometimes one needs to checkout src with --force svn option. # If custom kernel configs copied to src tree before checkout, e.g. SRC_FORCE_CHECKOUT= # The default make.conf and src.conf to use. Set to /dev/null # by default to avoid polluting the chroot(8) environment with # non-default settings. MAKE_CONF="/dev/null" SRC_CONF="/dev/null" # The number of make(1) jobs, defaults to the number of CPUs available for # buildworld, and half of number of CPUs available for buildkernel. WORLD_FLAGS="-j$(sysctl -n hw.ncpu)" KERNEL_FLAGS="-j$(( $(( $(sysctl -n hw.ncpu) + 1 )) / 2))" MAKE_FLAGS="-s" # The name of the kernel to build, defaults to GENERIC. KERNEL="GENERIC" # Set to non-empty value to disable checkout of doc/ and/or ports/. Disabling # ports/ checkout also forces NODOC to be set. NODOC= NOPORTS= # Set to non-empty value to build dvd1.iso as part of the release. WITH_DVD= WITH_COMPRESSED_IMAGES= # Set to non-empty value to build virtual machine images as part of # the release. WITH_VMIMAGES= WITH_COMPRESSED_VMIMAGES= +# Set to non-empty value to build virtual machine images for various +# cloud providers as part of the release. +WITH_CLOUDWARE= + usage() { echo "Usage: $0 [-c release.conf]" exit 1 } while getopts c: opt; do case ${opt} in c) RELEASECONF="${OPTARG}" if [ ! -e "${RELEASECONF}" ]; then echo "ERROR: Configuration file ${RELEASECONF} does not exist." exit 1 fi # Source the specified configuration file for overrides . ${RELEASECONF} ;; \?) usage ;; esac done shift $(($OPTIND - 1)) # Fix for backwards-compatibility with release.conf that does not have the # trailing '/'. case ${SVNROOT} in *svn*) SVNROOT="${SVNROOT}/" ;; *) ;; esac # Prefix the branches with the SVNROOT for the full checkout URL. SRCBRANCH="${SVNROOT}${SRCBRANCH}" DOCBRANCH="${SVNROOT}${DOCBRANCH}" PORTBRANCH="${SVNROOT}${PORTBRANCH}" if [ -n "${EMBEDDEDBUILD}" ]; then WITH_DVD= WITH_COMPRESSED_IMAGES= NODOC=yes fi # If PORTS is set and NODOC is unset, force NODOC=yes because the ports tree # is required to build the documentation set. if [ -n "${NOPORTS}" ] && [ -z "${NODOC}" ]; then echo "*** NOTICE: Setting NODOC=1 since ports tree is required" echo " and NOPORTS is set." NODOC=yes fi # If NOPORTS and/or NODOC are unset, they must not pass to make as variables. # The release makefile verifies definedness of NOPORTS/NODOC variables # instead of their values. DOCPORTS= if [ -n "${NOPORTS}" ]; then DOCPORTS="NOPORTS=yes " fi if [ -n "${NODOC}" ]; then DOCPORTS="${DOCPORTS}NODOC=yes" fi # The aggregated build-time flags based upon variables defined within # this file, unless overridden by release.conf. In most cases, these # will not need to be changed. CONF_FILES="__MAKE_CONF=${MAKE_CONF} SRCCONF=${SRC_CONF}" if [ -n "${TARGET}" ] && [ -n "${TARGET_ARCH}" ]; then ARCH_FLAGS="TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH}" else ARCH_FLAGS= fi load_chroot_env CHROOT_MAKEENV="${CHROOT_MAKEENV} MAKEOBJDIRPREFIX=${CHROOTDIR}/tmp/obj" CHROOT_WMAKEFLAGS="${MAKE_FLAGS} ${WORLD_FLAGS} ${CONF_FILES}" CHROOT_IMAKEFLAGS="${CONF_FILES}" CHROOT_DMAKEFLAGS="${CONF_FILES}" RELEASE_WMAKEFLAGS="${MAKE_FLAGS} ${WORLD_FLAGS} ${ARCH_FLAGS} ${CONF_FILES}" RELEASE_KMAKEFLAGS="${MAKE_FLAGS} ${KERNEL_FLAGS} KERNCONF=\"${KERNEL}\" ${ARCH_FLAGS} ${CONF_FILES}" RELEASE_RMAKEFLAGS="${ARCH_FLAGS} KERNCONF=\"${KERNEL}\" ${CONF_FILES} \ - ${DOCPORTS} WITH_DVD=${WITH_DVD} WITH_VMIMAGES=${WITH_VMIMAGES}" + ${DOCPORTS} WITH_DVD=${WITH_DVD} WITH_VMIMAGES=${WITH_VMIMAGES} \ + WITH_CLOUDWARE=${WITH_CLOUDWARE}" # Force src checkout if configured FORCE_SRC_KEY= if [ -n "${SRC_FORCE_CHECKOUT}" ]; then FORCE_SRC_KEY="--force" fi if [ -z "${CHROOTDIR}" ]; then echo "Please set CHROOTDIR." exit 1 fi if [ $(id -u) -ne 0 ]; then echo "Needs to be run as root." exit 1 fi set -e # Everything must succeed mkdir -p ${CHROOTDIR}/usr if [ -z "${SRC_UPDATE_SKIP}" ]; then ${VCSCMD} ${FORCE_SRC_KEY} ${SRCBRANCH} ${CHROOTDIR}/usr/src fi if [ -z "${NODOC}" ] && [ -z "${DOC_UPDATE_SKIP}" ]; then ${VCSCMD} ${DOCBRANCH} ${CHROOTDIR}/usr/doc fi if [ -z "${NOPORTS}" ] && [ -z "${PORTS_UPDATE_SKIP}" ]; then ${VCSCMD} ${PORTBRANCH} ${CHROOTDIR}/usr/ports fi if [ -z "${CHROOTBUILD_SKIP}" ]; then cd ${CHROOTDIR}/usr/src env ${CHROOT_MAKEENV} make ${CHROOT_WMAKEFLAGS} buildworld env ${CHROOT_MAKEENV} make ${CHROOT_IMAKEFLAGS} installworld \ DESTDIR=${CHROOTDIR} env ${CHROOT_MAKEENV} make ${CHROOT_DMAKEFLAGS} distribution \ DESTDIR=${CHROOTDIR} fi mount -t devfs devfs ${CHROOTDIR}/dev cp /etc/resolv.conf ${CHROOTDIR}/etc/resolv.conf trap "umount ${CHROOTDIR}/dev" EXIT # Clean up devfs mount on exit # If MAKE_CONF and/or SRC_CONF are set and not character devices (/dev/null), # copy them to the chroot. if [ -e ${MAKE_CONF} ] && [ ! -c ${MAKE_CONF} ]; then mkdir -p ${CHROOTDIR}/$(dirname ${MAKE_CONF}) cp ${MAKE_CONF} ${CHROOTDIR}/${MAKE_CONF} fi if [ -e ${SRC_CONF} ] && [ ! -c ${SRC_CONF} ]; then mkdir -p ${CHROOTDIR}/$(dirname ${SRC_CONF}) cp ${SRC_CONF} ${CHROOTDIR}/${SRC_CONF} fi # Embedded builds do not use the 'make release' target. if [ -n "${EMBEDDEDBUILD}" ]; then # If a crochet configuration file exists in *this* checkout of # release/, copy it to the /tmp/external directory within the chroot. # This allows building embedded releases without relying on updated # scripts and/or configurations to exist in the branch being built. load_target_env if [ -e ${RELENGDIR}/tools/${XDEV}/crochet-${KERNEL}.conf ] && \ [ -e ${RELENGDIR}/${XDEV}/release.sh ]; then mkdir -p ${CHROOTDIR}/tmp/external/${XDEV}/ cp ${RELENGDIR}/tools/${XDEV}/crochet-${KERNEL}.conf \ ${CHROOTDIR}/tmp/external/${XDEV}/crochet-${KERNEL}.conf /bin/sh ${RELENGDIR}/${XDEV}/release.sh fi # If the script does not exist for this architecture, exit. # This probably should be checked earlier, but allowing the rest # of the build process to get this far will at least set up the # chroot environment for testing. exit 0 else # Not embedded. continue fi if [ -d ${CHROOTDIR}/usr/ports ]; then # Run ldconfig(8) in the chroot directory so /var/run/ld-elf*.so.hints # is created. This is needed by ports-mgmt/pkg. chroot ${CHROOTDIR} /etc/rc.d/ldconfig forcerestart ## Trick the ports 'run-autotools-fixup' target to do the right thing. _OSVERSION=$(sysctl -n kern.osreldate) REVISION=$(chroot ${CHROOTDIR} make -C /usr/src/release -V REVISION) BRANCH=$(chroot ${CHROOTDIR} make -C /usr/src/release -V BRANCH) UNAME_r=${REVISION}-${BRANCH} if [ -d ${CHROOTDIR}/usr/doc ] && [ -z "${NODOC}" ]; then PBUILD_FLAGS="OSVERSION=${_OSVERSION} BATCH=yes" PBUILD_FLAGS="${PBUILD_FLAGS} UNAME_r=${UNAME_r}" PBUILD_FLAGS="${PBUILD_FLAGS} OSREL=${REVISION}" chroot ${CHROOTDIR} make -C /usr/ports/textproc/docproj \ ${PBUILD_FLAGS} OPTIONS_UNSET="FOP IGOR" \ install clean distclean fi fi load_target_env eval chroot ${CHROOTDIR} make -C /usr/src ${RELEASE_WMAKEFLAGS} buildworld eval chroot ${CHROOTDIR} make -C /usr/src ${RELEASE_KMAKEFLAGS} buildkernel eval chroot ${CHROOTDIR} make -C /usr/src/release ${RELEASE_RMAKEFLAGS} \ release eval chroot ${CHROOTDIR} make -C /usr/src/release ${RELEASE_RMAKEFLAGS} \ install DESTDIR=/R WITH_COMPRESSED_IMAGES=${WITH_COMPRESSED_IMAGES} \ WITH_COMPRESSED_VMIMAGES=${WITH_COMPRESSED_VMIMAGES} Index: head/release/scripts/mk-vmimage.sh =================================================================== --- head/release/scripts/mk-vmimage.sh (nonexistent) +++ head/release/scripts/mk-vmimage.sh (revision 277458) @@ -0,0 +1,111 @@ +#!/bin/sh +#- +# Copyright (c) 2014 The FreeBSD Foundation +# All rights reserved. +# +# This software was developed by Glen Barber under sponsorship +# from the FreeBSD Foundation. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# mk-vmimage.sh: Create virtual machine disk images in various formats. +# +# $FreeBSD$ +# + +usage() { + echo "${0} usage:" + echo "${@}" + return 1 +} + +main() { + local arg + while getopts "C:c:d:f:i:o:s:S:" arg; do + case "${arg}" in + C) + VMBUILDCONF="${OPTARG}" + ;; + c) + VMCONFIG="${OPTARG}" + ;; + d) + DESTDIR="${OPTARG}" + ;; + f) + VMFORMAT="${OPTARG}" + ;; + i) + VMBASE="${OPTARG}" + ;; + o) + VMIMAGE="${OPTARG}" + ;; + s) + VMSIZE="${OPTARG}" + ;; + S) + WORLDDIR="${OPTARG}" + ;; + *) + ;; + esac + done + shift $(( ${OPTIND} - 1)) + + if [ -z "${VMBASE}" -o \ + -z "${WORLDDIR}" -o \ + -z "${DESTDIR}" -o \ + -z "${VMSIZE}" -o \ + -z "${VMIMAGE}" -o \ + -z "${VMCONFIG}" ]; + then + usage + fi + + if [ -z "${VMBUILDCONF}" ] || [ ! -e "${VMBUILDCONF}" ]; then + echo "Must provide the path to vmimage.subr." + return 1 + fi + + . "${VMBUILDCONF}" + + if [ ! -z "${VMCONFIG}" ] && [ -e "${VMCONFIG}" ]; then + . "${VMCONFIG}" + fi + + vm_create_base + vm_install_base + vm_extra_install_base + vm_extra_install_packages + vm_extra_install_ports + vm_extra_enable_services + vm_extra_pre_umount + vm_extra_pkg_rmcache + cleanup + vm_create_disk || return 0 + vm_extra_create_disk + + return 0 +} + +main "$@" Property changes on: head/release/scripts/mk-vmimage.sh ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/release/tools/azure.conf =================================================================== --- head/release/tools/azure.conf (revision 277457) +++ head/release/tools/azure.conf (revision 277458) @@ -1,14 +1,42 @@ #!/bin/sh # # $FreeBSD$ # # Set to a list of packages to install. # Example: #export VM_EXTRA_PACKAGES="www/apache24" -export VM_EXTRA_PACKAGES= +export VM_EXTRA_PACKAGES="sysutils/azure-agent" # Set to a list of third-party software to enable in rc.conf(5). # Example: #export VM_RC_LIST="apache24" export VM_RC_LIST= + +vm_extra_pre_umount() { + chroot ${DESTDIR} /usr/sbin/waagent -verbose -install + yes | chroot ${DESTDIR} /usr/sbin/waagent -deprovision + echo 'sshd_enable="YES"' >> ${DESTDIR}/etc/rc.conf + echo 'ifconfig_hn0="SYNCDHCP"' >> ${DESTDIR}/etc/rc.conf + echo 'waagent_enable="YES"' >> ${DESTDIR}/etc/rc.conf + echo 'console="comconsole vidconsole"' >> ${DESTDIR}/boot/loader.conf + echo 'comconsole_speed="115200"' >> ${DESTDIR}/boot/loader.conf + + rm -f ${DESTDIR}/etc/resolv.conf + + return 0 +} + +vm_extra_create_disk() { + if [ ! -x "/usr/local/bin/qemu-img" ]; then + env ASSUME_ALWAYS_YES=yes pkg install -y emulators/qemu-devel + fi + + mv ${VMIMAGE} ${VMIMAGE}.raw + size=$(qemu-img info -f raw --output json ${VMIMAGE}.raw | awk '/virtual-size/ {print $2}' | tr -d ',') + size=$(( ( ${size} / ( 1024 * 1024 ) + 1 ) * ( 1024 * 1024 ) )) + qemu-img resize ${VMIMAGE}.raw ${size} + qemu-img convert -f raw -o subformat=fixed -O vpc ${VMIMAGE}.raw ${VMIMAGE} + + return 0 +} Index: head/release/tools/gce.conf =================================================================== --- head/release/tools/gce.conf (nonexistent) +++ head/release/tools/gce.conf (revision 277458) @@ -0,0 +1,100 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# Set to a list of packages to install. +export VM_EXTRA_PACKAGES="firstboot-freebsd-update firstboot-pkgs \ + google-cloud-sdk google-daemon panicmail sudo firstboot-growfs \ + google-startup-scripts" + +# Set to a list of third-party software to enable in rc.conf(5). +export VM_RC_LIST="google_accounts_manager ntpd" + +vm_extra_install_base() { + echo 'search google.internal' > ${DESTDIR}/etc/resolv.conf + echo 'nameserver 169.254.169.254' >> ${DESTDIR}/etc/resolv.conf + echo 'nameserver 8.8.8.8' >> ${DESTDIR}/etc/resolv.conf +} + +vm_extra_pre_umount() { + cat << EOF >> ${DESTDIR}/etc/rc.conf +dumpdev="AUTO" +ifconfig_vtnet0="SYNCDHCP mtu 1460" +ntpd_sync_on_start="YES" +ntpd_enable="YES" +sshd_enable="YES" +google_accounts_manager_enable="YES" +#disabled until I can figure out why the reboot for updates is hanging +#firstboot_freebsd_update_enable="YES" +#firstboot_pkgs_enable="YES" +# need to fill in something here +#firstboot_pkgs_list="" +panicmail_autosubmit="YES" +firstboot_growfs_enable="YES" +google_startup_enable="YES" +EOF + + cat << EOF >> ${DESTDIR}/boot/loader.conf +autoboot_delay="-1" +beastie_disable="YES" +loader_logo="none" +hw.memtest.tests="0" +console="comconsole,vidconsole" +hw.vtnet.mq_disable=1 +kern.timecounter.hardware=ACPI-safe +aesni_load="YES" +nvme_load="YES" +EOF + + echo '169.254.169.254 metadata.google.internal metadata' > \ + ${DESTDIR}/etc/hosts + + # overwrite ntp.conf + cat << EOF > ${DESTDIR}/etc/ntp.conf +server metadata.google.internal iburst + +restrict default kod nomodify notrap nopeer noquery +restrict -6 default kod nomodify notrap nopeer noquery + +restrict 127.0.0.1 +restrict -6 ::1 +restrict 127.127.1.0 +EOF + + cat << EOF >> ${DESTDIR}/etc/syslog.conf +*.err;kern.warning;auth.notice;mail.crit /dev/console +EOF + + cat << EOF >> ${DESTDIR}/etc/ssh/sshd_config +ChallengeResponseAuthentication no +X11Forwarding no +AcceptEnv LANG +Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc +AllowAgentForwarding no +ClientAliveInterval 420 +EOF + + cat << EOF >> ${DESTDIR}/etc/crontab +0 3 * * * root /usr/sbin/freebsd-update cron +EOF + + cat << EOF >> ${DESTDIR}/etc/sysctl.conf +net.inet.icmp.drop_redirect=1 +net.inet.ip.redirect=0 +net.inet.tcp.blackhole=2 +net.inet.udp.blackhole=1 +kern.ipc.somaxconn=1024 +debug.trace_on_panic=1 +debug.debugger_on_panic=0 +EOF + + ## XXX: Verify this is needed. I do not see this requirement + ## in the docs, and it impairs the ability to boot-test a copy + ## of the image prior to packaging for upload to GCE. + #sed -E -i '' 's/^([^#].*[[:space:]])on/\1off/' ${DESTDIR}/etc/ttys + + touch ${DESTDIR}/firstboot + + return 0 +} Property changes on: head/release/tools/gce.conf ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/release/tools/openstack.conf =================================================================== --- head/release/tools/openstack.conf (nonexistent) +++ head/release/tools/openstack.conf (revision 277458) @@ -0,0 +1,25 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# Set to a list of packages to install. +export VM_EXTRA_PACKAGES="net/cloud-init devel/py-pbr devel/py-iso8601 \ + net/py-eventlet net/py-netaddr comms/py-serial devel/py-six \ + devel/py-babel net/py-oauth net/py-netifaces" + +# Set to a list of third-party software to enable in rc.conf(5). +export VM_RC_LIST="cloudinit" + +vm_extra_pre_umount() { + echo 'sshd_enable="YES"' >> ${DESTDIR}/etc/rc.conf + echo 'ifconfig_DEFAULT="SYNCDHCP"' >> ${DESTDIR}/etc/rc.conf + + # Openstack wants sudo(8) usable by default without a password. + echo 'ALL ALL=(ALL) NOPASSWD:ALL' >> \ + ${DESTDIR}/usr/local/etc/sudoers.d/cloud-init + + rm -f ${DESTDIR}/etc/resolv.conf + + return 0 +} Property changes on: head/release/tools/openstack.conf ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/release/tools/vmimage.subr =================================================================== --- head/release/tools/vmimage.subr (nonexistent) +++ head/release/tools/vmimage.subr (revision 277458) @@ -0,0 +1,185 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# +# Common functions for virtual machine image build scripts. +# + +export PATH="/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin" +trap "cleanup" INT QUIT TRAP ABRT TERM + +write_partition_layout() { + if [ -z "${NOSWAP}" ]; then + SWAPOPT="-p freebsd-swap/swapfs::1G" + fi + + case "${TARGET}:${TARGET_ARCH}" in + amd64:amd64 | i386:i386) + mkimg -s gpt -b /boot/pmbr \ + -p freebsd-boot/bootfs:=/boot/gptboot \ + ${SWAPOPT} \ + -p freebsd-ufs/rootfs:=${VMBASE} \ + -o ${VMIMAGE} + ;; + powerpc:powerpc*) + mkimg -s apm \ + -p apple-boot/bootfs:=/boot/boot1.hfs \ + ${SWAPOPT} \ + -p freebsd-ufs/rootfs:=${VMBASE} \ + -o ${VMIMAGE} + ;; + *) + # ENOTSUPP + return 1 + ;; + esac + + return 0 +} + +err() { + printf "${@}\n" + cleanup + return 1 +} + +cleanup() { + umount ${DESTDIR}/dev 2>/dev/null + umount ${DESTDIR} + if [ ! -z "${mddev}" ]; then + mdconfig -d -u ${mddev} + fi + + return 0 +} + +vm_create_base() { + # Creates the UFS root filesystem for the virtual machine disk, + # written to the formatted disk image with mkimg(1). + + mkdir -p ${DESTDIR} + truncate -s ${VMSIZE} ${VMBASE} + mddev=$(mdconfig -f ${VMBASE}) + newfs -j /dev/${mddev} + mount /dev/${mddev} ${DESTDIR} + + return 0 +} + +vm_install_base() { + # Installs the FreeBSD userland/kernel to the virtual machine disk. + + cd ${WORLDDIR} && \ + make DESTDIR=${DESTDIR} \ + installworld installkernel distribution || \ + err "\n\nCannot install the base system to ${DESTDIR}." + + echo '# Custom /etc/fstab for FreeBSD VM images' \ + > ${DESTDIR}/etc/fstab + echo '/dev/gpt/rootfs / ufs rw 1 1' \ + >> ${DESTDIR}/etc/fstab + if [ -z "${NOSWAP}" ]; then + echo '/dev/gpt/swapfs none swap sw 0 0' \ + >> ${DESTDIR}/etc/fstab + fi + + mkdir -p ${DESTDIR}/dev + mount -t devfs devfs ${DESTDIR}/dev + chroot ${DESTDIR} /usr/bin/newaliases + chroot ${DESTDIR} /etc/rc.d/ldconfig forcestart + umount ${DESTDIR}/dev + + cp /etc/resolv.conf ${DESTDIR}/etc/resolv.conf + + return 0 +} + +vm_extra_install_base() { + # Prototype. When overridden, runs extra post-installworld commands + # as needed, based on the target virtual machine image or cloud + # provider image target. + + return 0 +} + +vm_extra_enable_services() { + if [ ! -z "${VM_RC_LIST}" ]; then + for _rcvar in ${VM_RC_LIST}; do + echo ${_rcvar}_enable="YES" >> ${DESTDIR}/etc/rc.conf + done + fi + + return 0 +} + +vm_extra_install_packages() { + if [ -z "${VM_EXTRA_PACKAGES}" ]; then + return 0 + fi + mkdir -p ${DESTDIR}/dev + mount -t devfs devfs ${DESTDIR}/dev + chroot ${DESTDIR} env ASSUME_ALWAYS_YES=yes \ + /usr/sbin/pkg bootstrap -y + chroot ${DESTDIR} env ASSUME_ALWAYS_YES=yes \ + /usr/sbin/pkg install -y ${VM_EXTRA_PACKAGES} + umount ${DESTDIR}/dev + + return 0 +} + +vm_extra_install_ports() { + # Prototype. When overridden, installs additional ports within the + # virtual machine environment. + + return 0 +} + +vm_extra_pre_umount() { + # Prototype. When overridden, installs additional ports within the + # virtual machine environment. + + rm -f ${DESTDIR}/etc/resolv.conf + return 0 +} + +vm_extra_pkg_rmcache() { + if [ -e ${DESTDIR}/usr/local/sbin/pkg ]; then + chroot ${DESTDIR} env ASSUME_ALWAYS_YES=yes \ + /usr/local/sbin/pkg clean -y -a + fi + + return 0 +} + +vm_umount_base() { + i=0 + sync + while ! umount ${DESTDIR}/dev ${DESTDIR}; do + i=$(( $i + 1 )) + if [ $i -ge 10 ]; then + # This should never happen. But, it has happened. + msg="Cannot umount(8) ${DESTDIR}\n" + msg="${msg}Something has gone horribly wrong." + err "${msg}" + fi + sleep 1 + done + + return 0 +} + +vm_create_disk() { + echo "Creating image... Please wait." + echo + + write_partition_layout || return 1 + + return 0 +} + +vm_extra_create_disk() { + + return 0 +} + Property changes on: head/release/tools/vmimage.subr ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: head/share/man/man7/release.7 =================================================================== --- head/share/man/man7/release.7 (revision 277457) +++ head/share/man/man7/release.7 (revision 277458) @@ -1,718 +1,789 @@ .\" Copyright (c) 2002 Murray Stokely .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" $FreeBSD$ .\" -.Dd October 2, 2014 +.Dd January 16, 2015 .Dt RELEASE 7 .Os .Sh NAME .Nm release .Nd "release building infrastructure" .Sh DESCRIPTION .Fx provides a complete build environment suitable for users to make full releases of the .Fx operating system. All of the tools necessary to build a release are available from the .Fx source code repository in .Pa src/release . A complete release can actually be built with only a single command, including the creation of ISO images suitable for burning to CD-ROM, memory stick images, and an FTP install directory. This command is aptly named .Dq Li "make release" . .Pp For some users, it may be desirable to provide an absolutely clean build environment, with no local modifications to the source tree or to .Xr make.conf 5 , and with clean checkouts of specific versions of the doc, src, and ports trees. For this purpose, a script .Pq Pa src/release/release.sh is provided to automate these checkouts and then execute .Dq Li "make release" in a clean .Xr chroot 8 . .Pp Before attempting to build a release, the user is expected to be familiar with the contents of .Xr build 7 , and should have experience upgrading systems from source. .Pp The release build process requires that .Pa /usr/obj be populated with the output of .Dq Li "make buildworld" and .Dq Li "make buildkernel" . This is necessary to provide the object files for the release or, when using .Pa release.sh , so that the object files for a complete system can be installed into a clean .Xr chroot 8 environment. .Pp If the target release build is for a different architecture or machine type, the .Va TARGET and .Va TARGET_ARCH variables must be used. See the supported .Fa release.conf variables for more information. .Pp The release procedure on some architectures may also require that the .Xr md 4 (memory disk) device driver be present in the kernel .Pq either by being compiled in or available as a module . .Pp This document does not cover source code management, quality assurance, or other aspects of the release engineering process. .Sh CLEAN RELEASE GENERATION Official releases of .Fx are produced in a totally clean environment to ensure consistency between the versions of the src, ports, and doc trees and to avoid contamination from the host system .Po such as local patches, changes to .Xr make.conf 5 , etc. .Pc . This is accomplished using the wrapper script .Pa src/release/release.sh . .Pp .Ic release.sh .Op Fl c Ar release.conf .Pp .Ic release.sh checks out the .Li src/ , .Li ports/ , and .Li doc/ trees to .Va CHROOTDIR , then calls .Dq Li "make buildworld" and .Dq Li "make installworld" to generate a .Xr chroot 8 environment. Next, .Dq Li "make release" is run within the .Xr chroot 8 environment and places the result in .Pa $CHROOTDIR/R . .Pp The optional .Fa release.conf configuration file supports the following variables: .Bl -tag -width Ev .It Va CHROOTDIR The directory within which the release will be built. .It Va CHROOT_MAKEENV Additional .Xr make 1 arguments to pass through, which directly affect the tuning of the build chroot. .It Va SVNROOT The .Xr svn 1 host used to check out the various trees. Defaults to .Pa svn://svn.FreeeBSD.org . .It Va SRCBRANCH The .Li src/ branch to use. Defaults to .Va head/@rHEAD . .It Va DOCBRANCH The .Li doc/ branch to use. Defaults to .Va head/@rHEAD . .It Va PORTBRANCH The .Li ports/ branch to use. Defaults to .Va head/@rHEAD . .It Va TARGET The target machine type for cross-building a release. .It Va TARGET_ARCH The target machine architecture for cross-building a release. .Pp For the supported list of .Va TARGET and .Va TARGET_ARCH combinations, consult the output of .Dq make targets as documented in .Xr build 7 . .It Va KERNEL The target kernel configuration to use. Defaults to .Va GENERIC . Multiple .Va KERNEL entries may be specified. .It Va MAKE_CONF The .Xr make.conf 5 to use for the release build. Defaults to .Fa /dev/null to prevent polluting the release with local system changes. .It Va SRC_CONF The .Xr src.conf 5 to use for the release build. Defaults to .Fa /dev/null to prevent polluting the release with local system changes. .It Va MAKE_FLAGS Additional flags to pass to .Xr make 1 . .It Va WORLD_FLAGS Additional flags to pass to .Xr make 1 during the .Dq buildworld phase. Defaults to setting the number of .Xr make 1 jobs .Pq Ar -j to the number of CPUs available on a SMP-capable system. .It Va KERNEL_FLAGS Additional flags to pass to .Xr make 1 during the .Dq buildkernel phase. Defaults to setting the number of .Xr make 1 jobs .Pq Ar -j to half the number of CPUs available on a SMP-capable system. .It Va NODOC Set to a non-empty value to skip the .Li doc/ tree checkout. When set, .Va NODOC will prevent the .Fa doc.txz distribution package from being created. .It Va NOPORTS Set to a non-empty value to skip the .Li ports/ tree checkout. When set, .Va NOPORTS will prevent the .Fa ports.txz distribution package from being created. Setting this also sets .Va NODOC . .It Va WITH_DVD Set to a non-empty value to include the .Cm dvdrom target. .It Va WITH_COMPRESSED_IMAGES Set to a non-empty value to compress the release images with .Xr xz 1 . The original .Pq uncompressed images are not removed. .It Va VCSCMD The command run to obtain the source trees. Defaults to .Qq Cm svn checkout . .It Va CHROOTBUILD_SKIP If defined, the .Li buildworld , .Li installworld , and .Li distribution stages of the .Xr chroot 8 build environment setup are skipped. This is intended solely for cases where the .Xr chroot 8 userland are provided by alternate means. .It Va SRC_UPDATE_SKIP Set to a non-empty value to prevent checkout or update of .Fa /usr/src within the .Xr chroot 8 . This is intended for use only when .Fa /usr/src is expected to exist by alternative means. .It Va DOC_UPDATE_SKIP Set to a non-empty value to prevent checkout or update of .Fa /usr/doc within the .Xr chroot 8 . This is intended for use only when .Fa /usr/doc is expected to exist by alternative means. .It Va PORTS_UPDATE_SKIP Set to a non-empty value to prevent checkout or update of .Fa /usr/ports within the .Xr chroot 8 . This is intended for use only when .Fa /usr/ports is expected to exist by alternative means. .El .Sh EMBEDDED BUILDS The following .Fa release.conf variables are relevant only to release builds for embedded systems: .Bl -tag -width Ev .It Va EMBEDDEDBUILD Set to a non-null value to enable functionality for embedded device release builds. .Pq This option is considered highly experimental. .Pp When set, .Va WITH_DVD is unset, and .Va NODOC is defined. Additionally, .Va XDEV and .Va XDEV_ARCH must also be defined. When the build environment is created, .Fa release.sh runs a separate build script located in an architecture-specific directory in .Pa src/release/${XDEV}/ . .It Va EMBEDDEDPORTS Set to the list of any ports that are required for the target device in the format of .Fa category/port . The .Fa devel/subversion port is built by default. .It Va CROCHETSRC Set to the source URL for the Crochet build tool. .It Va CROCHETBRANCH Set to the subversion branch from .Va ${CROCHETSRC} to use. Defaults to .Pa trunk . .It Va UBOOTSRC Set to the source URL of u-boot, if required. .It Va UBOOTBRANCH Set to the subversion branch from .Va ${UBOOTSRC} to use. Defaults to .Pa trunk . .It Va UBOOTDIR Set to the target directory within .Va ${CHROOTDIR} to check out .Va ${UBOOTSRC}/${UBOOTBRANCH} . .El .Sh VIRTUAL MACHINE DISK IMAGES The following .Fa release.conf variables are relevant only to virtual machine disk image builds: .Bl -tag -width Ev .It Va WITH_VMIMAGES Set to a non-null value to build virtual machine disk images as part of the release build. .Va WITH_VMIMAGES may also be specified as an envirionment variable passed to .Xr make 1 . .Pp The option requires .Xr mkimg 1 version 20140927 or later. .It Va WITH_COMPRESSED_VMIMAGES Set to a non-null value to compress the virtual machine disk images with .Xr xz 1 as part of the .Cm install .Xr make 1 target. Note that compressing virtual machine disk images may take a very long time on some systems. .It Va VMBASE Set to change the name of the resulting virtual machine disk image file. The default value is .Va vm . .It Va VMSIZE Set to change the size of the virtual machine disk capacity. The default value is .Va 20G . See .Xr truncate 1 for valid values. .Pp Virtual machine disk images are, by default, created as sparse images. When .Va WITH_COMPRESSED_VMIMAGES is used, the resulting files compressed with .Xr xz 1 compress to roughly the same size, regardless of the specified disk image size. .It Va VMFORMATS Set to the target virtual disk image format(s) to create. By default, the .Va vhdf , Va vmdk , Va qcow2 , and .Va raw formats are created. See .Xr mkimg 1 for valid format values .Pq requires version 20140927 or later . .El +.Pp +For a list of supported +.Va VMFORMATS +values +.Pq including cloud hosting provider formats +along with a brief description, run: +.Bd -literal -offset indent +cd /usr/src +make -C release list-vmtargets +.Ed +.Sh CLOUD HOSTING MACHINE IMAGES +The +.Fx +release build tools support building virtual machine images for various +cloud hosting providers, each with their own specific configuration to +include support for each hosting provider by default. +.Pp +The following +.Xr make 1 +environment variables are supported: +.Pp +.Bl -tag -width Ev +.It Va CLOUDWARE +Set to a list of one or more cloud hosting providers, enclosed in quotes. +Requires +.Va WITH_CLOUDWARE +to also be set. +.It Va WITH_CLOUDWARE +Set to a non-empty value to enable building virtual machine images +for various cloud hosting providers. +Requires +.Va CLOUDWARE +to also be set. +.El +.Pp +Additionally, the +.Va CLOUDWARE +and +.Va WITH_CLOUDWARE +variables can be added to +.Pa release.conf , +and used in conjunction with +.Pa release.sh . +.Pp +For a list of supported +.Va CLOUDWARE +values, run: +.Bd -literal -offset indent +cd /usr/src +make -C release list-cloudware +.Ed .Sh MAKEFILE TARGETS The release makefile .Pq Pa src/release/Makefile is fairly abstruse. Most developers will only be concerned with the .Cm release and .Cm install targets. .\" XXX: Some sort of introduction to this list? All the others have one. .Bl -tag -width ".Cm packagesystem" .It Cm release Meta-target to build all release media and distributions applicable to this platform. .It Cm install Copy all produced release media to .Pa ${DESTDIR} . .It Cm cdrom 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 .Pa disc1.iso and .Pa bootonly.iso as its output. .It Cm dvdrom Builds installation DVD-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 the .Pa dvd1.iso file as its output. .It Cm memstick Builds an installation memory stick image named .Pa memstick.img . Not applicable on all platforms. Requires that the .Xr md 4 .Pq memory disk device driver be present in the kernel .Pq either by being compiled in or available as a module . .It Cm mini-memstick Similar to .Cm memstick , with the exception that the installation distribution sets are not included. .It Cm ftp Creates a directory named .Pa ftp containing the distribution files used in network installations and suitable for upload to an FTP mirror. .It Cm vm-image Creates virtual machine disk images in various formats. The .Cm vm-image target requires the .Va WITH_VMIMAGES .Xr make 1 envirionment variable to be set to a non-null value. +.It Cm vm-cloudware +Builds +.Fx +virtual machine images for various cloud hosting providers. +See +.Qq CLOUD HOSTING MACHINE IMAGES +for implementation details. +.It Cm list-cloudware +Displays the list of valid +.Va CLOUDWARE +values. +.It Cm list-vmtargets +Displays the list of valid +.Va VMFORMAT +and +.Va CLOUDWARE +values. .El .Pp Major subtargets called by targets above: .Bl -tag -width ".Cm packagesystem" .It Cm packagesystem Generates all the distribution archives .Pq base, kernel, ports, doc applicable on this platform. .It Cm system Builds a bootable installation system containing all the distribution files packaged by the .Cm packagesystem target, and suitable for imaging by the .Cm cdrom , .Cm dvdrom and .Cm memstick targets. .It Cm reldoc Builds the release documentation. This includes the release notes, hardware guide, and installation instructions. Other documentation, such as the Handbook, is built during the .Cm base.txz target invoked by .Cm packagesystem . .El .Sh ENVIRONMENT Optional variables: .Bl -tag -width ".Ev TARGET_ARCH" .It Ev OSRELEASE Optional base name for generated media images .Pq 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 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 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 Ev NOPORTS If defined, the Ports Collection will be omitted from the release. .It Ev NOSRC If set, do not include system source code in the release. .It Ev NODOC If defined, the XML-based documentation from the .Fx Documentation Project will not be built. However, the .Dq doc distribution will still be created with the minimal documentation set provided in .Pa src/share/doc . .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 .Ev TARGET_ARCH Ns = Ns Li i386 and .Ev TARGET Ns = Ns Li pc98 . If not set, .Ev TARGET defaults to the current hardware platform. .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, .Ev TARGET_ARCH defaults to the current machine architecture, unless .Ev TARGET is also set, in which case it defaults to the appropriate value for that platform. Typically, one only needs to set .Ev TARGET . .El .Sh FILES .Bl -tag -compact -width Pa .It Pa /usr/doc/Makefile .It Pa /usr/doc/share/mk/doc.project.mk .It Pa /usr/ports/Mk/bsd.port.mk .It Pa /usr/ports/Mk/bsd.sites.mk .It Pa /usr/share/examples/etc/make.conf .It Pa /usr/src/Makefile .It Pa /usr/src/Makefile.inc1 .It Pa /usr/src/release/Makefile +.It Pa /usr/src/release/Makefile.vm .It Pa /usr/src/release/release.sh .It Pa /usr/src/release/release.conf.sample +.It Pa /usr/src/release/tools/*.conf +.It Pa /usr/src/release/tools/vmimage.subr .El .Sh EXAMPLES The following sequence of commands can be used to build a .Dq "-CURRENT snapshot": .Bd -literal -offset indent cd /usr svn co svn://svn.freebsd.org/base/head src cd src make buildworld buildkernel cd release make release make install DESTDIR=/var/freebsd-snapshot .Ed .Pp After running these commands, all produced distribution files (tarballs for FTP, CD-ROM images, etc.) are available in the .Pa /var/freebsd-snapshot directory. .Pp The following sequence of commands can be used to build a .Dq "-CURRENT snapshot" in a clean environment, including ports and documentation: .Bd -literal -offset indent cd /usr/src/release sh release.sh .Ed .Pp Optionally, a configuration file can be used customize the release build, such as the subversion revision to use, the branch of the subversion tree for .Li src/ , .Li ports/ , and .Li doc/ . .Bd -literal -offset indent cd /usr/src/release sh release.sh -c $HOME/release.conf .Ed .Pp After running these commands, all prepared release files are available in the .Pa /scratch directory. The target directory can be changed by specifying the .Va CHROOTDIR variable in .Li release.conf . .Sh SEE ALSO .Xr cc 1 , .Xr install 1 , .Xr make 1 , .Xr svn 1 Pq Pa ports/devel/subversion , .Xr uname 1 , .Xr md 4 , .Xr make.conf 5 , .Xr build 7 , .Xr ports 7 , .Xr chroot 8 , .Xr mtree 8 , .Xr sysctl 8 .Rs .%T "FreeBSD Release Engineering" .%U http://www.FreeBSD.org/doc/en_US.ISO8859-1/articles/releng/ .Re .Rs .%T "FreeBSD Release Engineering of Third Party Packages" .%U http://www.FreeBSD.org/doc/en_US.ISO8859-1/articles/releng-packages/ .Re .Rs .%T "FreeBSD Developers' Handbook" .%U http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/developers-handbook/ .Re .Sh HISTORY .Fx 1.x used a manual checklist, compiled by .An Rod Grimes , to produce a release. Apart from being incomplete, the list put a lot of specific demands on available file systems and was quite torturous to execute. .Pp As part of the .Fx 2.0 release engineering effort, significant effort was spent getting .Pa src/release/Makefile into a shape where it could at least automate most of the tediousness of building a release in a sterile environment. .Pp For the .Fx 9.0 release, .Pa src/release/Makefile was overhauled and the wrapper script .Pa src/release/generate-release.sh introduced to support the introduction of a new installer. .Pp For the .Fx 9.2 release, .Pa src/release/release.sh was introduced to support per-build configuration files. .Pa src/release/release.sh is heavily based on the .Pa src/release/generate-release.sh script. .Pp At near 1000 revisions spread over multiple branches, the .Xr svn 1 log of .Pa src/release/Makefile contains a vivid historical record of some of the hardships release engineers go through. .Sh AUTHORS .Pa src/release/Makefile was originally written by .An -nosplit .An Rod Grimes , .An Jordan Hubbard , and .An Poul-Henning Kamp . .Pp This manual page was originally written by .An Murray Stokely Aq Mt murray@FreeBSD.org . .Pp It was updated by .An Nathan Whitehorn Aq Mt nwhitehorn@FreeBSD.org to include the .Fa generate-release.sh script used for the .Fx 9.0 release cycle. .Pp It was later updated by .An Glen Barber Aq Mt gjb@FreeBSD.org to include the .Fa release.sh script used for the .Fx 9.2 release cycle.