From 32ae9a6b39372808f3d662300c15157513704aff Mon Sep 17 00:00:00 2001 From: Colin Percival Date: Sun, 6 Aug 2023 18:53:16 -0700 Subject: [PATCH] release: Build UFS and ZFS VM images A new option 'VMFSLIST' controls the list of filesystems for which VM images will be built; the default is to build both UFS and ZFS. The vm-install target installs these as ${OSRELEASE}-${FS}.${FORMAT}, e.g. FreeBSD-14.0-CURRENT-amd64-zfs.vmdk. For backwards compatibility, the ${VMFS} image is linked to the previously used ${OSRELEASE}.${FORMAT} name. Cloudware building will be updated in a later commit. Reviewed by: gjb Reviewed by: emaste, markj (previous version) Sponsored by: https://www.patreon.com/cperciva Differential Revision: https://reviews.freebsd.org/D41340 --- release/Makefile.vm | 33 +++++++++++++++++++++++++-------- share/man/man7/release.7 | 13 ++++++++++++- 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/release/Makefile.vm b/release/Makefile.vm index ce86fabdfe5e..0ab683c090ef 100644 --- a/release/Makefile.vm +++ b/release/Makefile.vm @@ -9,6 +9,7 @@ VMTARGETS= vm-image VMFORMATS?= vhd vmdk qcow2 raw VMSIZE?= 5120m VMFS?= ufs +VMFSLIST?= ufs zfs SWAPSIZE?= 1g VMBASE?= vm @@ -112,8 +113,10 @@ cw${_CW:tl}-package: .if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES) CLEANDIRS+= ${VMTARGETS} . for FORMAT in ${VMFORMATS} -CLEANFILES+= ${FORMAT}.img -CLEANFILES+= ${VMBASE}.${FORMAT} +. for FS in ${VMFSLIST} +CLEANFILES+= ${FORMAT}.${FS}.img +CLEANFILES+= ${VMBASE}.${FS}.${FORMAT} +. endfor . endfor .endif @@ -122,12 +125,14 @@ vm-base: vm-image vm-image: .if defined(WITH_VMIMAGES) && !empty(WITH_VMIMAGES) . for FORMAT in ${VMFORMATS} +. for FS in ${VMFSLIST} mkdir -p ${.OBJDIR}/${.TARGET} env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} SWAPSIZE=${SWAPSIZE} \ ${.CURDIR}/scripts/mk-vmimage.sh \ - -C ${.CURDIR}/tools/vmimage.subr -d ${.OBJDIR}/${.TARGET} -F ${VMFS} \ - -i ${.OBJDIR}/${FORMAT}.img -s ${VMSIZE} -f ${FORMAT} \ - -S ${WORLDDIR} -o ${.OBJDIR}/${VMBASE}.${FORMAT} + -C ${.CURDIR}/tools/vmimage.subr -d ${.OBJDIR}/${.TARGET} -F ${FS} \ + -i ${.OBJDIR}/${FORMAT}.${FS}.img -s ${VMSIZE} -f ${FORMAT} \ + -S ${WORLDDIR} -o ${.OBJDIR}/${VMBASE}.${FS}.${FORMAT} +. endfor . endfor .endif touch ${.TARGET} @@ -154,15 +159,27 @@ 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} +. for FS in ${VMFSLIST} + cp -p ${VMBASE}.${FS}.${FORMAT} \ + ${DESTDIR}/vmimages/${OSRELEASE}-${FS}.${FORMAT} +. endfor . endfor . if defined(WITH_COMPRESSED_VMIMAGES) && !empty(WITH_COMPRESSED_VMIMAGES) . for FORMAT in ${VMFORMATS} +. for FS in ${VMFSLIST} # Don't keep the originals. There is a copy in ${.OBJDIR} if needed. - ${XZ_CMD} ${DESTDIR}/vmimages/${OSRELEASE}.${FORMAT} + ${XZ_CMD} ${DESTDIR}/vmimages/${OSRELEASE}-${FS}.${FORMAT} +. endfor . endfor . endif + # Compatibility hardlinks from "foo.bar" to "foo-${VMFS}.bar". +. for FORMAT in ${VMFORMATS} +. if defined(WITH_COMPRESSED_VMIMAGES) && !empty(WITH_COMPRESSED_VMIMAGES) + ln -f ${DESTDIR}/vmimages/${OSRELEASE}-${VMFS}.${FORMAT}.xz ${DESTDIR}/vmimages/${OSRELEASE}.${FORMAT}.xz +. else + ln -f ${DESTDIR}/vmimages/${OSRELEASE}-${VMFS}.${FORMAT} ${DESTDIR}/vmimages/${OSRELEASE}.${FORMAT} +. endif +. endfor cd ${DESTDIR}/vmimages && sha512 ${OSRELEASE}* > \ ${DESTDIR}/vmimages/CHECKSUM.SHA512 cd ${DESTDIR}/vmimages && sha256 ${OSRELEASE}* > \ diff --git a/share/man/man7/release.7 b/share/man/man7/release.7 index 8ce2cf47b4fd..068837ff682f 100644 --- a/share/man/man7/release.7 +++ b/share/man/man7/release.7 @@ -366,13 +366,24 @@ is used, the resulting files compressed with compress to roughly the same size, regardless of the specified disk image size. .It Va VMFS -Set to specify the file system type to use. +(Deprecated.) +Set to specify which of the filesystem(s) listed in +.Va VMFSLIST +is linked to the historical non-filesystem-labelled file name. Valid values are .Va ufs and .Va zfs . The default value is .Va ufs . +.It Va VMFSLIST +Set to specify the list of file system types to build images for. +Valid values are one or both of +.Va ufs +and +.Va zfs . +The default value is +.Va ufs zfs . .It Va VMFORMATS Set to the target virtual disk image format(s) to create. By default, the