2 # Filename: ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/45-grub-images
3 # Purpose: create grub images for use in ISO
4 # Authors: grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports: see http://grml.org/bugs/
6 # License: This file is licensed under the GPL v2 or any later version.
7 ################################################################################
12 TMP_CONFIG="/tmp/grub_config_efi"
14 # this allows us to find this specific Grml ISO,
15 # even if there are multiple Grml ISOs present
16 bootfile="${GRML_NAME}_$(TZ=UTC date +%s)"
17 echo "$bootfile" > "${target}/"boot/grub/bootfile.txt
19 cat > "${target}/${TMP_CONFIG}" <<EOF
20 search.file /conf/bootfile_$bootfile root
21 set prefix=(\$root)/boot/grub
24 echo "E: Could not find root device (for /conf/bootfile_$bootfile)!"
28 declare -A ADDITIONAL_MODULES
29 ADDITIONAL_MODULES[i386-pc]="biosdisk"
31 if ifclass AMD64 ; then
32 if [ -r "${target}"/usr/lib/grub/x86_64-efi/moddep.lst ] ; then
34 ADDITIONAL_MODULES[x86_64-efi]="efi_gop efi_uga"
36 echo "/usr/lib/grub/x86_64-efi/moddep.lst could not be found, skipping."
37 echo "NOTE: grub-efi-amd64-bin not installed?"
41 if ifclass I386 ; then
42 if [ -r "${target}"/usr/lib/grub/i386-efi/moddep.lst ] ; then
44 ADDITIONAL_MODULES[i386-efi]="efi_gop efi_uga"
46 echo "/usr/lib/grub/i386-efi/moddep.lst could not be found, skipping."
47 echo "NOTE: grub-efi-ia32 not installed?"
51 for arch in "${ARCHS[@]}" ; do
54 i386-pc) filename=/boot/grub/grub.img ;;
55 x86_64-efi) filename=/boot/bootx64.efi ;;
56 i386-efi) filename=/boot/bootia32.efi ;;
59 $ROOTCMD grub-mkimage -O $arch -o "$filename" --prefix=/boot/grub/ --config="$TMP_CONFIG" \
60 echo iso9660 part_msdos search_fs_file test \
61 fat ext2 reiserfs xfs btrfs squash4 part_gpt lvm \
62 ${ADDITIONAL_MODULES[$arch]}
65 rm -f "${target}/${TMP_CONFIG}"
66 echo "Generated Grub images"
68 ## END OF FILE #################################################################
69 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2