OpenSBI的配置选项位于不同平台下的config.mk
文件,例如platform/generic/config.mk
:
# Blobs to build
FW_TEXT_START=0x80000000
FW_DYNAMIC=y
FW_JUMP=y
FW_PAYLOAD=y
ifeq ($(PLATFORM_RISCV_XLEN), 32)
# This needs to be 4MB aligned for 32-bit system
FW_JUMP_ADDR=$(shell printf "0x%X" $$(($(FW_TEXT_START) + 0x400000)))
else
# This needs to be 2MB aligned for 64-bit system
FW_JUMP_ADDR=$(shell printf "0x%X" $$(($(FW_TEXT_START) + 0x200000)))
endif
FW_JUMP_FDT_ADDR=$(shell printf "0x%X" $$(($(FW_TEXT_START) + 0x2200000)))
ifeq ($(PLATFORM_RISCV_XLEN), 32)
# This needs to be 4MB aligned for 32-bit system
FW_PAYLOAD_OFFSET=0x400000
else
# This needs to be 2MB aligned for 64-bit system
FW_PAYLOAD_OFFSET=0x200000
endif
FW_PAYLOAD_FDT_ADDR=$(FW_JUMP_FDT_ADDR)
选择编译需要的固件类型:
三种固件,根据自己的需求,在对应的固件类型配置为y:
FW_DYNAMIC
=yFW_JUMP
=yFW_PAYLOAD
=y默认三种固件类型都编译。
FW_TEXT_START
OpenSBI的运行地址,需要把OpenSBI下载到FW_TEXT_START指定的地址才能运行
FW_JUMP_ADDR
FW_JUMP固件的跳转地址,对于RV32需要4M对齐,对于RV64需要2M对齐
FW_PAYLOAD_OFFSET
FW_PAYLOAD固件的偏移地址,对于RV32需要4对齐,对于RV64需要2M对齐
FW_JUMP_FDT_ADDR
和FW_PAYLOAD_FDT_ADDR
设备树的地址
这里可能有个疑问:为什么跳转地址/偏移地址需要2M对齐或4M对齐?这个跟RISC-V Linux启动时建立的页表有关,需要深入分析才知道。
全部0条评论
快来发表一下你的评论吧 !