diff --git a/ci/scripts/test/rc/firstboot_ci b/ci/scripts/test/rc/firstboot_ci new file mode 100755 --- /dev/null +++ b/ci/scripts/test/rc/firstboot_ci @@ -0,0 +1,59 @@ +#!/bin/sh + +# KEYWORD: firstboot +# PROVIDE: firstboot_ci +# REQUIRE: NETWORKING +# BEFORE: LOGIN + +# Add the following lines to /etc/rc.conf.local or /etc/rc.conf (in the disk +# image, since this only runs on the first boot) to enable this: +# +# firstboot_ci_enable="YES" +# + +. /etc/rc.subr + +: ${firstboot_ci_enable:="NO"} + +name="firstboot_ci" +rcvar=firstboot_ci_enable +start_cmd="firstboot_ci_run" +stop_cmd=":" +os_version=$(uname -K) +os_arch=$(uname -p) +metadir="/meta" + +firstboot_ci_run() +{ + if [ -f "$meta/test_zfs" ];then + /usr/src/release/ci/scripts/test/subr/run-kyua-zfs.sh + exit 0 + fi + if [ -f "$meta/test_tcptestsuite" ];then + /usr/src/release/ci/scripts/test/subr/run-kyua-tcptestsuite.sh + exit 0 + fi + if [ -f "$meta/test_ltp" ];then + /usr/src/release/ci/scripts/test/subr/run-kyua-ltp.sh + exit 0 + fi + if [ -f "$meta/disable-zfs-tests" ];then + /usr/src/release/ci/scripts/test/subr/disable-zfs-tests.sh + fi + if [ -f "$meta/disable-dtrace-tests" ];then + /usr/src/release/ci/scripts/test/subr/disable-dtrace-tests.sh + fi + if [ -f "$meta/disable-disks-tests" ];then + /usr/src/release/ci/scripts/test/subr/disable-disks-tests.sh + fi + if [ -f "$meta/disable-notyet-tests" ];then + /usr/src/release/ci/scripts/test/subr/disable-notyet-tests.sh + fi + if [ ! -f "$meta/test_zfs" ] && [ ! -f "$meta/test_tcptestsuite" ] && [ ! -f "$meta/test_ltp" ];then + /usr/src/release/ci/scripts/test/subr/run-kyua.sh + exit 0 + fi +} + +load_rc_config $name +run_rc_command "$1" diff --git a/ci/scripts/test/rc/rc.local b/ci/scripts/test/rc/rc.local new file mode 100755 --- /dev/null +++ b/ci/scripts/test/rc/rc.local @@ -0,0 +1,45 @@ +#!/bin/sh +echo +echo "--------------------------------------------------------------" +echo "rc.local start!" +echo "--------------------------------------------------------------" +PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin +export PATH + +set -x + +ddb script kdb.enter.panic="show pcpu; reset" + +for TARDEV in /dev/vtbd0 /dev/vtbd1 /dev/ada0 /dev/ada1; do + ISTAR=$(file -s ${TARDEV} | grep "POSIX tar archive" | wc -l) + if [ ${ISTAR} -eq 1 ]; then + break + fi +done + +METADIR=/meta + +if [ ${ISTAR} -eq 1 ]; then + rm -fr ${METADIR} + mkdir -p ${METADIR} + tar xvf ${TARDEV} -C ${METADIR} + tar cvf ${TARDEV} -C ${METADIR} . +else + echo "ERROR: no device with POSIX tar archive format found." + # Don't shutdown because this is not run in unattended mode + exit 1 +fi + +if [ -f ${METADIR}/auto-shutdown ]; then + # XXX: Currently RISC-V and MIPS64 kernels lack the ability + # to make qemu exit on shutdown. Reboot instead; + # it makes qemu exit too. + case "$(uname -p)" in + mips64|riscv64) + shutdown -r now + ;; + *) + shutdown -p now + ;; + esac +fi diff --git a/ci/scripts/test/subr/disable-disks-tests.sh b/ci/scripts/test/subr/disable-disks-tests.sh new file mode 100644 --- /dev/null +++ b/ci/scripts/test/subr/disable-disks-tests.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +if [ -f /etc/kyua/kyua.conf ]; then + sed -i '' -E \ + -e 's,test_suites.FreeBSD.(cam|disks),-- &,' \ + /etc/kyua/kyua.conf +fi diff --git a/ci/scripts/test/subr/disable-dtrace-tests.sh b/ci/scripts/test/subr/disable-dtrace-tests.sh new file mode 100644 --- /dev/null +++ b/ci/scripts/test/subr/disable-dtrace-tests.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +if [ -f /usr/tests/cddl/usr.sbin/dtrace/Kyuafile ]; then + rm -f /usr/tests/cddl/usr.sbin/dtrace/Kyuafile +fi diff --git a/ci/scripts/test/subr/disable-notyet-tests.sh b/ci/scripts/test/subr/disable-notyet-tests.sh new file mode 100644 --- /dev/null +++ b/ci/scripts/test/subr/disable-notyet-tests.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +F=/usr/tests/lib/libcasper/services/cap_dns/Kyuafile +if [ -f ${F} ]; then + sed -i '' \ + -e 's/tap_test_program{name="dns_test", }/-- tap_test_program{name="dns_test", }/' \ + ${F} +fi + +F=/usr/tests/lib/libcasper/services/cap_net/Kyuafile +if [ -f ${F} ]; then + sed -i '' \ + -e 's/atf_test_program{name="net_test", }/-- atf_test_program{name="net_test", }/' \ + ${F} +fi + +F=/usr/local/tests/kyua/utils/signals/Kyuafile +if [ -f ${F} ]; then + sed -i '' \ + -e 's,atf_test_program{name="timer_test"},-- atf_test_program{name="timer_test"},' \ + ${F} +fi + +F=/usr/local/tests/kyua/integration/cmd_about_test +if [ -f ${F} ]; then + sed -i .'' \ + -e 's,atf_add_test_case topic__authors__installed,#atf_add_test_case topic__authors__installed,' \ + ${F} +fi + +F=/usr/tests/sys/netmap/Kyuafile +if [ -f ${F} ]; then + sed -i '' \ + -e 's,plain_test_program{name="ctrl-api-test",-- plain_test_program{name="ctrl-api-test",' \ + ${F} +fi diff --git a/ci/scripts/test/subr/disable-zfs-tests.sh b/ci/scripts/test/subr/disable-zfs-tests.sh new file mode 100644 --- /dev/null +++ b/ci/scripts/test/subr/disable-zfs-tests.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +if [ -f /usr/tests/sys/cddl/Kyuafile ]; then + sed -i '' \ + -e 's,include("zfs/Kyuafile"),-- include("zfs/Kyuafile"),' \ + /usr/tests/sys/cddl/Kyuafile +fi diff --git a/ci/scripts/test/subr/run-kyua-ltp.sh b/ci/scripts/test/subr/run-kyua-ltp.sh new file mode 100644 --- /dev/null +++ b/ci/scripts/test/subr/run-kyua-ltp.sh @@ -0,0 +1,48 @@ +#!/bin/sh + +METADIR=/meta + +PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin +export PATH + +# Enable services needed by tests +sysrc linux_enable="YES" +for i in proc sys tmp dev; do + mkdir -p /compat/linux/$i +done +service linux start + +# runltp creates nobody, bin, and daemon users, but not root +echo 'root:x:0:0:root::' > /compat/linux/etc/passwd + +# runltp creates nobody, bin, daemon, sys, and users groups, but not root +echo 'root:x:0:' > /compat/linux/etc/group + +# Workaround for https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=242955 +kldload ext2fs + +# Disable tests that hang undefinitely. +cat > /compat/linux/ltp-skipfile.conf << END +rt_sigtimedwait01 rt_sigtimedwait01 +sigtimedwait01 sigtimedwait01 +sigwaitinfo01 sigwaitinfo01 +inotify06 inotify06 +pidns05 pidns05 +utstest_unshare_3 utstest_unshare_3 +utstest_unshare_4 utstest_unshare_4 +kill10 kill10 +mmap_24-1 mmap_24-1 +sigaction_16-1 sigaction_16-1 +END + +# Add Open POSIX to the default run. +echo "openposix" >> /compat/linux/opt/ltp/scenario_groups/default + +mdconfig -s 512m + +set +e +yes | chroot /compat/linux /opt/ltp/runltp -Q -S /ltp-skipfile.conf -b /dev/md0 -pl /ltp-results.log +echo $? > ${METADIR}/runltp.error +set -e + +mv -v /compat/linux/ltp-results.log ${METADIR} diff --git a/ci/scripts/test/subr/run-kyua-tcttestsuite.sh b/ci/scripts/test/subr/run-kyua-tcttestsuite.sh new file mode 100644 --- /dev/null +++ b/ci/scripts/test/subr/run-kyua-tcttestsuite.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +METADIR=/meta + +PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin +export PATH + +cat <> /etc/kyua/kyua.conf +test_suites.FreeBSD.disks = '/dev/vtbd2 /dev/vtbd3 /dev/vtbd4 /dev/vtbd5 /dev/vtbd6' +EOF + +newfs /dev/vtbd7 +mount /dev/vtbd7 /tmp + +# Required by Packet Drill +sysctl vm.old_mlock=1 + +cd /usr/local/tests/tcptestsuite +set +e +/usr/bin/kyua test +rc=$? +if [ ${rc} -ne 0 ] && [ ${rc} -ne 1 ]; then + exit ${rc} +fi + +umount /tmp +set -e + +/usr/bin/kyua report --verbose --results-filter passed,skipped,xfail,broken,failed --output test-report.txt +/usr/bin/kyua report-junit --output=test-report.xml +mv test-report.* ${METADIR} diff --git a/ci/scripts/test/subr/run-kyua-zfs.sh b/ci/scripts/test/subr/run-kyua-zfs.sh new file mode 100644 --- /dev/null +++ b/ci/scripts/test/subr/run-kyua-zfs.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +METADIR=/meta + +PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin +export PATH + +cat <> /etc/kyua/kyua.conf +test_suites.FreeBSD.disks = '/dev/vtbd2 /dev/vtbd3 /dev/vtbd4 /dev/vtbd5 /dev/vtbd6' +EOF + +newfs /dev/vtbd7 +mount /dev/vtbd7 /tmp + +# Enable services needed by tests +sysrc zfsd_enable="YES" +service zfsd start + +cd /usr/tests/sys/cddl/zfs +set +e +/usr/bin/kyua test +rc=$? +if [ ${rc} -ne 0 ] && [ ${rc} -ne 1 ]; then + exit ${rc} +fi + +umount /tmp +set -e + +/usr/bin/kyua report --verbose --results-filter passed,skipped,xfail,broken,failed --output test-report.txt +/usr/bin/kyua report-junit --output=test-report.xml +mv test-report.* ${METADIR} diff --git a/ci/scripts/test/subr/run-kyua.sh b/ci/scripts/test/subr/run-kyua.sh new file mode 100644 --- /dev/null +++ b/ci/scripts/test/subr/run-kyua.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +echo "--------------------------------------------------------------" +echo "start kyua tests!" +echo "--------------------------------------------------------------" + +cd /usr/tests +set +e +kyua test +rc=$? +set -e +if [ ${rc} -ne 0 ] && [ ${rc} -ne 1 ]; then + exit ${rc} +fi +kyua report --verbose --results-filter passed,skipped,xfail,broken,failed --output test-report.txt +kyua report-junit --output=test-report.xml +mv test-report.* /meta +echo "--------------------------------------------------------------" +echo "Finished kyua tests!" +echo "--------------------------------------------------------------" diff --git a/release/Makefile b/release/Makefile --- a/release/Makefile +++ b/release/Makefile @@ -19,6 +19,9 @@ # Variables affecting the build process: # WORLDDIR: location of src tree -- must have built world and default kernel # (by default, the directory above this one) +# OBJDIR: location of objdir -- must have the artficats generated by +# packagesystem. (by default the value of ${.OBJDIR} as this +# needs to be passed to the scripts # PORTSDIR: location of ports tree to distribute (default: /usr/ports) # XTRADIR: xtra-bits-dir argument for /mkisoimages.sh # NOPKG: if set, do not distribute third-party packages @@ -30,11 +33,16 @@ # 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_COMPRESSED_CLOUDWARE: 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 +# WITH_PACKAGESYSTEM: if set, build images with packagesystem rather than +# installworld installkernel distribution # TARGET/TARGET_ARCH: architecture of built release # WORLDDIR?= ${.CURDIR}/.. +OBJDIR?= ${.OBJDIR} PORTSDIR?= /usr/ports .if !defined(TARGET) || empty(TARGET) diff --git a/release/Makefile.vm b/release/Makefile.vm --- a/release/Makefile.vm +++ b/release/Makefile.vm @@ -11,6 +11,8 @@ VMFS?= ufs SWAPSIZE?= 1g VMBASE?= vm +PACKAGESYSTEM=no +PACKAGESYSTEM_ARGS=-P ${PACKAGESYSTEM} VHD_DESC= Azure, VirtualPC, Hyper-V, Xen disk image VMDK_DESC= VMWare, VirtualBox disk image @@ -18,6 +20,7 @@ RAW_DESC= Unformatted raw disk image CLOUDWARE?= BASIC-CI \ + CI \ EC2 \ GCE \ OCI \ @@ -27,8 +30,11 @@ AZURE_DESC= Microsoft Azure platform image AZURE_DISK= ${OSRELEASE}.${AZURE_FORMAT} BASIC-CI_FORMAT= raw -BASIC-CI_DESC= Image for CI +BASIC-CI_DESC= Image for FreeDesktop CI BASIC-CI_DISK= ${OSRELEASE}.${BASIC-CI_FORMAT} +CI_FORMAT= raw +CI_DESC= Image for CI +CI_DISK= ${OSRELEASE}.${CI_FORMAT} EC2_FORMAT= raw EC2_DESC= Amazon EC2 image EC2_DISK= ${OSRELEASE}.${EC2_FORMAT} @@ -54,6 +60,15 @@ . endif .endfor +.if defined(WITH_PACKAGESYSTEM) && !empty(WITH_PACKAGESYSTEM) +.if !exists(${.OBJDIR}/base.txz) && (!exists(${.OBJDIR}/kernel.txz) || !exists(${.OBJDIR}/kernel-dbg.txz)) +.error A build with packagesystem is required first. You may have a wrong MAKEOBJDIRPREFIX +.else +PACKAGESYSTEM=yes +PACKAGESYSTEM_ARGS+=-D ${.OBJDIR} +.endif +.endif + emulator-portinstall: .if ${TARGET_ARCH} != ${MACHINE_ARCH} .if ( ${TARGET_ARCH} != "i386" ) || ( ${MACHINE_ARCH} != "amd64" ) @@ -93,8 +108,15 @@ ${.CURDIR}/scripts/mk-vmimage.sh \ -C ${.CURDIR}/tools/vmimage.subr -d ${.OBJDIR}/${.TARGET} -F ${VMFS} \ -i ${.OBJDIR}/${_CW:tl}.img -s ${VMSIZE} -f ${${_CW:tu}_FORMAT} \ - -S ${WORLDDIR} -o ${.OBJDIR}/${${_CW:tu}IMAGE} -c ${${_CW:tu}CONF} + -S ${WORLDDIR} -o ${.OBJDIR}/${${_CW:tu}IMAGE} -c ${${_CW:tu}CONF} \ + ${PACKAGESYSTEM_ARGS} touch ${.TARGET} +. if defined(WITH_COMPRESSED_CLOUDWARE) && !empty(WITH_COMPRESSED_CLOUDWARE) +. for FORMAT in ${${_CW:tu}_FORMAT} + # Don't keep the originals. There is a copy in ${.OBJDIR} if needed. + ${XZ_CMD} ${.OBJDIR}/${_CW:tl}.${FORMAT} +. endfor +. endif cw${_CW:tl}-package: @# Special target to handle packaging cloud images in the formats diff --git a/release/scripts/mk-vmimage.sh b/release/scripts/mk-vmimage.sh --- a/release/scripts/mk-vmimage.sh +++ b/release/scripts/mk-vmimage.sh @@ -3,6 +3,9 @@ # Copyright (c) 2014, 2015 The FreeBSD Foundation # All rights reserved. # +# Portions of this software were developed by Muhammad Moinur Rahman +# under sponsorship from the FreeBSD Foundation. +# # This software was developed by Glen Barber under sponsorship # from the FreeBSD Foundation. # @@ -31,7 +34,7 @@ # # $FreeBSD$ # - +set -ex usage() { echo "${0} usage:" echo "${@}" @@ -41,7 +44,7 @@ main() { local arg VMCONFIG="/dev/null" - while getopts "C:c:d:F:f:i:o:s:S:" arg; do + while getopts "C:c:D:d:F:f:i:P:o:s:S:" arg; do case "${arg}" in C) VMBUILDCONF="${OPTARG}" @@ -49,6 +52,9 @@ c) VMCONFIG="${OPTARG}" ;; + D) + OBJDIR="${OPTARG}" + ;; d) DESTDIR="${OPTARG}" ;; @@ -64,6 +70,9 @@ o) VMIMAGE="${OPTARG}" ;; + P) + PACKAGESYSTEM="${OPTARG}" + ;; s) VMSIZE="${OPTARG}" ;; diff --git a/release/tools/ci.conf b/release/tools/ci.conf new file mode 100644 --- /dev/null +++ b/release/tools/ci.conf @@ -0,0 +1,95 @@ +#!/bin/sh + +#VMSIZE?= 5120m +#VMFS?= ufs +#SWAPSIZE?= 1g +#VMBASE?= vm + +# Should be enough for base image, image can be resized in needed +export VMSIZE=8g + +# Set to a list of third-party software to enable in rc.conf(5). +export VM_RC_LIST="auditd freebsd-ci" + +# Install packages needed by tests: +# coreutils: bin/date +# gdb: local/kyua/utils/stacktrace_test +# jq: sys/net/if_bridge_test +# kyua: everything +# ksh93: tests/sys/cddl/zfs/... +# nist-kat: sys/opencrypto/runtests +# nmap: sys/netinet/fibs_test:arpresolve_checks_interface_fib +# perl5: lots of stuff +# pkgconf: local/lutok/examples_test, local/atf/atf-c, local/atf/atf-c++ +# py-dpkt: sys/opencrypto/runtests +# python3: sys/opencrypto/runtests +# devel/py-pytest: sys/net/routing, tests in python in general +# sudo: tests/sys/cddl/zfs/tests/delegate/... +# tcptestsuite: network stack test suite +export VM_EXTRA_PACKAGES="coreutils gdb jq ksh93 nist-kat nmap perl5 net/py-dpkt net/scapy python python3 devel/py-pytest sudo tcptestsuite" + +if [ "${TARGET}" = "amd64" ]; then + export VM_EXTRA_PACKAGES="$VM_EXTRA_PACKAGES linux-c7-ltp" +fi + +vm_extra_pre_umount() { + cat << EOF >> ${DESTDIR}/boot/loader.conf +autoboot_delay=1 +beastie_disable="YES" +loader_logo="none" +console="comconsole,vidconsole" +net.fibs=3 +net.inet.ip.fw.default_to_accept=1 +mac_bsdextended_load="YES" +vfs.zfs.arc_max=4294967296 +EOF + cat << EOF >> ${DESTDIR}/etc/kyua/kyua.conf +test_suites.FreeBSD.ci = 'true' +test_suites.FreeBSD.fibs = '1 2' +test_suites.FreeBSD.allow_sysctl_side_effects = '1' +test_suites.FreeBSD.cam_test_device = '/dev/ada0' +test_suites.FreeBSD.disks = '/dev/vtbd2 /dev/vtbd3 /dev/vtbd4 /dev/vtbd5 /dev/vtbd6' +EOF + cat << EOF >> ${DESTDIR}/etc/rc.conf +kld_list="" # Load modules needed by tests +kld_list="${kld_list} blake2" # sys/opencrypto +kld_list="${kld_list} cryptodev" # sys/opencrypto +kld_list="${kld_list} fusefs" # sys/fs/fusefs +kld_list="${kld_list} ipsec" # sys/netipsec +kld_list="${kld_list} mac_portacl" # sys/mac/portacl +kld_list="${kld_list} mqueuefs" # sys/kern/mqueue_test +kld_list="${kld_list} pfsync" # sys/netpfil/pf (loads pf) +kld_list="${kld_list} pflog" # sys/netpfil/pf +kld_list="${kld_list} ipl" # sys/sbin/ipf (loads ipfilter) +kld_list="${kld_list} ipfw" # sys/netpfil/ipfw (loads ipfw) +kld_list="${kld_list} ipfw_nat" # sys/netpfil/ipfw (loads ipfw_nat) +kld_list="${kld_list} ipdivert" # sys/netinet (loads ipdivert) +kld_list="${kld_list} dummynet" # sys/netpfil/common +kld_list="${kld_list} carp" # sys/netinet/carp +kld_list="${kld_list} if_stf" # sys/net/if_stf +background_fsck="NO" +sendmail_enable="NONE" +cron_enable="NO" +syslogd_enable="NO" +newsyslog_enable="NO" +firstboot_ci_enable="YES" +EOF + cat <> ${DESTDIR}/etc/sysctl.conf +kern.cryptodevallowsoft=1 +kern.ipc.tls.enable=1 +net.add_addr_allfibs=0 +security.mac.bsdextended.enabled=0 +vfs.aio.enable_unsafe=1 +vfs.usermount=1 +EOF + cat <> ${DESTDIR}/etc/fstab +fdesc /dev/fd fdescfs rw 0 0 +EOF + mkdir -p ${DESTDIR}/usr/local/etc/rc.d + echo $scriptdir + cp -p ${scriptdir}/../../ci/scripts/test/rc/firstboot_ci ${DESTDIR}/usr/local/etc/rc.d/ + cp -p ${scriptdir}/../../ci/scripts/test/rc/rc.local ${DESTDIR}/etc + touch ${DESTDIR}/firstboot + + return 0 +} diff --git a/release/tools/vmimage.subr b/release/tools/vmimage.subr --- a/release/tools/vmimage.subr +++ b/release/tools/vmimage.subr @@ -51,20 +51,25 @@ 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}." - - # Bootstrap etcupdate(8) and mergemaster(8) databases. - mkdir -p ${DESTDIR}/var/db/etcupdate - etcupdate extract -B \ - -M "TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH}" \ - -s ${WORLDDIR} -d ${DESTDIR}/var/db/etcupdate - sh ${WORLDDIR}/release/scripts/mm-mtree.sh -m ${WORLDDIR} \ - -F "TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH}" \ - -D ${DESTDIR} + if [ "${PACKAGESYSTEM}" == yes ]; then + for _DIST in $(ls ${OBJDIR}/*.txz); do + tar Jxf ${_DIST} -C ${DESTDIR} + done + else + cd ${WORLDDIR} && \ + make DESTDIR=${DESTDIR} \ + installworld installkernel distribution || \ + err "\n\nCannot install the base system to ${DESTDIR}." + + # Bootstrap etcupdate(8) and mergemaster(8) databases. + mkdir -p ${DESTDIR}/var/db/etcupdate + etcupdate extract -B \ + -M "TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH}" \ + -s ${WORLDDIR} -d ${DESTDIR}/var/db/etcupdate + sh ${WORLDDIR}/release/scripts/mm-mtree.sh -m ${WORLDDIR} \ + -F "TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH}" \ + -D ${DESTDIR} + fi echo '# Custom /etc/fstab for FreeBSD VM images' \ > ${DESTDIR}/etc/fstab @@ -172,8 +177,10 @@ vm_extra_pkg_rmcache() { if [ -e ${DESTDIR}/usr/local/sbin/pkg ]; then + mount -t devfs devfs ${DESTDIR}/dev chroot ${DESTDIR} ${EMULATOR} env ASSUME_ALWAYS_YES=yes \ /usr/local/sbin/pkg clean -y -a + umount_loop ${DESTDIR}/dev fi return 0 @@ -270,7 +277,7 @@ amd64:amd64 | i386:i386) ESP=yes BOOTPARTS="-b ${BOOTFILES}/i386/pmbr/pmbr \ - -p freebsd-boot/bootfs:=${BOOTFILES}/${X86GPTBOOTFILE}${BOOTPARTSOFFSET}" + -p freebsd-boot/bootfs:=${BOOTFILES}/${X86GPTBOOTFILE}${BOOTPARTSOFFSET}" ROOTFSPART="-p ${FSPARTTYPE}/rootfs:=${VMBASE}" MAKEFSARGS="$MAKEFSARGS -B little" ;; @@ -329,4 +336,3 @@ return 0 } -