Skip to contentSkip to conversation

docs: Correct FW_JUMP_FDT_ADDR calculation example

PATCH New Gabriel Somlo 2 participants 2 messages Mar 30, 2023 – Apr 7, 2023

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 docs: Correct FW_JUMP_FDT_ADDR calculation example

When using PLATFORM=generic defaults, the kernel is loaded at FW_JUMP_ADDR, and the FDT is loaded at `FW_JUMP_FDT_ADDR.

Therefore, the maximum kernel size before FW_JUMP_FDT_ADDR must be increased is $(( FW_JUMP_FDT_ADDR - FW_JUMP_ADDR )).

The example calculation assumes rv64, and is wrong to boot (off by 0x200000). Fix it and update it for the general case.

---
 docs/firmware/fw_jump.md | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
docs/firmware/fw_jump.md +9 -9
index 956897e..3e883fa 100644
@@ -43,18 +43,18 @@ follows:
 
   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.
+  You can use the following method (e.g., using bash or zsh):
 
   ```
-  ${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
+  ${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` > (FW_JUMP_FDT_ADDR - FW_JUMP_ADDR) )) &&
+  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
+  ${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` > (FW_JUMP_FDT_ADDR - FW_JUMP_ADDR) )) &&
+  echo fdt overlaps kernel, increase FW_JUMP_FDT_ADDR
   ```
 
 *FW_JUMP* Example
Signature · 1 line
2.39.2
Applied
#1 lore raw

PATCH v5 1/1 docs: Correct FW_JUMP_FDT_ADDR calculation example

Quoted 7 lines · On Fri, Mar 31, 2023 at 1:55?AM Gabriel Somlo <[email protected]> wrote:

When using PLATFORM=generic defaults, the kernel is loaded at FW_JUMP_ADDR, and the FDT is loaded at `FW_JUMP_FDT_ADDR.

Therefore, the maximum kernel size before FW_JUMP_FDT_ADDR must be increased is $(( FW_JUMP_FDT_ADDR - FW_JUMP_ADDR )).

Quoted 6 lines

The example calculation assumes rv64, and is wrong to boot (off by 0x200000). Fix it and update it for the general case.

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup

Quoted 44 lines
---
 docs/firmware/fw_jump.md | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
docs/firmware/fw_jump.md +9 -10
index 956897e..3e883fa 100644
@@ -43,18 +43,18 @@ follows:
 
   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.
+  You can use the following method (e.g., using bash or zsh):
 
   ```
-  ${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
+  ${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` > (FW_JUMP_FDT_ADDR - FW_JUMP_ADDR) )) &&
+  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
+  ${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` > (FW_JUMP_FDT_ADDR - FW_JUMP_ADDR) )) &&
+  echo fdt overlaps kernel, increase FW_JUMP_FDT_ADDR
   ```
 
 *FW_JUMP* Example
--

2.39.2

--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi