Makefile 3.5 KB

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