build 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #!/bin/bash
  2. #
  3. # build script: builds the ROM images with GRUB payloads and puts them in ./bin/
  4. #
  5. # Copyright (C) 2014, 2015 Francis Rowe <info@gluglug.org.uk>
  6. #
  7. # This program is free software: you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation, either version 3 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. #
  20. set -u -e -v
  21. # Build the ROM's
  22. # MAKE SURE THAT YOU RAN "buildall" OR "builddeps" *AT LEAST ONCE*
  23. # BEFORE RUNNING THIS!
  24. # Put GRUB payloads and config files
  25. # in the coreboot directory, ready for next step
  26. cd coreboot/
  27. for romtype in txtmode vesafb
  28. do
  29. cd ../resources/utilities/grub-assemble
  30. ./gen.sh "$romtype"
  31. rm -f ../../../coreboot/grub_"$romtype".elf
  32. mv grub_"$romtype".elf ../../../coreboot/
  33. cd ../../../coreboot
  34. # GRUB configuration files
  35. for keymap in $(ls ../resources/utilities/grub-assemble/keymap/original)
  36. do
  37. cat ../resources/grub/config/extra/common.cfg > grub_"$keymap"_"$romtype".cfg
  38. cat ../resources/grub/config/extra/"$romtype".cfg >> grub_"$keymap"_"$romtype".cfg
  39. echo "keymap $keymap" >> grub_"$keymap"_"$romtype".cfg
  40. cat ../resources/grub/config/menuentries/common.cfg >> grub_"$keymap"_"$romtype".cfg
  41. cat ../resources/grub/config/menuentries/"$romtype".cfg >> grub_"$keymap"_"$romtype".cfg
  42. # grubtest.cfg should be able to switch back to grub.cfg
  43. sed 's/grubtest.cfg/grub.cfg/' < grub_"$keymap"_"$romtype".cfg > grub_"$keymap"_"$romtype"_test.cfg
  44. done
  45. done
  46. cd ../
  47. # Build ROM images for supported boards
  48. for board in $(ls resources/libreboot/config/)
  49. do
  50. ./buildrom-withgrub $board
  51. done
  52. # Needed on i945 systems for the bucts/dd trick (documented)
  53. # This enables the ROM to be flashed over the lenovo bios firmware
  54. for i945board in x60 t60
  55. do
  56. cd bin/"$i945board"/
  57. for i945rom in $(ls)
  58. do
  59. dd if="$i945rom" of=top64k.bin bs=1 skip=$[$(stat -c %s "$i945rom") - 0x10000] count=64k
  60. dd if=top64k.bin of="$i945rom" bs=1 seek=$[$(stat -c %s "$i945rom") - 0x20000] count=64k conv=notrunc
  61. rm -f top64k.bin
  62. done
  63. cd ../../
  64. done
  65. # Build the deblobbed descriptor+gbe regions for GM45/ICH9M targets.
  66. # Then put them in the ROM images.
  67. cd bin/
  68. ../resources/utilities/ich9deblob/ich9gen
  69. for board in "x200"
  70. do
  71. for romsize in "4m" "8m"
  72. do
  73. cd "$board"_"$romsize"b/
  74. for rom in $(ls)
  75. do
  76. dd if=../ich9fdgbe_"$romsize".bin of="$rom" bs=1 count=12k conv=notrunc
  77. done
  78. cd ../
  79. done
  80. done
  81. rm -f ich9fdgbe_4m.bin
  82. rm -f ich9fdgbe_8m.bin
  83. cd ../
  84. # The GRUB payloads are no longer needed
  85. rm -f coreboot/grub_vesafb.elf
  86. rm -f coreboot/grub_txtmode.elf
  87. # The GRUB configs are no longer needed
  88. rm -f coreboot/grub*cfg
  89. # ------------------- DONE ----------------------