diff options
author | Colin Percival <cperciva@FreeBSD.org> | 2019-04-03 21:54:47 +0000 |
---|---|---|
committer | Colin Percival <cperciva@FreeBSD.org> | 2019-04-03 21:54:47 +0000 |
commit | 1ecaa3f75e21ab45f5e7849b4d2042c4645659da (patch) | |
tree | ea620cfcae31571663b38bde96777b821c96d317 /release/Makefile.vm | |
parent | 5eb264119ee0ef81b933f62a1df271b5a4250b59 (diff) | |
download | src-1ecaa3f75e21ab45f5e7849b4d2042c4645659da.tar.gz src-1ecaa3f75e21ab45f5e7849b4d2042c4645659da.zip |
Add support for cross-building cloudware images.
If MACHINE_ARCH doesn't match TARGET_ARCH, and we're not in the special
case of building i386 images on an amd64 host, we need to pull in the
qemu-user-static package; this allows us to run some commands inside
the VM disk image chroot, most notably to install packages.
Reviewed by: gjb
MFC after: 2 weeks
Sponsored by: FreeBSD/EC2 patreon (https://www.patreon.com/cperciva)
Notes
Notes:
svn path=/head/; revision=345858
Diffstat (limited to 'release/Makefile.vm')
-rw-r--r-- | release/Makefile.vm | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/release/Makefile.vm b/release/Makefile.vm index 93d662d9c4cb..c7a1d1f0d1fe 100644 --- a/release/Makefile.vm +++ b/release/Makefile.vm @@ -39,6 +39,24 @@ VAGRANT-VMWARE_FORMAT= vmdk VAGRANT-VMWARE_DESC= Vagrant Image for VMWare VAGRANT-VMWARE_DISK= ${OSRELEASE}.vmware.${VAGRANT_FORMAT} +emulator-portinstall: +.if ${TARGET_ARCH} != ${MACHINE_ARCH} +.if ( ${TARGET_ARCH} != "i386" ) || ( ${MACHINE_ARCH} != "amd64" ) +.if !exists(/usr/local/bin/qemu-${TARGET_ARCH}-static) +.if exists(${PORTSDIR}/emulators/qemu-user-static/Makefile) + env - PATH=$$PATH make -C ${PORTSDIR}/emulators/qemu-user-static BATCH=1 all install clean +.else +.if !exists(/usr/local/sbin/pkg-static) + env ASSUME_ALWAYS_YES=yes pkg bootstrap -y +.endif + env ASSUME_ALWAYS_YES=yes pkg install -y emulators/qemu-user-static +.endif +.endif + +QEMUSTATIC=/usr/local/bin/qemu-${TARGET_ARCH}-static +.endif +.endif + .if defined(WITH_CLOUDWARE) && !empty(WITH_CLOUDWARE) && !empty(CLOUDWARE) . for _CW in ${CLOUDWARE} CLOUDTARGETS+= cw-${_CW:tl} @@ -53,9 +71,10 @@ ${_CW:tu}IMAGE= ${_CW:tl}.${${_CW:tu}_FORMAT} ${_CW:tu}CONF?= ${.CURDIR}/tools/${_CW:tl}.conf . endif -cw-${_CW:tl}: +cw-${_CW:tl}: emulator-portinstall mkdir -p ${.OBJDIR}/${.TARGET} env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} SWAPSIZE=${SWAPSIZE} \ + QEMUSTATIC=${QEMUSTATIC} \ ${.CURDIR}/scripts/mk-vmimage.sh \ -C ${.CURDIR}/tools/vmimage.subr -d ${.OBJDIR}/${.TARGET} \ -i ${.OBJDIR}/${_CW:tl}.img -s ${VMSIZE} -f ${${_CW:tu}_FORMAT} \ |