build.ck 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /*++
  2. Copyright (c) 2014 Minoca Corp. All Rights Reserved
  3. Module Name:
  4. BeagleBone Stage 1 Loader
  5. Abstract:
  6. This module implements Texas Instruments AM335x first stage loader.
  7. Author:
  8. Evan Green 17-Dec-2014
  9. Environment:
  10. Firmware
  11. --*/
  12. function build() {
  13. text_address = "0x402F0408";
  14. sources = [
  15. "armv7/start.S",
  16. "boot.c",
  17. "clock.c",
  18. "//uefi/plat/panda/init:crc32.o",
  19. "//uefi/plat/panda/init:fatboot.o",
  20. "mux.c",
  21. "power.c",
  22. "serial.c",
  23. "//uefi/plat/panda/init:rommem.o"
  24. ];
  25. includes = [
  26. "$//uefi/include",
  27. "$//uefi/plat/panda/init"
  28. ];
  29. link_ldflags = [
  30. "-nostdlib",
  31. "-static"
  32. ];
  33. link_config = {
  34. "LDFLAGS": link_ldflags
  35. };
  36. elf = {
  37. "label": "bbonemlo.elf",
  38. "inputs": sources,
  39. "includes": includes,
  40. "linker_script": "$//uefi/plat/panda/init/link.x",
  41. "text_address": text_address,
  42. "config": link_config
  43. };
  44. entries = executable(elf);
  45. //
  46. // Flatten the firmware image and add the TI header.
  47. //
  48. flattened = {
  49. "label": "bbonemlo.bin",
  50. "inputs": [":bbonemlo.elf"]
  51. };
  52. flattened = flattened_binary(flattened);
  53. entries += flattened;
  54. bbonefwb_tool = {
  55. "type": "tool",
  56. "name": "bbonefwb",
  57. "command": "$^//uefi/plat/beagbone/init/fwbuild $TEXT_ADDRESS $IN $OUT",
  58. "description": "Building BeagleBone Firmware - $OUT"
  59. };
  60. entries += [bbonefwb_tool];
  61. bbonefwb = {
  62. "type": "target",
  63. "label": "bbonemlo",
  64. "tool": "bbonefwb",
  65. "inputs": [":bbonemlo.bin"],
  66. "implicit": [":fwbuild"],
  67. "config": {"TEXT_ADDRESS": text_address},
  68. "nostrip": TRUE
  69. };
  70. entries += binplace(bbonefwb);
  71. //
  72. // Add the firmware builder tool.
  73. //
  74. builder_sources = [
  75. "bbonefwb/fwbuild.c"
  76. ];
  77. builder_app = {
  78. "label": "fwbuild",
  79. "inputs": builder_sources,
  80. "build": TRUE
  81. };
  82. entries += application(builder_app);
  83. return entries;
  84. }
  85. return build();