Initial Commit
- initial default booting image
This commit is contained in:
136
boot/opensbi/Config.in
Normal file
136
boot/opensbi/Config.in
Normal file
@@ -0,0 +1,136 @@
|
||||
menuconfig BR2_TARGET_OPENSBI
|
||||
bool "opensbi"
|
||||
depends on BR2_riscv
|
||||
help
|
||||
OpenSBI aims to provide an open-source and extensible
|
||||
implementation of the RISC-V SBI specification for a platform
|
||||
specific firmware (M-mode) and a general purpose OS,
|
||||
hypervisor or bootloader (S-mode or HS-mode). OpenSBI
|
||||
implementation can be easily extended by RISC-V platform or
|
||||
System-on-Chip vendors to fit a particular hadware
|
||||
configuration.
|
||||
|
||||
https://github.com/riscv-software-src/opensbi
|
||||
|
||||
if BR2_TARGET_OPENSBI
|
||||
choice
|
||||
prompt "OpenSBI Version"
|
||||
help
|
||||
Select the specific OpenSBI version you want to use
|
||||
|
||||
config BR2_TARGET_OPENSBI_LATEST_VERSION
|
||||
bool "Latest version (1.8.1)"
|
||||
|
||||
config BR2_TARGET_OPENSBI_CUSTOM_VERSION
|
||||
bool "Custom version"
|
||||
help
|
||||
This option allows to use a specific official versions
|
||||
|
||||
config BR2_TARGET_OPENSBI_CUSTOM_TARBALL
|
||||
bool "Custom tarball"
|
||||
|
||||
config BR2_TARGET_OPENSBI_CUSTOM_GIT
|
||||
bool "Custom Git repository"
|
||||
|
||||
endchoice
|
||||
|
||||
config BR2_TARGET_OPENSBI_CUSTOM_VERSION_VALUE
|
||||
string "OpenSBI version"
|
||||
depends on BR2_TARGET_OPENSBI_CUSTOM_VERSION
|
||||
|
||||
config BR2_TARGET_OPENSBI_CUSTOM_TARBALL_LOCATION
|
||||
string "URL of custom OpenSBI tarball"
|
||||
depends on BR2_TARGET_OPENSBI_CUSTOM_TARBALL
|
||||
|
||||
if BR2_TARGET_OPENSBI_CUSTOM_GIT
|
||||
|
||||
config BR2_TARGET_OPENSBI_CUSTOM_REPO_URL
|
||||
string "URL of custom repository"
|
||||
|
||||
config BR2_TARGET_OPENSBI_CUSTOM_REPO_VERSION
|
||||
string "Custom repository version"
|
||||
help
|
||||
Revision to use in the typical format used by Git. E.G. a
|
||||
sha id, a tag, branch, ..
|
||||
|
||||
endif
|
||||
|
||||
config BR2_TARGET_OPENSBI_VERSION
|
||||
string
|
||||
default "1.8.1" if BR2_TARGET_OPENSBI_LATEST_VERSION
|
||||
default BR2_TARGET_OPENSBI_CUSTOM_VERSION_VALUE \
|
||||
if BR2_TARGET_OPENSBI_CUSTOM_VERSION
|
||||
default "custom" if BR2_TARGET_OPENSBI_CUSTOM_TARBALL
|
||||
default BR2_TARGET_OPENSBI_CUSTOM_REPO_VERSION \
|
||||
if BR2_TARGET_OPENSBI_CUSTOM_GIT
|
||||
|
||||
config BR2_TARGET_OPENSBI_LICENSE_FILES
|
||||
string "OpenSBI license files" if BR2_TARGET_OPENSBI_CUSTOM_GIT || \
|
||||
BR2_TARGET_OPENSBI_CUSTOM_TARBALL
|
||||
default "COPYING.BSD"
|
||||
help
|
||||
A space-separated list of license files related to the OpenSBI
|
||||
package.
|
||||
|
||||
config BR2_TARGET_OPENSBI_PLAT
|
||||
string "OpenSBI Platform"
|
||||
default ""
|
||||
help
|
||||
Specifies the OpenSBI platform to build. If no platform is
|
||||
specified only the OpenSBI platform independent static
|
||||
library libsbi.a is built. If a platform is specified then
|
||||
the platform specific static library libplatsbi.a and firmware
|
||||
examples are built.
|
||||
|
||||
config BR2_TARGET_OPENSBI_INSTALL_DYNAMIC_IMG
|
||||
bool "Install fw_dynamic image"
|
||||
default y if BR2_TARGET_OPENSBI_PLAT != ""
|
||||
help
|
||||
This installs the fw_dynamic image.
|
||||
|
||||
config BR2_TARGET_OPENSBI_INSTALL_JUMP_IMG
|
||||
bool "Install fw_jump image"
|
||||
default y if BR2_TARGET_OPENSBI_PLAT != ""
|
||||
help
|
||||
This installs the fw_jump image.
|
||||
|
||||
config BR2_TARGET_OPENSBI_INSTALL_PAYLOAD_IMG
|
||||
bool "Install fw_payload image"
|
||||
help
|
||||
This option enables the installation of the fw_paylaod
|
||||
image.
|
||||
|
||||
config BR2_TARGET_OPENSBI_LINUX_PAYLOAD
|
||||
bool "Include Linux as OpenSBI Payload"
|
||||
depends on BR2_TARGET_OPENSBI_PLAT != ""
|
||||
depends on BR2_LINUX_KERNEL
|
||||
depends on BR2_LINUX_KERNEL_IMAGE
|
||||
select BR2_TARGET_OPENSBI_INSTALL_PAYLOAD_IMG
|
||||
help
|
||||
Build OpenSBI with the Linux kernel as a Payload.
|
||||
|
||||
config BR2_TARGET_OPENSBI_UBOOT_PAYLOAD
|
||||
bool "Include U-Boot as OpenSBI Payload"
|
||||
depends on BR2_TARGET_OPENSBI_PLAT != ""
|
||||
depends on BR2_TARGET_UBOOT
|
||||
select BR2_TARGET_OPENSBI_INSTALL_PAYLOAD_IMG
|
||||
help
|
||||
Build OpenSBI with the U-Boot as a Payload.
|
||||
|
||||
config BR2_TARGET_OPENSBI_FW_FDT_PATH
|
||||
bool "Include U-Boot DTB in OpenSBI Payload"
|
||||
depends on BR2_TARGET_OPENSBI_UBOOT_PAYLOAD
|
||||
select BR2_TARGET_UBOOT_FORMAT_DTB
|
||||
help
|
||||
Build OpenSBI with FW_FDT_PATH set to
|
||||
$(BINARIES_DIR)/u-boot.dtb. Note that CONFIG_OF_SEPARATE
|
||||
must be set in the U-Boot configuration for this file to be
|
||||
produced.
|
||||
|
||||
config BR2_TARGET_OPENSBI_ADDITIONAL_VARIABLES
|
||||
string "Additional build variables"
|
||||
help
|
||||
Additional parameters for the build, which will be passed on
|
||||
the make command line. E.g: BUILD_INFO=1.
|
||||
|
||||
endif
|
||||
3
boot/opensbi/opensbi.hash
Normal file
3
boot/opensbi/opensbi.hash
Normal file
@@ -0,0 +1,3 @@
|
||||
# locally computed
|
||||
sha256 fb1ae61a85e966322101acb1c982f84d9eaafc4de7dd474a7d7546d9bb321c6f opensbi-1.8.1.tar.gz
|
||||
sha256 82d13fb1bf6bb162629deeea9eb9c117e74548d3b707e478967691fe79a68e21 COPYING.BSD
|
||||
90
boot/opensbi/opensbi.mk
Normal file
90
boot/opensbi/opensbi.mk
Normal file
@@ -0,0 +1,90 @@
|
||||
################################################################################
|
||||
#
|
||||
# opensbi
|
||||
#
|
||||
################################################################################
|
||||
|
||||
OPENSBI_VERSION = $(call qstrip,$(BR2_TARGET_OPENSBI_VERSION))
|
||||
|
||||
ifeq ($(BR2_TARGET_OPENSBI_CUSTOM_TARBALL),y)
|
||||
# Handle custom OpenSBI tarballs as specified by the configuration
|
||||
OPENSBI_TARBALL = $(call qstrip,$(BR2_TARGET_OPENSBI_CUSTOM_TARBALL_LOCATION))
|
||||
OPENSBI_SITE = $(patsubst %/,%,$(dir $(OPENSBI_TARBALL)))
|
||||
OPENSBI_SOURCE = $(notdir $(OPENSBI_TARBALL))
|
||||
else ifeq ($(BR2_TARGET_OPENSBI_CUSTOM_GIT),y)
|
||||
OPENSBI_SITE = $(call qstrip,$(BR2_TARGET_OPENSBI_CUSTOM_REPO_URL))
|
||||
OPENSBI_SITE_METHOD = git
|
||||
else
|
||||
# Handle official OpenSBI versions
|
||||
OPENSBI_SITE = $(call github,riscv-software-src,opensbi,v$(OPENSBI_VERSION))
|
||||
endif
|
||||
|
||||
OPENSBI_LICENSE = BSD-2-Clause
|
||||
OPENSBI_LICENSE_FILES = $(call qstrip,$(BR2_TARGET_OPENSBI_LICENSE_FILES))
|
||||
OPENSBI_INSTALL_TARGET = NO
|
||||
OPENSBI_INSTALL_STAGING = YES
|
||||
|
||||
ifeq ($(BR2_TARGET_OPENSBI)$(BR2_TARGET_OPENSBI_LATEST_VERSION),y)
|
||||
BR_NO_CHECK_HASH_FOR += $(OPENSBI_SOURCE)
|
||||
endif
|
||||
|
||||
OPENSBI_MAKE_ENV = \
|
||||
CROSS_COMPILE=$(TARGET_CROSS) \
|
||||
$(call qstrip,$(BR2_TARGET_OPENSBI_ADDITIONAL_VARIABLES))
|
||||
|
||||
OPENSBI_PLAT = $(call qstrip,$(BR2_TARGET_OPENSBI_PLAT))
|
||||
ifneq ($(OPENSBI_PLAT),)
|
||||
OPENSBI_MAKE_ENV += PLATFORM=$(OPENSBI_PLAT)
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_TARGET_OPENSBI_LINUX_PAYLOAD),y)
|
||||
OPENSBI_DEPENDENCIES += linux
|
||||
OPENSBI_MAKE_ENV += FW_PAYLOAD_PATH="$(BINARIES_DIR)/Image"
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_TARGET_OPENSBI_UBOOT_PAYLOAD),y)
|
||||
OPENSBI_DEPENDENCIES += uboot
|
||||
OPENSBI_MAKE_ENV += FW_PAYLOAD_PATH="$(BINARIES_DIR)/u-boot.bin"
|
||||
ifeq ($(BR2_TARGET_OPENSBI_FW_FDT_PATH),y)
|
||||
OPENSBI_MAKE_ENV += FW_FDT_PATH="$(BINARIES_DIR)/u-boot.dtb"
|
||||
endif
|
||||
endif
|
||||
|
||||
define OPENSBI_BUILD_CMDS
|
||||
$(TARGET_MAKE_ENV) $(OPENSBI_MAKE_ENV) $(MAKE) -C $(@D)
|
||||
endef
|
||||
|
||||
ifeq ($(BR2_TARGET_OPENSBI_INSTALL_DYNAMIC_IMG),y)
|
||||
OPENSBI_INSTALL_IMAGES = YES
|
||||
OPENSBI_FW_IMAGES += dynamic
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_TARGET_OPENSBI_INSTALL_JUMP_IMG),y)
|
||||
OPENSBI_INSTALL_IMAGES = YES
|
||||
OPENSBI_FW_IMAGES += jump
|
||||
endif
|
||||
|
||||
ifeq ($(BR2_TARGET_OPENSBI_INSTALL_PAYLOAD_IMG),y)
|
||||
OPENSBI_INSTALL_IMAGES = YES
|
||||
OPENSBI_FW_IMAGES += payload
|
||||
endif
|
||||
|
||||
ifneq ($(OPENSBI_PLAT),)
|
||||
define OPENSBI_INSTALL_IMAGES_CMDS
|
||||
$(foreach f,$(OPENSBI_FW_IMAGES),\
|
||||
$(INSTALL) -m 0644 -D $(@D)/build/platform/$(OPENSBI_PLAT)/firmware/fw_$(f).bin \
|
||||
$(BINARIES_DIR)/fw_$(f).bin
|
||||
$(INSTALL) -m 0644 -D $(@D)/build/platform/$(OPENSBI_PLAT)/firmware/fw_$(f).elf \
|
||||
$(BINARIES_DIR)/fw_$(f).elf
|
||||
)
|
||||
endef
|
||||
endif
|
||||
|
||||
# libsbi.a is not a library meant to be linked in user-space code, but
|
||||
# with bare metal code, which is why we don't install it in
|
||||
# $(STAGING_DIR)/usr/lib
|
||||
define OPENSBI_INSTALL_STAGING_CMDS
|
||||
$(INSTALL) -m 0644 -D $(@D)/build/lib/libsbi.a $(STAGING_DIR)/usr/share/opensbi/libsbi.a
|
||||
endef
|
||||
|
||||
$(eval $(generic-package))
|
||||
Reference in New Issue
Block a user