gen.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/bin/bash
  2. # Copying and distribution of this file, with or without modification,
  3. # are permitted in any medium without royalty provided the copyright
  4. # notice and this notice are preserved. This file is offered as-is,
  5. # without any warranty.
  6. # The original grub-assemble that this tool is based on:
  7. # https://gitorious.org/gnutoo-for-coreboot/grub-assemble
  8. [ "x${DEBUG+set}" = 'xset' ] && set -v
  9. set -u -e
  10. if (( $# != 1 )); then
  11. printf "Usage: ./gen.sh mode\n"
  12. printf "Example: ./gen.sh vesafb\n"
  13. printf "Example: ./gen.sh txtmode\n"
  14. printf "You need to specify exactly 1 argument\n"
  15. exit 1
  16. fi
  17. # This is where GRUB is expected to be (outside of the grub-assemble, instead in main checkout)
  18. grubdir="../../../grub"
  19. source "modules.conf"
  20. printf "Creating GRUB ELF executable for configuration '$1'\n"
  21. if [ "${1}" = "vesafb" ]
  22. then
  23. # Generate the grub.elf (vesafb)
  24. $grubdir/grub-mkstandalone \
  25. --grub-mkimage="${grubdir}/grub-mkimage" \
  26. -O i386-coreboot \
  27. -o "grub_vesafb.elf" \
  28. -d "${grubdir}/grub-core/" \
  29. --fonts= --themes= --locales= \
  30. --modules="${grub_modules}" \
  31. --install-modules="${grub_install_modules}" \
  32. /boot/grub/grub.cfg="../../../resources/grub/config/grub_memdisk.cfg" \
  33. /dejavusansmono.pf2="../../../resources/grub/font/dejavusansmono.pf2" \
  34. $(./grub_memdisk_keymap)
  35. elif [ "${1}" = "txtmode" ]
  36. then
  37. # Generate the grub.elf (txtmode)
  38. "${grubdir}/grub-mkstandalone" \
  39. --grub-mkimage="${grubdir}/grub-mkimage" \
  40. -O i386-coreboot \
  41. -o "grub_txtmode.elf" \
  42. -d "${grubdir}/grub-core/" \
  43. --fonts= --themes= --locales= \
  44. --modules="${grub_modules}" \
  45. --install-modules="${grub_install_modules}" \
  46. /boot/grub/grub.cfg="../../../resources/grub/config/grub_memdisk.cfg" \
  47. /memtest="../../../memtest86+-5.01/memtest" \
  48. $(./grub_memdisk_keymap)
  49. else
  50. printf "grub-assemble gen.sh: invalid mode '%s'\n" "${1}"
  51. exit 1
  52. fi
  53. printf "\n\n"