Makefile 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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)/$(ADK_TARGET_KERNEL)
  7. ifeq ($(ADK_TARGET_KERNEL_UIMAGE),y)
  8. KERNEL:=$(LINUX_DIR)/arch/mips/boot/uImage
  9. endif
  10. ifeq ($(ADK_TARGET_KERNEL_UIMAGEGZ),y)
  11. KERNEL:=$(LINUX_DIR)/arch/mips/boot/uImage.gz
  12. endif
  13. OSTRIP:=-R .reginfo -R .notes -R .note -R .comment -R .mdebug -R .note.gnu.build-id
  14. QEMU_ARGS:=-M malta
  15. QEMU_ARGS+=${ADK_QEMU_ARGS}
  16. QEMU_ARGS+=-device e1000,netdev=adk0 -netdev user,id=adk0
  17. ifeq ($(ADK_TARGET_CPU_MIPS_MIPS32R6),y)
  18. QEMU_ARGS+=-cpu mips32r6-generic
  19. endif
  20. # target helper text
  21. ifeq ($(ADK_TARGET_FS),archive)
  22. targethelp:
  23. @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSTARBALL)"
  24. ifeq ($(ADK_TARGET_QEMU),y)
  25. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  26. @echo "Use following command to create a QEMU Image:"
  27. @echo "./scripts/create.sh qemu-${ADK_TARGET_CPU_ARCH}.img $(FW_DIR)/$(ROOTFSTARBALL)"
  28. @echo "Start qemu with following options:"
  29. @echo 'qemu-system-${ADK_TARGET_CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL) qemu-${ADK_TARGET_CPU_ARCH}.img'
  30. endif
  31. ifeq ($(ADK_TARGET_SYSTEM_MIKROTIK_RB532),y)
  32. @echo "Use following command to install it on CF card:"
  33. @echo "sudo ./scripts/install-rb532.sh /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
  34. @echo 'Or boot your Routerboard via NFS and'
  35. @echo 'then install kernel and filesystem via:'
  36. @echo 'adkinstall -c -a ${ROOTFSTARBALL}'
  37. endif
  38. ifeq ($(ADK_TARGET_SYSTEM_IMGTEC_CI20),y)
  39. @echo "Use following command to install it on SD card:"
  40. @echo "sudo ./scripts/install.sh $(ADK_TARGET_SYSTEM) /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
  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 nfs root tarball is: ${FW_DIR}/${ROOTFSUSERTARBALL}'
  69. endif
  70. ifeq ($(ADK_TARGET_FS),usb)
  71. targethelp:
  72. @echo 'The root tarball is: ${FW_DIR}/${ROOTFSTARBALL}'
  73. endif
  74. ifeq ($(ADK_TARGET_FS),genimage)
  75. targethelp:
  76. @echo "The disk image is: $(FW_DIR)/sdcard.img"
  77. ifeq ($(ADK_TARGET_QEMU),y)
  78. @echo 'qemu-system-${ADK_TARGET_CPU_ARCH} ${QEMU_ARGS} $(FW_DIR)/disk.img'
  79. else
  80. @echo "Use following command to install it on SD card:"
  81. @echo 'sudo dd if=$(FW_DIR)/sdcard.img of=/dev/sdX bs=2048k'
  82. endif
  83. endif
  84. ifeq ($(ADK_TARGET_FS),ubifs)
  85. targethelp:
  86. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  87. @echo 'The UBI image is: ${FW_DIR}/${ROOTFSUBIFS}'
  88. endif
  89. # dummy
  90. kernel-strip:
  91. @cp $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL)
  92. kernel-install: kernel-strip
  93. @cp $(BUILD_DIR)/$(TARGET_KERNEL) $(FW_DIR)/${TARGET_KERNEL}
  94. # filesystem specific targets
  95. ifeq ($(ADK_TARGET_FS),archive)
  96. imageinstall: $(FW_DIR)/$(ROOTFSTARBALL) targethelp
  97. endif
  98. ifeq ($(ADK_TARGET_FS),initramfs)
  99. imageinstall: kernel-install $(FW_DIR)/$(INITRAMFS) targethelp
  100. endif
  101. ifeq ($(ADK_TARGET_FS),initramfsarchive)
  102. imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
  103. endif
  104. ifeq ($(ADK_TARGET_FS),initramfspiggyback)
  105. imageinstall: createinitramfs targethelp
  106. endif
  107. ifeq (${ADK_TARGET_FS},genimage)
  108. imageinstall: ${FW_DIR}/${GENIMAGE} targethelp
  109. endif
  110. ifeq ($(ADK_TARGET_FS),nfsroot)
  111. imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
  112. endif
  113. ifeq ($(ADK_TARGET_FS),ubifs)
  114. imageinstall: $(FW_DIR)/$(ROOTFSUBIFS) targethelp
  115. endif