1
0

Makefile 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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:=-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. endif
  15. ifeq ($(ADK_TARGET_FS),initramfsarchive)
  16. targethelp:
  17. @echo 'The kernel file is: $(FW_DIR)/${TARGET_KERNEL}'
  18. @echo "The RootFS tarball is: $(FW_DIR)/$(ROOTFSUSERTARBALL)"
  19. endif
  20. ifeq ($(ADK_TARGET_FS),initramfspiggyback)
  21. targethelp:
  22. @echo 'The kernel+initramfs file is: $(FW_DIR)/${TARGET_KERNEL}'
  23. endif
  24. kernel-strip:
  25. $(TARGET_CROSS)objcopy $(OSTRIP) -S $(KERNEL) $(BUILD_DIR)/$(TARGET_KERNEL)
  26. kernel-install: kernel-strip
  27. @cp $(BUILD_DIR)/$(TARGET_KERNEL) $(FW_DIR)/$(TARGET_KERNEL)
  28. bbl:
  29. @mkdir -p $(BUILD_DIR)/bbl
  30. @rm -rf $(BUILD_DIR)/riscv-pk
  31. (cd $(BUILD_DIR)/ && git clone https://github.com/riscv/riscv-pk.git)
  32. (cd $(BUILD_DIR)/bbl && PATH='$(HOST_PATH)' ../riscv-pk/configure \
  33. --host=$(GNU_TARGET_NAME) --target=$(GNU_TARGET_NAME) \
  34. --with-payload=$(FW_DIR)/$(TARGET_KERNEL))
  35. (cd $(BUILD_DIR)/bbl && PATH='$(HOST_PATH)' make)
  36. cp $(BUILD_DIR)/bbl/bbl $(FW_DIR)/$(TARGET_KERNEL).bbl
  37. # filesystem specific targets
  38. ifeq ($(ADK_TARGET_FS),initramfs)
  39. imageinstall: kernel-install bbl $(FW_DIR)/$(INITRAMFS) targethelp
  40. endif
  41. ifeq ($(ADK_TARGET_FS),initramfsarchive)
  42. imageinstall: kernel-install bbl $(FW_DIR)/$(ROOTFSUSERTARBALL) targethelp
  43. endif
  44. ifeq ($(ADK_TARGET_FS),initramfspiggyback)
  45. imageinstall: createinitramfs bbl targethelp
  46. endif