diff --git a/tools/boot/full-test.sh b/tools/boot/full-test.sh index 11f575779b92..89d2ac3b7277 100644 --- a/tools/boot/full-test.sh +++ b/tools/boot/full-test.sh @@ -1,617 +1,622 @@ #!/bin/sh # STAND_ROOT is the root of a tree: # cache - Cached binaries that we have downloaded # trees - binary trees that we use to make image # trees/${ARCH}/$thing # images - bootable images that we use to test # images/${ARCH}/$thing # bios - cached bios images (as well as 'vars' files when we start testing # different booting scenarios in the precense / absence of variables). # scripts - generated scripts that uses images to run the tests. # # Strategy: # Download FreeBSD release isos, Linux kernels (for the kboot tests) and # other misc things. We use these to generate dozens of test images that we # use qemu-system-XXXX to boot. They all boot the same thing at the moment: # an /etc/rc script that prints the boot method, echos success and then # halts. # What version of FreeBSD to we snag the ISOs from to extract the binaries # we are testing FREEBSD_VERSION=13.1 # eg https://download.freebsd.org/releases/amd64/amd64/ISO-IMAGES/13.1/FreeBSD-13.1-RELEASE-amd64-bootonly.iso.xz URLBASE="https://download.freebsd.org/releases" : ${STAND_ROOT:="${HOME}/stand-test-root"} CACHE=${STAND_ROOT}/cache TREES=${STAND_ROOT}/trees IMAGES=${STAND_ROOT}/images BIOS=${STAND_ROOT}/bios SCRIPTS=${STAND_ROOT}/scripts OVERRIDE=${STAND_ROOT}/override # hack -- I have extra junk in my qemu, but it's not needed to recreate things if [ $(whoami) = imp ]; then qemu_bin=/home/imp/git/qemu/00-build else qemu_bin=/usr/local/bin fi # All the architectures under test # Note: we can't yet do armv7 because we don't have a good iso for it and would # need root to extract the files. ARCHES="amd64:amd64 i386:i386 powerpc:powerpc powerpc:powerpc64 powerpc:powerpc64le powerpc:powerpcspe arm64:aarch64 riscv:riscv64" # The smallest FAT32 filesystem is 33292 KB espsize=33292 SRCTOP=$(make -v SRCTOP) mkdir -p ${CACHE} ${TREES} ${IMAGES} ${BIOS} die() { echo Fatal Error: $* exit 1 } ma_combo() { local m=$1 local ma=$2 local ma_combo="${m}" [ "${m}" != "${ma}" ] && ma_combo="${m}-${ma}" echo ${ma_combo} } fetch_one() { local m=$1 local ma=$2 local v=$3 local flavor=$4 local ma_combo=$(ma_combo $m $ma) local file="FreeBSD-${v}-RELEASE-${ma_combo}-${flavor}" local url="${URLBASE}/${m}/${ma}/ISO-IMAGES/${v}/${file}.xz" mkdir -p ${CACHE} [ -r ${CACHE}/${file} ] && echo "Using cached ${file}" && return cd ${CACHE} echo "Fetching ${url}" fetch ${url} || die "Can't fetch ${file} from ${url}" xz -d ${file}.xz || die "Can't uncompress ${file}.xz" cd .. } update_freebsd_img_cache() { local a m ma for a in $ARCHES; do m=${a%%:*} ma=${a##*:} fetch_one $m $ma ${FREEBSD_VERSION} bootonly.iso done fetch_one arm armv7 ${FREEBSD_VERSION} GENERICSD.img } make_minimal_freebsd_tree() { local m=$1 local ma=$2 local v=$3 local flavor=$4 local file d local ma_combo="${m}" [ "${m}" != "${ma}" ] && ma_combo="${m}-${ma}" file="FreeBSD-${v}-RELEASE-${ma_combo}-${flavor}" dir=${TREES}/${ma_combo}/freebsd rm -rf ${dir} # Make a super simple userland. It has just enough to print a santiy value, # then say test succeeded, and then halt the system. We assume that /bin/sh # has all the library prereqs for the rest... mkdir -p ${dir} # Make required dirs for d in boot/kernel boot/defaults boot/lua boot/loader.conf.d \ sbin bin lib libexec etc dev; do mkdir -p ${dir}/${d} done # Pretend we don't have a separate /usr ln -s . ${dir}/usr # snag the binaries for my simple /etc/rc file tar -C ${dir} -xf ${CACHE}/$file sbin/reboot sbin/halt sbin/init bin/sh sbin/sysctl \ lib/libncursesw.so.9 lib/libc.so.7 lib/libedit.so.8 libexec/ld-elf.so.1 # My simple etc/rc cat > ${dir}/etc/rc < ${dir}/boot.config cat > ${dir}/boot/loader.conf < ${initrd}) done } make_linux_esps() { # At the moment, we have just two for a in amd64:amd64 arm64:aarch64; do m=${a%%:*} ma=${a##*:} ma_combo="${m}" [ "${m}" != "${ma}" ] && ma_combo="${m}-${ma}" dir=${TREES}/${ma_combo}/linuxboot-esp initrd=${TREES}/${ma_combo}/initrd.img mkdir -p ${dir} case ${ma} in amd64) bin=x64 cons="console=ttyS0,115200" ;; aarch64) bin=aa64 ;; esac mkdir -p ${dir}/efi/boot cp ${CACHE}/linux/linux${bin}.efi ${dir} cp ${CACHE}/linux/shell${bin}.efi ${dir}/efi/boot/boot${bin}.efi cat > ${dir}/startup.nsh < ${out} < ${out} < ${out2} < ${out3} < ${dir2}/etc/fstab < ${dir2}/etc/fstab < ${dir2}/etc/fstab < ${out} < ${out} < ${out} < ${out} <