build.ck 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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. UEFI Core
  9. Abstract:
  10. This file is responsible for building the core UEFI support. This is a
  11. library containing the bulk of the UEFI interfaces, which platform
  12. specific images include into their boot image.
  13. Author:
  14. Evan Green 26-Feb-2014
  15. Environment:
  16. Firmware
  17. --*/
  18. from menv import addConfig, createVersionHeader, mconfig, kernelLibrary;
  19. function build() {
  20. var arch = mconfig.arch;
  21. var armSources;
  22. var baseSources;
  23. var emptyrdLib;
  24. var entries;
  25. var fwCoreVersionMajor;
  26. var fwCoreVersionMinor;
  27. var fwCoreVersionRevision;
  28. var includes;
  29. var lib;
  30. var sources;
  31. var sourcesConfig;
  32. var x86_sources;
  33. baseSources = [
  34. "acpi.c",
  35. "acpitabs.c",
  36. "basepe.c",
  37. "bdsboot.c",
  38. "bdscon.c",
  39. "bdsentry.c",
  40. "bdsutil.c",
  41. "cfgtable.c",
  42. "crc32.c",
  43. "dbgser.c",
  44. "devpathu.c",
  45. "diskio.c",
  46. "dispatch.c",
  47. "div.c",
  48. "drvsup.c",
  49. "event.c",
  50. "fatdev.c",
  51. "fatfs.c",
  52. "fsvars.c",
  53. "fvblock.c",
  54. "fvsect.c",
  55. "fwvol.c",
  56. "fwvolio.c",
  57. "handle.c",
  58. "image.c",
  59. "init.c",
  60. "intr.c",
  61. "locate.c",
  62. "lock.c",
  63. "memory.c",
  64. "part.c",
  65. "partelto.c",
  66. "partgpt.c",
  67. "partmbr.c",
  68. "pool.c",
  69. "ramdisk.c",
  70. "smbios.c",
  71. "stubs.c",
  72. "tpl.c",
  73. "timer.c",
  74. "util.c",
  75. "version.c",
  76. "vidcon.c",
  77. ];
  78. x86_sources = [
  79. "x86/archsup.S",
  80. "x86/prochw.c"
  81. ];
  82. armSources = [
  83. "armv7/commsup.S",
  84. "armv7/inttable.S",
  85. "armv7/prochw.c"
  86. ];
  87. if ((arch == "armv6") || (arch == "armv7")) {
  88. sources = baseSources + armSources;
  89. } else if (arch == "x86") {
  90. sources = baseSources + x86_sources;
  91. } else {
  92. Core.raise(ValueError("Unknown architecture"));
  93. }
  94. includes = [
  95. "$S/uefi/include",
  96. "$S/uefi/core"
  97. ];
  98. sourcesConfig = {
  99. "CFLAGS": ["-fshort-wchar"],
  100. };
  101. //
  102. // Create the version.h header.
  103. //
  104. fwCoreVersionMajor = "1";
  105. fwCoreVersionMinor = "0";
  106. fwCoreVersionRevision = "0";
  107. entries = createVersionHeader(fwCoreVersionMajor,
  108. fwCoreVersionMinor,
  109. fwCoreVersionRevision);
  110. lib = {
  111. "label": "ueficore",
  112. "inputs": sources,
  113. "sources_config": sourcesConfig,
  114. "includes": includes
  115. };
  116. emptyrdLib = {
  117. "label": "emptyrd",
  118. "inputs": ["emptyrd/emptyrd.S"]
  119. };
  120. entries += kernelLibrary(lib);
  121. //
  122. // Add the include and dependency for version.c.
  123. //
  124. for (entry in entries) {
  125. if (entry["output"] == "version.o") {
  126. addConfig(entry, "CPPFLAGS", "-I$O/uefi/core");
  127. entry["implicit"] = [":version.h"];
  128. break;
  129. }
  130. }
  131. entries += kernelLibrary(emptyrdLib);
  132. return entries;
  133. }