Skip to contentSkip to conversation

rockchip: Set default LNX_KRNL_IMG_TEXT_OFFSET_BASE to SYS_TEXT_BASE

PATCH In review Alper Nebi Yasak 3 participants 3 messages Jan 29, 2022 – Mar 14, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rockchip: Set default LNX_KRNL_IMG_TEXT_OFFSET_BASE to SYS_TEXT_BASE

U-Boot can be chainloaded from vendor firmware on ARM64 chromebooks from a GPT partition (roughly the same as in doc/chromium/chainload.rst), but an appropriate image header must be built-in to the U-Boot binary by enabling LINUX_KERNEL_IMAGE_HEADER.

This header has a field for an image load offset from 2MiB alignment which must also be customized through LNX_KRNL_IMG_TEXT_OFFSET_BASE. Set it equal to SYS_TEXT_BASE by default for Rockchip boards, which happens to make this offset zero and works fine on chromebook_kevin both for chainloading and bare-metal use.

---
Looks like ARM64 chromebooks also need POSITION_INDEPENDENT=y to chainload that way, but I'm not enabling the configs here. I'm thinking of selecting these from new configs that also enable binman definitions for the kernel partition and legacy boot images.

 arch/arm/mach-rockchip/Kconfig | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/mach-rockchip/Kconfig +3 -0
index 92f35309e4a6..308dc09b0389 100644
@@ -390,6 +390,9 @@ config ROCKCHIP_SPI_IMAGE
 	  containing U-Boot. The image is built by binman. U-Boot sits near
 	  the start of the image.
 
+config LNX_KRNL_IMG_TEXT_OFFSET_BASE
+	default SYS_TEXT_BASE
+
 source "arch/arm/mach-rockchip/px30/Kconfig"
 source "arch/arm/mach-rockchip/rk3036/Kconfig"
 source "arch/arm/mach-rockchip/rk3128/Kconfig"
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · Alper Nebi Yasak

U-Boot can be chainloaded from vendor firmware on ARM64 chromebooks from a GPT partition (roughly the same as in doc/chromium/chainload.rst), but an appropriate image header must be built-in to the U-Boot binary by enabling LINUX_KERNEL_IMAGE_HEADER.

This header has a field for an image load offset from 2MiB alignment which must also be customized through LNX_KRNL_IMG_TEXT_OFFSET_BASE. Set it equal to SYS_TEXT_BASE by default for Rockchip boards, which happens to make this offset zero and works fine on chromebook_kevin both for chainloading and bare-metal use.

Quoted 9 lines

---
Looks like ARM64 chromebooks also need POSITION_INDEPENDENT=y to chainload that way, but I'm not enabling the configs here. I'm thinking of selecting these from new configs that also enable binman definitions for the kernel partition and legacy boot images.

 arch/arm/mach-rockchip/Kconfig | 3 +++
 1 file changed, 3 insertions(+)
Reviewed-by on v1 1/1
#2 lore raw
In reply to Alper Nebi Yasak

Hi Alper,

Quoted 6 lines · Alper Nebi Yasak <[email protected]> 于2022年1月29日周六 23:28写道:

U-Boot can be chainloaded from vendor firmware on ARM64 chromebooks from a GPT partition (roughly the same as in doc/chromium/chainload.rst), but an appropriate image header must be built-in to the U-Boot binary by enabling LINUX_KERNEL_IMAGE_HEADER.

Quoted 7 lines

This header has a field for an image load offset from 2MiB alignment which must also be customized through LNX_KRNL_IMG_TEXT_OFFSET_BASE. Set it equal to SYS_TEXT_BASE by default for Rockchip boards, which happens to make this offset zero and works fine on chromebook_kevin both for chainloading and bare-metal use.

Thanks,
- Kever

Quoted 26 lines

---
Looks like ARM64 chromebooks also need POSITION_INDEPENDENT=y to chainload that way, but I'm not enabling the configs here. I'm thinking of selecting these from new configs that also enable binman definitions for the kernel partition and legacy boot images.

 arch/arm/mach-rockchip/Kconfig | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/mach-rockchip/Kconfig +3 -1
index 92f35309e4a6..308dc09b0389 100644
@@ -390,6 +390,9 @@ config ROCKCHIP_SPI_IMAGE
          containing U-Boot. The image is built by binman. U-Boot sits near
          the start of the image.
 
+config LNX_KRNL_IMG_TEXT_OFFSET_BASE
+       default SYS_TEXT_BASE
+
 source "arch/arm/mach-rockchip/px30/Kconfig"
 source "arch/arm/mach-rockchip/rk3036/Kconfig"
 source "arch/arm/mach-rockchip/rk3128/Kconfig"
--

2.34.1