From 906754e8413457df72df7935bc934a8d684bd204 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rn=20=C3=85ne=20de=20Jong?= Date: Fri, 27 May 2022 22:04:42 +0200 Subject: [PATCH] Prepare for later EFI boot --- .../freebsd-build-opennebula-image.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/opennebula-images/freebsd-build-opennebula-image.sh b/opennebula-images/freebsd-build-opennebula-image.sh index a29e5e9..3081154 100755 --- a/opennebula-images/freebsd-build-opennebula-image.sh +++ b/opennebula-images/freebsd-build-opennebula-image.sh @@ -65,7 +65,8 @@ ufsdisk="$(mktemp /var/tmp/ufsdisk.XXXXX)" truncate -s 6G "$ufsdisk" mdconfig -a -t vnode -f "$ufsdisk" -u md1 gpart create -s gpt /dev/md1 -gpart add -t freebsd-boot -l bootfs -b 40 -s 512K md1 +#gpart add -t efi -l efiboot0 -s 260M md1 +gpart add -t freebsd-boot -l gptboot0 -b 40 -s 512K md1 gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 md1 gpart add -t freebsd-ufs -l rootfs -b 1M -s 5G md1 newfs -U /dev/md1p2 @@ -81,7 +82,8 @@ zfsdisk="$(mktemp /var/tmp/zfsdisk.XXXXX)" truncate -s 6G "$zfsdisk" mdconfig -a -t vnode -f "$zfsdisk" -u md0 gpart create -s gpt /dev/md0 -gpart add -t freebsd-boot -l bootfs -b 40 -s 512K md0 +#gpart add -t efi -l efiboot0 -s 260M md1 +gpart add -t freebsd-boot -l gptboot0 -b 40 -s 512K md0 gpart bootcode -b /boot/pmbr -p /boot/gptzfsboot -i 1 md0 gpart add -t freebsd-zfs -l zfs0 -b 1M -s 5G md0 zpool create -O compression=on -o ashift=12 -o "altroot=$ZFSTARGET" -m none -t "$ZPOOL_TMP" "$ZPOOL" md0p2 @@ -133,7 +135,6 @@ mount_nullfs /var/tmp "$UFSTARGET/var/tmp" make -C "$CLOUDSETUP_WORK/" PREFIX="$UFSTARGET/usr/local" install # Configure new system. -printf '# Device\tMountpoint\tFStype\tOptions\t\tDump\tPass#\n' >"$UFSTARGET/etc/fstab" touch "$UFSTARGET/firstboot" sysrc -f "$UFSTARGET/boot/loader.conf" \ zfs_load=YES \ @@ -175,8 +176,13 @@ rm -rf "$UFSTARGET/var/db/freebsd-update/"* ||: zfs set compression=zstd-19 "$ZPOOL_TMP/ROOT/default" umount "$UFSTARGET/dev" "$UFSTARGET/tmp" "$UFSTARGET/var/tmp" rsync -aH --fileflags --inplace "$UFSTARGET/." "$ZFSTARGET" + sysrc -f "$UFSTARGET/boot/loader.conf" -x zfs_load -printf '%s\t%s\t\t%s\t%s\t%s\t%s\n' /dev/gpt/rootfs / ufs rw,noatime 1 1 >>"$UFSTARGET/etc/fstab" +printf '# Device\tMountpoint\tFStype\tOptions\t\tDump\tPass#\n' \ + >"$ZFSTARGET/etc/fstab" +printf '# Device\tMountpoint\tFStype\tOptions\t\tDump\tPass#\n%s\t%s\t\t%s\t%s\t%s\t%s\n' \ + /dev/gpt/rootfs / ufs rw,noatime 1 1 \ + >"$UFSTARGET/etc/fstab" sync ||: zfs inherit compression "$ZPOOL_TMP/ROOT/default"