Makefile 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. ################################################################################
  2. #
  3. # Copyright (c) 2015 Minoca Corp. All Rights Reserved
  4. #
  5. # Module Name:
  6. #
  7. # Veyron UEFI Firmware
  8. #
  9. # Abstract:
  10. #
  11. # This module implements UEFI firmware for the ASUS C201 (Veyron) SoC.
  12. #
  13. # Author:
  14. #
  15. # Chris Stevens 6-Jul-2015
  16. #
  17. # Environment:
  18. #
  19. # Firmware
  20. #
  21. ################################################################################
  22. include $(SRCDIR)/../common
  23. BINARY := veyronfw.elf
  24. BINARYTYPE = staticapp
  25. BINPLACE = bin
  26. VPATH += $(BINROOT):
  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. intr.o \
  33. main.o \
  34. memmap.o \
  35. ramdenum.o \
  36. $(RAMDISK_O) \
  37. sd.o \
  38. serial.o \
  39. smbios.o \
  40. smp.o \
  41. timer.o \
  42. usb.o \
  43. veyronfwv.o \
  44. video.o \
  45. ARMV7_OBJS = armv7/entry.o \
  46. armv7/minttbl.o \
  47. armv7/smpa.o \
  48. TEXT_ADDRESS = 0x020000A4
  49. TARGETLIBS += $(OBJROOT)/os/uefi/dev/gic/gic.a \
  50. $(OBJROOT)/os/uefi/dev/ns16550/ns16550.a \
  51. $(OBJROOT)/os/uefi/dev/sd/core/sd.a \
  52. $(OBJROOT)/os/uefi/dev/sd/dwc/sddwc.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), veyronfw.elf)
  59. RAMDISK_O = emptyrd.o
  60. DIRS = acpi \
  61. fwbuild \
  62. runtime \
  63. endif
  64. include $(SRCROOT)/os/minoca.mk
  65. CFLAGS += -fshort-wchar
  66. ##
  67. ## Don't bother to page align data since the text segment is loaded at a
  68. ## specific and unaligned place.
  69. ##
  70. EXTRA_LDFLAGS += -Wl,--nmagic
  71. KEYBLOCK = $(SRCROOT)/os/uefi/plat/veyron/veyron.kbk
  72. PRIVATE_KEY = $(SRCROOT)/os/uefi/plat/veyron/veyron.pem
  73. ##
  74. ## Define the target that creates the firmware volume object file.
  75. ##
  76. FWVOL_IMAGES = $(RTBASE) runtime/veyronrt.ffs acpi/acpi.ffs
  77. veyronfwv.o: veyronfwv
  78. @echo Objectifying - $(notdir $<)
  79. @$(OBJCOPY) -B $(BFD_ARCH) -I binary -O $(OBJ_FORMAT) $< $@
  80. veyronfwv: $(FWVOL_IMAGES)
  81. @echo Generating - $@
  82. @genfv -o $@ $^
  83. $(RAMDISK_O): $(RAMDISK)
  84. @echo Objectifying - $(notdir $<)
  85. @cp $^ ramdisk
  86. @$(OBJCOPY) -I binary -O $(OBJ_FORMAT) -B $(BFD_ARCH) ramdisk $@
  87. emptyrd:
  88. @echo Minoca > $@
  89. runtime/veyronrt.ffs: runtime
  90. acpi/acpi.ffs: acpi
  91. ##
  92. ## Handle any post build steps to fix up the firmware images.
  93. ##
  94. postbuild: veyronfw
  95. veyronfw: veyronfw.img | fwbuild
  96. @echo Generating - $@
  97. @fwbuild/veyrnfwb $(TEXT_ADDRESS) $(KEYBLOCK) $(PRIVATE_KEY) $^ $@
  98. @cp -p $@ $(BINROOT)/
  99. veyronfw.img: veyronfw.bin
  100. @echo Generating - $@
  101. @mkuboot -c -l $(TEXT_ADDRESS) -e $(TEXT_ADDRESS) -a arm -f fit -o $@ $^
  102. veyronfw.bin: $(BINARY)
  103. @echo Flattening - $(notdir $<)
  104. @$(OBJCOPY) -O binary $^ $@