diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 2c6adf12713ad..89a13e992b73f 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -52,6 +52,16 @@ config PAGE_OFFSET default 0xffffffff80000000 if 64BIT && MAXPHYSMEM_2GB default 0xffffffe000000000 if 64BIT && MAXPHYSMEM_128GB +config LMA_OFFSET + prompt "Load Memory address offset" + hex + default 0x00000000 + help + This selects the load memory address in the vmlinux kernel, which + is needed if you want to do JTAG debugging on the kernel in gdb, + with VM initially off. Default is 0 for compatibility but a more + realistic value would be 0x80000000 for Rocket as an example. + config STACKTRACE_SUPPORT def_bool y diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S index ece84991609ca..1d26a73e5fd3f 100644 --- a/arch/riscv/kernel/vmlinux.lds.S +++ b/arch/riscv/kernel/vmlinux.lds.S @@ -12,7 +12,7 @@ * GNU General Public License for more details. */ -#define LOAD_OFFSET PAGE_OFFSET +#define LOAD_OFFSET (PAGE_OFFSET-CONFIG_LMA_OFFSET) #include #include #include @@ -26,7 +26,7 @@ jiffies = jiffies_64; SECTIONS { /* Beginning of code and text segment */ - . = LOAD_OFFSET; + . = PAGE_OFFSET; _start = .; __init_begin = .; HEAD_TEXT_SECTION