Makefile 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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-${CPU_ARCH}.img $(FW_DIR)/$(ROOTFSTARBALL)"
  21. @echo "Start qemu with following options:"
  22. @echo 'qemu-system-${CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL) qemu-${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. endif
  28. endif
  29. ifeq ($(ADK_TARGET_FS),initramfs)
  30. targethelp:
  31. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  32. @echo 'The initramfs image is: ${FW_DIR}/${INITRAMFS}'
  33. ifeq ($(ADK_TARGET_QEMU),y)
  34. @echo "Start qemu with following command line:"
  35. @echo 'qemu-system-${CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL) -initrd ${FW_DIR}/${INITRAMFS}'
  36. endif
  37. endif
  38. ifeq ($(ADK_TARGET_FS),initramfs-archive)
  39. targethelp:
  40. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  41. @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
  42. endif
  43. ifeq ($(ADK_TARGET_FS),initramfs-piggyback)
  44. targethelp:
  45. @echo 'The kernel+initramfs file is: $(FW_DIR)/${TARGET_KERNEL}'
  46. ifeq ($(ADK_TARGET_QEMU),y)
  47. @echo "Start qemu with following command line:"
  48. @echo 'qemu-system-${CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL)'
  49. endif
  50. endif
  51. ifeq ($(ADK_TARGET_FS),nfsroot)
  52. targethelp:
  53. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  54. @echo 'The nfs root tarball is: ${FW_DIR}/${ROOTFSUSERTARBALL}'
  55. ifeq ($(ADK_TARGET_SYSTEM_LEMOTE_YEELONG),y)
  56. @echo 'Boot your Lemote Yeelong and type following commands in PMON:'
  57. @echo 'PMON> ifaddr rtl0 <ip-address-client>'
  58. @echo 'PMON> load tftp://<ip-address-server>/${TARGET_KERNEL}'
  59. @echo 'PMON> g'
  60. endif
  61. endif
  62. ifeq ($(ADK_TARGET_FS),usb)
  63. targethelp:
  64. @echo 'The root tarball is: ${FW_DIR}/${ROOTFSTARBALL}'
  65. endif
  66. ifeq ($(ADK_TARGET_FS),yaffs)
  67. targethelp:
  68. @echo 'The root tarball is: ${FW_DIR}/${ROOTFSTARBALL}'
  69. @echo 'Format your NAND with Routerboot, boot via NFS and'
  70. @echo 'then install kernel and filesystem via:'
  71. @echo 'adkinstall ${ROOTFSTARBALL}'
  72. endif
  73. # image creation and kernel install
  74. kernel-strip:
  75. $(TARGET_CROSS)objcopy $(OSTRIP) -S $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL)
  76. kernel-install: kernel-strip
  77. @cp $(BUILD_DIR)/$(TARGET_KERNEL) $(FW_DIR)/${TARGET_KERNEL}
  78. # filesystem specific targets
  79. ifeq ($(ADK_TARGET_FS),archive)
  80. imageinstall: $(FW_DIR)/$(ROOTFSTARBALL) targethelp
  81. endif
  82. ifeq ($(ADK_TARGET_FS),initramfs)
  83. imageinstall: kernel-install $(FW_DIR)/$(INITRAMFS) targethelp
  84. endif
  85. ifeq ($(ADK_TARGET_FS),initramfs-archive)
  86. imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
  87. endif
  88. ifeq ($(ADK_TARGET_FS),initramfs-piggyback)
  89. imageinstall: createinitramfs targethelp
  90. endif
  91. ifeq ($(ADK_TARGET_FS),nfsroot)
  92. imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
  93. endif
  94. ifeq ($(ADK_TARGET_FS),yaffs)
  95. imageinstall: $(FW_DIR)/$(ROOTFSTARBALL) targethelp
  96. endif