Makefile 7.1 KB

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