Makefile 4.2 KB

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