Skip to contentSkip to conversation

docs/firmware: Update FW_JUMP documentation

PATCH New Nylon Chen 2 participants 2 messages Sep 27, 2022 – Oct 13, 2022

lore
Share & tools
lore

Nylon Chen

author
#0 lore raw

PATCH v5 1/1 docs/firmware: Update FW_JUMP documentation

From: "Nylon.Chen" <[email protected]>

Add a tip for OpenSBI's FW_JUMP which helps
users avoid overwriting the kernel.

---
 docs/firmware/fw_jump.md | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
docs/firmware/fw_jump.md +16 -0
index 35a4301..956897e 100644
@@ -41,6 +41,22 @@ follows:
   provided, then the OpenSBI firmware will pass the FDT address passed by the
   previous booting stage to the next booting stage.
 
+  When using the default *FW_JUMP_FDT_ADDR* with *PLATFORM=generic*, you must
+  ensure *FW_JUMP_FDT_ADDR* is set high enough to avoid overwriting the kernel.
+  You can use the following method.
+
+  ```
+  ${CROSS_COMPILE}objdump -h $KERNEL_ELF | sort -k 5,5 | awk -n '/^ +[0-9]+ /\
+  {addr="0x"$3; size="0x"$5; printf "0x""%x\n",addr+size}' \
+  | (( `tail -1` > 0x2200000 )) && echo fdt overlaps kernel,\
+  increase FW_JUMP_FDT_ADDR
+
+  ${LLVM}objdump -h --show-lma $KERNEL_ELF | sort -k 5,5 | \
+  awk -n '/^ +[0-9]+ / {addr="0x"$3; size="0x"$5; printf "0x""%x\n",addr+size}'\
+  | (( `tail -1` > 0x2200000 )) && echo fdt overlaps kernel,\
+  increase FW_JUMP_FDT_ADDR
+  ```
+
 *FW_JUMP* Example
 -----------------
 
Signature · 1 line
2.36.1
Applied
#1 lore raw

PATCH v5 1/1 docs/firmware: Update FW_JUMP documentation

Quoted 8 lines · Nylon Chen

From: "Nylon.Chen" <[email protected]>

Add a tip for OpenSBI's FW_JUMP which helps
users avoid overwriting the kernel.

Looks good to me.

Applied this patch to the riscv/opensbi repo

Thanks,
Anup

Quoted 34 lines
---
 docs/firmware/fw_jump.md | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
docs/firmware/fw_jump.md +16 -1
index 35a4301..956897e 100644
@@ -41,6 +41,22 @@ follows:
   provided, then the OpenSBI firmware will pass the FDT address passed by the
   previous booting stage to the next booting stage.
 
+  When using the default *FW_JUMP_FDT_ADDR* with *PLATFORM=generic*, you must
+  ensure *FW_JUMP_FDT_ADDR* is set high enough to avoid overwriting the kernel.
+  You can use the following method.
+
+  ```
+  ${CROSS_COMPILE}objdump -h $KERNEL_ELF | sort -k 5,5 | awk -n '/^ +[0-9]+ /\
+  {addr="0x"$3; size="0x"$5; printf "0x""%x\n",addr+size}' \
+  | (( `tail -1` > 0x2200000 )) && echo fdt overlaps kernel,\
+  increase FW_JUMP_FDT_ADDR
+
+  ${LLVM}objdump -h --show-lma $KERNEL_ELF | sort -k 5,5 | \
+  awk -n '/^ +[0-9]+ / {addr="0x"$3; size="0x"$5; printf "0x""%x\n",addr+size}'\
+  | (( `tail -1` > 0x2200000 )) && echo fdt overlaps kernel,\
+  increase FW_JUMP_FDT_ADDR
+  ```
+
 *FW_JUMP* Example
 -----------------
 
--

2.36.1