Skip to contentSkip to conversation

docs/firmware: Update FW_JUMP documentation

PATCH Superseded Nylon Chen 2 participants 2 messages Sep 22, 2022

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Nylon Chen

author
#0 lore raw

PATCH v2 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 | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
docs/firmware/fw_jump.md +17 -0
index 35a4301..848f515 100644
@@ -41,6 +41,23 @@ follows:
   provided, then the OpenSBI firmware will pass the FDT address passed by the
   previous booting stage to the next booting stage.
 
+  If your *PLATFORM=generic* and your *FW_JUMP_FDT_ADDR* is default, 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 '/^ +[0-9]+ / ' \
+  | awk -n '{addr="0x"$3; size="0x"$5; printf "0x""%x\n",addr+size}' | \
+  if [[ `tail -n -1` -gt 0x2200000 ]]; then \
+  echo fdt overlaps kernel, increase FW_JUMP_FDT_ADDR ; fi
+
+
+  ${LLVM}objdump -h --show-lma $KERNEL_ELF | sort -k 5,5 | awk '/^ +[0-9]+ / ' \
+  | awk -n '{addr="0x"$3; size="0x"$5; printf "0x""%x\n",addr+size}' | \
+  if [[ `tail -n -1` -gt 0x2200000 ]]; then \
+  echo fdt overlaps kernel, increase FW_JUMP_FDT_ADDR ; fi
+  ```
+
 *FW_JUMP* Example
 -----------------
 
Signature · 1 line
2.36.1
#1 lore raw

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

Quoted 15 lines · Nylon Chen

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 | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
docs/firmware/fw_jump.md +0 -0
index 35a4301..848f515 100644

docs/firmware/fw_jump.md follows: · line 44

Quoted 4 lines
docs/firmware/fw_jump.md +1 -0
@@ -41,6 +41,23 @@ follows:
   provided, then the OpenSBI firmware will pass the FDT address passed by the
   previous booting stage to the next booting stage.
 
+  If your *PLATFORM=generic* and your *FW_JUMP_FDT_ADDR* is default, you must

When using the default *FW_JUMP_FDT_ADDR* with *PLATFORM=generic*,

docs/firmware/fw_jump.md follows: · line 45

Quoted 1 line
docs/firmware/fw_jump.md +1 -0
+  ensure *FW_JUMP_FDT_ADDR* is set high enough to avoid overwriting the kernel

Missing the period at the end of the sentence.

docs/firmware/fw_jump.md follows: · line 52

Quoted 7 lines
docs/firmware/fw_jump.md +7 -0
+  You can use the following method.
+
+  ```
+  ${CROSS_COMPILE}objdump -h $KERNEL_ELF | sort -k 5,5 | awk '/^ +[0-9]+ / ' \
+  | awk -n '{addr="0x"$3; size="0x"$5; printf "0x""%x\n",addr+size}' | \
+  if [[ `tail -n -1` -gt 0x2200000 ]]; then \
+  echo fdt overlaps kernel, increase FW_JUMP_FDT_ADDR ; fi

Should be able to merge the awks and drop the -n on tail and just use && instead of if-then. Also can use (( )) with normal math operators and don't need \ after |

  ${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

Thanks,
drew

Quoted 14 lines
docs/firmware/fw_jump.md +8 -0
+
+
+  ${LLVM}objdump -h --show-lma $KERNEL_ELF | sort -k 5,5 | awk '/^ +[0-9]+ / ' \
+  | awk -n '{addr="0x"$3; size="0x"$5; printf "0x""%x\n",addr+size}' | \
+  if [[ `tail -n -1` -gt 0x2200000 ]]; then \
+  echo fdt overlaps kernel, increase FW_JUMP_FDT_ADDR ; fi
+  ```
+
 *FW_JUMP* Example
 -----------------
 
Signature · 1 line
2.36.1