Makefile 3.5 KB

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