build.ck 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /*++
  2. Copyright (c) 2014 Minoca Corp.
  3. This file is licensed under the terms of the GNU General Public License
  4. version 3. Alternative licensing terms are available. Contact
  5. info@minocacorp.com for details. See the LICENSE file at the root of this
  6. project for complete licensing information.
  7. Module Name:
  8. BeagleBone UEFI Firmware
  9. Abstract:
  10. This module implements UEFI firmware for the TI BeagleBone Black.
  11. Author:
  12. Evan Green 19-Dec-2014
  13. Environment:
  14. Firmware
  15. --*/
  16. from menv import binplace, staticApplication, uefiFwvol, flattenedBinary;
  17. function build() {
  18. var commonLibs;
  19. var elf;
  20. var entries;
  21. var ffs;
  22. var flattened;
  23. var fwVolume;
  24. var includes;
  25. var libs;
  26. var linkConfig;
  27. var plat = "bbone";
  28. var platfw;
  29. var sources;
  30. var sourcesConfig;
  31. var textAddress = "0x82000000";
  32. var uboot;
  33. var ubootConfig;
  34. sources = [
  35. "armv7/entry.S",
  36. "clock.c",
  37. "debug.c",
  38. "fwvol.c",
  39. "i2c.c",
  40. "intr.c",
  41. "main.c",
  42. "memmap.c",
  43. ":" + plat + "fwv.o",
  44. "ramdenum.c",
  45. "sd.c",
  46. "serial.c",
  47. "smbios.c",
  48. "timer.c",
  49. "video.c"
  50. ];
  51. includes = [
  52. "$S/uefi/include"
  53. ];
  54. sourcesConfig = {
  55. "CFLAGS": ["-fshort-wchar"]
  56. };
  57. linkConfig = {
  58. "LDFLAGS": ["-Wl,--no-wchar-size-warning"],
  59. };
  60. commonLibs = [
  61. "uefi/core:ueficore",
  62. "kernel/kd:kdboot",
  63. "uefi/core:ueficore",
  64. "uefi/archlib:uefiarch",
  65. "lib/fatlib:fat",
  66. "lib/basevid:basevid",
  67. "lib/rtl/base:basertlb",
  68. "kernel/kd/kdusb:kdnousb",
  69. "kernel:archboot",
  70. "uefi/core:emptyrd",
  71. ];
  72. libs = commonLibs + [
  73. "uefi/dev/sd/core:sd",
  74. "uefi/dev/omapuart:omapuart"
  75. ];
  76. platfw = plat + "fw";
  77. elf = {
  78. "label": platfw + ".elf",
  79. "inputs": sources + libs,
  80. "sources_config": sourcesConfig,
  81. "text_address": textAddress,
  82. "includes": includes,
  83. "config": linkConfig
  84. };
  85. entries = staticApplication(elf);
  86. //
  87. // Build the firmware volume.
  88. //
  89. ffs = [
  90. "uefi/core/runtime:rtbase.ffs",
  91. "uefi/plat/beagbone/runtime:" + plat + "rt.ffs",
  92. "uefi/plat/beagbone/acpi:acpi.ffs"
  93. ];
  94. fwVolume = uefiFwvol("uefi/plat/beagbone", plat, ffs);
  95. entries += fwVolume;
  96. //
  97. // Flatten the firmware image and convert to u-boot.
  98. //
  99. flattened = {
  100. "label": platfw + ".bin",
  101. "inputs": [":" + platfw + ".elf"]
  102. };
  103. flattened = flattenedBinary(flattened);
  104. entries += flattened;
  105. ubootConfig = {
  106. "text_address": textAddress,
  107. "MKUBOOT_FLAGS": "-c -a arm -f legacy"
  108. };
  109. uboot = {
  110. "type": "target",
  111. "label": platfw,
  112. "inputs": [":" + platfw + ".bin"],
  113. "orderonly": ["uefi/tools/mkuboot:mkuboot"],
  114. "tool": "mkuboot",
  115. "config": ubootConfig,
  116. "nostrip": true
  117. };
  118. entries += binplace(uboot);
  119. return entries;
  120. }