Makefile 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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. ifeq ($(ADK_TARGET_SYSTEM_NUMATO_MIMASV2),y)
  7. KERNEL:=$(LINUX_DIR)/vmlinux
  8. else
  9. KERNEL:=$(LINUX_DIR)/arch/sh/boot/zImage
  10. endif
  11. OSTRIP:=-R .reginfo -R .notes -R .note -R .comment -R .mdebug -R .note.gnu.build-id
  12. QEMU_ARGS:=-M r2d
  13. QEMU_ARGS+=${ADK_QEMU_ARGS}
  14. QEMU_ARGS+=-monitor null
  15. QEMU_ARGS+=-net user -net nic,model=rtl8139
  16. ifeq ($(ADK_TARGET_QEMU_WITH_GRAPHIC),)
  17. QEMU_ARGS+=-serial null -serial stdio
  18. endif
  19. # target helper text
  20. ifeq ($(ADK_TARGET_FS),archive)
  21. targethelp:
  22. @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSTARBALL)"
  23. ifeq ($(ADK_TARGET_QEMU),y)
  24. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  25. @echo "Use following command to create a QEMU Image:"
  26. @echo "./scripts/create.sh qemu-${ADK_TARGET_CPU_ARCH}.img $(FW_DIR)/$(ROOTFSTARBALL)"
  27. @echo "Start qemu with following options:"
  28. @echo 'qemu-system-${ADK_TARGET_CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL) qemu-${ADK_TARGET_CPU_ARCH}.img'
  29. endif
  30. endif
  31. ifeq ($(ADK_TARGET_FS),initramfs)
  32. targethelp:
  33. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  34. @echo 'The initramfs image is: ${FW_DIR}/${INITRAMFS}'
  35. ifeq ($(ADK_TARGET_QEMU),y)
  36. @echo "Start qemu with following command line:"
  37. @echo 'qemu-system-${ADK_TARGET_CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL) -initrd ${FW_DIR}/${INITRAMFS}'
  38. endif
  39. endif
  40. ifeq ($(ADK_TARGET_FS),initramfsarchive)
  41. targethelp:
  42. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  43. @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
  44. endif
  45. ifeq ($(ADK_TARGET_FS),initramfspiggyback)
  46. targethelp:
  47. @echo 'The kernel+initramfs file is: $(FW_DIR)/${TARGET_KERNEL}'
  48. ifeq ($(ADK_TARGET_QEMU),y)
  49. @echo "Start qemu with following command line:"
  50. @echo 'qemu-system-${ADK_TARGET_CPU_ARCH} ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL)'
  51. endif
  52. endif
  53. # image creation and kernel install
  54. kernel-strip:
  55. ifeq ($(ADK_TARGET_SYSTEM_NUMATO_MIMASV2),y)
  56. $(TARGET_CROSS)objcopy $(OSTRIP) -S $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL)
  57. else
  58. @cp $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL)
  59. endif
  60. kernel-install: kernel-strip
  61. @cp $(BUILD_DIR)/$(TARGET_KERNEL) $(FW_DIR)/${TARGET_KERNEL}
  62. dtb-install:
  63. ifeq ($(ADK_TARGET_SYSTEM_NUMATO_MIMASV2),y)
  64. PATH='$(HOST_PATH)' dtc -O dtb -o $(FW_DIR)/dt.dtb \
  65. $(LINUX_DIR)/arch/sh/boot/dts/j2_mimas_v2.dts
  66. endif
  67. # filesystem specific targets
  68. ifeq ($(ADK_TARGET_FS),archive)
  69. imageinstall: $(FW_DIR)/$(ROOTFSTARBALL) targethelp
  70. endif
  71. ifeq ($(ADK_TARGET_FS),initramfs)
  72. imageinstall: kernel-install $(FW_DIR)/$(INITRAMFS) targethelp
  73. endif
  74. ifeq ($(ADK_TARGET_FS),initramfsarchive)
  75. imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
  76. endif
  77. ifeq ($(ADK_TARGET_FS),initramfspiggyback)
  78. imageinstall: dtb-install createinitramfs targethelp
  79. endif