build.ck 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. /*++
  2. Copyright (c) 2015 Minoca Corp. All Rights Reserved
  3. Module Name:
  4. Veyron UEFI Firmware
  5. Abstract:
  6. This module implements UEFI firmware for the ASUS C201 (Veyron Speedy) on
  7. the RK3288 SoC.
  8. Author:
  9. Chris Stevens 6-Jul-2015
  10. Environment:
  11. Firmware
  12. --*/
  13. function build() {
  14. plat = "veyron";
  15. text_address = "0x020000A4";
  16. sources = [
  17. "armv7/entry.S",
  18. "armv7/minttbl.S",
  19. "armv7/smpa.S",
  20. "debug.c",
  21. "fwvol.c",
  22. "intr.c",
  23. "main.c",
  24. "memmap.c",
  25. "ramdenum.c",
  26. "sd.c",
  27. "serial.c",
  28. "smbios.c",
  29. "smp.c",
  30. "timer.c",
  31. "usb.c",
  32. ":" + plat + "fwv.o",
  33. "video.c"
  34. ];
  35. includes = [
  36. "$//uefi/include"
  37. ];
  38. sources_config = {
  39. "CFLAGS": ["-fshort-wchar"]
  40. };
  41. //
  42. // Don't bother to page align data since the text segment is loaded at a
  43. // specific and unaligned place (hence the nmagic).
  44. //
  45. link_ldflags = [
  46. "-nostdlib",
  47. "-Wl,--no-wchar-size-warning",
  48. "-static",
  49. "-Wl,--nmagic"
  50. ];
  51. link_config = {
  52. "LDFLAGS": link_ldflags
  53. };
  54. common_libs = [
  55. "//uefi/core:ueficore",
  56. "//kernel/kd:kdboot",
  57. "//uefi/core:ueficore",
  58. "//uefi/archlib:uefiarch",
  59. "//lib/fatlib:fat",
  60. "//lib/basevid:basevid",
  61. "//lib/rtl/base:basertlb",
  62. "//kernel/kd/kdusb:kdnousb",
  63. "//kernel:archboot",
  64. "//uefi/core:emptyrd",
  65. ];
  66. libs = [
  67. "//uefi/dev/gic:gic",
  68. "//uefi/dev/ns16550:ns16550",
  69. "//uefi/dev/sd/dwc:sddwc",
  70. "//uefi/dev/sd/core:sd"
  71. ];
  72. libs += common_libs;
  73. platfw = plat + "fw";
  74. elf = {
  75. "label": platfw + ".elf",
  76. "inputs": sources + libs,
  77. "sources_config": sources_config,
  78. "includes": includes,
  79. "config": link_config
  80. };
  81. entries = executable(elf);
  82. //
  83. // Build the firmware volume.
  84. //
  85. ffs = [
  86. "//uefi/core/runtime:rtbase.ffs",
  87. "//uefi/plat/" + plat + "/runtime:" + plat + "rt.ffs",
  88. "//uefi/plat/" + plat + "/acpi:acpi.ffs"
  89. ];
  90. fw_volume = uefi_fwvol_o(plat, ffs);
  91. entries += fw_volume;
  92. //
  93. // Flatten the firmware image, convert to U-boot, and run the firmware
  94. // build process on it.
  95. //
  96. flattened = {
  97. "label": platfw + ".bin",
  98. "inputs": [":" + platfw + ".elf"]
  99. };
  100. flattened = flattened_binary(flattened);
  101. entries += flattened;
  102. uboot_config = {
  103. "TEXT_ADDRESS": text_address,
  104. "MKUBOOT_FLAGS": "-c -a arm -f fit"
  105. };
  106. uboot_name = platfw + ".ubo";
  107. uboot = {
  108. "label": uboot_name,
  109. "inputs": [":" + platfw + ".bin"],
  110. "orderonly": ["//uefi/tools/mkuboot:mkuboot"],
  111. "tool": "mkuboot",
  112. "config": uboot_config
  113. };
  114. entries += [uboot];
  115. fwb_sources = [
  116. "veyron.kbk",
  117. "veyron.pem",
  118. ":" + uboot_name
  119. ];
  120. fwb_config = {
  121. "TEXT_ADDRESS": text_address
  122. };
  123. fwb = {
  124. "type": "target",
  125. "label": platfw,
  126. "inputs": fwb_sources,
  127. "implicit": ["//uefi/plat/veyron/fwbuild:veyrnfwb"],
  128. "config": fwb_config,
  129. "tool": "veyrnfwb",
  130. "nostrip": TRUE
  131. };
  132. entries += binplace(fwb);
  133. return entries;
  134. }
  135. return build();