Makefile 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. ################################################################################
  2. #
  3. # Copyright (c) 2012 Minoca Corp. All Rights Reserved
  4. #
  5. # Module Name:
  6. #
  7. # PandaBoard UEFI Firmware
  8. #
  9. # Abstract:
  10. #
  11. # This module implements UEFI firmware for the TI PandaBoard.
  12. #
  13. # Author:
  14. #
  15. # Evan Green 26-Feb-2014
  16. #
  17. # Environment:
  18. #
  19. # Firmware
  20. #
  21. ################################################################################
  22. include $(SRCDIR)/../common
  23. BINARY := pandafw.elf
  24. BINARYTYPE = staticapp
  25. ifeq ($(BINARY), pandafw.elf)
  26. endif
  27. LDFLAGS += -Wl,--no-wchar-size-warning -nodefaultlibs -nostartfiles -nostdlib
  28. RAMDISK = emptyrd
  29. RAMDISK_O = ramdisk.o
  30. OBJS += debug.o \
  31. fwvol.o \
  32. init/id.o \
  33. intr.o \
  34. main.o \
  35. memmap.o \
  36. omap4usb.o \
  37. pandafwv.o \
  38. ramdenum.o \
  39. $(RAMDISK_O) \
  40. sd.o \
  41. serial.o \
  42. smbios.o \
  43. smp.o \
  44. timer.o \
  45. video.o \
  46. ARMV7_OBJS = armv7/entry.o \
  47. armv7/smpa.o \
  48. TEXT_ADDRESS = 0x82000000
  49. TARGETLIBS += $(OBJROOT)/os/uefi/dev/gic/gic.a \
  50. $(OBJROOT)/os/uefi/dev/sd/core/sd.a \
  51. $(OBJROOT)/os/uefi/dev/omap4/omap4.a \
  52. $(OBJROOT)/os/uefi/dev/omapuart/omapuart.a \
  53. EXTRA_SRC_DIRS = armv7
  54. ##
  55. ## Only build the directories if the binary hasn't been forced on the command
  56. ## line.
  57. ##
  58. ifeq ($(BINARY), pandafw.elf)
  59. BINPLACE = bin
  60. RAMDISK_O = emptyrd.o
  61. DIRS = acpi \
  62. init \
  63. runtime
  64. endif
  65. include $(SRCROOT)/os/minoca.mk
  66. CFLAGS += -fshort-wchar
  67. ##
  68. ## Define the target that creates the firmware volume object file.
  69. ##
  70. FWVOL_IMAGES = $(RTBASE) runtime/pandart.ffs acpi/acpi.ffs
  71. pandafwv.o: pandafwv
  72. @echo Objectifying - $(notdir $<)
  73. @$(OBJCOPY) -B $(BFD_ARCH) -I binary -O $(OBJ_FORMAT) $< $@
  74. pandafwv: $(FWVOL_IMAGES)
  75. @echo Generating - $@
  76. @genfv -o $@ $^
  77. $(RAMDISK_O): $(RAMDISK)
  78. @echo Objectifying - $(notdir $<)
  79. @cp $^ ramdisk
  80. @$(OBJCOPY) -I binary -O $(OBJ_FORMAT) -B $(BFD_ARCH) ramdisk $@
  81. emptyrd:
  82. @echo Minoca > $@
  83. runtime/pandart.ffs: runtime
  84. acpi/acpi.ffs: acpi
  85. ##
  86. ## Handle any post build steps to fix up the firmware images.
  87. ##
  88. ifeq ($(BINARY), pandafw.elf)
  89. postbuild: pandafw pandafw.bin
  90. pandafw: pandafw.bin
  91. @echo Generating - $@
  92. @mkuboot -c -a arm -f legacy -l $(TEXT_ADDRESS) -e $(TEXT_ADDRESS) -o $@ $^
  93. @cp -p $@ $(BINROOT)/
  94. pandafw.bin: $(BINARY)
  95. @echo Flattening - $(notdir $<)
  96. @$(OBJCOPY) -O binary $^ $@
  97. endif
  98. ifeq ($(BINARY), pandafw_usb.elf)
  99. postbuild: pandafw_usb pandafw_usb.bin
  100. pandafw_usb: pandafw_usb.bin
  101. @echo Generating - $@
  102. @mkuboot -c -a arm -f legacy -l $(TEXT_ADDRESS) -e $(TEXT_ADDRESS) -o $@ $^
  103. @cp -p $@ $(BINROOT)/pandausb.img
  104. pandafw_usb.bin: $(BINARY)
  105. @echo Flattening - $(notdir $<)
  106. @$(OBJCOPY) -O binary $^ $@
  107. endif
  108. ##
  109. ## Manually copy to binroot, since the binplace variable isn't set for the
  110. ## second iteration of the USB build. Setting it causes all images to be
  111. ## rebuilt every time.
  112. ##
  113. postbuild: $(BINARY)
  114. @cp -p $(BINARY) $(BINROOT)/