Archive for September, 2018

FreeBSD Bootonly ISO failures PXE booting under UEFI

September 9, 2018 2 comments

FreeBSD Bootonly ISO failures PXE booting under UEFI

The image below illustrates an error observed on some hardware platforms that fail to PXE boot FreeBSD’s bootonly ISO under UEFI. The failure occurs in mountroot() and manifests as an error 19 reportedly meaning the media cannot be located. This has been observed with 10.3, 11.1, and 11.2.

mountroot() error 19


One can workaround this problem by deploying a bootonly ISO configured with an MFS_IMAGE. EFI_STAGING_SIZE may need adjusting to accommodate larger objects; It defaults to 64. EFI_STAGING_SIZE can be defined within make.conf, release.conf, or on the command line. While not illustrated below, EFI_STAGING_SIZE is implicitly defined specifying a make.conf that includes the knob in the environment via MAKE_CONF.

MFS_IMAGE is necessary because the project’s bootonly ISO fails to PXE boot at mountroot() w/ error 19 indicating the boot media cannot be located. MFS_IMAGE implies a MD_ROOT root filesystem. The build system doesn’t seem to provide a mechanism to build a default MFS_IMAGE and is therefore done outside the context of a build.

The following procedure builds a binary distribution from the source tree in it’s default form (including the default bootonly.iso). It rebuilds the bootonly.iso after generating a root partition and MDROOT kernel.


# Create CHROOTDIR w/ GENERIC kernel (also builds binary release)
root # cd ~/projects/freebsd
root # git checkout releng/11.2
root # release/ -c release/release.conf

# Create root.part from ${OBJDIR} bootonly
root # cd ${CHROOTDIR}/usr/obj/usr/src/release
root # rm bootonly/boot/kernel/kernel
root # rm bootonly/boot/geom_md.ko
root # echo "/dev/ufs/FreeBSD_Install / ufs rw 0 0" > bootonly/etc/fstab
root # makefs -B little -o label=FreeBSD_Install root.part bootonly/
root # cd .. && mkdir -p sys/MDROOT
root # mv release/root.part sys/MDROOT/

# Build MDROOT kernel
root # cat ${CHROOTDIR}/usr/src/sys/amd64/conf/MDROOT
include GENERIC
ident MDROOT

makeoptions     MFS_IMAGE=root.part
root # eval chroot ${CHROOTDIR} env KERNCONF=MDROOT make \ 
    -C /usr/src buildkernel

# Build bootonly ISO w MDROOT kernel
root # mount -t devfs devs ${CHROOTDIR}/dev
root # chflags -R noschg ${CHROOTDIR}/usr/obj/usr/src/release/bootonly && \
    rm -rf ${CHROOTDIR}/usr/obj/usr/src/bootonly
root # eval chroot ${CHROOTDIR} env KERNCONF=MDROOT \ 
    NOPKG=1 NOSRC=1 NODOC=1 NOPORTS=1 make -C /usr/src/release bootonly.iso