Skip to contentSkip to conversation

Nokia RX-51: Fixes for U-Boot v2023.01-rc1

PATCH In review Pali Rohár 3 participants 8 messages Nov 20, 2022 – Nov 21, 2022 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

cover Nokia RX-51: Fixes for U-Boot v2023.01-rc1

This patch series fixes U-Boot v2023.01-rc1 on Nokia N900 and extend documentation for debugging purposes. The main issue is broken POSITION_INDEPENDENT=y for (probably all) 32-bit ARM boards.

Pali Rohár (3):
arm32: Fix relocation of env_addr if POSITION_INDEPENDENT=y Nokia RX-51: Document debugging options and compile command Nokia RX-51: Do not overwrite standard $loadaddr variable

 arch/arm/lib/crt0.S          |  5 +++++
 doc/board/nokia/rx51.rst     | 32 ++++++++++++++++++++++++++++++++
 include/configs/nokia_rx51.h |  9 +++++----
 3 files changed, 42 insertions(+), 4 deletions(-)
Signature · 1 line
2.20.1
#6 lore raw

PATCH 3/3 Nokia RX-51: Do not overwrite standard $loadaddr variable

Instead of overwriting $loadaddr variable, use custom temporary $fileloadaddr variable. So scripts can access default/original address stored in $loadaddr at build time.

---
 include/configs/nokia_rx51.h | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
include/configs/nokia_rx51.h +5 -4
index a88cfe77d50c..99a020c3c71d 100644
@@ -78,15 +78,16 @@
 	"kernaddr=0x82008000\0" \
 	"initrdaddr=0x84008000\0" \
 	"scriptaddr=0x86008000\0" \
+	"fileloadaddr=" __stringify(CONFIG_SYS_LOAD_ADDR) "\0" \
 	"fileload=${mmctype}load mmc ${mmcnum}:${mmcpart} " \
-		"${loadaddr} ${mmcfile}\0" \
-	"kernload=setenv loadaddr ${kernaddr};" \
+		"${fileloadaddr} ${mmcfile}\0" \
+	"kernload=setenv fileloadaddr ${kernaddr};" \
 		"setenv mmcfile ${mmckernfile};" \
 		"run fileload\0" \
-	"initrdload=setenv loadaddr ${initrdaddr};" \
+	"initrdload=setenv fileloadaddr ${initrdaddr};" \
 		"setenv mmcfile ${mmcinitrdfile};" \
 		"run fileload\0" \
-	"scriptload=setenv loadaddr ${scriptaddr};" \
+	"scriptload=setenv fileloadaddr ${scriptaddr};" \
 		"setenv mmcfile ${mmcscriptfile};" \
 		"run fileload\0" \
 	"scriptboot=echo Running ${mmcscriptfile} from mmc " \
Signature · 1 line
2.20.1
#4 lore raw

PATCH 2/3 Nokia RX-51: Document debugging options and compile command

In reply to Pali Rohár

Add example command how to compile U-Boot and add new documentation section describing how to enable early debug UART and verbose log output for N900.

---
 doc/board/nokia/rx51.rst | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
doc/board/nokia/rx51.rst +32 -0
index 7c6647bce22e..93502e2dfc05 100644
@@ -9,6 +9,10 @@ on a real N900. It does very little hardware configuration because NOLO has
 already configured the board. It is only needed to enable the internal eMMC
 memory via the twl4030 regulator which is not enabled by NOLO.
 
+.. code-block:: bash
+
+   make CROSS_COMPILE=arm-linux-gnueabi- nokia_rx51_defconfig u-boot.bin
+
 NOLO is expecting a kernel image and will treat any image it finds in
 OneNAND as such. This u-boot is intended to be flashed to the N900 like
 a kernel. In order to transparently boot the original kernel, it will be
@@ -160,6 +164,34 @@ UBIFS support add following lines into file ``configs/nokia_rx51_defconfig``::
     CONFIG_CMD_UBIFS=y
     CONFIG_MTD_UBI_BEB_LIMIT=10
 
+Early output
+------------
+
+Early U-Boot output can be enabled on serial console by adding following lines
+into file ``configs/nokia_rx51_defconfig``::
+
+    CONFIG_DEBUG_UART=y
+    CONFIG_DEBUG_UART_OMAP=y
+    CONFIG_DEBUG_UART_SHIFT=2
+    CONFIG_DEBUG_UART_BASE=0x49020000
+    CONFIG_DEBUG_UART_CLOCK=48000000
+
+Note that early output is not available on USB tty console.
+
+Verbose debug output
+--------------------
+
+Verbose debug output with maximal log level can be enabled by adding following
+lines into file ``configs/nokia_rx51_defconfig``::
+
+    CONFIG_DM_DEBUG=y
+    CONFIG_LOG=y
+    CONFIG_LOGLEVEL=9
+    CONFIG_LOG_MAX_LEVEL=9
+    CONFIG_LOG_DEFAULT_LEVEL=9
+
+And compiling U-Boot by additional make parameter ``KCPPFLAGS=-DLOG_DEBUG``.
+
 Run in QEMU
 -----------
 
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/3 arm32: Fix relocation of env_addr if POSITION_INDEPENDENT=y

In reply to Pali Rohár

Apply commit 534f0fbd6520 ("arm64: Fix relocation of env_addr if POSITION_INDEPENDENT=y") also for 32-bit ARM.

This change fixes crashing of U-Boot on ARMv7 (Omap3 / Cortex-A8) Nokia N900 phone (real HW). Note that qemu emulator of this board with same u-boot.bin binary has not triggered this crash.

Crash happened after U-Boot printed following debug lines to serial console:

initcall: 0001ea8c (relocated to 8fe0aa8c)
Loading Environment from <NULL>... Using default environment Destroy Hash Table: 8fe25a98 table = 00000000 Create Hash Table: N=387

---
 arch/arm/lib/crt0.S | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm/lib/crt0.S +5 -0
index 6d566dca5c81..a0311438b458 100644
@@ -147,6 +147,11 @@ ENTRY(_main)
 	ldr	r1, =CONFIG_TEXT_BASE
 	sub	r1, r0
 	add	lr, r1
+#if defined(CONFIG_SYS_RELOC_GD_ENV_ADDR)
+	ldr	r0, [r9, #GD_ENV_ADDR]		/* r0 = gd->env_addr */
+	add	r0, r0, r1
+	str	r0, [r9, #GD_ENV_ADDR]
+#endif
 #endif
 	ldr	r0, [r9, #GD_RELOC_OFF]		/* r0 = gd->reloc_off */
 	add	lr, lr, r0
Signature · 1 line
2.20.1
#2 lore raw

Re: [PATCH 1/3] arm32: Fix relocation of env_addr if POSITION_INDEPENDENT=y

Quoted 8 lines · Pali Rohár

Apply commit 534f0fbd6520 ("arm64: Fix relocation of env_addr if POSITION_INDEPENDENT=y") also for 32-bit ARM.

This change fixes crashing of U-Boot on ARMv7 (Omap3 / Cortex-A8) Nokia N900 phone (real HW). Note that qemu emulator of this board with same u-boot.bin binary has not triggered this crash.

Quoted 8 lines

Crash happened after U-Boot printed following debug lines to serial console:

initcall: 0001ea8c (relocated to 8fe0aa8c)
Loading Environment from <NULL>... Using default environment Destroy Hash Table: 8fe25a98 table = 00000000 Create Hash Table: N=387

It would be nice to add:

#3 lore raw

Re: [PATCH 1/3] arm32: Fix relocation of env_addr if POSITION_INDEPENDENT=y

In reply to Pali Rohár
Quoted 7 lines · Pali Rohár

Apply commit 534f0fbd6520 ("arm64: Fix relocation of env_addr if POSITION_INDEPENDENT=y") also for 32-bit ARM.

This change fixes crashing of U-Boot on ARMv7 (Omap3 / Cortex-A8) Nokia N900 phone (real HW). Note that qemu emulator of this board with same u-boot.bin binary has not triggered this crash.

Quoted 8 lines

Crash happened after U-Boot printed following debug lines to serial console:

initcall: 0001ea8c (relocated to 8fe0aa8c)
Loading Environment from <NULL>... Using default environment Destroy Hash Table: 8fe25a98 table = 00000000 Create Hash Table: N=387

Applied to u-boot/master, thanks!

Signature · 1 line
Tom
#5 lore raw

Re: [PATCH 2/3] Nokia RX-51: Document debugging options and compile command

In reply to Pali Rohár
Quoted 4 lines · Pali Rohár

Add example command how to compile U-Boot and add new documentation section describing how to enable early debug UART and verbose log output for N900.

Applied to u-boot/master, thanks!

Signature · 1 line
Tom
#7 lore raw

Re: [PATCH 3/3] Nokia RX-51: Do not overwrite standard $loadaddr variable

In reply to Pali Rohár
Quoted 5 lines · Pali Rohár

Instead of overwriting $loadaddr variable, use custom temporary $fileloadaddr variable. So scripts can access default/original address stored in $loadaddr at build time.

Applied to u-boot/master, thanks!

Signature · 1 line
Tom