freebsd-build: fix building efifat after r351831
diff mbox series

Message ID 20190910112753.34545-1-roger.pau@citrix.com
State New
Headers show
Series
  • freebsd-build: fix building efifat after r351831
Related show

Commit Message

Roger Pau Monné Sept. 10, 2019, 11:27 a.m. UTC
FreeBSD revisions after r351831 no longer automatically build an
efifat partition image, and makefs should be used instead if such file
is required.

Do this and add logic to build the efifat partition ourselves if it's
not present in the output of the build.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Ian Jackson <Ian.Jackson@citrix.com>
---
 ts-freebsd-build | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Comments

Ian Jackson Sept. 12, 2019, 9:17 a.m. UTC | #1
Roger Pau Monne writes ("[PATCH] freebsd-build: fix building efifat after r351831"):
> FreeBSD revisions after r351831 no longer automatically build an
> efifat partition image, and makefs should be used instead if such file
> is required.
> 
> Do this and add logic to build the efifat partition ourselves if it's
> not present in the output of the build.

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

And pushed to pretest, thanks.

Ian.

Patch
diff mbox series

diff --git a/ts-freebsd-build b/ts-freebsd-build
index bdf666eb..a34d3ae7 100755
--- a/ts-freebsd-build
+++ b/ts-freebsd-build
@@ -189,6 +189,18 @@  gzip $output.tmp/boot/kernel/kernel
 
 makefs -B little $output.part $output.tmp
 
+# NB: since r351831 efifat files are no longer automatically generated.
+if [ ! -f $target/boot/boot1.efifat ]; then
+    # Create an EFI partition using the FAT filesystem
+    mkdir -p $output.efi/EFI/BOOT
+    cp $target/boot/loader.efi $output.efi/EFI/BOOT/bootx64.efi
+    size=`stat -f%z $output.efi/EFI/BOOT/bootx64.efi`
+    size=`expr $size + $size / 2`
+    makefs -t msdos -o fat_type=32 -o sectors_per_cluster=1 \
+        -o volume_label=EFISYS -s $size $target/boot/boot1.efifat $output.efi
+    rm -rf $output.efi
+fi
+
 mkimg -s gpt -b $target/boot/pmbr -p efi:=$target/boot/boot1.efifat \
     -p freebsd-boot:=$target/boot/gptboot -p freebsd-ufs:=$output.part \
     -p freebsd-swap::1M -o $output