1
0

Makefile 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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. # target helper text
  15. ifeq ($(ADK_TARGET_FS),archive)
  16. targethelp:
  17. @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSTARBALL)"
  18. ifeq ($(ADK_TARGET_QEMU),y)
  19. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  20. @echo "Use following command to create a QEMU Image:"
  21. @echo "./scripts/create.sh qemu-${ADK_TARGET_CPU_ARCH}.img $(FW_DIR)/$(ROOTFSTARBALL)"
  22. @echo "Start qemu with following options:"
  23. @echo 'qemu-system-${ADK_TARGET_CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL) qemu-${ADK_TARGET_CPU_ARCH}.img'
  24. endif
  25. ifeq ($(ADK_TARGET_SYSTEM_MIKROTIK_RB532),y)
  26. @echo "Use following command to install it on CF card:"
  27. @echo "sudo ./scripts/install-rb532.sh /dev/sdX $(FW_DIR)/$(ROOTFSTARBALL)"
  28. @echo 'Or boot your Routerboard via NFS and'
  29. @echo 'then install kernel and filesystem via:'
  30. @echo 'adkinstall -c -a ${ROOTFSTARBALL}'
  31. endif
  32. endif
  33. ifeq ($(ADK_TARGET_FS),initramfs)
  34. targethelp:
  35. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  36. @echo 'The initramfs image is: ${FW_DIR}/${INITRAMFS}'
  37. ifeq ($(ADK_TARGET_QEMU),y)
  38. @echo "Start qemu with following command line:"
  39. @echo 'qemu-system-${ADK_TARGET_CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL) -initrd ${FW_DIR}/${INITRAMFS}'
  40. endif
  41. endif
  42. ifeq ($(ADK_TARGET_FS),initramfsarchive)
  43. targethelp:
  44. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  45. @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
  46. endif
  47. ifeq ($(ADK_TARGET_FS),initramfspiggyback)
  48. targethelp:
  49. @echo 'The kernel+initramfs file is: $(FW_DIR)/${TARGET_KERNEL}'
  50. ifeq ($(ADK_TARGET_QEMU),y)
  51. @echo "Start qemu with following command line:"
  52. @echo 'qemu-system-${ADK_TARGET_CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL)'
  53. endif
  54. endif
  55. ifeq ($(ADK_TARGET_FS),nfsroot)
  56. targethelp:
  57. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  58. @echo 'The nfs root tarball is: ${FW_DIR}/${ROOTFSUSERTARBALL}'
  59. endif
  60. ifeq ($(ADK_TARGET_FS),usb)
  61. targethelp:
  62. @echo 'The root tarball is: ${FW_DIR}/${ROOTFSTARBALL}'
  63. endif
  64. ifeq ($(ADK_TARGET_FS),yaffs)
  65. targethelp:
  66. @echo 'The root tarball is: ${FW_DIR}/${ROOTFSTARBALL}'
  67. @echo 'Format your NAND with Routerboot, boot via NFS and'
  68. @echo 'then install kernel and filesystem via:'
  69. @echo 'adkinstall -n -a ${ROOTFSTARBALL}'
  70. endif
  71. # image creation and kernel install
  72. kernel-strip:
  73. ifeq ($(ADK_TARGET_KERNEL_UIMAGE),)
  74. $(TARGET_CROSS)objcopy $(OSTRIP) -S $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL)
  75. else
  76. @cp $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL)
  77. endif
  78. kernel-install: kernel-strip
  79. @cp $(BUILD_DIR)/$(TARGET_KERNEL) $(FW_DIR)/${TARGET_KERNEL}
  80. # filesystem specific targets
  81. ifeq ($(ADK_TARGET_FS),archive)
  82. imageinstall: $(FW_DIR)/$(ROOTFSTARBALL) targethelp
  83. endif
  84. ifeq ($(ADK_TARGET_FS),initramfs)
  85. imageinstall: kernel-install $(FW_DIR)/$(INITRAMFS) targethelp
  86. endif
  87. ifeq ($(ADK_TARGET_FS),initramfsarchive)
  88. imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
  89. endif
  90. ifeq ($(ADK_TARGET_FS),initramfspiggyback)
  91. imageinstall: createinitramfs targethelp
  92. endif
  93. ifeq ($(ADK_TARGET_FS),nfsroot)
  94. imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
  95. endif
  96. ifeq ($(ADK_TARGET_FS),yaffs)
  97. imageinstall: $(FW_DIR)/$(ROOTFSTARBALL) targethelp
  98. endif