LINUX_KERNEL_IMAGE_HEADER has no prompt, so a board can only get the
header through a select in its platform Kconfig, and the text offset
base it needs has no prompt either, so a board cannot set it from its
defconfig.

The header is what a stock boot loader that only ever starts a kernel
image checks before it jumps, and a board whose stock loader cannot be
replaced has to be chainloaded through it. The Keenetic KN-1012, an
MT7981 router, is such a board: its loader accepts a kernel FIT and
nothing else, and U-Boot runs from it as that kernel. Getting the header
onto the binary took a platform Kconfig change for one board.

Give both symbols a prompt, so a board defconfig can enable the header
and set the offset base the loader expects. Platforms that select the
header are not affected, and the existing per-platform defaults for the
offset base stay in force.

Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <[email protected]>
---
 arch/arm/Kconfig | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 3e9f3b5103..cc40be0048 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -92,18 +92,19 @@ config SPL_USE_SEPARATE_FAULT_HANDLERS
          on them separately.
 
 config LINUX_KERNEL_IMAGE_HEADER
+       bool "Place a Linux kernel image header at the start of U-Boot"
        depends on ARM64
-       bool
        help
          Place a Linux kernel image header at the start of the U-Boot binary.
          The format of the header is described in the Linux kernel source at
          Documentation/arm64/booting.txt. This feature is useful since the
          image header reports the amount of memory (BSS and similar) that
-         U-Boot needs to use, but which isn't part of the binary.
+         U-Boot needs to use, but which isn't part of the binary. It also
+         lets a boot loader that only starts kernel images chainload U-Boot.
 
 config LNX_KRNL_IMG_TEXT_OFFSET_BASE
+       hex "Base of the text offset in the Linux kernel image header"
        depends on LINUX_KERNEL_IMAGE_HEADER
-       hex
        help
          The value subtracted from CONFIG_TEXT_BASE to calculate the
          TEXT_OFFSET value written to the Linux kernel image header.
-- 
2.53.0

Reply via email to