Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F133627113
D49320.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D49320.diff
View Options
diff --git a/release/Makefile.vm b/release/Makefile.vm
--- a/release/Makefile.vm
+++ b/release/Makefile.vm
@@ -108,6 +108,10 @@
QEMUTGT?=
.if defined(WITH_CLOUDWARE) && !empty(WITH_CLOUDWARE) && !empty(CLOUDWARE)
+.if (defined(WITHOUT_QEMU) && !defined(NO_ROOT)) || \
+ (!defined(WITHOUT_QEMU) && defined(NO_ROOT))
+.error WITHOUT_QEMU requires NO_ROOT (and vice versa)
+.endif
. for _CW in ${CLOUDWARE}
. if exists(${.CURDIR}/tools/${_CW:tl}.conf) && !defined(${_CW:tu}CONF)
${_CW:tu}CONF?= ${.CURDIR}/tools/${_CW:tl}.conf
@@ -126,6 +130,7 @@
env TARGET=${TARGET} TARGET_ARCH=${TARGET_ARCH} SWAPSIZE=${SWAPSIZE} \
QEMUSTATIC=${QEMUSTATIC} \
WITHOUT_QEMU=${WITHOUT_QEMU:Dtrue} \
+ NO_ROOT=${NO_ROOT:Dtrue} \
${.CURDIR}/scripts/mk-vmimage.sh \
-C ${.CURDIR}/tools/vmimage.subr -d ${.OBJDIR}/${.TARGET} -F ${_FS} \
-i ${.OBJDIR}/${_CW:tl}.${_FS}.${_FMT}.img -s ${VMSIZE} -f ${_FMT} \
diff --git a/release/tools/basic-ci.conf b/release/tools/basic-ci.conf
--- a/release/tools/basic-ci.conf
+++ b/release/tools/basic-ci.conf
@@ -21,6 +21,8 @@
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 @@
UsePAM no
EOF
- touch ${DESTDIR}/firstboot
+ touch_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
@@ -37,6 +37,13 @@
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 @@
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 @@
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 @@
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 @@
-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 @@
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 @@
return 0
}
+touch_firstboot() {
+ touch ${DESTDIR}/firstboot
+ metalog_add_data ./firstboot
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Oct 28, 3:10 AM (11 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24333483
Default Alt Text
D49320.diff (4 KB)
Attached To
Mode
D49320: release/vm: partially support NO_ROOT
Attached
Detach File
Event Timeline
Log In to Comment