1
0

Makefile 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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_QEMU),y)
  24. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  25. @echo "Use following command to create a QEMU Image:"
  26. @echo "./scripts/create.sh qemu-${ADK_TARGET_CPU_ARCH}.img $(FW_DIR)/$(ROOTFSTARBALL)"
  27. @echo "Start qemu with following options:"
  28. @echo 'qemu-system-${ADK_TARGET_CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL)'
  29. endif
  30. endif
  31. ifeq ($(ADK_TARGET_FS),initramfs)
  32. targethelp:
  33. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  34. @echo 'The initramfs image is: ${FW_DIR}/${INITRAMFS}'
  35. ifeq ($(ADK_TARGET_QEMU),y)
  36. @echo "Start qemu with following command line:"
  37. @echo 'qemu-system-${ADK_TARGET_CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL) -initrd ${FW_DIR}/${INITRAMFS}'
  38. endif
  39. endif
  40. ifeq ($(ADK_TARGET_FS),initramfsarchive)
  41. targethelp:
  42. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  43. @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
  44. endif
  45. ifeq ($(ADK_TARGET_FS),initramfspiggyback)
  46. targethelp:
  47. @echo 'The kernel+initramfs file is: $(FW_DIR)/${TARGET_KERNEL}'
  48. ifeq ($(ADK_TARGET_QEMU),y)
  49. @echo "Start qemu with following command line:"
  50. @echo 'qemu-system-${ADK_TARGET_CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL)'
  51. endif
  52. endif
  53. kernel-strip:
  54. ifeq ($(ADK_TARGET_KERNEL_GIT_REPO_NAME),rpi)
  55. @echo adding DT trailer to kernel $(MAKE_TRACE)
  56. PATH='$(HOST_PATH)' perl $(LINUX_DIR)/scripts/mkknlimg $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL) $(MAKE_TRACE)
  57. else
  58. @cp $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL)
  59. endif
  60. kernel-install: kernel-strip
  61. @cp $(BUILD_DIR)/$(TARGET_KERNEL) $(FW_DIR)/$(TARGET_KERNEL)
  62. dtb-install:
  63. ifeq ($(ADK_TARGET_BOARD_BCM28XX),y)
  64. env $(KERNEL_MAKE_ENV) $(MAKE) -C "${LINUX_DIR}" $(KERNEL_MAKE_OPTS) \
  65. dtbs $(MAKE_TRACE)
  66. mkdir -p $(FW_DIR)/overlays
  67. for x in $(LINUX_DIR)/arch/arm64/boot/dts/overlays/*.dtbo; do \
  68. [[ -e "$$x" ]] && cp $(LINUX_DIR)/arch/arm64/boot/dts/overlays/*.dtbo $(FW_DIR)/overlays; \
  69. break; \
  70. done
  71. for x in $(LINUX_DIR)/arch/arm64/boot/dts/broadcom/*.dtb; do \
  72. [[ -e "$$x" ]] && cp $(LINUX_DIR)/arch/arm64/boot/dts/broadcom/*.dtb $(FW_DIR); \
  73. break; \
  74. done
  75. endif
  76. # filesystem specific targets
  77. ifeq ($(ADK_TARGET_FS),archive)
  78. imageinstall: dtb-install $(FW_DIR)/$(ROOTFSTARBALL) targethelp
  79. endif
  80. ifeq ($(ADK_TARGET_FS),initramfs)
  81. imageinstall: kernel-install $(FW_DIR)/$(INITRAMFS) targethelp
  82. endif
  83. ifeq ($(ADK_TARGET_FS),initramfsarchive)
  84. imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
  85. endif
  86. ifeq ($(ADK_TARGET_FS),initramfspiggyback)
  87. imageinstall: createinitramfs targethelp
  88. endif