Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153689724
D23436.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D23436.diff
View Options
Index: head/sys/conf/Makefile.riscv
===================================================================
--- head/sys/conf/Makefile.riscv
+++ head/sys/conf/Makefile.riscv
@@ -28,8 +28,17 @@
INCLUDES+= -I$S/contrib/libfdt
+# Set the ELF LMA to the address that OpenSBI's fw_jump jumps to. This allows
+# us to load the kernel with the -kernel flag in QEMU without having to embed
+# it inside BBL or OpenSBI's fw_payload first.
+# Note: For rv32 the start address is different (0x80400000).
+# We set this value using --defsym rather than hardcoding it in ldscript.riscv
+# so that different kernel configs can override the load address.
+KERNEL_LMA?= 0x80200000
+
SYSTEM_LD= @${LD} -N -m ${LD_EMULATION} -Bdynamic -T ${LDSCRIPT} ${_LDFLAGS} \
--no-warn-mismatch --warn-common --export-dynamic \
+ --defsym='kernel_lma=${KERNEL_LMA}' \
--dynamic-linker /red/herring \
-o ${.TARGET} -X ${SYSTEM_OBJS} vers.o
Index: head/sys/conf/ldscript.riscv
===================================================================
--- head/sys/conf/ldscript.riscv
+++ head/sys/conf/ldscript.riscv
@@ -7,7 +7,8 @@
{
/* Read-only sections, merged into text segment: */
. = kernbase;
- .text : AT(ADDR(.text) - kernbase)
+ /* The load address kernel_lma is set using --defsym= on the command line. */
+ .text : AT(kernel_lma)
{
*(.text)
*(.stub)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Apr 23, 10:57 PM (10 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
32049839
Default Alt Text
D23436.diff (1 KB)
Attached To
Mode
D23436: Set the LMA of the riscv kernel to the OpenSBI jump target by default
Attached
Detach File
Event Timeline
Log In to Comment