summaryrefslogtreecommitdiff
path: root/grub-efi.sh
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2016-04-27 21:45:38 -0400
committerAndrew Cady <d@jerkface.net>2016-04-27 21:45:38 -0400
commit93563bbaa724587c1da6013256fa851242ccb4dc (patch)
tree8bbec322acd80104c0cb2f5227829c08ddf7728c /grub-efi.sh
parente8c2c781aea759c47bf81ff2aed5960032a5b50e (diff)
add the code to generate grub efi images
Diffstat (limited to 'grub-efi.sh')
-rwxr-xr-xgrub-efi.sh48
1 files changed, 48 insertions, 0 deletions
diff --git a/grub-efi.sh b/grub-efi.sh
new file mode 100755
index 0000000..76ee34a
--- /dev/null
+++ b/grub-efi.sh
@@ -0,0 +1,48 @@
1#!/bin/sh
2grub_config()
3{
4 cat <<EOF
5insmod echo
6echo GRUB
7insmod part_acorn
8insmod part_amiga
9insmod part_apple
10insmod part_bsd
11insmod part_dvh
12insmod part_gpt
13insmod part_msdos
14insmod part_plan
15insmod part_sun
16insmod part_sunpc
17
18insmod linux
19insmod iso9660
20
21echo Loading vmlinuz...
22linux /linux/vmlinuz boot=samizdat components quiet splash
23echo Loading initrd.img...
24initrd /linux/initrd.img
25echo Booting.
26echo
27boot
28
29EOF
30}
31
32real_destdir=grub-efi
33destdir=grub-efi.tmp
34
35set -e
36rm -r "${destdir}" 2>/dev/null || true
37mkdir -p "${destdir}"/grub/i386-pc/
38cp -r /usr/lib/grub/i386-pc/* "${destdir}"/grub/i386-pc/
39rm "${destdir}"/grub/i386-pc/*.img || true
40
41grub_config > "${destdir}"/load_cfg
42set -x
43grub-mkimage -O i386-pc -d /usr/lib/grub/i386-pc/ -o "${destdir}"/core.img -c "${destdir}"/load_cfg --prefix=/grub iso9660 biosdisk
44cat /usr/lib/grub/i386-pc/cdboot.img "${destdir}"/core.img > "${destdir}"/grub/i386-pc/eltorito.img
45cat /usr/lib/grub/i386-pc/boot.img "${destdir}"/core.img > "${destdir}"/embedded.img
46
47rm -r "$real_destdir" 2>/dev/null || true
48mv -T "$destdir" "$real_destdir"