gen.sh 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #!/bin/bash
  2. # grub-assemble gen.sh: generate GRUB ELF files (coreboot payloads)
  3. #
  4. # Copyright (C) 2014, 2015 Leah Rowe <info@minifree.org>
  5. #
  6. # This program is free software: you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation, either version 3 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. #
  19. [ "x${DEBUG+set}" = 'xset' ] && set -v
  20. set -u -e
  21. if [ $# != 1 ]; then
  22. printf "Usage: ./gen.sh mode\n"
  23. printf "Example: ./gen.sh vesafb\n"
  24. printf "Example: ./gen.sh txtmode\n"
  25. printf "You need to specify exactly 1 argument\n"
  26. exit 1
  27. fi
  28. # This is where GRUB is expected to be (outside of the grub-assemble, instead in main checkout)
  29. grubdir="../../../grub"
  30. source "modules.conf"
  31. list_keymaps () {
  32. for keylayout in keymap/original/*; do
  33. keymap="${keylayout##*/}"
  34. printf "/boot/grub/layouts/%s.gkb=keymap/%s.gkb " "${keymap}" "${keymap}"
  35. done
  36. }
  37. keymaps=$(list_keymaps)
  38. printf "Creating GRUB ELF executable for configuration '%s'\n" "${1}"
  39. if [ "${1}" = "vesafb" ]; then
  40. # Generate the grub.elf (vesafb)
  41. $grubdir/grub-mkstandalone \
  42. --grub-mkimage="${grubdir}/grub-mkimage" \
  43. -O i386-coreboot \
  44. -o "grub_vesafb.elf" \
  45. -d "${grubdir}/grub-core/" \
  46. --fonts= --themes= --locales= \
  47. --modules="${grub_modules}" \
  48. --install-modules="${grub_install_modules}" \
  49. /boot/grub/grub.cfg="../../../resources/grub/config/grub_memdisk.cfg" \
  50. /dejavusansmono.pf2="../../../resources/grub/font/dejavusansmono.pf2" \
  51. ${keymaps}
  52. elif [ "${1}" = "txtmode" ]
  53. then
  54. # Generate the grub.elf (txtmode)
  55. "${grubdir}/grub-mkstandalone" \
  56. --grub-mkimage="${grubdir}/grub-mkimage" \
  57. -O i386-coreboot \
  58. -o "grub_txtmode.elf" \
  59. -d "${grubdir}/grub-core/" \
  60. --fonts= --themes= --locales= \
  61. --modules="${grub_modules}" \
  62. --install-modules="${grub_install_modules}" \
  63. /boot/grub/grub.cfg="../../../resources/grub/config/grub_memdisk.cfg" \
  64. /memtest.bin="../../../memtest86plus/memtest.bin" \
  65. ${keymaps}
  66. else
  67. printf "grub-assemble gen.sh: invalid mode '%s'\n" "${1}"
  68. exit 1
  69. fi
  70. printf "\n\n"