build.ck 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 Runtime Core
  9. Abstract:
  10. This module implements the UEFI core runtime support, which only
  11. supports setting the virtual address map. It is implemented as a
  12. separate runtime binary to avoid the paradox of ExitBootServices
  13. and SetVirtualAddressMap trying to tear down or change themselves.
  14. Author:
  15. Evan Green 10-Mar-2014
  16. Environment:
  17. Firmware
  18. --*/
  19. from menv import executable, mconfig, uefiRuntimeFfs;
  20. function build() {
  21. var arch = mconfig.arch;
  22. var elf;
  23. var entries;
  24. var includes;
  25. var libs;
  26. var linkConfig;
  27. var sources;
  28. var sourcesConfig;
  29. sources = [
  30. "uefi/core:crc32.o",
  31. "runtime.c",
  32. ];
  33. libs = [
  34. "uefi/archlib:uefiarch"
  35. ];
  36. includes = [
  37. "$S/uefi/include",
  38. "$S/uefi/core"
  39. ];
  40. sourcesConfig = {
  41. "CFLAGS": ["-fshort-wchar"],
  42. };
  43. linkConfig = {
  44. "LDFLAGS": ["-pie", "-nostdlib", "-nodefaultlibs",
  45. "-nostartfiles", "-static"]
  46. };
  47. elf = {
  48. "label": "rtbase.elf",
  49. "inputs": sources + libs,
  50. "sources_config": sourcesConfig,
  51. "includes": includes,
  52. "entry": "EfiRuntimeDriverEntry",
  53. "config": linkConfig
  54. };
  55. if ((arch == "armv7") || (arch == "armv6")) {
  56. elf["linker_script"] = "$S/uefi/include/link_arm.x";
  57. }
  58. entries = executable(elf);
  59. entries += uefiRuntimeFfs("rtbase");
  60. return entries;
  61. }