Makefile 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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}/arch/arm64/boot/Image
  7. QEMU_ARGS:=${ADK_QEMU_ARGS}
  8. QEMU_ARGS+=-M virt -cpu cortex-a57 -smp 1
  9. ifeq ($(ADK_TARGET_QEMU_WITH_VIRTIO),y)
  10. QEMU_ARGS+=-netdev user,id=eth0 -device virtio-net-device,netdev=eth0
  11. endif
  12. ifeq ($(ADK_TARGET_FS),archive)
  13. QEMU_ARGS+=-device virtio-blk-device,drive=vda -drive file=qemu-${ADK_TARGET_CPU_ARCH}.img,if=none,id=vda,format=raw
  14. endif
  15. # target helper text
  16. ifeq ($(ADK_TARGET_FS),archive)
  17. targethelp:
  18. @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSTARBALL)"
  19. ifeq ($(ADK_TARGET_BOARD_BCM28XX),y)
  20. @echo "Use following command to install it on SD card:"
  21. @echo "sudo ./scripts/install.sh $(ADK_TARGET_SYSTEM) /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
  22. endif
  23. ifeq ($(ADK_TARGET_SYSTEM_ROCKPI4_PLUS),y)
  24. ifeq ($(ADK_RUNTIME_DATA_PARTITION),y)
  25. @echo "Use following command to install with a writable data partition"
  26. @echo "sudo ./scripts/install.sh -d 256 $(ADK_TARGET_SYSTEM) /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
  27. @echo "If you want to update a card without loosing existing data on the writable partition use:"
  28. @echo "sudo ./scripts/install.sh -k -d 256 $(ADK_TARGET_SYSTEM) /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
  29. @echo "In both cases the cfgfs partition is _not_ removed!"
  30. else
  31. @echo "Use following command to install it on SD card:"
  32. @echo "sudo ./scripts/install.sh $(ADK_TARGET_SYSTEM) /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
  33. endif
  34. endif
  35. ifeq ($(ADK_TARGET_QEMU),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)'
  41. endif
  42. endif
  43. ifeq ($(ADK_TARGET_FS),initramfs)
  44. targethelp:
  45. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  46. @echo 'The initramfs image is: ${FW_DIR}/${INITRAMFS}'
  47. ifeq ($(ADK_TARGET_QEMU),y)
  48. @echo "Start qemu with following command line:"
  49. @echo 'qemu-system-${ADK_TARGET_CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL) -initrd ${FW_DIR}/${INITRAMFS}'
  50. endif
  51. endif
  52. ifeq ($(ADK_TARGET_FS),initramfsarchive)
  53. targethelp:
  54. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  55. @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
  56. endif
  57. ifeq ($(ADK_TARGET_FS),initramfspiggyback)
  58. targethelp:
  59. @echo 'The kernel+initramfs file is: $(FW_DIR)/${TARGET_KERNEL}'
  60. ifeq ($(ADK_TARGET_QEMU),y)
  61. @echo "Start qemu with following command line:"
  62. @echo 'qemu-system-${ADK_TARGET_CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL)'
  63. endif
  64. endif
  65. ifeq ($(ADK_TARGET_FS),nfsroot)
  66. targethelp:
  67. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  68. @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
  69. endif
  70. ifeq ($(ADK_TARGET_FS),genimage)
  71. targethelp:
  72. @echo "The disk image is: $(FW_DIR)/sdcard.img"
  73. @echo "Use following command to install it on SD card:"
  74. @echo 'sudo dd if=$(FW_DIR)/sdcard.img of=/dev/sdX bs=2048k'
  75. endif
  76. ifeq ($(ADK_TARGET_FS),nfsroot)
  77. imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
  78. endif
  79. kernel-strip:
  80. @cp $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL)
  81. kernel-install: kernel-strip
  82. @cp $(BUILD_DIR)/$(TARGET_KERNEL) $(FW_DIR)/$(TARGET_KERNEL)
  83. dtb-install:
  84. ifeq ($(ADK_TARGET_BOARD_BCM28XX),y)
  85. ${KERNEL_MAKE} dtbs $(MAKE_TRACE)
  86. mkdir -p $(FW_DIR)/overlays
  87. for x in $(LINUX_DIR)/arch/arm64/boot/dts/overlays/*.dtbo; do \
  88. [[ -e "$$x" ]] && cp $(LINUX_DIR)/arch/arm64/boot/dts/overlays/*.dtbo $(FW_DIR)/overlays; \
  89. break; \
  90. done
  91. for x in $(LINUX_DIR)/arch/arm64/boot/dts/broadcom/*.dtb; do \
  92. [[ -e "$$x" ]] && cp $(LINUX_DIR)/arch/arm64/boot/dts/broadcom/*.dtb $(FW_DIR); \
  93. break; \
  94. done
  95. endif
  96. ifeq ($(ADK_TARGET_SYSTEM_ROCKPI4_PLUS),y)
  97. ${KERNEL_MAKE} rockchip/rk3399-rock-pi-4b-plus.dtb $(MAKE_TRACE)
  98. endif
  99. for x in $(LINUX_DIR)/arch/arm64/boot/dts/*/*.dtb; do \
  100. [[ -e "$$x" ]] && cp $(LINUX_DIR)/arch/arm64/boot/dts/*/*.dtb $(FW_DIR); \
  101. break; \
  102. done
  103. # filesystem specific targets
  104. ifeq ($(ADK_TARGET_FS),archive)
  105. imageinstall: dtb-install $(FW_DIR)/$(ROOTFSTARBALL) targethelp
  106. endif
  107. ifeq ($(ADK_TARGET_FS),initramfs)
  108. imageinstall: kernel-install $(FW_DIR)/$(INITRAMFS) targethelp
  109. endif
  110. ifeq ($(ADK_TARGET_FS),initramfsarchive)
  111. imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
  112. endif
  113. ifeq ($(ADK_TARGET_FS),initramfspiggyback)
  114. imageinstall: createinitramfs targethelp
  115. endif
  116. ifeq ($(ADK_TARGET_FS),genimage)
  117. imageinstall: dtb-install $(FW_DIR)/$(GENIMAGE) targethelp
  118. endif