Makefile 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. ################################################################################
  2. #
  3. # Copyright (c) 2015 Minoca Corp.
  4. #
  5. # This file is licensed under the terms of the GNU General Public License
  6. # version 3. Alternative licensing terms are available. Contact
  7. # info@minocacorp.com for details. See the LICENSE file at the root of this
  8. # project for complete licensing information.
  9. #
  10. # Binary Name:
  11. #
  12. # Images
  13. #
  14. # Abstract:
  15. #
  16. # This module builds the final OS images.
  17. #
  18. # Author:
  19. #
  20. # Evan Green 26-Oct-2015
  21. #
  22. # Environment:
  23. #
  24. # Build
  25. #
  26. ################################################################################
  27. include $(SRCROOT)/os/minoca.mk
  28. VPATH += $(BINROOT):
  29. INSTALL_IMAGE := $(BINROOT)/install.img
  30. IMAGES = $(INSTALL_IMAGE)
  31. ifneq ($(DEBUG),rel)
  32. MSETUP_DEBUG := -D
  33. endif
  34. MSETUP := msetup
  35. MSETUP_IMAGE_SIZE := -G1024M
  36. MSETUP_TINY_IMAGE_SIZE := -G30M
  37. ##
  38. ## Build x86 images.
  39. ##
  40. ifeq (x86, $(ARCH)$(VARIANT))
  41. IMAGES += $(BINROOT)/pc.img \
  42. $(BINROOT)/pcefi.img \
  43. $(BINROOT)/pctiny.img \
  44. $(INSTALL_IMAGE): $(LAST_UPDATE_FILE)
  45. @echo Building - $(notdir $@)
  46. @mkdir -p $(BINROOT)/apps
  47. @cd $(BINROOT) && $(MSETUP) -ql install-x86 -i.. -d $@ -a0 \
  48. $(MSETUP_IMAGE_SIZE)
  49. $(BINROOT)/pc.img: $(INSTALL_IMAGE)
  50. @echo Building - $(notdir $@)
  51. @cd $(BINROOT) && $(MSETUP) -ql pc32 -i $< $(MSETUP_DEBUG) -d $@ -a0 \
  52. $(MSETUP_IMAGE_SIZE)
  53. $(BINROOT)/pcefi.img: $(INSTALL_IMAGE)
  54. @echo Building - $(notdir $@)
  55. @cd $(BINROOT) && $(MSETUP) -ql pc32efi -i $< $(MSETUP_DEBUG) -d $@ -a0 \
  56. $(MSETUP_IMAGE_SIZE)
  57. $(BINROOT)/pctiny.img: $(INSTALL_IMAGE)
  58. @echo Building - $(notdir $@)
  59. @cd $(BINROOT) && $(MSETUP) -ql pc32-tiny -i $< $(MSETUP_DEBUG) -d $@ -a0 \
  60. $(MSETUP_TINY_IMAGE_SIZE)
  61. endif
  62. ##
  63. ## Build x64 images.
  64. ##
  65. ifeq (x64, $(ARCH)$(VARIANT))
  66. IMAGES += $(BINROOT)/pc.img \
  67. $(BINROOT)/pcefi.img \
  68. $(BINROOT)/pctiny.img \
  69. $(INSTALL_IMAGE): $(LAST_UPDATE_FILE)
  70. @echo Building - $(notdir $@)
  71. @mkdir -p $(BINROOT)/apps
  72. @cd $(BINROOT) && $(MSETUP) -ql install-x64 -i.. -d $@ -a0 \
  73. $(MSETUP_IMAGE_SIZE)
  74. $(BINROOT)/pc.img: $(INSTALL_IMAGE)
  75. @echo Building - $(notdir $@)
  76. @cd $(BINROOT) && $(MSETUP) -ql pc64 -i $< $(MSETUP_DEBUG) -d $@ -a0 \
  77. $(MSETUP_IMAGE_SIZE)
  78. $(BINROOT)/pcefi.img: $(INSTALL_IMAGE)
  79. @echo Building - $(notdir $@)
  80. @cd $(BINROOT) && $(MSETUP) -ql pc64efi -i $< $(MSETUP_DEBUG) -d $@ -a0 \
  81. $(MSETUP_IMAGE_SIZE)
  82. $(BINROOT)/pctiny.img: $(INSTALL_IMAGE)
  83. @echo Building - $(notdir $@)
  84. @cd $(BINROOT) && $(MSETUP) -ql pc64-tiny -i $< $(MSETUP_DEBUG) -d $@ -a0 \
  85. $(MSETUP_TINY_IMAGE_SIZE)
  86. endif
  87. ##
  88. ## Build x86 Quark images. Debugging is currently disabled on Galileo since the
  89. ## headphones UART is used for the console.
  90. ##
  91. ifeq (x86q, $(ARCH)$(VARIANT))
  92. IMAGES += $(BINROOT)/galileo.img
  93. $(INSTALL_IMAGE): $(LAST_UPDATE_FILE)
  94. @echo Building - $(notdir $@)
  95. @mkdir -p $(BINROOT)/apps
  96. @cd $(BINROOT) && $(MSETUP) -ql install-x86 -i.. -d $@ -a0 \
  97. $(MSETUP_IMAGE_SIZE)
  98. $(BINROOT)/galileo.img: $(INSTALL_IMAGE)
  99. @echo Building - $(notdir $@)
  100. @cd $(BINROOT) && $(MSETUP) -ql galileo -i $< -d $@ -a0 \
  101. $(MSETUP_IMAGE_SIZE)
  102. endif
  103. ##
  104. ## Build ARMv7 images.
  105. ##
  106. ifeq (armv7, $(ARCH))
  107. IMAGES += $(BINROOT)/bbone.img \
  108. $(BINROOT)/integ.img \
  109. $(BINROOT)/integrd.img \
  110. $(BINROOT)/panda.img \
  111. $(BINROOT)/pandausb.img \
  112. $(BINROOT)/rpi2.img \
  113. $(BINROOT)/veyron.img \
  114. $(INSTALL_IMAGE): $(LAST_UPDATE_FILE)
  115. @echo Building - $(notdir $@)
  116. @mkdir -p $(BINROOT)/apps
  117. @cd $(BINROOT) && $(MSETUP) -ql install-armv7 -i.. -d $@ -a0 \
  118. $(MSETUP_IMAGE_SIZE)
  119. $(BINROOT)/bbone.img: $(INSTALL_IMAGE)
  120. @echo Building - $(notdir $@)
  121. @cd $(BINROOT) && $(MSETUP) -ql beagleboneblack -i $< $(MSETUP_DEBUG) \
  122. -d $@ -a0 $(MSETUP_IMAGE_SIZE)
  123. $(BINROOT)/integ.img: $(BINROOT)/integrd.img
  124. @echo Building - $(notdir $@)
  125. @cp $^ $(OBJROOT)/os/uefi/plat/integcp/ramdisk
  126. @cd $(SRCROOT)/os/uefi/plat/integcp && \
  127. $(MAKE) BINARY=integ.img SRCDIR=$(SRCROOT)/os/uefi/plat/integcp
  128. $(BINROOT)/integrd.img: $(INSTALL_IMAGE)
  129. @echo Building - $(notdir $@)
  130. @cd $(BINROOT) && $(MSETUP) -ql integrd -i $< $(MSETUP_DEBUG) -d $@ -a0 \
  131. $(MSETUP_TINY_IMAGE_SIZE)
  132. $(BINROOT)/panda.img: $(INSTALL_IMAGE)
  133. @echo Building - $(notdir $@)
  134. @cd $(BINROOT) && $(MSETUP) -ql panda -i $< $(MSETUP_DEBUG) -d $@ -a0 \
  135. $(MSETUP_IMAGE_SIZE)
  136. $(BINROOT)/pandausb.img: $(BINROOT)/pandard.img
  137. @echo Building - $(notdir $@)
  138. @cp $^ $(OBJROOT)/os/uefi/plat/panda/ramdisk
  139. @cd $(SRCROOT)/os/uefi/plat/panda && \
  140. $(MAKE) BINARY=pandafw_usb.elf SRCDIR=$(SRCROOT)/os/uefi/plat/panda
  141. $(BINROOT)/pandard.img: $(INSTALL_IMAGE)
  142. @echo Building - $(notdir $@)
  143. @cd $(BINROOT) && $(MSETUP) -ql panda-usb -i $< $(MSETUP_DEBUG) -d $@ -a0 \
  144. $(MSETUP_TINY_IMAGE_SIZE)
  145. $(BINROOT)/rpi2.img: $(INSTALL_IMAGE)
  146. @echo Building - $(notdir $@)
  147. @cd $(BINROOT) && $(MSETUP) -ql raspberrypi2 -i $< $(MSETUP_DEBUG) -d $@ \
  148. -a0 $(MSETUP_IMAGE_SIZE)
  149. $(BINROOT)/veyron.img: $(INSTALL_IMAGE)
  150. @echo Building - $(notdir $@)
  151. @cd $(BINROOT) && $(MSETUP) -ql veyron -i $< $(MSETUP_DEBUG) -d $@ -a0 \
  152. $(MSETUP_IMAGE_SIZE)
  153. endif
  154. ##
  155. ## Build ARMv6 images.
  156. ##
  157. ifeq (armv6, $(ARCH))
  158. IMAGES += $(BINROOT)/rpi.img \
  159. $(INSTALL_IMAGE): $(LAST_UPDATE_FILE)
  160. @echo Building - $(notdir $@)
  161. @mkdir -p $(BINROOT)/apps
  162. @cd $(BINROOT) && $(MSETUP) -ql install-armv6 -i.. -d $@ -a0 \
  163. $(MSETUP_IMAGE_SIZE)
  164. $(BINROOT)/rpi.img: $(INSTALL_IMAGE)
  165. @echo Building - $(notdir $@)
  166. @cd $(BINROOT) && $(MSETUP) -ql raspberrypi -i $< $(MSETUP_DEBUG) -d $@ \
  167. -a0 $(MSETUP_IMAGE_SIZE)
  168. endif
  169. all: $(IMAGES)
  170. clean: images-clean
  171. .PHONY: images-clean
  172. images-clean:
  173. rm -f $(IMAGES)