Makefile 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. QEMU_ARGS:=-M virt -nographic
  9. # target helper text
  10. ifeq ($(ADK_TARGET_FS),initramfs)
  11. targethelp:
  12. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  13. @echo 'The initramfs image is: ${FW_DIR}/${INITRAMFS}'
  14. ifeq ($(ADK_TARGET_QEMU),y)
  15. @echo "Start qemu with following command line:"
  16. @echo 'qemu-system-riscv64 ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL).bbl -initrd ${FW_DIR}/${INITRAMFS}'
  17. endif
  18. endif
  19. ifeq ($(ADK_TARGET_FS),initramfsarchive)
  20. targethelp:
  21. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}.bbl'
  22. @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
  23. endif
  24. ifeq ($(ADK_TARGET_FS),initramfspiggyback)
  25. targethelp:
  26. @echo 'The kernel+initramfs file is: $(FW_DIR)/${TARGET_KERNEL}'
  27. ifeq ($(ADK_TARGET_QEMU),y)
  28. @echo "Start qemu with following command line:"
  29. @echo 'qemu-system-riscv64 ${QEMU_ARGS} -kernel $(FW_DIR)/$(TARGET_KERNEL).bbl'
  30. endif
  31. endif
  32. kernel-strip:
  33. $(TARGET_CROSS)objcopy $(OSTRIP) -S $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL)
  34. kernel-install: kernel-strip
  35. @cp $(BUILD_DIR)/$(TARGET_KERNEL) $(FW_DIR)/$(TARGET_KERNEL)
  36. bbl:
  37. @mkdir -p $(BUILD_DIR)/bbl
  38. @rm -rf $(BUILD_DIR)/riscv-pk
  39. (cd $(BUILD_DIR)/ && git clone https://github.com/riscv/riscv-pk.git)
  40. (cd $(BUILD_DIR)/bbl && PATH='$(HOST_PATH)' ../riscv-pk/configure \
  41. --host=$(GNU_TARGET_NAME) --target=$(GNU_TARGET_NAME) \
  42. --with-payload=$(FW_DIR)/$(TARGET_KERNEL))
  43. (cd $(BUILD_DIR)/bbl && PATH='$(HOST_PATH)' make)
  44. cp $(BUILD_DIR)/bbl/bbl $(FW_DIR)/$(TARGET_KERNEL).bbl
  45. # filesystem specific targets
  46. ifeq ($(ADK_TARGET_FS),initramfs)
  47. imageinstall: kernel-install bbl $(FW_DIR)/$(INITRAMFS) targethelp
  48. endif
  49. ifeq ($(ADK_TARGET_FS),initramfsarchive)
  50. imageinstall: kernel-install bbl $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
  51. endif
  52. ifeq ($(ADK_TARGET_FS),initramfspiggyback)
  53. imageinstall: createinitramfs bbl targethelp
  54. endif