All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Nokia RX-51: Fixes for U-Boot v2023.01-rc1
@ 2022-11-20 16:56 Pali Rohár
  2022-11-20 16:56 ` [PATCH 1/3] arm32: Fix relocation of env_addr if POSITION_INDEPENDENT=y Pali Rohár
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Pali Rohár @ 2022-11-20 16:56 UTC (permalink / raw)
  To: Tom Rini; +Cc: u-boot, maemo-leste

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(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] arm32: Fix relocation of env_addr if POSITION_INDEPENDENT=y
  2022-11-20 16:56 [PATCH 0/3] Nokia RX-51: Fixes for U-Boot v2023.01-rc1 Pali Rohár
@ 2022-11-20 16:56 ` Pali Rohár
  2022-11-20 16:59   ` Fabio Estevam
  2022-11-21 17:34   ` Tom Rini
  2022-11-20 16:56 ` [PATCH 2/3] Nokia RX-51: Document debugging options and compile command Pali Rohár
  2022-11-20 16:56 ` [PATCH 3/3] Nokia RX-51: Do not overwrite standard $loadaddr variable Pali Rohár
  2 siblings, 2 replies; 8+ messages in thread
From: Pali Rohár @ 2022-11-20 16:56 UTC (permalink / raw)
  To: Tom Rini; +Cc: u-boot, maemo-leste

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

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 arch/arm/lib/crt0.S | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S
index 6d566dca5c81..a0311438b458 100644
--- a/arch/arm/lib/crt0.S
+++ b/arch/arm/lib/crt0.S
@@ -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
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] Nokia RX-51: Document debugging options and compile command
  2022-11-20 16:56 [PATCH 0/3] Nokia RX-51: Fixes for U-Boot v2023.01-rc1 Pali Rohár
  2022-11-20 16:56 ` [PATCH 1/3] arm32: Fix relocation of env_addr if POSITION_INDEPENDENT=y Pali Rohár
@ 2022-11-20 16:56 ` Pali Rohár
  2022-11-21 17:34   ` Tom Rini
  2022-11-20 16:56 ` [PATCH 3/3] Nokia RX-51: Do not overwrite standard $loadaddr variable Pali Rohár
  2 siblings, 1 reply; 8+ messages in thread
From: Pali Rohár @ 2022-11-20 16:56 UTC (permalink / raw)
  To: Tom Rini; +Cc: u-boot, maemo-leste

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.

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 doc/board/nokia/rx51.rst | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/doc/board/nokia/rx51.rst b/doc/board/nokia/rx51.rst
index 7c6647bce22e..93502e2dfc05 100644
--- a/doc/board/nokia/rx51.rst
+++ b/doc/board/nokia/rx51.rst
@@ -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
 -----------
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] Nokia RX-51: Do not overwrite standard $loadaddr variable
  2022-11-20 16:56 [PATCH 0/3] Nokia RX-51: Fixes for U-Boot v2023.01-rc1 Pali Rohár
  2022-11-20 16:56 ` [PATCH 1/3] arm32: Fix relocation of env_addr if POSITION_INDEPENDENT=y Pali Rohár
  2022-11-20 16:56 ` [PATCH 2/3] Nokia RX-51: Document debugging options and compile command Pali Rohár
@ 2022-11-20 16:56 ` Pali Rohár
  2022-11-21 17:34   ` Tom Rini
  2 siblings, 1 reply; 8+ messages in thread
From: Pali Rohár @ 2022-11-20 16:56 UTC (permalink / raw)
  To: Tom Rini; +Cc: u-boot, maemo-leste

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

Signed-off-by: Pali Rohár <pali@kernel.org>
---
 include/configs/nokia_rx51.h | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/include/configs/nokia_rx51.h b/include/configs/nokia_rx51.h
index a88cfe77d50c..99a020c3c71d 100644
--- a/include/configs/nokia_rx51.h
+++ b/include/configs/nokia_rx51.h
@@ -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 " \
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] arm32: Fix relocation of env_addr if POSITION_INDEPENDENT=y
  2022-11-20 16:56 ` [PATCH 1/3] arm32: Fix relocation of env_addr if POSITION_INDEPENDENT=y Pali Rohár
@ 2022-11-20 16:59   ` Fabio Estevam
  2022-11-21 17:34   ` Tom Rini
  1 sibling, 0 replies; 8+ messages in thread
From: Fabio Estevam @ 2022-11-20 16:59 UTC (permalink / raw)
  To: Pali Rohár; +Cc: Tom Rini, u-boot, maemo-leste

On Sun, Nov 20, 2022 at 1:57 PM Pali Rohár <pali@kernel.org> wrote:
>
> 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
>
> Signed-off-by: Pali Rohár <pali@kernel.org>

It would be nice to add:

Suggested-by: Tom Rini <trini@konsulko.com>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] arm32: Fix relocation of env_addr if POSITION_INDEPENDENT=y
  2022-11-20 16:56 ` [PATCH 1/3] arm32: Fix relocation of env_addr if POSITION_INDEPENDENT=y Pali Rohár
  2022-11-20 16:59   ` Fabio Estevam
@ 2022-11-21 17:34   ` Tom Rini
  1 sibling, 0 replies; 8+ messages in thread
From: Tom Rini @ 2022-11-21 17:34 UTC (permalink / raw)
  To: Pali Rohár; +Cc: u-boot, maemo-leste

[-- Attachment #1: Type: text/plain, Size: 774 bytes --]

On Sun, Nov 20, 2022 at 05:56:26PM +0100, Pali Rohár wrote:

> 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
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] Nokia RX-51: Document debugging options and compile command
  2022-11-20 16:56 ` [PATCH 2/3] Nokia RX-51: Document debugging options and compile command Pali Rohár
@ 2022-11-21 17:34   ` Tom Rini
  0 siblings, 0 replies; 8+ messages in thread
From: Tom Rini @ 2022-11-21 17:34 UTC (permalink / raw)
  To: Pali Rohár; +Cc: u-boot, maemo-leste

[-- Attachment #1: Type: text/plain, Size: 320 bytes --]

On Sun, Nov 20, 2022 at 05:56:27PM +0100, Pali Rohár wrote:

> 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.
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 3/3] Nokia RX-51: Do not overwrite standard $loadaddr variable
  2022-11-20 16:56 ` [PATCH 3/3] Nokia RX-51: Do not overwrite standard $loadaddr variable Pali Rohár
@ 2022-11-21 17:34   ` Tom Rini
  0 siblings, 0 replies; 8+ messages in thread
From: Tom Rini @ 2022-11-21 17:34 UTC (permalink / raw)
  To: Pali Rohár; +Cc: u-boot, maemo-leste

[-- Attachment #1: Type: text/plain, Size: 342 bytes --]

On Sun, Nov 20, 2022 at 05:56:28PM +0100, Pali Rohár wrote:

> Instead of overwriting $loadaddr variable, use custom temporary
> $fileloadaddr variable. So scripts can access default/original address
> stored in $loadaddr at build time.
> 
> Signed-off-by: Pali Rohár <pali@kernel.org>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-11-21 17:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-20 16:56 [PATCH 0/3] Nokia RX-51: Fixes for U-Boot v2023.01-rc1 Pali Rohár
2022-11-20 16:56 ` [PATCH 1/3] arm32: Fix relocation of env_addr if POSITION_INDEPENDENT=y Pali Rohár
2022-11-20 16:59   ` Fabio Estevam
2022-11-21 17:34   ` Tom Rini
2022-11-20 16:56 ` [PATCH 2/3] Nokia RX-51: Document debugging options and compile command Pali Rohár
2022-11-21 17:34   ` Tom Rini
2022-11-20 16:56 ` [PATCH 3/3] Nokia RX-51: Do not overwrite standard $loadaddr variable Pali Rohár
2022-11-21 17:34   ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.