opensbi.mk 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. ################################################################################
  2. #
  3. # opensbi
  4. #
  5. ################################################################################
  6. OPENSBI_VERSION = 0.8
  7. OPENSBI_SITE = $(call github,riscv,opensbi,v$(OPENSBI_VERSION))
  8. OPENSBI_LICENSE = BSD-2-Clause
  9. OPENSBI_LICENSE_FILES = COPYING.BSD
  10. OPENSBI_INSTALL_TARGET = NO
  11. OPENSBI_INSTALL_STAGING = YES
  12. OPENSBI_MAKE_ENV = \
  13. CROSS_COMPILE=$(TARGET_CROSS)
  14. OPENSBI_PLAT = $(call qstrip,$(BR2_TARGET_OPENSBI_PLAT))
  15. ifneq ($(OPENSBI_PLAT),)
  16. OPENSBI_MAKE_ENV += PLATFORM=$(OPENSBI_PLAT)
  17. endif
  18. ifeq ($(BR2_TARGET_OPENSBI_LINUX_PAYLOAD),y)
  19. OPENSBI_DEPENDENCIES += linux
  20. OPENSBI_MAKE_ENV += FW_PAYLOAD_PATH="$(BINARIES_DIR)/Image"
  21. endif
  22. define OPENSBI_BUILD_CMDS
  23. $(TARGET_MAKE_ENV) $(OPENSBI_MAKE_ENV) $(MAKE) -C $(@D)
  24. endef
  25. ifneq ($(OPENSBI_PLAT),)
  26. OPENSBI_INSTALL_IMAGES = YES
  27. OPENSBI_FW_IMAGES += jump dynamic
  28. ifeq ($(BR2_TARGET_OPENSBI_LINUX_PAYLOAD),y)
  29. OPENSBI_FW_IMAGES += payload
  30. endif
  31. endif
  32. define OPENSBI_INSTALL_IMAGES_CMDS
  33. $(foreach f,$(OPENSBI_FW_IMAGES),\
  34. $(INSTALL) -m 0644 -D $(@D)/build/platform/$(OPENSBI_PLAT)/firmware/fw_$(f).bin \
  35. $(BINARIES_DIR)/fw_$(f).bin
  36. $(INSTALL) -m 0644 -D $(@D)/build/platform/$(OPENSBI_PLAT)/firmware/fw_$(f).elf \
  37. $(BINARIES_DIR)/fw_$(f).elf
  38. )
  39. endef
  40. # libsbi.a is not a library meant to be linked in user-space code, but
  41. # with bare metal code, which is why we don't install it in
  42. # $(STAGING_DIR)/usr/lib
  43. define OPENSBI_INSTALL_STAGING_CMDS
  44. $(INSTALL) -m 0644 -D $(@D)/build/lib/libsbi.a $(STAGING_DIR)/usr/share/opensbi/libsbi.a
  45. endef
  46. $(eval $(generic-package))