aboutsummaryrefslogtreecommitdiff
path: root/release/tools
diff options
context:
space:
mode:
authorBrooks Davis <brooks@FreeBSD.org>2025-03-12 21:05:39 +0000
committerBrooks Davis <brooks@FreeBSD.org>2025-03-12 21:05:39 +0000
commitc41ba99779d0431c37ac06a674e7744d15de8045 (patch)
tree87ca41f2358cb675d1b82a1b25a7a29274e2090b /release/tools
parent92d399a3be0e53622b9af16a82f9b7c7b62b34f7 (diff)
Diffstat (limited to 'release/tools')
-rw-r--r--release/tools/basic-ci.conf4
-rw-r--r--release/tools/vmimage.subr33
2 files changed, 30 insertions, 7 deletions
diff --git a/release/tools/basic-ci.conf b/release/tools/basic-ci.conf
index 5acc04b1e530..12c9abb15fb1 100644
--- a/release/tools/basic-ci.conf
+++ b/release/tools/basic-ci.conf
@@ -21,6 +21,8 @@ beastie_disable="YES"
loader_logo="none"
console="comconsole,vidconsole"
EOF
+ metalog_add_data ./boot/loader.conf
+
cat <<EOF >> ${DESTDIR}/etc/ssh/sshd_config
PermitRootLogin yes
PasswordAuthentication yes
@@ -28,7 +30,7 @@ PermitEmptyPasswords yes
UsePAM no
EOF
- touch ${DESTDIR}/firstboot
+ touch_firstboot
return 0
}
diff --git a/release/tools/vmimage.subr b/release/tools/vmimage.subr
index e7bd351c035c..c647097e8ced 100644
--- a/release/tools/vmimage.subr
+++ b/release/tools/vmimage.subr
@@ -37,6 +37,13 @@ cleanup() {
return 0
}
+metalog_add_data() {
+ if [ -n "${NO_ROOT}" ]; then
+ echo "$1 type=file uname=root gname=wheel mode=0644" >> \
+ ${DESTDIR}/METALOG
+ fi
+}
+
vm_create_base() {
mkdir -p ${DESTDIR}
@@ -61,7 +68,14 @@ vm_install_base() {
etcupdate extract -B \
-M "TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH}" \
-s ${WORLDDIR} -d ${DESTDIR}/var/db/etcupdate \
- -L /dev/stdout
+ -L /dev/stdout ${NO_ROOT:+-N}
+ if [ -n "${NO_ROOT}" ]; then
+ # Reroot etcupdate's internal METALOG to the whole tree
+ sed -n 's,^\.,./var/db/etcupdate/current,p' \
+ ${DESTDIR}/var/db/etcupdate/current/METALOG | \
+ env -i LC_COLLATE=C sort >> ${DESTDIR}/METALOG
+ rm ${DESTDIR}/var/db/etcupdate/current/METALOG
+ fi
echo '# Custom /etc/fstab for FreeBSD VM images' \
> ${DESTDIR}/etc/fstab
@@ -73,16 +87,19 @@ vm_install_base() {
echo '/dev/gpt/swapfs none swap sw 0 0' \
>> ${DESTDIR}/etc/fstab
fi
+ metalog_add_data ./etc/fstab
local hostname
hostname="$(echo $(uname -o) | tr '[:upper:]' '[:lower:]')"
echo "hostname=\"${hostname}\"" >> ${DESTDIR}/etc/rc.conf
+ metalog_add_data ./etc/rc.conf
if [ "${VMFS}" = zfs ]; then
echo "zfs_enable=\"YES\"" >> ${DESTDIR}/etc/rc.conf
echo "zpool_reguid=\"zroot\"" >> ${DESTDIR}/etc/rc.conf
echo "zpool_upgrade=\"zroot\"" >> ${DESTDIR}/etc/rc.conf
echo "kern.geom.label.disk_ident.enable=0" >> ${DESTDIR}/boot/loader.conf
echo "zfs_load=YES" >> ${DESTDIR}/boot/loader.conf
+ metalog_add_data ./boot/loader.conf
fi
return 0
@@ -191,11 +208,11 @@ buildfs() {
case "${VMFS}" in
ufs)
- makefs ${MAKEFSARGS} -o label=rootfs -o version=2 -o softupdates=1 \
- ${VMBASE} ${DESTDIR}
+ cd ${DESTDIR} && makefs ${MAKEFSARGS} -o label=rootfs -o version=2 -o softupdates=1 \
+ ${VMBASE} .${NO_ROOT:+/METALOG}
;;
zfs)
- makefs -t zfs ${MAKEFSARGS} \
+ cd ${DESTDIR} && makefs -t zfs ${MAKEFSARGS} \
-o poolname=zroot -o bootfs=zroot/ROOT/default -o rootpath=/ \
-o fs=zroot\;mountpoint=none \
-o fs=zroot/ROOT\;mountpoint=none \
@@ -212,7 +229,7 @@ buildfs() {
-o fs=zroot/var/log\;setuid=off\;exec=off \
-o fs=zroot/var/mail\;atime=on \
-o fs=zroot/var/tmp\;setuid=off \
- ${VMBASE} ${DESTDIR}
+ ${VMBASE} .${NO_ROOT:+/METALOG}
;;
*)
echo "Unexpected VMFS value '${VMFS}'"
@@ -276,7 +293,7 @@ vm_create_disk() {
WITH_UNIFIED_OBJDIR=yes \
make -C ${WORLDDIR}/stand -V .OBJDIR)"
BOOTFILES="$(realpath ${BOOTFILES})"
- MAKEFSARGS="-s ${VMSIZE}"
+ MAKEFSARGS="-s ${VMSIZE} -D"
case "${TARGET}:${TARGET_ARCH}" in
amd64:amd64 | i386:i386)
@@ -345,3 +362,7 @@ vm_extra_create_disk() {
return 0
}
+touch_firstboot() {
+ touch ${DESTDIR}/firstboot
+ metalog_add_data ./firstboot
+}