tianocore 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #!/usr/bin/env bash
  2. # helper script: builds Tianocore source code
  3. #
  4. # Copyright (C) 2020, 2021 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. printf "Building Tianocore\n"
  22. [ ! -d "payload/" ] && mkdir -p payload/
  23. [ ! -d "payload/tianocore/" ] && mkdir -p payload/tianocore/
  24. rm -f payload/tianocore/*
  25. if [ ! -d "coreboot/default/" ]; then
  26. ./download coreboot default
  27. ./build module cbutils default
  28. fi
  29. if [ ! -d "coreboot/default/util/crossgcc/xgcc/i386-elf" ]; then
  30. (
  31. # cat version coreboot/default/.coreboot-version -> breaks the build process; this file is not available, at the moment
  32. cd coreboot/default/
  33. make crossgcc-i386 CPUS=$(nproc) # tianocore actually uses host gcc, which means
  34. # right now you should be building this on a 64-bit x86 host.
  35. # It does not currently use coreboot crossgcc. However, a dummy coreboot
  36. # ROM is compiled using Tianocore in order to derive tianocore.elf
  37. # and of course, that implies crossgcc. tianocore is only really use
  38. # on x86, so we only care about i386 crossgcc here
  39. )
  40. fi
  41. if [ ! -d "coreboot/default/payloads/external/tianocore/tianocore/" ]; then
  42. ./download tianocore
  43. fi
  44. (
  45. cd coreboot/default/payloads/external/tianocore/
  46. make clean
  47. )
  48. (
  49. cd coreboot/default/
  50. make distclean
  51. cp ../../resources/tianocore/dummy.coreboot.config .config
  52. make -j$(nproc)
  53. )
  54. cp coreboot/default/payloads/external/tianocore/tianocore/Build/UEFIPAYLOAD.fd \
  55. payload/tianocore/tianocore.elf
  56. (
  57. cd coreboot/default/
  58. make distclean
  59. )
  60. (
  61. cd coreboot/default/payloads/external/tianocore/
  62. make clean
  63. )