Makefile 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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)/vmlinux
  7. OSTRIP:=-R .reginfo -R .notes -R .note -R .comment -R .mdebug -R .note.gnu.build-id
  8. ifeq ($(ADK_TARGET_KERNEL_UIMAGEBIN),y)
  9. KERNEL:=$(LINUX_DIR)/arch/h8300/boot/uImage.bin
  10. OSTRIP:=
  11. endif
  12. ifeq ($(ADK_TARGET_KERNEL_ZIMAGE),y)
  13. KERNEL:=$(LINUX_DIR)/arch/h8300/boot/zImage
  14. OSTRIP:=
  15. endif
  16. ifeq ($(ADK_TARGET_KERNEL_VMLINUX_SREC),y)
  17. KERNEL:=$(LINUX_DIR)/arch/h8300/boot/vmlinux.srec
  18. endif
  19. ifeq ($(ADK_TARGET_KERNEL_VMLINUX_BIN),y)
  20. KERNEL:=$(LINUX_DIR)/arch/h8300/boot/vmlinux.bin
  21. OSTRIP:=
  22. endif
  23. QEMU_ARGS:=${ADK_QEMU_ARGS}
  24. ifeq ($(ADK_TARGET_SYSTEM_QEMU_H8300),y)
  25. QEMU_ARGS+=-M edosk2674 -append "console=ttySC2,38400"
  26. endif
  27. # target helper text
  28. ifeq ($(ADK_TARGET_FS),archive)
  29. targethelp:
  30. @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSTARBALL)"
  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. endif
  37. ifeq ($(ADK_TARGET_FS),initramfsarchive)
  38. targethelp:
  39. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  40. @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
  41. endif
  42. ifeq ($(ADK_TARGET_FS),initramfspiggyback)
  43. targethelp:
  44. @echo 'The kernel+initramfs file is: $(FW_DIR)/${TARGET_KERNEL}'
  45. ifeq ($(ADK_TARGET_SIM),y)
  46. @echo "Run the simulator via:"
  47. @echo '$(TARGET_CROSS)gdb $(FW_DIR)/$(TARGET_KERNEL)'
  48. @echo 'gdb> target sim'
  49. @echo 'gdb> sim intmode 1'
  50. @echo 'gdb> sim sci net 12345'
  51. @echo 'gdb> load'
  52. @echo 'start telnet localhost 12345 in a second shell'
  53. @echo 'gdb> run earlyprintk=h8300-sim console=ttySC0'
  54. endif
  55. endif
  56. ifeq ($(ADK_TARGET_FS),nfsroot)
  57. targethelp:
  58. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  59. @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
  60. endif
  61. ifeq ($(ADK_TARGET_FS),squashfs)
  62. targethelp:
  63. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  64. @echo "The RootFS image is: $(FW_DIR)/$(ROOTFSSQUASHFS)"
  65. ifeq ($(ADK_TARGET_QEMU),y)
  66. @echo "Start qemu with following options:"
  67. @echo 'qemu-system-h8300 $(QEMU_ARGS) -nographic -kernel $(FW_DIR)/$(TARGET_KERNEL) -pflash $(FW_DIR)/$(ROOTFSSQUASHFS)'
  68. endif
  69. endif
  70. kernel-strip:
  71. ifneq ($(OSTRIP),)
  72. $(TARGET_CROSS)objcopy $(OSTRIP) -S $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL)
  73. else
  74. @cp $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL)
  75. endif
  76. kernel-install: kernel-strip
  77. @cp $(BUILD_DIR)/$(TARGET_KERNEL) $(FW_DIR)/$(TARGET_KERNEL)
  78. ifeq ($(ADK_TARGET_FS),squashfs)
  79. env PATH=$(HOST_PATH) qemu-img create -f raw $(FW_DIR)/$(ROOTFSSQUASHFS) 4M
  80. dd conv=notrunc if=$(BUILD_DIR)/root.squashfs of=$(FW_DIR)/$(ROOTFSSQUASHFS)
  81. endif
  82. # filesystem specific targets
  83. ifeq ($(ADK_TARGET_FS),archive)
  84. imageinstall: $(FW_DIR)/$(ROOTFSTARBALL) targethelp
  85. endif
  86. ifeq ($(ADK_TARGET_FS),initramfs)
  87. imageinstall: kernel-install $(FW_DIR)/$(INITRAMFS) targethelp
  88. endif
  89. ifeq ($(ADK_TARGET_FS),initramfsarchive)
  90. imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
  91. endif
  92. ifeq ($(ADK_TARGET_FS),initramfspiggyback)
  93. imageinstall: createinitramfs targethelp
  94. endif
  95. ifeq ($(ADK_TARGET_FS),nfsroot)
  96. imageinstall: kernel-install $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
  97. endif
  98. ifeq ($(ADK_TARGET_FS),squashfs)
  99. imageinstall: $(BUILD_DIR)/root.squashfs kernel-install targethelp
  100. endif