Makefile 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. @echo "Use following command to install it on SD card:"
  25. @echo "sudo ./scripts/install.sh $(ADK_TARGET_SYSTEM) /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
  26. endif
  27. ifeq ($(ADK_TARGET_QEMU),y)
  28. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  29. @echo "Use following command to create a QEMU Image:"
  30. @echo "./scripts/create.sh qemu-${ADK_TARGET_CPU_ARCH}.img $(FW_DIR)/$(ROOTFSTARBALL)"
  31. @echo "Start qemu with following options:"
  32. @echo 'qemu-system-${ADK_TARGET_CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL)'
  33. endif
  34. endif
  35. ifeq ($(ADK_TARGET_FS),initramfs)
  36. targethelp:
  37. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  38. @echo 'The initramfs image is: ${FW_DIR}/${INITRAMFS}'
  39. ifeq ($(ADK_TARGET_QEMU),y)
  40. @echo "Start qemu with following command line:"
  41. @echo 'qemu-system-${ADK_TARGET_CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL) -initrd ${FW_DIR}/${INITRAMFS}'
  42. endif
  43. endif
  44. ifeq ($(ADK_TARGET_FS),initramfsarchive)
  45. targethelp:
  46. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  47. @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
  48. endif
  49. ifeq ($(ADK_TARGET_FS),initramfspiggyback)
  50. targethelp:
  51. @echo 'The kernel+initramfs file is: $(FW_DIR)/${TARGET_KERNEL}'
  52. ifeq ($(ADK_TARGET_QEMU),y)
  53. @echo "Start qemu with following command line:"
  54. @echo 'qemu-system-${ADK_TARGET_CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL)'
  55. endif
  56. endif
  57. ifeq ($(ADK_TARGET_FS),genimage)
  58. targethelp:
  59. @echo "The disk image is: $(FW_DIR)/sdcard.img"
  60. @echo "Use following command to install it on SD card:"
  61. @echo 'sudo dd if=$(FW_DIR)/sdcard.img of=/dev/sdX bs=2048k'
  62. endif
  63. kernel-strip:
  64. @cp $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL)
  65. kernel-install: kernel-strip
  66. @cp $(BUILD_DIR)/$(TARGET_KERNEL) $(FW_DIR)/$(TARGET_KERNEL)
  67. dtb-install:
  68. ifeq ($(ADK_TARGET_BOARD_BCM28XX),y)
  69. ${KERNEL_MAKE} dtbs $(MAKE_TRACE)
  70. mkdir -p $(FW_DIR)/overlays
  71. for x in $(LINUX_DIR)/arch/arm64/boot/dts/overlays/*.dtbo; do \
  72. [[ -e "$$x" ]] && cp $(LINUX_DIR)/arch/arm64/boot/dts/overlays/*.dtbo $(FW_DIR)/overlays; \
  73. break; \
  74. done
  75. for x in $(LINUX_DIR)/arch/arm64/boot/dts/broadcom/*.dtb; do \
  76. [[ -e "$$x" ]] && cp $(LINUX_DIR)/arch/arm64/boot/dts/broadcom/*.dtb $(FW_DIR); \
  77. break; \
  78. done
  79. endif
  80. ifeq ($(ADK_TARGET_SYSTEM_ROCKPI4_PLUS),y)
  81. ${KERNEL_MAKE} rockchip/rk3399-rock-pi-4b-plus.dtb $(MAKE_TRACE)
  82. endif
  83. for x in $(LINUX_DIR)/arch/arm64/boot/dts/*/*.dtb; do \
  84. [[ -e "$$x" ]] && cp $(LINUX_DIR)/arch/arm64/boot/dts/*/*.dtb $(FW_DIR); \
  85. break; \
  86. done
  87. # filesystem specific targets
  88. ifeq ($(ADK_TARGET_FS),archive)
  89. imageinstall: dtb-install $(FW_DIR)/$(ROOTFSTARBALL) targethelp
  90. endif
  91. ifeq ($(ADK_TARGET_FS),initramfs)
  92. imageinstall: kernel-install $(FW_DIR)/$(INITRAMFS) targethelp
  93. endif
  94. ifeq ($(ADK_TARGET_FS),initramfsarchive)
  95. imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
  96. endif
  97. ifeq ($(ADK_TARGET_FS),initramfspiggyback)
  98. imageinstall: createinitramfs targethelp
  99. endif
  100. ifeq ($(ADK_TARGET_FS),genimage)
  101. imageinstall: dtb-install $(FW_DIR)/$(GENIMAGE) targethelp
  102. endif