Makefile 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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 $(TOPDIR)/rules.mk
  4. include $(TOPDIR)/mk/kernel.mk
  5. include $(TOPDIR)/mk/modules.mk
  6. include $(TOPDIR)/mk/kernel-build.mk
  7. include $(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_WITH_VIRTIO),y)
  29. QEMU_ARGS+=-drive file=qemu-${CPU_ARCH}.img,if=virtio,index=0 -net nic,model=virtio -net user
  30. endif
  31. # target helper text
  32. ifeq ($(ADK_TARGET_FS),archive)
  33. targethelp:
  34. @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSTARBALL)"
  35. ifeq ($(ADK_TARGET_QEMU_ARM_MODEL_VERSATILEPB),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-${CPU_ARCH}.img $(FW_DIR)/$(ROOTFSTARBALL)"
  39. @echo "Start qemu with following options:"
  40. @echo 'qemu-system-${CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL) qemu-${CPU_ARCH}.img'
  41. endif
  42. ifeq ($(ADK_TARGET_SYSTEM_RASPBERRY_PI),y)
  43. @echo "Use following command to install it on SD card:"
  44. @echo "sudo ./scripts/install-rpi.sh /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
  45. @echo "Use following command to install with a writable data partition"
  46. @echo "sudo ./scripts/install-rpi.sh -d /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
  47. endif
  48. ifeq ($(ADK_TARGET_SYSTEM_CUBOX_I),y)
  49. @echo "Use following command to install it on SD card:"
  50. @echo "sudo ./scripts/install-cubox.sh /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL) $(FW_DIR)"
  51. endif
  52. endif
  53. ifeq ($(ADK_TARGET_FS),initramfs)
  54. targethelp:
  55. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  56. @echo 'The initramfs image is: ${FW_DIR}/${INITRAMFS}'
  57. ifeq ($(ADK_TARGET_QEMU),y)
  58. @echo "Start qemu with following command line:"
  59. @echo 'qemu-system-${CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL) -initrd ${FW_DIR}/${INITRAMFS}'
  60. endif
  61. endif
  62. ifeq ($(ADK_TARGET_FS),initramfs-archive)
  63. targethelp:
  64. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  65. @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
  66. endif
  67. ifeq ($(ADK_TARGET_FS),initramfs-piggyback)
  68. targethelp:
  69. @echo 'The kernel+initramfs file is: $(FW_DIR)/${TARGET_KERNEL}'
  70. ifeq ($(ADK_TARGET_QEMU),y)
  71. @echo "Start qemu with following command line:"
  72. @echo 'qemu-system-${CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL)'
  73. endif
  74. endif
  75. kernel-strip:
  76. @cp $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL)
  77. kernel-install: kernel-strip
  78. @cp $(BUILD_DIR)/$(TARGET_KERNEL) $(FW_DIR)/$(TARGET_KERNEL)
  79. dtb-install:
  80. env $(KERNEL_MAKE_ENV) $(MAKE) -C $(LINUX_DIR) $(KERNEL_MAKE_OPTS) \
  81. -j${ADK_MAKE_JOBS} imx6q-cubox-i.dtb imx6dl-cubox-i.dtb $(MAKE_TRACE)
  82. $(CP) $(LINUX_DIR)/arch/arm/boot/dts/imx6*-cubox-i.dtb \
  83. $(FW_DIR)
  84. # filesystem specific targets
  85. ifeq ($(ADK_TARGET_FS),archive)
  86. ifeq ($(ADK_TARGET_SYSTEM_CUBOX_I),y)
  87. imageinstall: dtb-install $(FW_DIR)/$(ROOTFSTARBALL) targethelp
  88. else
  89. imageinstall: $(FW_DIR)/$(ROOTFSTARBALL) targethelp
  90. endif
  91. endif
  92. ifeq ($(ADK_TARGET_FS),initramfs)
  93. imageinstall: kernel-install $(FW_DIR)/$(INITRAMFS) targethelp
  94. endif
  95. ifeq ($(ADK_TARGET_FS),initramfs-archive)
  96. imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
  97. endif
  98. ifeq ($(ADK_TARGET_FS),initramfs-piggyback)
  99. imageinstall: createinitramfs targethelp
  100. endif
  101. ifeq ($(ADK_TARGET_FS),nfsroot)
  102. imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
  103. endif
  104. ifeq ($(ADK_TARGET_FS),usb)
  105. imageinstall: $(FW_DIR)/$(ROOTFSTARBALL) targethelp
  106. endif