build.ck 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /*++
  2. Copyright (c) 2014 Minoca Corp. All Rights Reserved
  3. Module Name:
  4. BeagleBone UEFI Firmware
  5. Abstract:
  6. This module implements UEFI firmware for the TI BeagleBone Black.
  7. Author:
  8. Evan Green 19-Dec-2014
  9. Environment:
  10. Firmware
  11. --*/
  12. function build() {
  13. plat = "bbone";
  14. text_address = "0x82000000";
  15. sources = [
  16. "armv7/entry.S",
  17. "clock.c",
  18. "debug.c",
  19. "fwvol.c",
  20. "i2c.c",
  21. "intr.c",
  22. "main.c",
  23. "memmap.c",
  24. ":" + plat + "fwv.o",
  25. "ramdenum.c",
  26. "sd.c",
  27. "serial.c",
  28. "smbios.c",
  29. "timer.c",
  30. "video.c"
  31. ];
  32. includes = [
  33. "$//uefi/include"
  34. ];
  35. sources_config = {
  36. "CFLAGS": ["-fshort-wchar"]
  37. };
  38. link_ldflags = [
  39. "-nostdlib",
  40. "-Wl,--no-wchar-size-warning",
  41. "-static"
  42. ];
  43. link_config = {
  44. "LDFLAGS": link_ldflags
  45. };
  46. common_libs = [
  47. "//uefi/core:ueficore",
  48. "//kernel/kd:kdboot",
  49. "//uefi/core:ueficore",
  50. "//uefi/archlib:uefiarch",
  51. "//lib/fatlib:fat",
  52. "//lib/basevid:basevid",
  53. "//lib/rtl/base:basertlb",
  54. "//kernel/kd/kdusb:kdnousb",
  55. "//kernel:archboot",
  56. "//uefi/core:emptyrd",
  57. ];
  58. libs = common_libs + [
  59. "//uefi/dev/sd/core:sd",
  60. "//uefi/dev/omapuart:omapuart"
  61. ];
  62. platfw = plat + "fw";
  63. elf = {
  64. "label": platfw + ".elf",
  65. "inputs": sources + libs,
  66. "sources_config": sources_config,
  67. "includes": includes,
  68. "config": link_config
  69. };
  70. entries = executable(elf);
  71. //
  72. // Build the firmware volume.
  73. //
  74. ffs = [
  75. "//uefi/core/runtime:rtbase.ffs",
  76. "//uefi/plat/beagbone/runtime:" + plat + "rt.ffs",
  77. "//uefi/plat/beagbone/acpi:acpi.ffs"
  78. ];
  79. fw_volume = uefi_fwvol_o(plat, ffs);
  80. entries += fw_volume;
  81. //
  82. // Flatten the firmware image and convert to u-boot.
  83. //
  84. flattened = {
  85. "label": platfw + ".bin",
  86. "inputs": [":" + platfw + ".elf"]
  87. };
  88. flattened = flattened_binary(flattened);
  89. entries += flattened;
  90. uboot_config = {
  91. "TEXT_ADDRESS": text_address,
  92. "MKUBOOT_FLAGS": "-c -a arm -f legacy"
  93. };
  94. uboot = {
  95. "label": platfw,
  96. "inputs": [":" + platfw + ".bin"],
  97. "orderonly": ["//uefi/tools/mkuboot:mkuboot"],
  98. "tool": "mkuboot",
  99. "config": uboot_config,
  100. "nostrip": TRUE
  101. };
  102. entries += binplace(uboot);
  103. return entries;
  104. }
  105. return build();