build.ck 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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. BIOS UEFI Firmware
  9. Abstract:
  10. This module implements a UEFI-compatible firmware layer on top of a
  11. legacy PC/AT BIOS.
  12. Author:
  13. Evan Green 26-Feb-2014
  14. Environment:
  15. Firmware
  16. --*/
  17. from menv import executable, uefiFwvol, flattenedBinary;
  18. function build() {
  19. var commonLibs;
  20. var elf;
  21. var entries;
  22. var ffs;
  23. var flattened;
  24. var fwVolume;
  25. var includes;
  26. var libs;
  27. var linkConfig;
  28. var linkLdflags;
  29. var plat = "bios";
  30. var platfw;
  31. var sources;
  32. var sourcesConfig;
  33. var textAddress = "0x100000";
  34. sources = [
  35. "acpi.c",
  36. "bioscall.c",
  37. ":" + plat + "fwv.o",
  38. "disk.c",
  39. "debug.c",
  40. "fwvol.c",
  41. "intr.c",
  42. "main.c",
  43. "memmap.c",
  44. "timer.c",
  45. "video.c",
  46. "x86/entry.S",
  47. "x86/realmexe.S"
  48. ];
  49. includes = [
  50. "$S/uefi/include"
  51. ];
  52. sourcesConfig = {
  53. "CFLAGS": ["-fshort-wchar"]
  54. };
  55. linkLdflags = [
  56. "-nostdlib",
  57. "-static"
  58. ];
  59. linkConfig = {
  60. "LDFLAGS": linkLdflags
  61. };
  62. commonLibs = [
  63. "uefi/core:ueficore",
  64. "kernel/kd:kdboot",
  65. "uefi/core:ueficore",
  66. "uefi/archlib:uefiarch",
  67. "lib/fatlib:fat",
  68. "lib/basevid:basevid",
  69. "lib/rtl/base:basertlb",
  70. "kernel/kd/kdusb:kdnousb",
  71. "uefi/core:emptyrd",
  72. ];
  73. libs = [
  74. "uefi/dev/ns16550:ns16550"
  75. ];
  76. libs += commonLibs;
  77. platfw = plat + "fw";
  78. elf = {
  79. "label": platfw + ".elf",
  80. "inputs": sources + libs,
  81. "sources_config": sourcesConfig,
  82. "includes": includes,
  83. "config": linkConfig
  84. };
  85. entries = executable(elf);
  86. //
  87. // Build the firmware volume.
  88. //
  89. ffs = [
  90. "uefi/core/runtime:rtbase.ffs",
  91. "uefi/plat/bios/runtime:" + plat + "rt.ffs"
  92. ];
  93. fwVolume = uefiFwvol("uefi/plat/bios", plat, ffs);
  94. entries += fwVolume;
  95. flattened = {
  96. "label": platfw,
  97. "inputs": [":" + platfw + ".elf"]
  98. };
  99. flattened = flattenedBinary(flattened);
  100. entries += flattened;
  101. return entries;
  102. }