3 # Install loader, kernel, and enough of userland to boot in QEMU and echo
4 # "Hello world." from init, as a very quick smoke test for CI. Uses QEMU's
5 # virtual FAT filesystem to avoid the need to create a disk image.
11 # Root directory for minimal FreeBSD installation.
12 ROOTDIR=$(pwd)/fat-root
14 # Create minimal directory structure.
15 rm -f $ROOTDIR/efi/boot/BOOTx64.EFI
16 for dir in dev bin efi/boot etc lib libexec sbin usr/libexec; do
17 mkdir -p $ROOTDIR/$dir
20 # Install kernel, loader and minimal userland.
21 make -DNO_ROOT DESTDIR=$ROOTDIR \
23 WITHOUT_DEBUG_FILES=yes \
24 WITHOUT_KERNEL_SYMBOLS=yes \
27 lib/libc lib/libedit lib/ncurses \
29 bin/sh sbin/init sbin/shutdown; do
30 make -DNO_ROOT DESTDIR=$ROOTDIR INSTALL="install -U" \
38 # Put loader in standard EFI location.
39 mv $ROOTDIR/boot/loader.efi $ROOTDIR/efi/boot/BOOTx64.EFI
41 # Configuration files.
42 cat > $ROOTDIR/boot/loader.conf <<EOF
43 vfs.root.mountfrom="msdosfs:/dev/ada0s1"
47 cat > $ROOTDIR/etc/rc <<EOF
54 # Remove unnecessary files to keep FAT filesystem size down.
55 rm -rf $ROOTDIR/METALOG $ROOTDIR/usr/lib
59 qemu-system-x86_64 -m 256M -bios OVMF.fd \
60 -serial stdio -vga none -nographic -monitor none \
61 -snapshot -hda fat:$ROOTDIR 2>&1 | tee boot.log
62 grep -q 'Hello world.' boot.log