build.ck 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. /*++
  2. Copyright (c) 2013 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. Images
  9. Abstract:
  10. This module builds the final OS images.
  11. Author:
  12. Evan Green 26-Oct-2015
  13. Environment:
  14. Build
  15. --*/
  16. from menv import group, mconfig;
  17. function buildImage(name, msetupFlags) {
  18. var entry;
  19. var installDeps;
  20. installDeps = [
  21. "apps:all_apps",
  22. "apps/posix:skel",
  23. "apps/tzcomp:tz_files",
  24. "kernel:kernel",
  25. "kernel:devmap.set",
  26. "kernel:dev2drv.set",
  27. "kernel:init.set",
  28. "kernel:init.sh",
  29. "boot:boot_apps",
  30. "drivers:drivers",
  31. "uefi:platfw",
  32. "apps/setup:build_msetup"
  33. ];
  34. entry = {
  35. "type": "target",
  36. "tool": "msetup_image",
  37. "label": name,
  38. "output": mconfig.binroot + "/" + name,
  39. "implicit": installDeps,
  40. "config": {"MSETUP_FLAGS": msetupFlags}
  41. };
  42. if (name != "install.img") {
  43. entry["inputs"] = [":install.img"];
  44. }
  45. return [entry];
  46. }
  47. function build() {
  48. var arch = mconfig.arch;
  49. var commonImageFlags;
  50. var entries;
  51. var flags;
  52. var imageSize = "-G512M";
  53. var installFlags;
  54. var ramdiskImages;
  55. var tinyImageSize = "-G30M";
  56. var variant = mconfig.variant;
  57. commonImageFlags = [
  58. "-q",
  59. "-a0"
  60. ];
  61. if (mconfig.debug == "dbg") {
  62. commonImageFlags += ["-D"];
  63. }
  64. installFlags = commonImageFlags + [
  65. "-linstall-" + arch,
  66. "-i" + mconfig.outroot,
  67. imageSize,
  68. ];
  69. commonImageFlags += [
  70. "-i" + mconfig.binroot + "/install.img"
  71. ];
  72. entries = buildImage("install.img", installFlags);
  73. if (arch == "x86") {
  74. if (variant == "q") {
  75. flags = commonImageFlags + [
  76. "-lgalileo",
  77. imageSize
  78. ];
  79. entries += buildImage("galileo.img", flags);
  80. } else {
  81. flags = commonImageFlags + [
  82. "-lpc32",
  83. imageSize
  84. ];
  85. entries += buildImage("pc.img", flags);
  86. flags = commonImageFlags + [
  87. "-lpc32efi",
  88. imageSize
  89. ];
  90. entries += buildImage("pcefi.img", flags);
  91. flags = commonImageFlags + [
  92. "-lpc32-tiny",
  93. tinyImageSize
  94. ];
  95. entries += buildImage("pctiny.img", flags);
  96. }
  97. } else if (arch == "x64") {
  98. flags = commonImageFlags + [
  99. "-lpc64",
  100. imageSize
  101. ];
  102. entries += buildImage("pc.img", flags);
  103. flags = commonImageFlags + [
  104. "-lpc64efi",
  105. imageSize
  106. ];
  107. entries += buildImage("pcefi.img", flags);
  108. flags = commonImageFlags + [
  109. "-lpc64-tiny",
  110. tinyImageSize
  111. ];
  112. entries += buildImage("pctiny.img", flags);
  113. } else if (arch == "armv7") {
  114. flags = commonImageFlags + [imageSize];
  115. entries += buildImage("bbone.img", flags + ["-lbeagleboneblack"]);
  116. entries += buildImage("panda.img", flags + ["-lpanda"]);
  117. entries += buildImage("rpi2.img", flags + ["-lraspberrypi2"]);
  118. entries += buildImage("veyron.img", flags + ["-lveyron"]);
  119. ramdiskImages = [
  120. "uefi/plat/integcp:integ.img",
  121. "uefi/plat/panda:pandausb.img"
  122. ];
  123. entries += group("ramdisk_images", ramdiskImages);
  124. } else if (arch == "armv6") {
  125. flags = commonImageFlags + [
  126. imageSize,
  127. "-lraspberrypi"
  128. ];
  129. entries += buildImage("rpi.img", flags + ["-lraspberrypi"]);
  130. }
  131. return entries;
  132. }