Makefile 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. # This file is part of the OpenADK project. OpenADK is copyrighted
  2. # material, please see the LICENCE file in the top-level directory.
  3. include $(ADK_TOPDIR)/rules.mk
  4. include $(ADK_TOPDIR)/mk/kernel.mk
  5. include $(ADK_TOPDIR)/mk/modules.mk
  6. include $(ADK_TOPDIR)/mk/kernel-build.mk
  7. include $(ADK_TOPDIR)/mk/image.mk
  8. KERNEL:=$(LINUX_DIR)/$(ADK_TARGET_KERNEL)
  9. ifeq ($(ADK_TARGET_KERNEL_ZIMAGE),y)
  10. KERNEL:=$(LINUX_DIR)/arch/arm/boot/zImage
  11. endif
  12. ifeq ($(ADK_TARGET_KERNEL_UIMAGE),y)
  13. KERNEL:=$(LINUX_DIR)/arch/arm/boot/uImage
  14. endif
  15. QEMU_ARGS:=${ADK_QEMU_ARGS}
  16. ifeq ($(ADK_TARGET_QEMU_ARM_MODEL_SPITZ),y)
  17. QEMU_ARGS+=-M spitz
  18. endif
  19. ifeq ($(ADK_TARGET_QEMU_ARM_MODEL_TERRIER),y)
  20. QEMU_ARGS+=-M terrier
  21. endif
  22. ifeq ($(ADK_TARGET_QEMU_ARM_MODEL_VERSATILEPB),y)
  23. QEMU_ARGS+=-M versatilepb -net user -net nic,model=smc91c111
  24. endif
  25. ifeq ($(ADK_TARGET_QEMU_ARM_MODEL_VEXPRESS_A9),y)
  26. QEMU_ARGS+=-M vexpress-a9 -cpu cortex-a9 -m 256 -net user -net nic,model=lan9118 -dtb $(FW_DIR)/vexpress-v2p-ca9.dtb
  27. endif
  28. ifeq ($(ADK_TARGET_QEMU_WITH_VIRTIO),y)
  29. QEMU_ARGS+=-drive file=qemu-${ADK_TARGET_CPU_ARCH}.img,if=virtio,index=0 -net nic,model=virtio -net user
  30. endif
  31. # target helper text
  32. ifeq ($(ADK_TARGET_FS),archive)
  33. targethelp:
  34. @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSTARBALL)"
  35. ifeq ($(ADK_TARGET_QEMU_ARM_MODEL_VERSATILEPB)$(ADK_TARGET_QEMU_ARM_MODEL_TERRIER)$(ADK_TARGET_QEMU_ARM_MODEL_SPITZ),y)
  36. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  37. @echo "Use following command to create a QEMU Image:"
  38. @echo "./scripts/create.sh qemu-${ADK_TARGET_CPU_ARCH}.img $(FW_DIR)/$(ROOTFSTARBALL)"
  39. @echo "Start qemu with following options:"
  40. @echo 'qemu-system-${ADK_TARGET_CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL) qemu-${ADK_TARGET_CPU_ARCH}.img'
  41. endif
  42. ifeq ($(ADK_TARGET_SYSTEM_RASPBERRY_PI),y)
  43. ifeq ($(ADK_APPLIANCE_KODI),y)
  44. @echo "Use following command to install with a writable data partition"
  45. @echo "sudo ./scripts/install.sh -d 256 raspberry-pi /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
  46. @echo "If you want to update a card without loosing existing data on the writable partition use:"
  47. @echo "sudo ./scripts/install.sh -k -d 256 raspbrry-pi /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
  48. @echo "In both cases the cfgfs partition is _not_ removed!"
  49. else
  50. @echo "Use following command to install it on SD card:"
  51. @echo "sudo ./scripts/install.sh raspberry-pi /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
  52. endif
  53. endif
  54. ifeq ($(ADK_TARGET_SYSTEM_RASPBERRY_PI2),y)
  55. ifeq ($(ADK_APPLIANCE_KODI),y)
  56. @echo "Use following command to install with a writable data partition"
  57. @echo "sudo ./scripts/install.sh -d 256 raspberry-pi2 /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
  58. @echo "If you want to update a card without loosing existing data on the writable partition use:"
  59. @echo "sudo ./scripts/install.sh -k -d 256 raspberry-pi2 /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
  60. @echo "In both cases the cfgfs partition is _not_ removed!"
  61. else
  62. @echo "Use following command to install it on SD card:"
  63. @echo "sudo ./scripts/install.sh raspberry-pi2 /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
  64. @echo "Use following command to install with a writable data partition"
  65. @echo "sudo ./scripts/install.sh -d 256 raspberry-pi2 /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
  66. endif
  67. endif
  68. ifeq ($(ADK_TARGET_SYSTEM_BANANA_PRO),y)
  69. @echo "Use following command to install it on SD card:"
  70. @echo "sudo ./scripts/install.sh banana-pro /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
  71. @echo "Use following command to install with a writable data partition"
  72. @echo "sudo ./scripts/install.sh -d 256 banana-pro /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
  73. endif
  74. ifeq ($(ADK_TARGET_SYSTEM_SOLIDRUN_IMX6),y)
  75. ifeq ($(ADK_APPLIANCE_KODI),y)
  76. @echo "Use following command to install with a writable data partition"
  77. @echo "sudo ./scripts/install.sh -d 256 solidrun-imx6 /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
  78. @echo "If you want to update a card without loosing existing data on the writable partition use:"
  79. @echo "sudo ./scripts/install.sh -k -d 256 solidrun-imx6 /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
  80. @echo "In both cases the cfgfs partition is _not_ removed!"
  81. else
  82. @echo "Use following command to install it on SD card:"
  83. @echo "sudo ./scripts/install.sh solidrun-imx6 /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
  84. endif
  85. endif
  86. endif
  87. ifeq ($(ADK_TARGET_FS),initramfs)
  88. targethelp:
  89. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  90. @echo 'The initramfs image is: ${FW_DIR}/${INITRAMFS}'
  91. ifeq ($(ADK_TARGET_QEMU),y)
  92. @echo "Start qemu with following command line:"
  93. @echo 'qemu-system-${ADK_TARGET_CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL) -initrd ${FW_DIR}/${INITRAMFS}'
  94. endif
  95. endif
  96. ifeq ($(ADK_TARGET_FS),initramfsarchive)
  97. targethelp:
  98. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  99. @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
  100. endif
  101. ifeq ($(ADK_TARGET_FS),initramfspiggyback)
  102. targethelp:
  103. @echo 'The kernel+initramfs file is: $(FW_DIR)/${TARGET_KERNEL}'
  104. ifeq ($(ADK_TARGET_QEMU),y)
  105. @echo "Start qemu with following command line:"
  106. @echo 'qemu-system-${ADK_TARGET_CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL)'
  107. endif
  108. endif
  109. ifeq ($(ADK_TARGET_FS),nfsroot)
  110. targethelp:
  111. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  112. @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
  113. endif
  114. kernel-strip:
  115. @cp $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL)
  116. ifeq ($(ADK_TARGET_SYSTEM_RASPBERRY_PI),y)
  117. @echo adding DT trailer to kernel $(MAKE_TRACE)
  118. -rm $(BUILD_DIR)/$(TARGET_KERNEL)
  119. $(ADK_TOPDIR)/scripts/mkknlimg --dtok $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL) $(MAKE_TRACE)
  120. endif
  121. ifeq ($(ADK_TARGET_SYSTEM_RASPBERRY_PI2),y)
  122. @echo adding DT trailer to kernel $(MAKE_TRACE)
  123. -rm $(BUILD_DIR)/$(TARGET_KERNEL)
  124. $(ADK_TOPDIR)/scripts/mkknlimg --dtok $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL) $(MAKE_TRACE)
  125. endif
  126. kernel-install: kernel-strip
  127. @cp $(BUILD_DIR)/$(TARGET_KERNEL) $(FW_DIR)/$(TARGET_KERNEL)
  128. dtb-install:
  129. ifeq ($(ADK_TARGET_QEMU_ARM_MODEL_VEXPRESS_A9),y)
  130. env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
  131. dtbs $(MAKE_TRACE)
  132. endif
  133. ifeq ($(ADK_TARGET_SYSTEM_RASPBERRY_PI),y)
  134. env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
  135. dtbs $(MAKE_TRACE)
  136. endif
  137. ifeq ($(ADK_TARGET_SYSTEM_RASPBERRY_PI2),y)
  138. env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
  139. dtbs $(MAKE_TRACE)
  140. endif
  141. ifeq ($(ADK_TARGET_SYSTEM_BANANA_PRO),y)
  142. env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
  143. sun7i-a20-bananapro.dtb
  144. endif
  145. ifeq ($(ADK_TARGET_SYSTEM_SOLIDRUN_IMX6),y)
  146. env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
  147. imx6q-cubox-i.dtb imx6dl-cubox-i.dtb imx6dl-hummingboard.dtb imx6q-hummingboard.dtb $(MAKE_TRACE)
  148. endif
  149. for x in $(LINUX_DIR)/arch/arm/boot/dts/*.dtb; do \
  150. [[ -e "$$x" ]] && cp $(LINUX_DIR)/arch/arm/boot/dts/*.dtb $(FW_DIR); \
  151. break; \
  152. done
  153. # filesystem specific targets
  154. ifeq ($(ADK_TARGET_FS),archive)
  155. imageinstall: dtb-install $(FW_DIR)/$(ROOTFSTARBALL) targethelp
  156. endif
  157. ifeq ($(ADK_TARGET_FS),initramfs)
  158. imageinstall: kernel-install dtb-install $(FW_DIR)/$(INITRAMFS) targethelp
  159. endif
  160. ifeq ($(ADK_TARGET_FS),initramfsarchive)
  161. imageinstall: kernel-install dtb-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
  162. endif
  163. ifeq ($(ADK_TARGET_FS),initramfspiggyback)
  164. imageinstall: dtb-install createinitramfs targethelp
  165. endif
  166. ifeq ($(ADK_TARGET_FS),nfsroot)
  167. imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
  168. endif
  169. ifeq ($(ADK_TARGET_FS),usb)
  170. imageinstall: $(FW_DIR)/$(ROOTFSTARBALL) targethelp
  171. endif