diff options
author | Andrew Cady <d@jerkface.net> | 2016-04-27 21:45:38 -0400 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2016-04-27 21:45:38 -0400 |
commit | 93563bbaa724587c1da6013256fa851242ccb4dc (patch) | |
tree | 8bbec322acd80104c0cb2f5227829c08ddf7728c /grub-efi.sh | |
parent | e8c2c781aea759c47bf81ff2aed5960032a5b50e (diff) |
add the code to generate grub efi images
Diffstat (limited to 'grub-efi.sh')
-rwxr-xr-x | grub-efi.sh | 48 |
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 | ||
2 | grub_config() | ||
3 | { | ||
4 | cat <<EOF | ||
5 | insmod echo | ||
6 | echo GRUB | ||
7 | insmod part_acorn | ||
8 | insmod part_amiga | ||
9 | insmod part_apple | ||
10 | insmod part_bsd | ||
11 | insmod part_dvh | ||
12 | insmod part_gpt | ||
13 | insmod part_msdos | ||
14 | insmod part_plan | ||
15 | insmod part_sun | ||
16 | insmod part_sunpc | ||
17 | |||
18 | insmod linux | ||
19 | insmod iso9660 | ||
20 | |||
21 | echo Loading vmlinuz... | ||
22 | linux /linux/vmlinuz boot=samizdat components quiet splash | ||
23 | echo Loading initrd.img... | ||
24 | initrd /linux/initrd.img | ||
25 | echo Booting. | ||
26 | echo | ||
27 | boot | ||
28 | |||
29 | EOF | ||
30 | } | ||
31 | |||
32 | real_destdir=grub-efi | ||
33 | destdir=grub-efi.tmp | ||
34 | |||
35 | set -e | ||
36 | rm -r "${destdir}" 2>/dev/null || true | ||
37 | mkdir -p "${destdir}"/grub/i386-pc/ | ||
38 | cp -r /usr/lib/grub/i386-pc/* "${destdir}"/grub/i386-pc/ | ||
39 | rm "${destdir}"/grub/i386-pc/*.img || true | ||
40 | |||
41 | grub_config > "${destdir}"/load_cfg | ||
42 | set -x | ||
43 | grub-mkimage -O i386-pc -d /usr/lib/grub/i386-pc/ -o "${destdir}"/core.img -c "${destdir}"/load_cfg --prefix=/grub iso9660 biosdisk | ||
44 | cat /usr/lib/grub/i386-pc/cdboot.img "${destdir}"/core.img > "${destdir}"/grub/i386-pc/eltorito.img | ||
45 | cat /usr/lib/grub/i386-pc/boot.img "${destdir}"/core.img > "${destdir}"/embedded.img | ||
46 | |||
47 | rm -r "$real_destdir" 2>/dev/null || true | ||
48 | mv -T "$destdir" "$real_destdir" | ||