Skip to content

Commit 6c4a2f6

Browse files
fzi-haxelpalmer-dabbelt
authored andcommitted
riscv: Allow disabling of BUILTIN_DTB for XIP
This enables, among other things, testing with the QEMU virt machine. To build an XIP kernel for the QEMU virt machine, configure the the kernel as desired and apply the following configuration ``` CONFIG_NONPORTABLE=y CONFIG_XIP_KERNEL=y CONFIG_XIP_PHYS_ADDR=0x20000000 CONFIG_PHYS_RAM_BASE=0x80200000 CONFIG_BUILTIN_DTB=n ``` Since the QEMU virt flash memory expects a 32 MB file, the built image must be padded. For example, with `truncate -s 32M arch/riscv/boot/xipImage` The kernel can be started using the following command in QEMU (v8+) ``` qemu-system-riscv64 -M virt,pflash0=pflash0 \ -blockdev node-name=pflash0,driver=file,read-only=on,\ filename=arch/riscv/boot/xipImage <optional parameters> ``` Signed-off-by: Frederik Haxel <haxel@fzi.de> Link: https://lore.kernel.org/r/20231212130116.848530-4-haxel@fzi.de Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
1 parent 5daa372 commit 6c4a2f6

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

arch/riscv/Kconfig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -904,13 +904,13 @@ config RISCV_ISA_FALLBACK
904904
on the replacement properties, "riscv,isa-base" and
905905
"riscv,isa-extensions".
906906

907-
endmenu # "Boot options"
908-
909907
config BUILTIN_DTB
910-
bool
908+
bool "Built-in device tree"
911909
depends on OF && NONPORTABLE
912910
default y if XIP_KERNEL
913911

912+
endmenu # "Boot options"
913+
914914
config PORTABLE
915915
bool
916916
default !NONPORTABLE

arch/riscv/kernel/head.S

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,10 +266,12 @@ SYM_CODE_START(_start_kernel)
266266
la sp, _end + THREAD_SIZE
267267
XIP_FIXUP_OFFSET sp
268268
mv s0, a0
269+
mv s1, a1
269270
call __copy_data
270271

271-
/* Restore a0 copy */
272+
/* Restore a0 & a1 copy */
272273
mv a0, s0
274+
mv a1, s1
273275
#endif
274276

275277
#ifndef CONFIG_XIP_KERNEL

0 commit comments

Comments
 (0)