Index: head/tools/boot/rootgen.sh =================================================================== --- head/tools/boot/rootgen.sh (revision 346653) +++ head/tools/boot/rootgen.sh (revision 346654) @@ -1,882 +1,892 @@ #!/bin/sh # $FreeBSD$ passphrase=passphrase iterations=50000 # The smallest FAT32 filesystem is 33292 KB espsize=33292 # # Builds all the bat-shit crazy combinations we support booting from, # at least for amd64. It assume you have a ~sane kernel in /boot/kernel # and copies that into the ~150MB root images we create (we create the du # size of the kernel + 20MB # # Sad panda sez: this runs as root, but could be userland if someone # creates userland geli and zfs tools. # # This assumes an external program install-boot.sh which will install # the appropriate boot files in the appropriate locations. # # These images assume ada0 will be the root image. We should likely # use labels, but we don't. # # Assumes you've already rebuilt... maybe bad? Also maybe bad: the env # vars should likely be conditionally set to allow better automation. # . $(dirname $0)/install-boot.sh cpsys() { src=$1 dst=$2 # Copy kernel + boot loader (cd $src ; tar cf - .) | (cd $dst; tar xf -) } mk_nogeli_gpt_ufs_legacy() { src=$1 img=$2 cat > ${src}/etc/fstab < ${src}/etc/fstab < ${src}/etc/fstab <> ${mntpt}/boot/loader.conf <> ${mntpt}/boot/loader.conf <> ${mntpt}/boot/loader.conf < ${src}/etc/fstab < ${src}/etc/fstab < ${src}/etc/fstab <> ${mntpt}/boot/loader.conf <> ${mntpt}/boot/loader.conf <> ${mntpt}/boot/loader.conf < ${mntpt}/boot/loader.conf < ${mntpt}/etc/fstab < ${mntpt}/boot/loader.conf < ${mntpt}/etc/fstab < ${mntpt}/boot/loader.conf < ${mntpt}/etc/fstab <> ${mntpt}/boot/loader.conf <> ${mntpt}/boot/loader.conf < ${mntpt}/boot/loader.conf < ${src}/etc/fstab < $sh chmod 755 $sh # https://wiki.freebsd.org/arm64/QEMU also has # -device virtio-net-device,netdev=net0 # -netdev user,id=net0 } # Amd64 qemu qemu_amd64_legacy() { img=$1 sh=$2 echo "qemu-system-x86_64 -m 256m --drive file=${img},format=raw ${qser}" > $sh chmod 755 $sh } qemu_amd64_uefi() { img=$1 sh=$2 echo "qemu-system-x86_64 -m 256m -bios ~/bios/OVMF-X64.fd --drive file=${img},format=raw ${qser}" > $sh chmod 755 $sh } qemu_amd64_both() { img=$1 sh=$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 chmod 755 $sh } # arm # nothing listed? # i386 qemu_i386_legacy() { img=$1 sh=$2 echo "qemu-system-i386 --drive file=${img},format=raw ${qser}" > $sh chmod 755 $sh } # Not yet supported qemu_i386_uefi() { img=$1 sh=$2 echo "qemu-system-i386 -bios ~/bios/OVMF-X32.fd --drive file=${img},format=raw ${qser}" > $sh chmod 755 $sh } # Needs UEFI to be supported qemu_i386_both() { img=$1 sh=$2 echo "qemu-system-i386 --drive file=${img},format=raw ${qser}" > $sh echo "qemu-system-i386 -bios ~/bios/OVMF-X32.fd --drive file=${img},format=raw ${qser}" >> $sh chmod 755 $sh } make_one_image() { local arch=${1?} local geli=${2?} local scheme=${3?} local fs=${4?} local bios=${5?} # 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 "vvvvvvvvvvvvvv Creating $img vvvvvvvvvvvvvvv" rm -f ${img}* eval mk_${geli}_${scheme}_${fs}_${bios} ${DESTDIR} ${img} ${MNTPT} ${geli} ${scheme} ${fs} ${bios} eval qemu_${arch}_${bios} ${img} ${sh} [ -n "${SUDO_USER}" ] && chown ${SUDO_USER} ${img}* echo "^^^^^^^^^^^^^^ Created $img ^^^^^^^^^^^^^^^" } # mips # qemu-system-mips -kernel /path/to/rootfs/boot/kernel/kernel -nographic -hda /path/to/disk.img -m 2048 # Powerpc -- doesn't work but maybe it would enough for testing -- needs details # powerpc64 # qemu-system-ppc64 -drive file=/path/to/disk.img,format=raw # sparc64 # qemu-system-sparc64 -drive file=/path/to/disk.img,format=raw # Misc variables SRCTOP=$(make -v SRCTOP) cd ${SRCTOP}/stand OBJDIR=$(make -v .OBJDIR) IMGDIR=${OBJDIR}/boot-images mkdir -p ${IMGDIR} MNTPT=$(mktemp -d /tmp/stand-test.XXXXXX) # Setup the installed tree... DESTDIR=${OBJDIR}/boot-tree rm -rf ${DESTDIR} mkdir -p ${DESTDIR}/boot/defaults mkdir -p ${DESTDIR}/boot/kernel cp /boot/kernel/kernel ${DESTDIR}/boot/kernel echo -h -D -S115200 > ${DESTDIR}/boot.config cat > ${DESTDIR}/boot/loader.conf < ${DESTDIR}/etc/rc <