summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rwxr-xr-xconfig/binary_local-hooks/mkefipart-fat27
1 files changed, 27 insertions, 0 deletions
diff --git a/config/binary_local-hooks/mkefipart-fat b/config/binary_local-hooks/mkefipart-fat
new file mode 100755
index 0000000..5273076
--- /dev/null
+++ b/config/binary_local-hooks/mkefipart-fat
@@ -0,0 +1,27 @@
+#! /bin/sh
+# mkefipart-fat - written by Andreas Loibl <andreas@andreas-loibl.de>
+#
+# Generate an image for a FAT-EFI-partition
+
+if [ ! -x /usr/bin/mmd ]; then
+ echo "Error: mtools are needed! Run: apt-get install mtools"
+ exit 1
+fi
+
+img=binary/boot.efi.img
+[ "$1" ] && img="$1"
+rm -f "$img"
+
+# Stuff boot*.efi into a FAT filesystem,
+# (x+1023)/1024*1024 rounds up to multiple of MB.
+mkfs.msdos -n KANOTIX_EFI -C "$img" \
+ $(( ($(stat -c %s binary/efi/boot/boot*.efi | awk '{s+=$1} END {print s}') / 1024 + 1023) \
+ / 1024 * 1024 ))
+mmd -i "$img" ::efi
+mmd -i "$img" ::efi/boot
+for file in binary/efi/boot/boot*.efi
+do
+ mcopy -i "$img" $file "::efi/boot/$(basename "$file")"
+done
+
+exit 0