build.ck 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. Master Boot Record
  9. Abstract:
  10. This module implements the Master Boot Record that is installed at
  11. sector 0 of PC/AT disks.
  12. Author:
  13. Evan Green 4-Feb-2014
  14. Environment:
  15. Boot
  16. --*/
  17. from menv import staticApplication, flattenedBinary;
  18. function build() {
  19. var entries;
  20. var flattened;
  21. var image;
  22. var linkConfig;
  23. var sources;
  24. sources = [
  25. "mbr.S"
  26. ];
  27. linkConfig = {
  28. "LDFLAGS": ["-Wl,-zmax-page-size=1"]
  29. };
  30. image = {
  31. "label": "mbr.elf",
  32. "inputs": sources,
  33. "config": linkConfig,
  34. "text_address": "0x600",
  35. };
  36. entries = staticApplication(image);
  37. //
  38. // Flatten the binary so it can be written directly to disk and loaded by
  39. // the BIOS.
  40. //
  41. flattened = {
  42. "label": "mbr.bin",
  43. "inputs": [":mbr.elf"],
  44. "binplace": "bin",
  45. "nostrip": true
  46. };
  47. flattened = flattenedBinary(flattened);
  48. entries += flattened;
  49. return entries;
  50. }