ron minnich has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/81632?usp=email )
Change subject: riscv/opensbi: make the opensbi payload a flat binary ......................................................................
riscv/opensbi: make the opensbi payload a flat binary
opensbi is now self-relocating and, further, has strict requirements on the alignment of the data segment -- it has to be power of 2.
As opposed to trying to play too many games with ELF files and ldscripts, taking them beyond what's possible, It's simplest just to unpack the opensbi elf into a flat binary and bspecify its location in cbfs.
Change-Id: I31525125e87ff5925ca82f4e48fe1191ba6326fd Signed-off-by: Ronald G Minnich rminnich@gmail.com --- M src/arch/riscv/Makefile.mk M src/mainboard/emulation/qemu-riscv/memlayout.ld 2 files changed, 7 insertions(+), 8 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/32/81632/1
diff --git a/src/arch/riscv/Makefile.mk b/src/arch/riscv/Makefile.mk index d5defea..7e00711 100644 --- a/src/arch/riscv/Makefile.mk +++ b/src/arch/riscv/Makefile.mk @@ -149,7 +149,7 @@ OPENSBI_SOURCE := $(top)/3rdparty/opensbi OPENSBI_BUILD := $(abspath $(obj)/3rdparty/opensbi) OPENSBI_TARGET := $(OPENSBI_BUILD)/platform/$(CONFIG_OPENSBI_PLATFORM)/firmware/fw_dynamic.elf -OPENSBI := $(obj)/opensbi.elf +OPENSBI := $(obj)/opensbi.bin
# TODO: Building with clang has troubles finding the proper linker. # Always use GCC for now. @@ -170,16 +170,15 @@ FW_TEXT_START=$(CONFIG_OPENSBI_TEXT_START)
$(OPENSBI): $(OPENSBI_TARGET) - cp $< $@ + $(OBJCOPY_ramstage) -v -O binary $(OPENSBI_TARGET) $(OPENSBI)
OPENSBI_CBFS := $(CONFIG_CBFS_PREFIX)/opensbi $(OPENSBI_CBFS)-file := $(OPENSBI) -$(OPENSBI_CBFS)-type := payload -$(OPENSBI_CBFS)-compression := $(CBFS_COMPRESS_FLAG) +$(OPENSBI_CBFS)-type := flat-binary +$(OPENSBI_CBFS)-compression := none +$(OPENSBI_CBFS)-options := -l $(CONFIG_OPENSBI_TEXT_START) -e $(CONFIG_OPENSBI_TEXT_START) cbfs-files-y += $(OPENSBI_CBFS)
-check-ramstage-overlap-files += $(OPENSBI_CBFS) - CPPFLAGS_common += -I$(OPENSBI_SOURCE)/include ramstage-y += opensbi.c
diff --git a/src/mainboard/emulation/qemu-riscv/memlayout.ld b/src/mainboard/emulation/qemu-riscv/memlayout.ld index 047597b..fc86f05 100644 --- a/src/mainboard/emulation/qemu-riscv/memlayout.ld +++ b/src/mainboard/emulation/qemu-riscv/memlayout.ld @@ -5,8 +5,8 @@ #include <mainboard/addressmap.h>
#define BOOTBLOCKSIZE 128K -#define OPENSBISIZE 512K -#define ROMSTAGESIZE 256K +#define OPENSBISIZE 512K+128K +#define ROMSTAGESIZE 0 #define RAMSTAGESIZE 2M #define CONSOLESIZE 8K #define FMAPSIZE 2K