Skip to contentSkip to conversation

rpi: Convert to standard boot

PATCH RESEND In review Simon Glass 2 participants 14 messages Jul 27, 2023 – Oct 15, 2023 Broadcom BCM2711/BCM2835 Arm architecture

lore
Share & tools
lore
#0 lore raw

v3 cover rpi: Convert to standard boot

This series moves Raspberry Pi boards over to use standard boot.

It also moves rpi over to use a text-based environment. Unfortunately it is not possible to empty the header file due to several CFG options.

Fix the repeated "and and" while we are here.

Note that this reduces rodata size by about 4.5KB. We could get another

for a total image-size saving of about 15KB. This is mostly because HUSH_PARSER is not enabled anymore and the environment shrinks down by about 3.5K. Hush is not actually needed anymore, since standard boot does not use it. Also CMD_SYSBOOT is dropped since standard boot calls the pxe_utils code directly in that case.

Changes in v3:
- Rebase to -master

Changes in v2:
- Rebase to -next
- Add new patch to disable DISTRO_DEFAULTS

Simon Glass (3):
arm: rpi: Switch to standard boot
rpi: Disable DISTRO_DEFAULTS
arm: rpi: Switch to a text environment

 board/raspberrypi/rpi/rpi.env  |  77 +++++++++++++++++++
 configs/rpi_0_w_defconfig      |   2 +-
 configs/rpi_2_defconfig        |   2 +-
 configs/rpi_3_32b_defconfig    |   2 +-
 configs/rpi_3_b_plus_defconfig |   2 +-
 configs/rpi_3_defconfig        |   2 +-
 configs/rpi_4_32b_defconfig    |   2 +-
 configs/rpi_4_defconfig        |   2 +-
 configs/rpi_arm64_defconfig    |   2 +-
 configs/rpi_defconfig          |   2 +-
 include/configs/rpi.h          | 134 ---------------------------------
 11 files changed, 86 insertions(+), 143 deletions(-)
 create mode 100644 board/raspberrypi/rpi/rpi.env
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
#1 lore raw

PATCH RESEND v3 1/3 arm: rpi: Switch to standard boot

Drop use of the distro scripts and use standard boot instead.

We don't need to specify the mmc devices individually, since they are used in order from 0 to 2, and standard boot uses that order anyway.

---

Changes in v3:
- Rebase to -master

Changes in v2:
- Rebase to -next

 configs/rpi_0_w_defconfig      |  1 +
 configs/rpi_2_defconfig        |  1 +
 configs/rpi_3_32b_defconfig    |  1 +
 configs/rpi_3_b_plus_defconfig |  1 +
 configs/rpi_3_defconfig        |  1 +
 configs/rpi_4_32b_defconfig    |  1 +
 configs/rpi_4_defconfig        |  1 +
 configs/rpi_arm64_defconfig    |  1 +
 configs/rpi_defconfig          |  1 +
 include/configs/rpi.h          | 38 ++--------------------------------
 10 files changed, 11 insertions(+), 36 deletions(-)
configs/rpi_0_w_defconfig +1 -0
index 5da334a8bcf9..7554e671e2ca 100644
@@ -12,6 +12,7 @@ CONFIG_DEFAULT_DEVICE_TREE="bcm2835-rpi-zero-w"
 CONFIG_SYS_PROMPT="U-Boot> "
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_SYS_LOAD_ADDR=0x1000000
+CONFIG_BOOTSTD_DEFAULTS=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_USE_PREBOOT=y
configs/rpi_2_defconfig +1 -0
index 990862160712..653f78bec1e8 100644
@@ -13,6 +13,7 @@ CONFIG_DEFAULT_DEVICE_TREE="bcm2836-rpi-2-b"
 CONFIG_SYS_PROMPT="U-Boot> "
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_SYS_LOAD_ADDR=0x1000000
+CONFIG_BOOTSTD_DEFAULTS=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_USE_PREBOOT=y
configs/rpi_3_32b_defconfig +1 -0
index 80885aa9488d..305f1dacfd46 100644
@@ -12,6 +12,7 @@ CONFIG_DEFAULT_DEVICE_TREE="bcm2837-rpi-3-b"
 CONFIG_SYS_PROMPT="U-Boot> "
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_SYS_LOAD_ADDR=0x1000000
+CONFIG_BOOTSTD_DEFAULTS=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_USE_PREBOOT=y
configs/rpi_3_b_plus_defconfig +1 -0
index 0acce8b883f8..f36f1258aa6d 100644
@@ -11,6 +11,7 @@ CONFIG_DEFAULT_DEVICE_TREE="bcm2837-rpi-3-b-plus"
 CONFIG_SYS_PROMPT="U-Boot> "
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_SYS_LOAD_ADDR=0x1000000
+CONFIG_BOOTSTD_DEFAULTS=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_USE_PREBOOT=y
configs/rpi_3_defconfig +1 -0
index bb6fe128061b..a0d8be42537f 100644
@@ -11,6 +11,7 @@ CONFIG_DEFAULT_DEVICE_TREE="bcm2837-rpi-3-b"
 CONFIG_SYS_PROMPT="U-Boot> "
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_SYS_LOAD_ADDR=0x1000000
+CONFIG_BOOTSTD_DEFAULTS=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_USE_PREBOOT=y
configs/rpi_4_32b_defconfig +1 -0
index f6213340971e..71f61c52e52d 100644
@@ -10,6 +10,7 @@ CONFIG_SYS_PROMPT="U-Boot> "
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_DM_RESET=y
 CONFIG_SYS_LOAD_ADDR=0x1000000
+CONFIG_BOOTSTD_DEFAULTS=y
 CONFIG_PCI=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_DISTRO_DEFAULTS=y
configs/rpi_4_defconfig +1 -0
index bbc0fd6c649a..fa2c05da21e8 100644
@@ -10,6 +10,7 @@ CONFIG_SYS_PROMPT="U-Boot> "
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_DM_RESET=y
 CONFIG_SYS_LOAD_ADDR=0x1000000
+CONFIG_BOOTSTD_DEFAULTS=y
 CONFIG_PCI=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_DISTRO_DEFAULTS=y
configs/rpi_arm64_defconfig +1 -0
index 5d9a273cb920..3e64573b70b1 100644
@@ -10,6 +10,7 @@ CONFIG_SYS_PROMPT="U-Boot> "
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_DM_RESET=y
 CONFIG_SYS_LOAD_ADDR=0x1000000
+CONFIG_BOOTSTD_DEFAULTS=y
 CONFIG_PCI=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_DISTRO_DEFAULTS=y
configs/rpi_defconfig +1 -0
index 550b8dcb9587..4b8e402c89d4 100644
@@ -12,6 +12,7 @@ CONFIG_DEFAULT_DEVICE_TREE="bcm2835-rpi-b"
 CONFIG_SYS_PROMPT="U-Boot> "
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_SYS_LOAD_ADDR=0x1000000
+CONFIG_BOOTSTD_DEFAULTS=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_USE_PREBOOT=y
include/configs/rpi.h +2 -36
index 4da982f73578..4160db2d8e14 100644
@@ -122,47 +122,13 @@
 	"fdt_addr_r=0x02600000\0" \
 	"ramdisk_addr_r=0x02700000\0"
 
-#if IS_ENABLED(CONFIG_CMD_MMC)
-	#define BOOT_TARGET_MMC(func) \
-		func(MMC, mmc, 0) \
-		func(MMC, mmc, 1) \
-		func(MMC, mmc, 2)
-#else
-	#define BOOT_TARGET_MMC(func)
-#endif
-
-#if IS_ENABLED(CONFIG_CMD_USB)
-	#define BOOT_TARGET_USB(func) func(USB, usb, 0)
-#else
-	#define BOOT_TARGET_USB(func)
-#endif
-
-#if CONFIG_IS_ENABLED(CMD_PXE)
-	#define BOOT_TARGET_PXE(func) func(PXE, pxe, na)
-#else
-	#define BOOT_TARGET_PXE(func)
-#endif
-
-#if CONFIG_IS_ENABLED(CMD_DHCP)
-	#define BOOT_TARGET_DHCP(func) func(DHCP, dhcp, na)
-#else
-	#define BOOT_TARGET_DHCP(func)
-#endif
-
-#define BOOT_TARGET_DEVICES(func) \
-	BOOT_TARGET_MMC(func) \
-	BOOT_TARGET_USB(func) \
-	BOOT_TARGET_PXE(func) \
-	BOOT_TARGET_DHCP(func)
-
-#include <config_distro_bootcmd.h>
+#define BOOT_TARGETS	"mmc usb pxe dhcp"
 
 #define CFG_EXTRA_ENV_SETTINGS \
 	"dhcpuboot=usb start; dhcp u-boot.uimg; bootm\0" \
 	ENV_DEVICE_SETTINGS \
 	ENV_DFU_SETTINGS \
 	ENV_MEM_LAYOUT_SETTINGS \
-	BOOTENV
-
+	"boot_targets=" BOOT_TARGETS "\0"
 
 #endif
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
#2 lore raw

PATCH RESEND v3 2/3 rpi: Disable DISTRO_DEFAULTS

In reply to Simon Glass

Disable this option to reclaim some space, since bootstd requires less functionality to operate (e.g. hush parser).

---

(no changes since v2)

Changes in v2:
- Add new patch to disable DISTRO_DEFAULTS

 configs/rpi_0_w_defconfig      | 1 -
 configs/rpi_2_defconfig        | 1 -
 configs/rpi_3_32b_defconfig    | 1 -
 configs/rpi_3_b_plus_defconfig | 1 -
 configs/rpi_3_defconfig        | 1 -
 configs/rpi_4_32b_defconfig    | 1 -
 configs/rpi_4_defconfig        | 1 -
 configs/rpi_arm64_defconfig    | 1 -
 configs/rpi_defconfig          | 1 -
 9 files changed, 9 deletions(-)
configs/rpi_0_w_defconfig +0 -1
index 7554e671e2ca..3167bfbe48f7 100644
@@ -14,7 +14,6 @@ CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_SYS_LOAD_ADDR=0x1000000
 CONFIG_BOOTSTD_DEFAULTS=y
 CONFIG_OF_BOARD_SETUP=y
-CONFIG_DISTRO_DEFAULTS=y
 CONFIG_USE_PREBOOT=y
 # CONFIG_DISPLAY_CPUINFO is not set
 # CONFIG_DISPLAY_BOARDINFO is not set
configs/rpi_2_defconfig +0 -1
index 653f78bec1e8..883dab161702 100644
@@ -15,7 +15,6 @@ CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_SYS_LOAD_ADDR=0x1000000
 CONFIG_BOOTSTD_DEFAULTS=y
 CONFIG_OF_BOARD_SETUP=y
-CONFIG_DISTRO_DEFAULTS=y
 CONFIG_USE_PREBOOT=y
 # CONFIG_DISPLAY_CPUINFO is not set
 # CONFIG_DISPLAY_BOARDINFO is not set
configs/rpi_3_32b_defconfig +0 -1
index 305f1dacfd46..5ff7d987a431 100644
@@ -14,7 +14,6 @@ CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_SYS_LOAD_ADDR=0x1000000
 CONFIG_BOOTSTD_DEFAULTS=y
 CONFIG_OF_BOARD_SETUP=y
-CONFIG_DISTRO_DEFAULTS=y
 CONFIG_USE_PREBOOT=y
 # CONFIG_DISPLAY_CPUINFO is not set
 # CONFIG_DISPLAY_BOARDINFO is not set
configs/rpi_3_b_plus_defconfig +0 -1
index f36f1258aa6d..31f2a6eb310c 100644
@@ -13,7 +13,6 @@ CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_SYS_LOAD_ADDR=0x1000000
 CONFIG_BOOTSTD_DEFAULTS=y
 CONFIG_OF_BOARD_SETUP=y
-CONFIG_DISTRO_DEFAULTS=y
 CONFIG_USE_PREBOOT=y
 # CONFIG_DISPLAY_CPUINFO is not set
 # CONFIG_DISPLAY_BOARDINFO is not set
configs/rpi_3_defconfig +0 -1
index a0d8be42537f..fa6e1507d640 100644
@@ -13,7 +13,6 @@ CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_SYS_LOAD_ADDR=0x1000000
 CONFIG_BOOTSTD_DEFAULTS=y
 CONFIG_OF_BOARD_SETUP=y
-CONFIG_DISTRO_DEFAULTS=y
 CONFIG_USE_PREBOOT=y
 # CONFIG_DISPLAY_CPUINFO is not set
 # CONFIG_DISPLAY_BOARDINFO is not set
configs/rpi_4_32b_defconfig +0 -1
index 71f61c52e52d..55bf6c0770f0 100644
@@ -13,7 +13,6 @@ CONFIG_SYS_LOAD_ADDR=0x1000000
 CONFIG_BOOTSTD_DEFAULTS=y
 CONFIG_PCI=y
 CONFIG_OF_BOARD_SETUP=y
-CONFIG_DISTRO_DEFAULTS=y
 CONFIG_USE_PREBOOT=y
 CONFIG_PREBOOT="pci enum; usb start;"
 # CONFIG_DISPLAY_CPUINFO is not set
configs/rpi_4_defconfig +0 -1
index fa2c05da21e8..6679cce9a165 100644
@@ -13,7 +13,6 @@ CONFIG_SYS_LOAD_ADDR=0x1000000
 CONFIG_BOOTSTD_DEFAULTS=y
 CONFIG_PCI=y
 CONFIG_OF_BOARD_SETUP=y
-CONFIG_DISTRO_DEFAULTS=y
 CONFIG_USE_PREBOOT=y
 CONFIG_PREBOOT="pci enum; usb start;"
 # CONFIG_DISPLAY_CPUINFO is not set
configs/rpi_arm64_defconfig +0 -1
index 3e64573b70b1..26e29ffb5a1f 100644
@@ -13,7 +13,6 @@ CONFIG_SYS_LOAD_ADDR=0x1000000
 CONFIG_BOOTSTD_DEFAULTS=y
 CONFIG_PCI=y
 CONFIG_OF_BOARD_SETUP=y
-CONFIG_DISTRO_DEFAULTS=y
 CONFIG_USE_PREBOOT=y
 CONFIG_PREBOOT="pci enum; usb start;"
 # CONFIG_DISPLAY_CPUINFO is not set
configs/rpi_defconfig +0 -1
index 4b8e402c89d4..0ac5efec717b 100644
@@ -14,7 +14,6 @@ CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_SYS_LOAD_ADDR=0x1000000
 CONFIG_BOOTSTD_DEFAULTS=y
 CONFIG_OF_BOARD_SETUP=y
-CONFIG_DISTRO_DEFAULTS=y
 CONFIG_USE_PREBOOT=y
 # CONFIG_DISPLAY_CPUINFO is not set
 # CONFIG_DISPLAY_BOARDINFO is not set
Signature · 1 line
2.41.0.487.g6d72f3e995-goog
#3 lore raw

PATCH RESEND v3 3/3 arm: rpi: Switch to a text environment

In reply to Simon Glass

Use the new environment format so we can drop most of the config.h file.

---

(no changes since v1)

 board/raspberrypi/rpi/rpi.env |  77 ++++++++++++++++++++++++++
 include/configs/rpi.h         | 100 ----------------------------------
 2 files changed, 77 insertions(+), 100 deletions(-)
 create mode 100644 board/raspberrypi/rpi/rpi.env
board/raspberrypi/rpi/rpi.env new file +77 -0
new file mode 100644
index 000000000000..30228285edde
@@ -0,0 +1,77 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+
+/* environment for Raspberry Pi boards */
+
+dhcpuboot=usb start; dhcp u-boot.uimg; bootm
+
+/* Environment */
+stdin=serial,usbkbd
+stdout=serial,vidconsole
+stderr=serial,vidconsole
+
+/* DFU over USB/UDC */
+#ifdef CONFIG_CMD_DFU
+dfu_alt_info=u-boot.bin fat 0 1;uboot.env fat 0 1;
+  config.txt fat 0 1;
+#ifdef CONFIG_ARM64
+dfu_alt_info+=Image fat 0 1
+#else
+dfu_alt_info+=zImage fat 0 1
+#endif
+#endif  /* CONFIG_CMD_DFU */
+
+/*
+ * Memory layout for where various images get loaded by boot scripts:
+ *
+ * I suspect address 0 is used as the SMP pen on the RPi2, so avoid this.
+ *
+ * Older versions of the boot firmware place the firmware-loaded DTB at 0x100,
+ * newer versions place it in high memory. So prevent U-Boot from doing its own
+ * DTB + initrd relocation so that we won't accidentally relocate the initrd
+ * over the firmware-loaded DTB and generally try to lay out things starting
+ * from the bottom of RAM.
+ *
+ * kernel_addr_r has different constraints on ARM and Aarch64.  For 32-bit ARM,
+ * it must be within the first 128M of RAM in order for the kernel's
+ * CONFIG_AUTO_ZRELADDR option to work. The kernel itself will be decompressed
+ * to 0x8000 but the decompressor clobbers 0x4000-0x8000 as well. The
+ * decompressor also likes to relocate itself to right past the end of the
+ * decompressed kernel, so in total the sum of the compressed and
+ * decompressed kernel needs to be reserved.
+ *
+ *   For Aarch64, the kernel image is uncompressed and must be loaded at
+ *   text_offset bytes (specified in the header of the Image) into a 2MB
+ *   boundary. The 'booti' command relocates the image if necessary. Linux uses
+ *   a default text_offset of 0x80000.  In summary, loading at 0x80000
+ *   satisfies all these constraints and reserving memory up to 0x02400000
+ *   permits fairly large (roughly 36M) kernels.
+ *
+ * scriptaddr and pxefile_addr_r can be pretty much anywhere that doesn't
+ * conflict with something else. Reserving 1M for each of them at
+ * 0x02400000-0x02500000 and 0x02500000-0x02600000 should be plenty.
+ *
+ * On ARM, both the DTB and any possible initrd must be loaded such that they
+ * fit inside the lowmem mapping in Linux. In practice, this usually means not
+ * more than ~700M away from the start of the kernel image but this number can
+ * be larger OR smaller depending on e.g. the 'vmalloc=xxxM' command line
+ * parameter given to the kernel. So reserving memory from low to high
+ * satisfies this constraint again. Reserving 1M at 0x02600000-0x02700000 for
+ * the DTB leaves rest of the free RAM to the initrd starting at 0x02700000.
+ * Even with the smallest possible CPU-GPU memory split of the CPU getting
+ * only 64M, the remaining 25M starting at 0x02700000 should allow quite
+ * large initrds before they start colliding with U-Boot.
+ */
+#ifdef CONFIG_ARM64
+fdt_high=ffffffffffffffff
+initrd_high=ffffffffffffffff
+#else
+fdt_high=ffffffff
+initrd_high=ffffffff
+#endif
+kernel_addr_r=0x00080000
+scriptaddr=0x02400000
+pxefile_addr_r=0x02500000
+fdt_addr_r=0x02600000
+ramdisk_addr_r=0x02700000
+
+boot_targets=mmc usb pxe dhcp
include/configs/rpi.h +0 -100

110 lines not on this page · raw message

Signature · 1 line
2.41.0.487.g6d72f3e995-goog
#4 lore raw
In reply to Simon Glass

Hi Matthias, Peter,

Quoted 8 lines · Simon Glass

This series moves Raspberry Pi boards over to use standard boot.

It also moves rpi over to use a text-based environment. Unfortunately it is not possible to empty the header file due to several CFG options.

Fix the repeated "and and" while we are here.

Quoted 7 lines

Note that this reduces rodata size by about 4.5KB. We could get another

for a total image-size saving of about 15KB. This is mostly because HUSH_PARSER is not enabled anymore and the environment shrinks down by about 3.5K. Hush is not actually needed anymore, since standard boot does not use it. Also CMD_SYSBOOT is dropped since standard boot calls the pxe_utils code directly in that case.

It has now been about 6 months since I sent the v1 series of this. Even this v3 series is now out of date (in the cover letter).

Is rpi still maintained?

Regards,
Simon

#5 lore raw
Quoted 20 lines · Simon Glass

Hi Matthias, Peter,

Quoted 8 lines · Simon Glass

This series moves Raspberry Pi boards over to use standard boot.

It also moves rpi over to use a text-based environment. Unfortunately it is not possible to empty the header file due to several CFG options.

Fix the repeated "and and" while we are here.

Quoted 7 lines

Note that this reduces rodata size by about 4.5KB. We could get another

for a total image-size saving of about 15KB. This is mostly because HUSH_PARSER is not enabled anymore and the environment shrinks down by about 3.5K. Hush is not actually needed anymore, since standard boot does not use it. Also CMD_SYSBOOT is dropped since standard boot calls the pxe_utils code directly in that case.

Quoted 4 lines

It has now been about 6 months since I sent the v1 series of this. Even this v3 series is now out of date (in the cover letter).

Is rpi still maintained?

Yes, but we've had conversations about this in the past and snide comments and regressions don't enamor me to your patches...

That said without seeing this email I actually started tested them yesterday.

U-Boot isn't part of my $dayjob and I've had limited time of late, that's slowly getting better.

Peter

#6 lore raw

Hi Peter,

Quoted 22 lines · Peter Robinson
Quoted 20 lines · Simon Glass

Hi Matthias, Peter,

Quoted 15 lines · Simon Glass

This series moves Raspberry Pi boards over to use standard boot.

It also moves rpi over to use a text-based environment. Unfortunately it is not possible to empty the header file due to several CFG options.

Fix the repeated "and and" while we are here.

Note that this reduces rodata size by about 4.5KB. We could get another

for a total image-size saving of about 15KB. This is mostly because HUSH_PARSER is not enabled anymore and the environment shrinks down by about 3.5K. Hush is not actually needed anymore, since standard boot does not use it. Also CMD_SYSBOOT is dropped since standard boot calls the pxe_utils code directly in that case.

Quoted 7 lines
Quoted 4 lines

It has now been about 6 months since I sent the v1 series of this. Even this v3 series is now out of date (in the cover letter).

Is rpi still maintained?

Yes, but we've had conversations about this in the past and snide comments and regressions don't enamor me to your patches...

I'm sorry for the snide comments.

Quoted 5 lines

That said without seeing this email I actually started tested them yesterday.

U-Boot isn't part of my $dayjob and I've had limited time of late, that's slowly getting better.

OK, good. We have seen quite a few regressions and bugs. I expect that to continue for at least a few more releases, as more boards pick this up.

Regards,
Simon

#7 lore raw
Quoted 37 lines · Simon Glass

Hi Peter,

Quoted 22 lines · Peter Robinson
Quoted 20 lines · Simon Glass

Hi Matthias, Peter,

Quoted 15 lines · Simon Glass

This series moves Raspberry Pi boards over to use standard boot.

It also moves rpi over to use a text-based environment. Unfortunately it is not possible to empty the header file due to several CFG options.

Fix the repeated "and and" while we are here.

Note that this reduces rodata size by about 4.5KB. We could get another

for a total image-size saving of about 15KB. This is mostly because HUSH_PARSER is not enabled anymore and the environment shrinks down by about 3.5K. Hush is not actually needed anymore, since standard boot does not use it. Also CMD_SYSBOOT is dropped since standard boot calls the pxe_utils code directly in that case.

Quoted 7 lines
Quoted 4 lines

It has now been about 6 months since I sent the v1 series of this. Even this v3 series is now out of date (in the cover letter).

Is rpi still maintained?

Yes, but we've had conversations about this in the past and snide comments and regressions don't enamor me to your patches...

I'm sorry for the snide comments.

Quoted 1 line
Quoted 8 lines
Quoted 4 lines

That said without seeing this email I actually started tested them yesterday.

U-Boot isn't part of my $dayjob and I've had limited time of late, that's slowly getting better.

OK, good. We have seen quite a few regressions and bugs. I expect that to continue for at least a few more releases, as more boards pick this up.

Yes, tracking regressions, like the numerous ones on rockchip over the last few releases, and making things continue to work for users have been taking up the lions share of my free time and are definitely one of the reasons I've been reticent to take these patches.

I have been following reports of supposed regressions upstream on the Raspberry Pi boards and most of them are not regressions but rather users looking to do things that aren't widely tested (NVME) or aren't enabled by default (USB on CM4) and related pieces. We're certainly not seeing them on Fedora.

I've pushed these patches to a Fedora build for wider testing and I'm testing my devices more this week and should have a pull later in the week.

Peter

#8 lore raw
In reply to Simon Glass

Hi Simon,

So with more testing of 2023.10 in Fedora we found a regression where the display dies when the vc4 module loads in the kernel. With further debug it was found that it was due to the new U-Boot and with bisecting it myself I have found this series is the cause of the regression.

The testing I have done is with recent RPi firmware, U-Boot 2023.10 and kernel 6.5.x, but also seen with 6.4.x, with a minimal text only image. I can also reproduce it by using the F-38 GA image, no updates and purely just changing the U-Boot component. I've done my testing on the RPi4.

Let me know if you need more information, I believe you have a RPi you can test with.

Regards,
Peter

Quoted 45 lines · Simon Glass

This series moves Raspberry Pi boards over to use standard boot.

It also moves rpi over to use a text-based environment. Unfortunately it is not possible to empty the header file due to several CFG options.

Fix the repeated "and and" while we are here.

Note that this reduces rodata size by about 4.5KB. We could get another

for a total image-size saving of about 15KB. This is mostly because HUSH_PARSER is not enabled anymore and the environment shrinks down by about 3.5K. Hush is not actually needed anymore, since standard boot does not use it. Also CMD_SYSBOOT is dropped since standard boot calls the pxe_utils code directly in that case.

Changes in v3:
- Rebase to -master

Changes in v2:
- Rebase to -next
- Add new patch to disable DISTRO_DEFAULTS

Simon Glass (3):
arm: rpi: Switch to standard boot
rpi: Disable DISTRO_DEFAULTS
arm: rpi: Switch to a text environment

 board/raspberrypi/rpi/rpi.env  |  77 +++++++++++++++++++
 configs/rpi_0_w_defconfig      |   2 +-
 configs/rpi_2_defconfig        |   2 +-
 configs/rpi_3_32b_defconfig    |   2 +-
 configs/rpi_3_b_plus_defconfig |   2 +-
 configs/rpi_3_defconfig        |   2 +-
 configs/rpi_4_32b_defconfig    |   2 +-
 configs/rpi_4_defconfig        |   2 +-
 configs/rpi_arm64_defconfig    |   2 +-
 configs/rpi_defconfig          |   2 +-
 include/configs/rpi.h          | 134 ---------------------------------
 11 files changed, 86 insertions(+), 143 deletions(-)
 create mode 100644 board/raspberrypi/rpi/rpi.env

--
2.41.0.487.g6d72f3e995-goog

#9 lore raw

Hi Peter,

Quoted 9 lines · Peter Robinson

Hi Simon,

So with more testing of 2023.10 in Fedora we found a regression where the display dies when the vc4 module loads in the kernel. With further debug it was found that it was due to the new U-Boot and with bisecting it myself I have found this series is the cause of the regression.

Quoted 8 lines

The testing I have done is with recent RPi firmware, U-Boot 2023.10 and kernel 6.5.x, but also seen with 6.4.x, with a minimal text only image. I can also reproduce it by using the F-38 GA image, no updates and purely just changing the U-Boot component. I've done my testing on the RPi4.

Let me know if you need more information, I believe you have a RPi you can test with.

Thanks for the report. Which rpi should I test with? I take it that vc4 is a kernel module? Do you have the error message?

Regards,
Simon

Quoted 50 lines

Regards,
Peter

Quoted 45 lines · Simon Glass

This series moves Raspberry Pi boards over to use standard boot.

It also moves rpi over to use a text-based environment. Unfortunately it is not possible to empty the header file due to several CFG options.

Fix the repeated "and and" while we are here.

Note that this reduces rodata size by about 4.5KB. We could get another

for a total image-size saving of about 15KB. This is mostly because HUSH_PARSER is not enabled anymore and the environment shrinks down by about 3.5K. Hush is not actually needed anymore, since standard boot does not use it. Also CMD_SYSBOOT is dropped since standard boot calls the pxe_utils code directly in that case.

Changes in v3:
- Rebase to -master

Changes in v2:
- Rebase to -next
- Add new patch to disable DISTRO_DEFAULTS

Simon Glass (3):
arm: rpi: Switch to standard boot
rpi: Disable DISTRO_DEFAULTS
arm: rpi: Switch to a text environment

 board/raspberrypi/rpi/rpi.env  |  77 +++++++++++++++++++
 configs/rpi_0_w_defconfig      |   2 +-
 configs/rpi_2_defconfig        |   2 +-
 configs/rpi_3_32b_defconfig    |   2 +-
 configs/rpi_3_b_plus_defconfig |   2 +-
 configs/rpi_3_defconfig        |   2 +-
 configs/rpi_4_32b_defconfig    |   2 +-
 configs/rpi_4_defconfig        |   2 +-
 configs/rpi_arm64_defconfig    |   2 +-
 configs/rpi_defconfig          |   2 +-
 include/configs/rpi.h          | 134 ---------------------------------
 11 files changed, 86 insertions(+), 143 deletions(-)
 create mode 100644 board/raspberrypi/rpi/rpi.env

--
2.41.0.487.g6d72f3e995-goog

#10 lore raw

Hi Simon,

Quoted 12 lines
Quoted 12 lines

So with more testing of 2023.10 in Fedora we found a regression where the display dies when the vc4 module loads in the kernel. With further debug it was found that it was due to the new U-Boot and with bisecting it myself I have found this series is the cause of the regression.

The testing I have done is with recent RPi firmware, U-Boot 2023.10 and kernel 6.5.x, but also seen with 6.4.x, with a minimal text only image. I can also reproduce it by using the F-38 GA image, no updates and purely just changing the U-Boot component. I've done my testing on the RPi4.

Quoted 5 lines
Quoted 2 lines

Let me know if you need more information, I believe you have a RPi you can test with.

Thanks for the report. Which rpi should I test with? I take it that vc4 is a kernel module? Do you have the error message?

Well I've been testing on the RPi4 (as I mentioned above), there's no direct error message that's directly linked but the screen goes blank and turns off, even on a text only install, and yes, on the rpi4 the vc4 kernel module deals with driving the HDMI and other output interfaces (whereas the v3d is the driver for the render unit), and on rpi3 and older vc4 also runs the 3D render module too.

Quoted 54 lines

Regards,
Simon

Quoted 50 lines

Regards,
Peter

Quoted 45 lines · Simon Glass

This series moves Raspberry Pi boards over to use standard boot.

It also moves rpi over to use a text-based environment. Unfortunately it is not possible to empty the header file due to several CFG options.

Fix the repeated "and and" while we are here.

Note that this reduces rodata size by about 4.5KB. We could get another

for a total image-size saving of about 15KB. This is mostly because HUSH_PARSER is not enabled anymore and the environment shrinks down by about 3.5K. Hush is not actually needed anymore, since standard boot does not use it. Also CMD_SYSBOOT is dropped since standard boot calls the pxe_utils code directly in that case.

Changes in v3:
- Rebase to -master

Changes in v2:
- Rebase to -next
- Add new patch to disable DISTRO_DEFAULTS

Simon Glass (3):
arm: rpi: Switch to standard boot
rpi: Disable DISTRO_DEFAULTS
arm: rpi: Switch to a text environment

 board/raspberrypi/rpi/rpi.env  |  77 +++++++++++++++++++
 configs/rpi_0_w_defconfig      |   2 +-
 configs/rpi_2_defconfig        |   2 +-
 configs/rpi_3_32b_defconfig    |   2 +-
 configs/rpi_3_b_plus_defconfig |   2 +-
 configs/rpi_3_defconfig        |   2 +-
 configs/rpi_4_32b_defconfig    |   2 +-
 configs/rpi_4_defconfig        |   2 +-
 configs/rpi_arm64_defconfig    |   2 +-
 configs/rpi_defconfig          |   2 +-
 include/configs/rpi.h          | 134 ---------------------------------
 11 files changed, 86 insertions(+), 143 deletions(-)
 create mode 100644 board/raspberrypi/rpi/rpi.env

--
2.41.0.487.g6d72f3e995-goog

#11 lore raw

Hi Peter,

Quoted 21 lines · Peter Robinson

Hi Simon,

Quoted 12 lines
Quoted 12 lines

So with more testing of 2023.10 in Fedora we found a regression where the display dies when the vc4 module loads in the kernel. With further debug it was found that it was due to the new U-Boot and with bisecting it myself I have found this series is the cause of the regression.

The testing I have done is with recent RPi firmware, U-Boot 2023.10 and kernel 6.5.x, but also seen with 6.4.x, with a minimal text only image. I can also reproduce it by using the F-38 GA image, no updates and purely just changing the U-Boot component. I've done my testing on the RPi4.

Quoted 5 lines
Quoted 2 lines

Let me know if you need more information, I believe you have a RPi you can test with.

Thanks for the report. Which rpi should I test with? I take it that vc4 is a kernel module? Do you have the error message?

Quoted 6 lines

Well I've been testing on the RPi4 (as I mentioned above), there's no direct error message that's directly linked but the screen goes blank and turns off, even on a text only install, and yes, on the rpi4 the vc4 kernel module deals with driving the HDMI and other output interfaces (whereas the v3d is the driver for the render unit), and on rpi3 and older vc4 also runs the 3D render module too.

OK I have an rpi4, but I don't get that far:

Quoted 1 line
Quoted 1 line
Quoted 1 line

U-Boot 2023.10-00111-g7d1e5aacdb4 (Oct 08 2023 - 14:14:10 -0600)

DRAM: 948 MiB (effective 3.9 GiB)
RPI 4 Model B (0xc03111)

Core:  205 devices, 16 uclasses, devicetree: board
MMC:   mmcnr@7e300000: 1, mmc@7e340000: 0
Loading Environment from FAT... Unable to read "uboot.env" from mmc0:1...
In:    serial,usbkbd
Out:   serial,vidconsole
Err:   serial,vidconsole
Net:   eth0: ethernet@7d580000
PCIe BRCM: link up, 5.0 Gbps x1 (SSC)

starting USB...
Bus xhci_pci: Register 5000420 NbrPorts 5
Starting the controller
USB XHCI 1.00
scanning bus xhci_pci for devices... 3 USB Device(s) found
scanning usb for storage devices... 1 Storage Device(s) found
Hit any key to stop autoboot: 0
U-Boot> bootfl scan
Card did not respond to voltage select! : -110
** Booting bootflow 'usb_mass_storage.lun0.bootdev.part_2' with efi Card did not respond to voltage select! : -110
Failed to load EFI variables
ERROR: invalid device tree
Boot failed (err=-22)
<<<

Do you know what that might be? I ask because it seems that you are actually able to boot.

I'll keep looking.

Regards,
Simon
[..]

#12 lore raw

Hi Peter,

Quoted 8 lines · Simon Glass

Hi Peter,

Quoted 4 lines · Peter Robinson

Hi Simon,

Quoted 1 line
Quoted 1 line

So with more testing of 2023.10 in Fedora we found a regression

where

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

the display dies when the vc4 module loads in the kernel. With

further

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

debug it was found that it was due to the new U-Boot and with bisecting it myself I have found this series is the cause of the regression.

The testing I have done is with recent RPi firmware, U-Boot 2023.10 and kernel 6.5.x, but also seen with 6.4.x, with a minimal text only image. I can also reproduce it by using the F-38 GA image, no

updates

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

and purely just changing the U-Boot component. I've done my testing

on

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

the RPi4.

Let me know if you need more information, I believe you have a RPi

you

Quoted 43 lines
Quoted 11 lines
Quoted 4 lines
Quoted 1 line

can test with.

Thanks for the report. Which rpi should I test with? I take it that vc4 is a kernel module? Do you have the error message?

Well I've been testing on the RPi4 (as I mentioned above), there's no direct error message that's directly linked but the screen goes blank and turns off, even on a text only install, and yes, on the rpi4 the vc4 kernel module deals with driving the HDMI and other output interfaces (whereas the v3d is the driver for the render unit), and on rpi3 and older vc4 also runs the 3D render module too.

OK I have an rpi4, but I don't get that far:

Quoted 1 line
Quoted 1 line
Quoted 1 line

U-Boot 2023.10-00111-g7d1e5aacdb4 (Oct 08 2023 - 14:14:10 -0600)

DRAM: 948 MiB (effective 3.9 GiB)
RPI 4 Model B (0xc03111)

Core:  205 devices, 16 uclasses, devicetree: board
MMC:   mmcnr@7e300000: 1, mmc@7e340000: 0
Loading Environment from FAT... Unable to read "uboot.env" from mmc0:1...
In:    serial,usbkbd
Out:   serial,vidconsole
Err:   serial,vidconsole
Net:   eth0: ethernet@7d580000
PCIe BRCM: link up, 5.0 Gbps x1 (SSC)

starting USB...
Bus xhci_pci: Register 5000420 NbrPorts 5
Starting the controller
USB XHCI 1.00
scanning bus xhci_pci for devices... 3 USB Device(s) found
scanning usb for storage devices... 1 Storage Device(s) found
Hit any key to stop autoboot: 0
U-Boot> bootfl scan
Card did not respond to voltage select! : -110
** Booting bootflow 'usb_mass_storage.lun0.bootdev.part_2' with efi Card did not respond to voltage select! : -110
Failed to load EFI variables
ERROR: invalid device tree
Boot failed (err=-22)
<<<

Quoted 4 lines

Do you know what that might be? I ask because it seems that you are actually able to boot.

I'll keep looking.

This was apparently a corrupted uSD card as I tried again and it booted.

Regards,
Simon

#13 lore raw

Hi Peter,

Quoted 67 lines · Simon Glass

Hi Peter,

Quoted 63 lines · Simon Glass

Hi Peter,

Quoted 21 lines · Peter Robinson

Hi Simon,

Quoted 12 lines
Quoted 12 lines

So with more testing of 2023.10 in Fedora we found a regression where the display dies when the vc4 module loads in the kernel. With further debug it was found that it was due to the new U-Boot and with bisecting it myself I have found this series is the cause of the regression.

The testing I have done is with recent RPi firmware, U-Boot 2023.10 and kernel 6.5.x, but also seen with 6.4.x, with a minimal text only image. I can also reproduce it by using the F-38 GA image, no updates and purely just changing the U-Boot component. I've done my testing on the RPi4.

Quoted 5 lines
Quoted 2 lines

Let me know if you need more information, I believe you have a RPi you can test with.

Thanks for the report. Which rpi should I test with? I take it that vc4 is a kernel module? Do you have the error message?

Quoted 6 lines

Well I've been testing on the RPi4 (as I mentioned above), there's no direct error message that's directly linked but the screen goes blank and turns off, even on a text only install, and yes, on the rpi4 the vc4 kernel module deals with driving the HDMI and other output interfaces (whereas the v3d is the driver for the render unit), and on rpi3 and older vc4 also runs the 3D render module too.

OK I have an rpi4, but I don't get that far:

Quoted 1 line
Quoted 1 line
Quoted 1 line

U-Boot 2023.10-00111-g7d1e5aacdb4 (Oct 08 2023 - 14:14:10 -0600)

DRAM: 948 MiB (effective 3.9 GiB)
RPI 4 Model B (0xc03111)

Core:  205 devices, 16 uclasses, devicetree: board
MMC:   mmcnr@7e300000: 1, mmc@7e340000: 0
Loading Environment from FAT... Unable to read "uboot.env" from mmc0:1...
In:    serial,usbkbd
Out:   serial,vidconsole
Err:   serial,vidconsole
Net:   eth0: ethernet@7d580000
PCIe BRCM: link up, 5.0 Gbps x1 (SSC)

starting USB...
Bus xhci_pci: Register 5000420 NbrPorts 5
Starting the controller
USB XHCI 1.00
scanning bus xhci_pci for devices... 3 USB Device(s) found
scanning usb for storage devices... 1 Storage Device(s) found
Hit any key to stop autoboot: 0
U-Boot> bootfl scan
Card did not respond to voltage select! : -110
** Booting bootflow 'usb_mass_storage.lun0.bootdev.part_2' with efi Card did not respond to voltage select! : -110
Failed to load EFI variables
ERROR: invalid device tree
Boot failed (err=-22)
<<<

Quoted 6 lines
Quoted 4 lines

Do you know what that might be? I ask because it seems that you are actually able to boot.

I'll keep looking.

This was apparently a corrupted uSD card as I tried again and it booted.

It boots up and I see a strange greenish cloud picture. But the image disappears every 10 seconds or so. Is that the problem you are seeing?

Then I tried again with bootstd disabled and it booted with the fedora thing in the top left. No flicker.

Then I tried again with bootstd enabled and it booted with the fedora thing in the middle No flicker.

So I am not sure what is going on here.

I noticed this in the output when booting from Fedora (without updating U-Boot):

Found EFI removable media binary efi/boot/bootaa64.efi Found DTB mmc 0:2 /dtb/broadcom/bcm2711-rpi-4-b.dtb

The first line looks OK, but I cannot see the second line anywhere in the distro scripts. Also I know of no mechanism to use a DT from a different partition than the EFI app. Could Fedora be doing something strange here?

One last thing is that Fedora has the DT files in the root dir of partition 1. They should be in the dtb/broadcom directory, I believe.

Regards,
Simon