From 3d3f2fb069d972785763e7ed4244d62e4e85cce0 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Tue, 16 Aug 2022 11:29:25 -0600 Subject: [PATCH] stand: Make makeroot.sh use makefs for ZFS Start to use makefs for ZFS. This covers the gpt nogeli variants. ZFS MBR booting is tricky and complicated, so will need some additional tweaks that makefs/mkimg isn't able to do at the moment. This means that all gpt nogeli amd64 combinations can be built w/o root. In addition, tweak the generated qemu.sh files to use stdio for the console. We grep the output for SUCCESS and report each of the booting types. Create a all.sh that will run these automatically. These all can also run w/o root. In the future, I'll add support for a make univers followed by this script to create other architectures' tests and/or generate stand tests for /usr/tests... Sponsored by: Netflix --- tools/boot/rootgen.sh | 173 ++++++++++++++++++++---------------------- 1 file changed, 82 insertions(+), 91 deletions(-) diff --git a/tools/boot/rootgen.sh b/tools/boot/rootgen.sh index 80554fb1b77..f087afa5ad4 100755 --- a/tools/boot/rootgen.sh +++ b/tools/boot/rootgen.sh @@ -35,9 +35,9 @@ cpsys() { } ufs_fstab() { - src=$1 + dir=$1 - cat > ${src}/etc/fstab < ${dir}/etc/fstab < ${dst}/boot/loader.conf.local <> ${mntpt}/boot/loader.conf <> ${mntpt}/boot/loader.conf <> ${mntpt}/boot/loader.conf < $sh + echo "echo -n $(basename $sh .sh):' '" > $sh + echo "(qemu-system-x86_64 -m 256m --drive file=${img},format=raw ${qser} | tee $log 2>&1 | grep -q SUCCESS) && echo legacy pass || echo legacy fail" >> $sh chmod 755 $sh } @@ -664,8 +641,10 @@ qemu_amd64_uefi() { img=$1 sh=$2 + log=$(log_for $2) - echo "qemu-system-x86_64 -m 256m -bios ~/bios/OVMF-X64.fd --drive file=${img},format=raw ${qser}" > $sh + echo "echo -n $(basename $sh .sh):' '" > $sh + echo "(qemu-system-x86_64 -m 256m -bios ~/bios/OVMF-X64.fd --drive file=${img},format=raw ${qser} | tee $log 2>&1 | grep -q SUCCESS) && echo uefi pass || echo uefi fail" >> $sh chmod 755 $sh } @@ -673,9 +652,12 @@ qemu_amd64_both() { img=$1 sh=$2 + log=$(log_for $2) - echo "qemu-system-x86_64 -m 256m --drive file=${img},format=raw ${qser}" > $sh - echo "qemu-system-x86_64 -m 256m -bios ~/bios/OVMF-X64.fd --drive file=${img},format=raw ${qser}" >> $sh + echo "echo -n $(basename $sh .sh):' '" > $sh + echo "(qemu-system-x86_64 -m 256m --drive file=${img},format=raw ${qser} | tee $log 2>&1 | grep -q SUCCESS) && echo legacy pass || echo legacy fail" >> $sh + echo "echo -n $(basename $sh .sh):' '" >> $sh + echo "(qemu-system-x86_64 -m 256m -bios ~/bios/OVMF-X64.fd --drive file=${img},format=raw ${qser} | tee -a $log 2>&1 | grep -q SUCCESS) && echo uefi pass || echo uefi fail" >> $sh chmod 755 $sh } @@ -724,6 +706,8 @@ make_one_image() # Create sparse file and mount newly created filesystem(s) on it img=${IMGDIR}/${arch}-${geli}-${scheme}-${fs}-${bios}.img sh=${IMGDIR}/${arch}-${geli}-${scheme}-${fs}-${bios}.sh + echo "$sh" >> ${IMGDIR}/all.sh + echo date >> ${IMGDIR}/all.sh echo "vvvvvvvvvvvvvv Creating $img vvvvvvvvvvvvvvv" rm -f ${img}* eval mk_${geli}_${scheme}_${fs}_${bios} ${DESTDIR} ${img} ${MNTPT} ${geli} ${scheme} ${fs} ${bios} @@ -753,6 +737,7 @@ cp /boot/kernel/kernel ${DESTDIR}/boot/kernel echo -h -D -S115200 > ${DESTDIR}/boot.config cat > ${DESTDIR}/boot/loader.conf < ${IMGDIR}/all.sh +chmod +x ${IMGDIR}/all.sh + if [ $# -eq 5 ]; then make_one_image $* + echo ${IMGDIR}/all.sh exit fi # OK. Let the games begin for arch in amd64; do - for geli in nogeli geli; do + for geli in nogeli; do # geli for scheme in gpt mbr; do - for fs in ufs zfs; do + for fs in ufs ; do # zfs for bios in legacy uefi both; do make_one_image ${arch} ${geli} ${scheme} ${fs} ${bios} done @@ -797,6 +787,7 @@ for arch in amd64; do done done done +echo ${IMGDIR}/all.sh rmdir ${MNTPT}