Index: head/tools/boot/install-boot.sh =================================================================== --- head/tools/boot/install-boot.sh +++ head/tools/boot/install-boot.sh @@ -51,6 +51,37 @@ exit 0 } +boot_nogeli_gpt_zfs_uefi() { + dev=$1 + dst=$2 + + idx=$(find-part $dev "efi") + if [ -z "$idx" ] ; then + die "No efi ESP partition found" + fi + doit gpart bootcode -p ${efi2} -i $idx $dev + exit 0 +} + +boot_nogeli_gpt_zfs_both() { + dev=$1 + dst=$2 + + # XXX: Should this be copy/pasted, or should it call both _uefi and _legacy + idx=$(find-part $dev "efi") + if [ -z "$idx" ] ; then + die "No efi ESP partition found" + fi + doit gpart bootcode -p ${efi2} -i $idx $dev + + idx=$(find-part $dev "freebsd-boot") + if [ -z "$idx" ] ; then + die "No freebsd-boot partition found" + fi + doit gpart bootcode -b ${gpt0} -p ${gptzfs2} -i $idx $dev + exit 0 +} + boot_nogeli_mbr_zfs_legacy() { dev=$1 dst=$2 @@ -133,6 +164,10 @@ gpt0=${DESTDIR}/boot/pmbr gpt2=${DESTDIR}/boot/gptboot gptzfs2=${DESTDIR}/boot/gptzfsboot + +# For gpt + EFI we install the ESP +# XXX This should use newfs or makefs, but it deosn't yet +efi2=${DESTDIR}/boot/boot1.efifat # For MBR, we have lots of choices, but select boot0 mbr0=${DESTDIR}/boot/boot0 Index: head/tools/boot/rootgen.sh =================================================================== --- head/tools/boot/rootgen.sh +++ head/tools/boot/rootgen.sh @@ -119,9 +119,84 @@ } mk_nogeli_gpt_zfs_uefi() { + src=$1 + img=$2 + mntpt=$3 + geli=$4 + scheme=$5 + fs=$6 + bios=$7 + pool=nogeli-gpt-zfs-uefi + + dd if=/dev/zero of=${img} count=1 seek=$((200 * 1024 * 1024 / 512)) + md=$(mdconfig -f ${img}) + gpart create -s gpt ${md} + gpart add -t efi -s 800k -a 4k ${md} + gpart add -t freebsd-zfs -l root $md + # install-boot will make this bootable + zpool create -O mountpoint=none -R ${mntpt} ${pool} ${md}p2 + zpool set bootfs=${pool} ${pool} + zfs create -po mountpoint=/ ${pool}/ROOT/default + # NB: The online guides go nuts customizing /var and other mountpoints here, no need + cpsys ${src} ${mntpt} + df + # need to make a couple of tweaks + cat > ${mntpt}/boot/loader.conf < ${mntpt}/boot/loader.conf < $sh - echo "qemu-system-x86_64 -bios ~/bios/OVMF-X64.fd --drive file=${img},format=raw ${qser}" > $sh + echo "qemu-system-x86_64 -bios ~/bios/OVMF-X64.fd --drive file=${img},format=raw ${qser}" >> $sh } # arm @@ -288,7 +363,7 @@ 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 + echo "qemu-system-i386 -bios ~/bios/OVMF-X32.fd --drive file=${img},format=raw ${qser}" >> $sh } # mips @@ -314,8 +389,15 @@ rm -rf ${DESTDIR} mkdir -p ${DESTDIR}/boot/defaults mkdir -p ${DESTDIR}/boot/kernel +cp /boot/boot0 ${DESTDIR}/boot +cp /boot/boot0sio ${DESTDIR}/boot +cp /boot/pmbr ${DESTDIR}/boot +cp /boot/boot ${DESTDIR}/boot # XXX boot1 exists only on sparc64 cp /boot/boot1 ${DESTDIR}/boot +cp /boot/boot1.efifat ${DESTDIR}/boot +cp /boot/gptboot ${DESTDIR}/boot +cp /boot/gptzfsboot ${DESTDIR}/boot cp /boot/loader ${DESTDIR}/boot cp /boot/kernel/kernel ${DESTDIR}/boot/kernel echo -h -D -S115200 > ${DESTDIR}/boot.config