summaryrefslogtreecommitdiff
path: root/mkefipart-fat
diff options
context:
space:
mode:
authorAndreas Loibl <andreas@andreas-loibl.de>2011-09-29 19:46:39 +0200
committerAndreas Loibl <andreas@andreas-loibl.de>2011-09-29 19:46:39 +0200
commite747a371c4287f6b6af58d5558c7961d3d1866a0 (patch)
treeea7ba2ce3014466e8e5d755de3bd7135187bb9f1 /mkefipart-fat
parentfcf285b974a5c3ed75c37f5b619abab19845f126 (diff)
downloadkanotix-e747a371c4287f6b6af58d5558c7961d3d1866a0.zip
kanotix-e747a371c4287f6b6af58d5558c7961d3d1866a0.tar.gz
added scripts to generate the EFI-partition-images
Diffstat (limited to 'mkefipart-fat')
-rwxr-xr-xmkefipart-fat26
1 files changed, 26 insertions, 0 deletions
diff --git a/mkefipart-fat b/mkefipart-fat
new file mode 100755
index 0000000..21bfdc8
--- /dev/null
+++ b/mkefipart-fat
@@ -0,0 +1,26 @@
+#! /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=efi-fat.img
+[ "$1" ] && img="$1"
+
+# Stuff boot*.efi into a FAT filesystem, making it as small as possible. 24KiB
+# headroom seems to be enough; (x+31)/32*32 rounds up to multiple of 32.
+mkfs.msdos -n EFI -C "$img" \
+ $(( ($(stat -c %s binary/efi/boot/boot*.efi | awk '{s+=$1} END {print s}') / 1024 + 55) \
+ / 32 * 32 ))
+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