From f39b767ea5b2fc3c54ea6d7b89bfdc1ab032f7864327490bc2522079abfaa952 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Thu, 26 Oct 2023 06:37:38 +0000 Subject: [PATCH] Accepting request 1120007 from home:mbrugger:branches:hardware:boot Fix boo#1216036. Tested on RPi4. Boot from USB and uSD fine. For details see: https://lore.kernel.org/u-boot/20231023070216.394709-1-sjg@chromium.org/#t * Patches added: 0018-Revert-bootstd-Scan-all-bootdevs-in.patch 0019-bootstd-Expand-boot-ordering-test-t.patch 0020-bootstd-Correct-logic-for-single-uc.patch 0021-bootstd-Scan-all-bootdevs-in-a-boot.patch OBS-URL: https://build.opensuse.org/request/show/1120007 OBS-URL: https://build.opensuse.org/package/show/hardware:boot/u-boot?expand=0&rev=201 --- ...-XXX-openSUSE-XXX-Prepend-partition-.patch | 2 +- ...-Revert-Revert-omap3-Use-raw-SPL-by-.patch | 2 +- ...-rpi-Use-firmware-provided-device-tr.patch | 10 +- ...-Temp-workaround-for-Chromebook-snow.patch | 2 +- ...-tools-zynqmpbif-Add-support-for-loa.patch | 2 +- 0006-Kconfig-add-btrfs-to-distro-boot.patch | 2 +- ...-configs-Re-sync-with-CONFIG_DISTRO_.patch | 10 +- ...-sunxi-dts-OrangePi-Zero-Add-SPI-ali.patch | 4 +- ...-sunxi-dts-OrangePi-Zero-Enable-SPI-.patch | 2 +- ...-Disable-CONFIG_CMD_BTRFS-in-xilinx_.patch | 2 +- ...-smbios-Fix-table-when-no-string-is-.patch | 2 +- 0012-riscv-enable-CMD_BTRFS.patch | 2 +- ...-Disable-timer-check-in-file-loading.patch | 2 +- ...-Enable-EFI-and-ISO-partitions-suppo.patch | 2 +- ...-cmd-boot-add-brom-cmd-to-reboot-to-.patch | 4 +- ...-cmd-boot-add-brom-cmd-to-reboot-to-.patch | 8 +- ...-bootstd-Scan-all-bootdevs-in-a-boot.patch | 6 +- ...-Revert-bootstd-Scan-all-bootdevs-in.patch | 90 +++++++++++ ...-bootstd-Expand-boot-ordering-test-t.patch | 59 ++++++++ ...-bootstd-Correct-logic-for-single-uc.patch | 81 ++++++++++ ...-bootstd-Scan-all-bootdevs-in-a-boot.patch | 141 ++++++++++++++++++ u-boot.changes | 11 ++ u-boot.spec | 4 + 23 files changed, 418 insertions(+), 32 deletions(-) create mode 100644 0018-Revert-bootstd-Scan-all-bootdevs-in.patch create mode 100644 0019-bootstd-Expand-boot-ordering-test-t.patch create mode 100644 0020-bootstd-Correct-logic-for-single-uc.patch create mode 100644 0021-bootstd-Scan-all-bootdevs-in-a-boot.patch diff --git a/0001-XXX-openSUSE-XXX-Prepend-partition-.patch b/0001-XXX-openSUSE-XXX-Prepend-partition-.patch index 43e068f..7199e33 100644 --- a/0001-XXX-openSUSE-XXX-Prepend-partition-.patch +++ b/0001-XXX-openSUSE-XXX-Prepend-partition-.patch @@ -12,7 +12,7 @@ Subject: [PATCH] XXX openSUSE XXX: Prepend partition 3 (and 4 for chromebook 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h -index 2a136b96a6..f2d2c76161 100644 +index 2a136b96a6d..f2d2c761616 100644 --- a/include/config_distro_bootcmd.h +++ b/include/config_distro_bootcmd.h @@ -166,7 +166,7 @@ diff --git a/0002-Revert-Revert-omap3-Use-raw-SPL-by-.patch b/0002-Revert-Revert-omap3-Use-raw-SPL-by-.patch index e985c45..ab6a422 100644 --- a/0002-Revert-Revert-omap3-Use-raw-SPL-by-.patch +++ b/0002-Revert-Revert-omap3-Use-raw-SPL-by-.patch @@ -9,7 +9,7 @@ This reverts commit 7fa75d0ac5502db813d109c1df7bd0da34688685. 1 file changed, 2 deletions(-) diff --git a/arch/arm/mach-omap2/boot-common.c b/arch/arm/mach-omap2/boot-common.c -index a2dd5f6df0..d2c8e7f5ef 100644 +index a2dd5f6df01..d2c8e7f5ef3 100644 --- a/arch/arm/mach-omap2/boot-common.c +++ b/arch/arm/mach-omap2/boot-common.c @@ -126,8 +126,6 @@ void save_omap_boot_params(void) diff --git a/0003-rpi-Use-firmware-provided-device-tr.patch b/0003-rpi-Use-firmware-provided-device-tr.patch index 263ef0c..21e7dba 100644 --- a/0003-rpi-Use-firmware-provided-device-tr.patch +++ b/0003-rpi-Use-firmware-provided-device-tr.patch @@ -28,7 +28,7 @@ Signed-off-by: Guillaume Gardet 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/configs/rpi_0_w_defconfig b/configs/rpi_0_w_defconfig -index ab6e6bcf29..a141bc4438 100644 +index ab6e6bcf29e..a141bc44380 100644 --- a/configs/rpi_0_w_defconfig +++ b/configs/rpi_0_w_defconfig @@ -24,7 +24,7 @@ CONFIG_CMD_GPIO=y @@ -41,7 +41,7 @@ index ab6e6bcf29..a141bc4438 100644 CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y diff --git a/configs/rpi_2_defconfig b/configs/rpi_2_defconfig -index 0dea092f24..46bdbfb532 100644 +index 0dea092f240..46bdbfb5328 100644 --- a/configs/rpi_2_defconfig +++ b/configs/rpi_2_defconfig @@ -25,7 +25,7 @@ CONFIG_CMD_GPIO=y @@ -54,7 +54,7 @@ index 0dea092f24..46bdbfb532 100644 CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y diff --git a/configs/rpi_3_32b_defconfig b/configs/rpi_3_32b_defconfig -index 0ccc93d572..4c912b28f6 100644 +index 0ccc93d572b..4c912b28f64 100644 --- a/configs/rpi_3_32b_defconfig +++ b/configs/rpi_3_32b_defconfig @@ -24,7 +24,7 @@ CONFIG_CMD_GPIO=y @@ -67,7 +67,7 @@ index 0ccc93d572..4c912b28f6 100644 CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y diff --git a/configs/rpi_3_defconfig b/configs/rpi_3_defconfig -index 84b61f862a..210ec94974 100644 +index 84b61f862a5..210ec949748 100644 --- a/configs/rpi_3_defconfig +++ b/configs/rpi_3_defconfig @@ -23,7 +23,7 @@ CONFIG_CMD_GPIO=y @@ -80,7 +80,7 @@ index 84b61f862a..210ec94974 100644 CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y diff --git a/configs/rpi_defconfig b/configs/rpi_defconfig -index d049d0fb5c..adf46bec3d 100644 +index d049d0fb5c6..adf46bec3d0 100644 --- a/configs/rpi_defconfig +++ b/configs/rpi_defconfig @@ -24,7 +24,7 @@ CONFIG_CMD_GPIO=y diff --git a/0004-Temp-workaround-for-Chromebook-snow.patch b/0004-Temp-workaround-for-Chromebook-snow.patch index 1f124f0..ba3a7cc 100644 --- a/0004-Temp-workaround-for-Chromebook-snow.patch +++ b/0004-Temp-workaround-for-Chromebook-snow.patch @@ -9,7 +9,7 @@ Subject: [PATCH] Temp workaround for Chromebook snow to avoid the 'unable to 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c -index 5085a3b491..6c098475be 100644 +index 5085a3b491d..6c098475bea 100644 --- a/drivers/mmc/dw_mmc.c +++ b/drivers/mmc/dw_mmc.c @@ -609,7 +609,8 @@ void dwmci_setup_cfg(struct mmc_config *cfg, struct dwmci_host *host, diff --git a/0005-tools-zynqmpbif-Add-support-for-loa.patch b/0005-tools-zynqmpbif-Add-support-for-loa.patch index 4ee540f..a469b0a 100644 --- a/0005-tools-zynqmpbif-Add-support-for-loa.patch +++ b/0005-tools-zynqmpbif-Add-support-for-loa.patch @@ -34,7 +34,7 @@ Signed-off-by: Alexander Graf 1 file changed, 15 insertions(+) diff --git a/tools/zynqmpbif.c b/tools/zynqmpbif.c -index 82ce0ac1a5..b4302fa67e 100644 +index 82ce0ac1a52..b4302fa67ee 100644 --- a/tools/zynqmpbif.c +++ b/tools/zynqmpbif.c @@ -42,6 +42,7 @@ enum bif_flag { diff --git a/0006-Kconfig-add-btrfs-to-distro-boot.patch b/0006-Kconfig-add-btrfs-to-distro-boot.patch index fe4ce64..17236b7 100644 --- a/0006-Kconfig-add-btrfs-to-distro-boot.patch +++ b/0006-Kconfig-add-btrfs-to-distro-boot.patch @@ -13,7 +13,7 @@ Signed-off-by: Matthias Brugger 1 file changed, 1 insertion(+) diff --git a/boot/Kconfig b/boot/Kconfig -index 86c2787dc5..fc01c8932f 100644 +index 86c2787dc53..fc01c8932f1 100644 --- a/boot/Kconfig +++ b/boot/Kconfig @@ -885,6 +885,7 @@ config DISTRO_DEFAULTS diff --git a/0007-configs-Re-sync-with-CONFIG_DISTRO_.patch b/0007-configs-Re-sync-with-CONFIG_DISTRO_.patch index 6dd2d46..a8455e0 100644 --- a/0007-configs-Re-sync-with-CONFIG_DISTRO_.patch +++ b/0007-configs-Re-sync-with-CONFIG_DISTRO_.patch @@ -18,7 +18,7 @@ Signed-off-by: Matthias Brugger 5 files changed, 2 insertions(+), 4 deletions(-) diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig -index 138a99b37f..82c85f4e77 100644 +index 138a99b37fe..82c85f4e77c 100644 --- a/configs/sandbox64_defconfig +++ b/configs/sandbox64_defconfig @@ -88,7 +88,6 @@ CONFIG_CMD_REGULATOR=y @@ -30,7 +30,7 @@ index 138a99b37f..82c85f4e77 100644 CONFIG_CMD_CRAMFS=y CONFIG_CMD_EXT4_WRITE=y diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig -index 62bc182ca1..841e0c07ff 100644 +index 62bc182ca16..841e0c07ff0 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -122,7 +122,6 @@ CONFIG_CMD_REGULATOR=y @@ -42,7 +42,7 @@ index 62bc182ca1..841e0c07ff 100644 CONFIG_CMD_CRAMFS=y CONFIG_CMD_EROFS=y diff --git a/configs/socfpga_arria10_defconfig b/configs/socfpga_arria10_defconfig -index 82b16418a6..73e89da98e 100644 +index 82b16418a6f..73e89da98ef 100644 --- a/configs/socfpga_arria10_defconfig +++ b/configs/socfpga_arria10_defconfig @@ -69,3 +69,5 @@ CONFIG_DESIGNWARE_APB_TIMER=y @@ -52,7 +52,7 @@ index 82b16418a6..73e89da98e 100644 +# CONFIG_CMD_BTRFS is not set +# CONFIG_FS_BTRFS is not set diff --git a/configs/turris_mox_defconfig b/configs/turris_mox_defconfig -index 234f1e721a..e5197a8fb5 100644 +index 234f1e721aa..e5197a8fb5f 100644 --- a/configs/turris_mox_defconfig +++ b/configs/turris_mox_defconfig @@ -50,7 +50,6 @@ CONFIG_CMD_CACHE=y @@ -64,7 +64,7 @@ index 234f1e721a..e5197a8fb5 100644 CONFIG_MAC_PARTITION=y CONFIG_ENV_OVERWRITE=y diff --git a/configs/turris_omnia_defconfig b/configs/turris_omnia_defconfig -index 22aaee2638..6ca655f49c 100644 +index 22aaee26384..6ca655f49ce 100644 --- a/configs/turris_omnia_defconfig +++ b/configs/turris_omnia_defconfig @@ -73,7 +73,6 @@ CONFIG_CMD_CACHE=y diff --git a/0008-sunxi-dts-OrangePi-Zero-Add-SPI-ali.patch b/0008-sunxi-dts-OrangePi-Zero-Add-SPI-ali.patch index 3970a93..89f4eee 100644 --- a/0008-sunxi-dts-OrangePi-Zero-Add-SPI-ali.patch +++ b/0008-sunxi-dts-OrangePi-Zero-Add-SPI-ali.patch @@ -15,7 +15,7 @@ Signed-off-by: Matthias Brugger create mode 100644 arch/arm/dts/sunxi-spi-u-boot.dtsi diff --git a/arch/arm/dts/sun8i-h2-plus-orangepi-zero.dts b/arch/arm/dts/sun8i-h2-plus-orangepi-zero.dts -index 3706216ffb..c3660f72d9 100644 +index 3706216ffb4..c3660f72d9e 100644 --- a/arch/arm/dts/sun8i-h2-plus-orangepi-zero.dts +++ b/arch/arm/dts/sun8i-h2-plus-orangepi-zero.dts @@ -46,6 +46,7 @@ @@ -28,7 +28,7 @@ index 3706216ffb..c3660f72d9 100644 #include diff --git a/arch/arm/dts/sunxi-spi-u-boot.dtsi b/arch/arm/dts/sunxi-spi-u-boot.dtsi new file mode 100644 -index 0000000000..df89d02ff2 +index 00000000000..df89d02ff2f --- /dev/null +++ b/arch/arm/dts/sunxi-spi-u-boot.dtsi @@ -0,0 +1,8 @@ diff --git a/0009-sunxi-dts-OrangePi-Zero-Enable-SPI-.patch b/0009-sunxi-dts-OrangePi-Zero-Enable-SPI-.patch index c927a79..40f9a1a 100644 --- a/0009-sunxi-dts-OrangePi-Zero-Enable-SPI-.patch +++ b/0009-sunxi-dts-OrangePi-Zero-Enable-SPI-.patch @@ -13,7 +13,7 @@ Signed-off-by: Matthias Brugger 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/dts/sun8i-h2-plus-orangepi-zero.dts b/arch/arm/dts/sun8i-h2-plus-orangepi-zero.dts -index c3660f72d9..80c1e66b38 100644 +index c3660f72d9e..80c1e66b38c 100644 --- a/arch/arm/dts/sun8i-h2-plus-orangepi-zero.dts +++ b/arch/arm/dts/sun8i-h2-plus-orangepi-zero.dts @@ -164,8 +164,8 @@ diff --git a/0010-Disable-CONFIG_CMD_BTRFS-in-xilinx_.patch b/0010-Disable-CONFIG_CMD_BTRFS-in-xilinx_.patch index e087f35..ad60339 100644 --- a/0010-Disable-CONFIG_CMD_BTRFS-in-xilinx_.patch +++ b/0010-Disable-CONFIG_CMD_BTRFS-in-xilinx_.patch @@ -9,7 +9,7 @@ Subject: [PATCH] Disable CONFIG_CMD_BTRFS in xilinx_zynqmp_virt_defconfig to 1 file changed, 1 insertion(+) diff --git a/configs/xilinx_zynqmp_virt_defconfig b/configs/xilinx_zynqmp_virt_defconfig -index acab38fefe..59889a1c0b 100644 +index acab38fefee..59889a1c0b7 100644 --- a/configs/xilinx_zynqmp_virt_defconfig +++ b/configs/xilinx_zynqmp_virt_defconfig @@ -96,6 +96,7 @@ CONFIG_CMD_REGULATOR=y diff --git a/0011-smbios-Fix-table-when-no-string-is-.patch b/0011-smbios-Fix-table-when-no-string-is-.patch index fe16bf4..4b61ab8 100644 --- a/0011-smbios-Fix-table-when-no-string-is-.patch +++ b/0011-smbios-Fix-table-when-no-string-is-.patch @@ -19,7 +19,7 @@ Series-cc: u-boot@lists.denx.de 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/smbios.c b/lib/smbios.c -index d7f4999e8b..2cdfef7a2c 100644 +index d7f4999e8b2..2cdfef7a2c9 100644 --- a/lib/smbios.c +++ b/lib/smbios.c @@ -172,7 +172,7 @@ static int smbios_add_prop(struct smbios_ctx *ctx, const char *prop) diff --git a/0012-riscv-enable-CMD_BTRFS.patch b/0012-riscv-enable-CMD_BTRFS.patch index db21fac..d3240c4 100644 --- a/0012-riscv-enable-CMD_BTRFS.patch +++ b/0012-riscv-enable-CMD_BTRFS.patch @@ -9,7 +9,7 @@ Signed-off-by: Matthias Brugger 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot/Kconfig b/boot/Kconfig -index fc01c8932f..f8c1e170e9 100644 +index fc01c8932f1..f8c1e170e9a 100644 --- a/boot/Kconfig +++ b/boot/Kconfig @@ -885,7 +885,7 @@ config DISTRO_DEFAULTS diff --git a/0013-Disable-timer-check-in-file-loading.patch b/0013-Disable-timer-check-in-file-loading.patch index 15f6348..3beebb6 100644 --- a/0013-Disable-timer-check-in-file-loading.patch +++ b/0013-Disable-timer-check-in-file-loading.patch @@ -25,7 +25,7 @@ Signed-off-by: Matthias Brugger 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c -index f0d76113b0..314af7e202 100644 +index f0d76113b00..314af7e2022 100644 --- a/lib/efi_loader/efi_disk.c +++ b/lib/efi_loader/efi_disk.c @@ -19,6 +19,7 @@ diff --git a/0014-Enable-EFI-and-ISO-partitions-suppo.patch b/0014-Enable-EFI-and-ISO-partitions-suppo.patch index 2144a1b..9ad1a9e 100644 --- a/0014-Enable-EFI-and-ISO-partitions-suppo.patch +++ b/0014-Enable-EFI-and-ISO-partitions-suppo.patch @@ -10,7 +10,7 @@ Subject: [PATCH] Enable EFI and ISO partitions support on socfpga_de0_nano_soc 1 file changed, 2 deletions(-) diff --git a/configs/socfpga_de0_nano_soc_defconfig b/configs/socfpga_de0_nano_soc_defconfig -index 364ae912ca..f41e8fa0b8 100644 +index 364ae912ca5..f41e8fa0b89 100644 --- a/configs/socfpga_de0_nano_soc_defconfig +++ b/configs/socfpga_de0_nano_soc_defconfig @@ -45,8 +45,6 @@ CONFIG_CMD_EXT4_WRITE=y diff --git a/0015-cmd-boot-add-brom-cmd-to-reboot-to-.patch b/0015-cmd-boot-add-brom-cmd-to-reboot-to-.patch index 5cfb45d..04fabcb 100644 --- a/0015-cmd-boot-add-brom-cmd-to-reboot-to-.patch +++ b/0015-cmd-boot-add-brom-cmd-to-reboot-to-.patch @@ -12,7 +12,7 @@ Signed-off-by: Michal Suchanek 2 files changed, 21 insertions(+) diff --git a/arch/arm/include/asm/arch-rockchip/boot_mode.h b/arch/arm/include/asm/arch-rockchip/boot_mode.h -index 6b2a610cf4..bcdf4420cf 100644 +index 6b2a610cf4c..bcdf4420cfc 100644 --- a/arch/arm/include/asm/arch-rockchip/boot_mode.h +++ b/arch/arm/include/asm/arch-rockchip/boot_mode.h @@ -19,6 +19,7 @@ @@ -24,7 +24,7 @@ index 6b2a610cf4..bcdf4420cf 100644 #endif diff --git a/cmd/boot.c b/cmd/boot.c -index 14839c1ced..d7c7db449c 100644 +index 14839c1cedc..d7c7db449c5 100644 --- a/cmd/boot.c +++ b/cmd/boot.c @@ -44,16 +44,36 @@ static int do_go(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) diff --git a/0016-cmd-boot-add-brom-cmd-to-reboot-to-.patch b/0016-cmd-boot-add-brom-cmd-to-reboot-to-.patch index c023deb..584cfb1 100644 --- a/0016-cmd-boot-add-brom-cmd-to-reboot-to-.patch +++ b/0016-cmd-boot-add-brom-cmd-to-reboot-to-.patch @@ -16,7 +16,7 @@ Signed-off-by: Michal Suchanek 4 files changed, 67 insertions(+), 1 deletion(-) diff --git a/arch/arm/include/asm/arch-sunxi/cpu.h b/arch/arm/include/asm/arch-sunxi/cpu.h -index b08f202374..36e7697b1c 100644 +index b08f2023748..36e7697b1c4 100644 --- a/arch/arm/include/asm/arch-sunxi/cpu.h +++ b/arch/arm/include/asm/arch-sunxi/cpu.h @@ -20,4 +20,15 @@ @@ -36,7 +36,7 @@ index b08f202374..36e7697b1c 100644 + #endif /* _SUNXI_CPU_H */ diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig -index e20c3a3ee9..43a4575049 100644 +index e20c3a3ee92..43a4575049a 100644 --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig @@ -1073,6 +1073,22 @@ source "board/sunxi/Kconfig" @@ -63,7 +63,7 @@ index e20c3a3ee9..43a4575049 100644 bool "Enable DIPs detection for CHIP board" select SUPPORT_EXTENSION_SCAN diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c -index 78597ad932..71844952d8 100644 +index 78597ad932c..71844952d87 100644 --- a/arch/arm/mach-sunxi/board.c +++ b/arch/arm/mach-sunxi/board.c @@ -300,7 +300,30 @@ uint32_t sunxi_get_boot_device(void) @@ -106,7 +106,7 @@ index 78597ad932..71844952d8 100644 #if defined CONFIG_MACH_SUN6I || defined CONFIG_MACH_SUN8I_H3 diff --git a/cmd/boot.c b/cmd/boot.c -index d7c7db449c..111c9d9409 100644 +index d7c7db449c5..111c9d94090 100644 --- a/cmd/boot.c +++ b/cmd/boot.c @@ -47,6 +47,7 @@ static int do_go(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) diff --git a/0017-bootstd-Scan-all-bootdevs-in-a-boot.patch b/0017-bootstd-Scan-all-bootdevs-in-a-boot.patch index 12135c5..70da4eb 100644 --- a/0017-bootstd-Scan-all-bootdevs-in-a-boot.patch +++ b/0017-bootstd-Scan-all-bootdevs-in-a-boot.patch @@ -34,7 +34,7 @@ Reported-by: Vincent Stehlé 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c -index fa52bc3a9c..5a60cf223c 100644 +index fa52bc3a9c4..5a60cf223c7 100644 --- a/boot/bootdev-uclass.c +++ b/boot/bootdev-uclass.c @@ -460,10 +460,11 @@ int bootdev_find_by_label(const char *label, struct udevice **devp, @@ -51,7 +51,7 @@ index fa52bc3a9c..5a60cf223c 100644 } log_debug("- no device in %s\n", media->name); diff --git a/boot/bootflow.c b/boot/bootflow.c -index 81b5829d5b..74abf3e17d 100644 +index 81b5829d5b3..74abf3e17d7 100644 --- a/boot/bootflow.c +++ b/boot/bootflow.c @@ -260,8 +260,25 @@ static int iter_incr(struct bootflow_iter *iter) @@ -83,7 +83,7 @@ index 81b5829d5b..74abf3e17d 100644 ret = bootdev_next_prio(iter, &dev); method_flags = 0; diff --git a/test/boot/bootdev.c b/test/boot/bootdev.c -index 6b29213416..c5f14a7a13 100644 +index 6b29213416d..c5f14a7a132 100644 --- a/test/boot/bootdev.c +++ b/test/boot/bootdev.c @@ -221,6 +221,16 @@ static int bootdev_test_order(struct unit_test_state *uts) diff --git a/0018-Revert-bootstd-Scan-all-bootdevs-in.patch b/0018-Revert-bootstd-Scan-all-bootdevs-in.patch new file mode 100644 index 0000000..b3293e7 --- /dev/null +++ b/0018-Revert-bootstd-Scan-all-bootdevs-in.patch @@ -0,0 +1,90 @@ +From 922a2954f8bd2f980bf5e6f2be8c334129f27f85 Mon Sep 17 00:00:00 2001 +From: Simon Glass +Date: Mon, 23 Oct 2023 00:02:10 -0700 +Subject: [PATCH] Revert "bootstd: Scan all bootdevs in a boot_targets entry" + +This commit was intended to allow all bootdevs in each boot_targets +entry to be scanned. However it causes bad ordering with bootdevs, e.g. +scanning Ethernet bootdevs when it should be keeping to mmc. + +Revert it so we can try another approach. + +This reverts commit e824d0d0c219bc6da767f13f90c5b00eefe929f0. + +Signed-off-by: Simon Glass +--- + boot/bootdev-uclass.c | 3 +-- + boot/bootflow.c | 21 ++------------------- + test/boot/bootdev.c | 10 ---------- + 3 files changed, 3 insertions(+), 31 deletions(-) + +diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c +index 5a60cf223c7..fa52bc3a9c4 100644 +--- a/boot/bootdev-uclass.c ++++ b/boot/bootdev-uclass.c +@@ -460,11 +460,10 @@ int bootdev_find_by_label(const char *label, struct udevice **devp, + * if no sequence number was provided, we must scan all + * bootdevs for this media uclass + */ +- if (seq == -1) ++ if (IS_ENABLED(CONFIG_BOOTSTD_FULL) && seq == -1) + method_flags |= BOOTFLOW_METHF_SINGLE_UCLASS; + if (method_flagsp) + *method_flagsp = method_flags; +- log_debug("method flags %x\n", method_flags); + return 0; + } + log_debug("- no device in %s\n", media->name); +diff --git a/boot/bootflow.c b/boot/bootflow.c +index 74abf3e17d7..81b5829d5b3 100644 +--- a/boot/bootflow.c ++++ b/boot/bootflow.c +@@ -260,25 +260,8 @@ static int iter_incr(struct bootflow_iter *iter) + } else { + log_debug("labels %p\n", iter->labels); + if (iter->labels) { +- /* +- * when the label is "mmc" we want to scan all +- * mmc bootdevs, not just the first. See +- * bootdev_find_by_label() where this flag is +- * set up +- */ +- if (iter->method_flags & BOOTFLOW_METHF_SINGLE_UCLASS) { +- uclass_next_device(&dev); +- log_debug("looking for next device %s: %s\n", +- iter->dev->name, +- dev ? dev->name : ""); +- } else { +- dev = NULL; +- } +- if (!dev) { +- log_debug("looking at next label\n"); +- ret = bootdev_next_label(iter, &dev, +- &method_flags); +- } ++ ret = bootdev_next_label(iter, &dev, ++ &method_flags); + } else { + ret = bootdev_next_prio(iter, &dev); + method_flags = 0; +diff --git a/test/boot/bootdev.c b/test/boot/bootdev.c +index c5f14a7a132..6b29213416d 100644 +--- a/test/boot/bootdev.c ++++ b/test/boot/bootdev.c +@@ -221,16 +221,6 @@ static int bootdev_test_order(struct unit_test_state *uts) + ut_asserteq_str("mmc2.bootdev", iter.dev_used[1]->name); + bootflow_iter_uninit(&iter); + +- /* Make sure it scans a bootdevs in each target */ +- ut_assertok(env_set("boot_targets", "mmc spi")); +- ut_asserteq(0, bootflow_scan_first(NULL, NULL, &iter, 0, &bflow)); +- ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow)); +- ut_asserteq(3, iter.num_devs); +- ut_asserteq_str("mmc2.bootdev", iter.dev_used[0]->name); +- ut_asserteq_str("mmc1.bootdev", iter.dev_used[1]->name); +- ut_asserteq_str("mmc0.bootdev", iter.dev_used[2]->name); +- bootflow_iter_uninit(&iter); +- + return 0; + } + BOOTSTD_TEST(bootdev_test_order, UT_TESTF_DM | UT_TESTF_SCAN_FDT); diff --git a/0019-bootstd-Expand-boot-ordering-test-t.patch b/0019-bootstd-Expand-boot-ordering-test-t.patch new file mode 100644 index 0000000..aaa0742 --- /dev/null +++ b/0019-bootstd-Expand-boot-ordering-test-t.patch @@ -0,0 +1,59 @@ +From 7d7d42a872edc05d43089d0e4e8540fd4948d515 Mon Sep 17 00:00:00 2001 +From: Simon Glass +Date: Mon, 23 Oct 2023 00:02:11 -0700 +Subject: [PATCH] bootstd: Expand boot-ordering test to include USB + +Scan the USB bus as well, so we can check that different uclasses work +correctly in boot_targets + +update the function comment with more detail. + +Signed-off-by: Simon Glass +--- + test/boot/bootdev.c | 17 ++++++++++++++--- + 1 file changed, 14 insertions(+), 3 deletions(-) + +diff --git a/test/boot/bootdev.c b/test/boot/bootdev.c +index 6b29213416d..7228f545e9e 100644 +--- a/test/boot/bootdev.c ++++ b/test/boot/bootdev.c +@@ -190,12 +190,21 @@ static int bootdev_test_any(struct unit_test_state *uts) + BOOTSTD_TEST(bootdev_test_any, UT_TESTF_DM | UT_TESTF_SCAN_FDT | + UT_TESTF_ETH_BOOTDEV); + +-/* Check bootdev ordering with the bootdev-order property */ ++/* ++ * Check bootdev ordering with the bootdev-order property and boot_targets ++ * environment variable ++ */ + static int bootdev_test_order(struct unit_test_state *uts) + { + struct bootflow_iter iter; + struct bootflow bflow; + ++ test_set_skip_delays(true); ++ ++ /* Start up USB which gives us three additional bootdevs */ ++ usb_started = false; ++ ut_assertok(run_command("usb start", 0)); ++ + /* + * First try the order set by the bootdev-order property + * Like all sandbox unit tests this relies on the devicetree setting up +@@ -213,12 +222,14 @@ static int bootdev_test_order(struct unit_test_state *uts) + bootflow_iter_uninit(&iter); + + /* Use the environment variable to override it */ +- ut_assertok(env_set("boot_targets", "mmc1 mmc2")); ++ ut_assertok(env_set("boot_targets", "mmc1 mmc2 usb")); + ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow)); + ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow)); +- ut_asserteq(2, iter.num_devs); ++ ut_asserteq(3, iter.num_devs); + ut_asserteq_str("mmc1.bootdev", iter.dev_used[0]->name); + ut_asserteq_str("mmc2.bootdev", iter.dev_used[1]->name); ++ ut_asserteq_str("usb_mass_storage.lun0.bootdev", ++ iter.dev_used[2]->name); + bootflow_iter_uninit(&iter); + + return 0; diff --git a/0020-bootstd-Correct-logic-for-single-uc.patch b/0020-bootstd-Correct-logic-for-single-uc.patch new file mode 100644 index 0000000..58344ef --- /dev/null +++ b/0020-bootstd-Correct-logic-for-single-uc.patch @@ -0,0 +1,81 @@ +From c46f69b087a37ac68e43042ff84e8962eaeba19d Mon Sep 17 00:00:00 2001 +From: Simon Glass +Date: Mon, 23 Oct 2023 00:02:12 -0700 +Subject: [PATCH] bootstd: Correct logic for single uclass + +The current logic for "bootflow mmc" is flawed since it checks the +uclass of the bootdev instead of its parent, the media device. Correct +this and add a test that covers this scenario. + +Signed-off-by: Simon Glass +--- + boot/bootflow.c | 24 ++++++++++++++++++++++-- + test/boot/bootdev.c | 13 +++++++++++++ + 2 files changed, 35 insertions(+), 2 deletions(-) + +diff --git a/boot/bootflow.c b/boot/bootflow.c +index 81b5829d5b3..7a9033b3b39 100644 +--- a/boot/bootflow.c ++++ b/boot/bootflow.c +@@ -155,6 +155,27 @@ static void bootflow_iter_set_dev(struct bootflow_iter *iter, + } + } + ++/** ++ * scan_next_in_uclass() - Scan for the next bootdev in the same media uclass ++ * ++ * Move through the following bootdevs until we find another in this media ++ * uclass, or run out ++ * ++ * @devp: On entry, the device to check, on exit the new device, or NULL if ++ * there is none ++ */ ++static void scan_next_in_uclass(struct udevice **devp) ++{ ++ struct udevice *dev = *devp; ++ enum uclass_id cur_id = device_get_uclass_id(dev->parent); ++ ++ do { ++ uclass_find_next_device(&dev); ++ } while (dev && cur_id != device_get_uclass_id(dev->parent)); ++ ++ *devp = dev; ++} ++ + /** + * iter_incr() - Move to the next item (method, part, bootdev) + * +@@ -230,8 +251,7 @@ static int iter_incr(struct bootflow_iter *iter) + &method_flags); + } else if (IS_ENABLED(CONFIG_BOOTSTD_FULL) && + (iter->flags & BOOTFLOWIF_SINGLE_UCLASS)) { +- /* Move to the next bootdev in this uclass */ +- uclass_find_next_device(&dev); ++ scan_next_in_uclass(&dev); + if (!dev) { + log_debug("finished uclass %s\n", + dev_get_uclass_name(dev)); +diff --git a/test/boot/bootdev.c b/test/boot/bootdev.c +index 7228f545e9e..63786174805 100644 +--- a/test/boot/bootdev.c ++++ b/test/boot/bootdev.c +@@ -232,6 +232,19 @@ static int bootdev_test_order(struct unit_test_state *uts) + iter.dev_used[2]->name); + bootflow_iter_uninit(&iter); + ++ /* Try a single uclass */ ++ ut_assertok(env_set("boot_targets", NULL)); ++ ut_assertok(bootflow_scan_first(NULL, "mmc", &iter, 0, &bflow)); ++ ut_asserteq(2, iter.num_devs); ++ ++ /* Now scan pass mmc1 and make sure that only mmc0 shows up */ ++ ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow)); ++ ut_asserteq(3, iter.num_devs); ++ ut_asserteq_str("mmc2.bootdev", iter.dev_used[0]->name); ++ ut_asserteq_str("mmc1.bootdev", iter.dev_used[1]->name); ++ ut_asserteq_str("mmc0.bootdev", iter.dev_used[2]->name); ++ bootflow_iter_uninit(&iter); ++ + return 0; + } + BOOTSTD_TEST(bootdev_test_order, UT_TESTF_DM | UT_TESTF_SCAN_FDT); diff --git a/0021-bootstd-Scan-all-bootdevs-in-a-boot.patch b/0021-bootstd-Scan-all-bootdevs-in-a-boot.patch new file mode 100644 index 0000000..bcc7d00 --- /dev/null +++ b/0021-bootstd-Scan-all-bootdevs-in-a-boot.patch @@ -0,0 +1,141 @@ +From e2de6a2b955ea225631bfd84a3401386a02585c1 Mon Sep 17 00:00:00 2001 +From: Simon Glass +Date: Mon, 23 Oct 2023 00:02:13 -0700 +Subject: [PATCH] bootstd: Scan all bootdevs in a boot_targets entry (take 2) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When the boot_targets environment variable is used with the distro-boot +scripts, each device is included individually. For example, if there +are three mmc devices, then we will have something like: + + boot_targets="mmc0 mmc1 mmc2" + +In contrast, standard boot supports specifying just the uclass, i.e.: + + boot_targets="mmc" + +The intention is that this should scan all MMC devices, but in fact it +currently only scans the first. + +Update the logic to handle this case, without required BOOTSTD_FULL to +be enabled. + +Signed-off-by: Simon Glass +Reported-by: Date Huang +Reported-by: Vincent Stehlé +Reported-by: Ivan Ivanov +--- + boot/bootdev-uclass.c | 3 ++- + boot/bootflow.c | 22 ++++++++++++++++++++-- + test/boot/bootdev.c | 32 ++++++++++++++++++++++++++++++-- + 3 files changed, 52 insertions(+), 5 deletions(-) + +diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c +index fa52bc3a9c4..5a60cf223c7 100644 +--- a/boot/bootdev-uclass.c ++++ b/boot/bootdev-uclass.c +@@ -460,10 +460,11 @@ int bootdev_find_by_label(const char *label, struct udevice **devp, + * if no sequence number was provided, we must scan all + * bootdevs for this media uclass + */ +- if (IS_ENABLED(CONFIG_BOOTSTD_FULL) && seq == -1) ++ if (seq == -1) + method_flags |= BOOTFLOW_METHF_SINGLE_UCLASS; + if (method_flagsp) + *method_flagsp = method_flags; ++ log_debug("method flags %x\n", method_flags); + return 0; + } + log_debug("- no device in %s\n", media->name); +diff --git a/boot/bootflow.c b/boot/bootflow.c +index 7a9033b3b39..0f09e638f28 100644 +--- a/boot/bootflow.c ++++ b/boot/bootflow.c +@@ -280,8 +280,26 @@ static int iter_incr(struct bootflow_iter *iter) + } else { + log_debug("labels %p\n", iter->labels); + if (iter->labels) { +- ret = bootdev_next_label(iter, &dev, +- &method_flags); ++ /* ++ * when the label is "mmc" we want to scan all ++ * mmc bootdevs, not just the first. See ++ * bootdev_find_by_label() where this flag is ++ * set up ++ */ ++ if (iter->method_flags & ++ BOOTFLOW_METHF_SINGLE_UCLASS) { ++ scan_next_in_uclass(&dev); ++ log_debug("looking for next device %s: %s\n", ++ iter->dev->name, ++ dev ? dev->name : ""); ++ } else { ++ dev = NULL; ++ } ++ if (!dev) { ++ log_debug("looking at next label\n"); ++ ret = bootdev_next_label(iter, &dev, ++ &method_flags); ++ } + } else { + ret = bootdev_next_prio(iter, &dev); + method_flags = 0; +diff --git a/test/boot/bootdev.c b/test/boot/bootdev.c +index 63786174805..0702fccdae6 100644 +--- a/test/boot/bootdev.c ++++ b/test/boot/bootdev.c +@@ -225,7 +225,7 @@ static int bootdev_test_order(struct unit_test_state *uts) + ut_assertok(env_set("boot_targets", "mmc1 mmc2 usb")); + ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow)); + ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow)); +- ut_asserteq(3, iter.num_devs); ++ ut_asserteq(5, iter.num_devs); + ut_asserteq_str("mmc1.bootdev", iter.dev_used[0]->name); + ut_asserteq_str("mmc2.bootdev", iter.dev_used[1]->name); + ut_asserteq_str("usb_mass_storage.lun0.bootdev", +@@ -237,7 +237,20 @@ static int bootdev_test_order(struct unit_test_state *uts) + ut_assertok(bootflow_scan_first(NULL, "mmc", &iter, 0, &bflow)); + ut_asserteq(2, iter.num_devs); + +- /* Now scan pass mmc1 and make sure that only mmc0 shows up */ ++ /* Now scan past mmc1 and make sure that only mmc0 shows up */ ++ ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow)); ++ ut_asserteq(3, iter.num_devs); ++ ut_asserteq_str("mmc2.bootdev", iter.dev_used[0]->name); ++ ut_asserteq_str("mmc1.bootdev", iter.dev_used[1]->name); ++ ut_asserteq_str("mmc0.bootdev", iter.dev_used[2]->name); ++ bootflow_iter_uninit(&iter); ++ ++ /* Try a single uclass with boot_targets */ ++ ut_assertok(env_set("boot_targets", "mmc")); ++ ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow)); ++ ut_asserteq(2, iter.num_devs); ++ ++ /* Now scan past mmc1 and make sure that only mmc0 shows up */ + ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow)); + ut_asserteq(3, iter.num_devs); + ut_asserteq_str("mmc2.bootdev", iter.dev_used[0]->name); +@@ -245,6 +258,21 @@ static int bootdev_test_order(struct unit_test_state *uts) + ut_asserteq_str("mmc0.bootdev", iter.dev_used[2]->name); + bootflow_iter_uninit(&iter); + ++ /* Try a single uclass with boot_targets */ ++ ut_assertok(env_set("boot_targets", "mmc usb")); ++ ut_assertok(bootflow_scan_first(NULL, NULL, &iter, 0, &bflow)); ++ ut_asserteq(2, iter.num_devs); ++ ++ /* Now scan past mmc1 and make sure that the 3 USB devices show up */ ++ ut_asserteq(-ENODEV, bootflow_scan_next(&iter, &bflow)); ++ ut_asserteq(6, iter.num_devs); ++ ut_asserteq_str("mmc2.bootdev", iter.dev_used[0]->name); ++ ut_asserteq_str("mmc1.bootdev", iter.dev_used[1]->name); ++ ut_asserteq_str("mmc0.bootdev", iter.dev_used[2]->name); ++ ut_asserteq_str("usb_mass_storage.lun0.bootdev", ++ iter.dev_used[3]->name); ++ bootflow_iter_uninit(&iter); ++ + return 0; + } + BOOTSTD_TEST(bootdev_test_order, UT_TESTF_DM | UT_TESTF_SCAN_FDT); diff --git a/u-boot.changes b/u-boot.changes index 8777a4f..14091db 100644 --- a/u-boot.changes +++ b/u-boot.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Tue Oct 24 13:41:26 UTC 2023 - Matthias Brugger + +Fix boo#1216036. Tested on RPi4. Boot from USB and uSD fine. +For details see: https://lore.kernel.org/u-boot/20231023070216.394709-1-sjg@chromium.org/#t +* Patches added: + 0018-Revert-bootstd-Scan-all-bootdevs-in.patch + 0019-bootstd-Expand-boot-ordering-test-t.patch + 0020-bootstd-Correct-logic-for-single-uc.patch + 0021-bootstd-Scan-all-bootdevs-in-a-boot.patch + ------------------------------------------------------------------- Fri Oct 13 08:21:12 UTC 2023 - Guillaume Gardet diff --git a/u-boot.spec b/u-boot.spec index a1de476..c679a30 100644 --- a/u-boot.spec +++ b/u-boot.spec @@ -240,6 +240,10 @@ Patch0014: 0014-Enable-EFI-and-ISO-partitions-suppo.patch Patch0015: 0015-cmd-boot-add-brom-cmd-to-reboot-to-.patch Patch0016: 0016-cmd-boot-add-brom-cmd-to-reboot-to-.patch Patch0017: 0017-bootstd-Scan-all-bootdevs-in-a-boot.patch +Patch0018: 0018-Revert-bootstd-Scan-all-bootdevs-in.patch +Patch0019: 0019-bootstd-Expand-boot-ordering-test-t.patch +Patch0020: 0020-bootstd-Correct-logic-for-single-uc.patch +Patch0021: 0021-bootstd-Scan-all-bootdevs-in-a-boot.patch # Patches: end BuildRequires: bc BuildRequires: bison