From 474ee5a81880dcf60789e7c2a3054b3afb34c3ca Mon Sep 17 00:00:00 2001 From: Michael Clark Date: Mon, 21 May 2018 13:29:31 +1200 Subject: RISC-V: Support separate firmware and kernel payload Support for separate firmware and kernel payload is added by updating BBL to read optional preloaded kernel address attributes from device-tree using a similar mechanism to that used to pass init ramdisk addresses to linux kernel. chosen { riscv,kernel-start = <0x00000000 0x80200000>; riscv,kernel-end = <0x00000000 0x80590634>; }; These attributes are added by QEMU and read by BBL when combining -bios and -kernel options. e.g. $ qemu-system-riscv64 -machine virt -bios bbl -kernel vmlinux With this change, bbl can be compiled without --with-payload and the dummy payload alignment is altered to make the memory footprint of the firmware-only bbl smaller. The dummy payload message is updated to indicate the alternative load method. This load method could also be supported by a first stage boot loader that reads seperate firmware and kernel from SPI flash. The main advantage of this new mechanism is that it eases kernel development by avoiding the riscv-pk packaging step after kernel builds, makes building per repository artefacts for CI simpler, and mimics bootloaders on other platforms that can load a kernel image file directly. Ultimately BBL should use an SPI driver to load the kernel image however this mechanism supports use cases such such as QEMU's -bios, -kernel and -initrd options following examples from other platforms that pass kernel entry to firmware via device-tree. Cc: Palmer Dabbelt Cc: Alistair Francis Signed-off-by: Michael Clark --- dummy_payload/dummy_entry.S | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'dummy_payload') diff --git a/dummy_payload/dummy_entry.S b/dummy_payload/dummy_entry.S index 92d4652..2473d8c 100644 --- a/dummy_payload/dummy_entry.S +++ b/dummy_payload/dummy_entry.S @@ -18,5 +18,11 @@ _start: .data str: - .asciz "This is bbl's dummy_payload. To boot a real kernel, reconfigure\n\ -bbl with the flag --with-payload=PATH, then rebuild bbl.\n" + .asciz "This is bbl's dummy_payload. To boot a real kernel, reconfigure bbl +with the flag --with-payload=PATH, then rebuild bbl. Alternatively, +bbl can be used in firmware-only mode by adding device-tree nodes +for an external payload and use QEMU's -bios and -kernel options.\n + chosen { + riscv,kernel-start = ; + riscv,kernel-end = ; + };\n\n" -- cgit v1.1