Makefile 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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 -net user -net nic,model=lan9118
  27. endif
  28. ifeq ($(ADK_TARGET_QEMU_ARM_MODEL_STELLARIS_M3),y)
  29. QEMU_ARGS+=-M lm3s6965evb -cpu cortex-m3
  30. endif
  31. ifeq ($(ADK_TARGET_QEMU_WITH_VIRTIO),y)
  32. QEMU_ARGS+=-drive file=qemu-${ADK_TARGET_CPU_ARCH}.img,if=virtio,index=0 -net nic,model=virtio -net user
  33. endif
  34. # target helper text
  35. ifeq ($(ADK_TARGET_FS),archive)
  36. targethelp:
  37. @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSTARBALL)"
  38. ifeq ($(ADK_TARGET_QEMU_ARM_MODEL_VERSATILEPB)$(ADK_TARGET_QEMU_ARM_MODEL_TERRIER)$(ADK_TARGET_QEMU_ARM_MODEL_SPITZ),y)
  39. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  40. @echo "Use following command to create a QEMU Image:"
  41. @echo "./scripts/create.sh qemu-${ADK_TARGET_CPU_ARCH}.img $(FW_DIR)/$(ROOTFSTARBALL)"
  42. @echo "Start qemu with following options:"
  43. @echo 'qemu-system-${ADK_TARGET_CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL) qemu-${ADK_TARGET_CPU_ARCH}.img'
  44. endif
  45. ifeq ($(ADK_TARGET_SYSTEM_RASPBERRY_PI),y)
  46. @echo "Use following command to install it on SD card:"
  47. @echo "sudo ./scripts/install.sh raspberry-pi /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
  48. @echo "Use following command to install with a writable data partition"
  49. @echo "sudo ./scripts/install.sh -d 256 raspberry-pi /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
  50. endif
  51. ifeq ($(ADK_TARGET_SYSTEM_SOLIDRUN_IMX6),y)
  52. ifeq ($(ADK_APPLIANCE_KODI),y)
  53. @echo "Use following command to install with a writable data partition"
  54. @echo "sudo ./scripts/install.sh -d 256 solidrun-imx6 /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
  55. @echo "If you want to update a card without loosing existing data on the writable partition use:"
  56. @echo "sudo ./scripts/install.sh -k -d 256 solidrun-imx6 /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
  57. @echo "In both cases the cfgfs partition is _not_ removed!"
  58. else
  59. @echo "Use following command to install it on SD card:"
  60. @echo "sudo ./scripts/install.sh solidrun-imx6 /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
  61. endif
  62. endif
  63. endif
  64. ifeq ($(ADK_TARGET_FS),initramfs)
  65. targethelp:
  66. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  67. @echo 'The initramfs image is: ${FW_DIR}/${INITRAMFS}'
  68. ifeq ($(ADK_TARGET_QEMU),y)
  69. @echo "Start qemu with following command line:"
  70. @echo 'qemu-system-${ADK_TARGET_CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL) -initrd ${FW_DIR}/${INITRAMFS}'
  71. endif
  72. endif
  73. ifeq ($(ADK_TARGET_FS),initramfsarchive)
  74. targethelp:
  75. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  76. @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
  77. endif
  78. ifeq ($(ADK_TARGET_FS),initramfspiggyback)
  79. targethelp:
  80. @echo 'The kernel+initramfs file is: $(FW_DIR)/${TARGET_KERNEL}'
  81. ifeq ($(ADK_TARGET_QEMU),y)
  82. @echo "Start qemu with following command line:"
  83. @echo 'qemu-system-${ADK_TARGET_CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL)'
  84. endif
  85. endif
  86. ifeq ($(ADK_TARGET_FS),nfsroot)
  87. targethelp:
  88. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  89. @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
  90. endif
  91. kernel-strip:
  92. @cp $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL)
  93. ifeq ($(ADK_TARGET_SYSTEM_RASPBERRY_PI),y)
  94. ifeq ($(ADK_KERNEL_BCM2708_DT),y)
  95. @echo adding DT trailer to kernel $(MAKE_TRACE)
  96. -rm $(BUILD_DIR)/$(TARGET_KERNEL)
  97. $(ADK_TOPDIR)/scripts/mkknlimg --dtok $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL) $(MAKE_TRACE)
  98. endif
  99. endif
  100. kernel-install: kernel-strip
  101. @cp $(BUILD_DIR)/$(TARGET_KERNEL) $(FW_DIR)/$(TARGET_KERNEL)
  102. dtb-install:
  103. ifeq ($(ADK_TARGET_SYSTEM_RASPBERRY_PI),y)
  104. env $(KERNEL_MAKE_ENV) $(MAKE) -C $(LINUX_DIR) $(KERNEL_MAKE_OPTS) \
  105. dtbs $(MAKE_TRACE)
  106. endif
  107. ifeq ($(ADK_TARGET_SYSTEM_SOLIDRUN_IMX6),y)
  108. env $(KERNEL_MAKE_ENV) $(MAKE) -C $(LINUX_DIR) $(KERNEL_MAKE_OPTS) \
  109. imx6q-cubox-i.dtb imx6dl-cubox-i.dtb imx6dl-hummingboard.dtb imx6q-hummingboard.dtb $(MAKE_TRACE)
  110. endif
  111. for x in $(LINUX_DIR)/arch/arm/boot/dts/*.dtb; do \
  112. [[ -e "$$x" ]] && cp $(LINUX_DIR)/arch/arm/boot/dts/*.dtb $(FW_DIR); \
  113. break; \
  114. done
  115. # filesystem specific targets
  116. ifeq ($(ADK_TARGET_FS),archive)
  117. imageinstall: dtb-install $(FW_DIR)/$(ROOTFSTARBALL) targethelp
  118. endif
  119. ifeq ($(ADK_TARGET_FS),initramfs)
  120. imageinstall: kernel-install $(FW_DIR)/$(INITRAMFS) targethelp
  121. endif
  122. ifeq ($(ADK_TARGET_FS),initramfsarchive)
  123. imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
  124. endif
  125. ifeq ($(ADK_TARGET_FS),initramfspiggyback)
  126. imageinstall: createinitramfs targethelp
  127. endif
  128. ifeq ($(ADK_TARGET_FS),nfsroot)
  129. imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
  130. endif
  131. ifeq ($(ADK_TARGET_FS),usb)
  132. imageinstall: $(FW_DIR)/$(ROOTFSTARBALL) targethelp
  133. endif