build.ck 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. /*++
  2. Copyright (c) 2012 Minoca Corp. All Rights Reserved
  3. Module Name:
  4. Kernel
  5. Abstract:
  6. This is the core of the operating system.
  7. Author:
  8. Evan Green 26-Jul-2012
  9. Environment:
  10. Kernel
  11. --*/
  12. function build() {
  13. base_sources = [
  14. "init.c"
  15. ];
  16. boot_arch_sources = [];
  17. if ((arch == "armv7") || (arch == "armv6")) {
  18. arm_sources = [
  19. "armv7/commsup.S",
  20. "armv7/inttable.S",
  21. "armv7/prochw.c",
  22. "armv7/sstep.c",
  23. "armv7/trap.S",
  24. "armv7/vfp.c"
  25. ];
  26. boot_arch_sources = [":armv7/sstep.o"];
  27. if (arch == "armv7") {
  28. arch_sources = arm_sources + [
  29. "armv7/archsup.S",
  30. "armv7/archsupc.c"
  31. ];
  32. } else {
  33. arch_sources = arm_sources + [
  34. "armv6/archsup.S",
  35. "armv6/archsupc.c"
  36. ];
  37. }
  38. } else if (arch == "x86") {
  39. arch_sources = [
  40. "x86/archsup.S",
  41. "x86/archsupc.c",
  42. "x86/prochw.c",
  43. "x86/trap.S"
  44. ];
  45. }
  46. kernel_libs = [
  47. "//kernel/acpi:acpi",
  48. "//lib/crypto:crypto",
  49. "//kernel/ob:ob",
  50. "//lib/rtl/base:basertl",
  51. "//lib/rtl/kmode:krtl",
  52. "//lib/im:im",
  53. "//lib/basevid:basevid",
  54. "//lib/termlib:termlib",
  55. "//kernel/kd:kd",
  56. "//kernel/kd/kdusb:kdusb",
  57. "//kernel/ps:ps",
  58. "//kernel/ke:ke",
  59. "//kernel/io:io",
  60. "//kernel/hl:hl",
  61. "//kernel/mm:mm",
  62. "//kernel/sp:sp"
  63. ];
  64. kernel_config = {
  65. "LDFLAGS": ["-Wl,--whole-archive"]
  66. };
  67. kernel = {
  68. "label": "kernel",
  69. "inputs": base_sources + arch_sources + kernel_libs,
  70. "implicit": [":kernel-version"],
  71. "entry": "KepStartSystem",
  72. "config": kernel_config
  73. };
  74. boot_arch_lib = {
  75. "label": "archboot",
  76. "inputs": boot_arch_sources
  77. };
  78. entries = driver(kernel);
  79. if (boot_arch_sources) {
  80. entries += static_library(boot_arch_lib);
  81. }
  82. //
  83. // Copy the config files.
  84. //
  85. entries += copy("config/dev2drv.set",
  86. binroot + "/dev2drv.set",
  87. "dev2drv.set",
  88. null,
  89. null);
  90. entries += copy("config/devmap.set",
  91. binroot + "/devmap.set",
  92. "devmap.set",
  93. null,
  94. null);
  95. entries += copy("config/init.set",
  96. binroot + "/init.set",
  97. "init.set",
  98. null,
  99. null);
  100. entries += copy("config/init.sh",
  101. binroot + "/init.sh",
  102. "init.sh",
  103. null,
  104. null);
  105. //
  106. // Create the version header.
  107. //
  108. version_major = "0";
  109. version_minor = "2";
  110. version_revision = "0";
  111. entries += create_version_header(version_major,
  112. version_minor,
  113. version_revision);
  114. //
  115. // Also create a version file in the binroot.
  116. //
  117. version_config = {
  118. "MAJOR": version_major,
  119. "MINOR": version_minor,
  120. "REVISION": version_revision,
  121. "FORM": "simple"
  122. };
  123. version_file = {
  124. "type": "target",
  125. "label": "kernel-version",
  126. "output": binroot + "/kernel-version",
  127. "tool": "gen_version",
  128. "config": version_config
  129. };
  130. entries += [version_file];
  131. return entries;
  132. }
  133. return build();