Accepting request 1117636 from hardware:boot

OBS-URL: https://build.opensuse.org/request/show/1117636
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/u-boot?expand=0&rev=176
This commit is contained in:
Ana Guerrero 2023-10-15 17:25:46 +00:00 committed by Git OBS Bridge
commit 495e93e6f6
4 changed files with 115 additions and 21 deletions

View File

@ -0,0 +1,105 @@
From ab50ce2798c3a39dd186a72c3862ef923d4d713a Mon Sep 17 00:00:00 2001
From: Simon Glass <sjg@chromium.org>
Date: Sat, 23 Sep 2023 14:50:15 -0600
Subject: [PATCH] bootstd: Scan all bootdevs in a boot_targets entry
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.
I believe at least three people reported this, but I found two.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Date Huang <tjjh89017@hotmail.com>
Reported-by: Vincent Stehlé <vincent.stehle@arm.com>
---
boot/bootdev-uclass.c | 3 ++-
boot/bootflow.c | 21 +++++++++++++++++++--
test/boot/bootdev.c | 10 ++++++++++
3 files changed, 31 insertions(+), 3 deletions(-)
diff --git a/boot/bootdev-uclass.c b/boot/bootdev-uclass.c
index fa52bc3a9c..5a60cf223c 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 81b5829d5b..74abf3e17d 100644
--- a/boot/bootflow.c
+++ b/boot/bootflow.c
@@ -260,8 +260,25 @@ 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) {
+ uclass_next_device(&dev);
+ log_debug("looking for next device %s: %s\n",
+ iter->dev->name,
+ dev ? dev->name : "<none>");
+ } 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 6b29213416..c5f14a7a13 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)
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);

View File

@ -1,20 +0,0 @@
From 23180509c73da88f6e4d2b28f519d65341ad07db Mon Sep 17 00:00:00 2001
From: Guillaume Gardet <guillaume.gardet@arm.com>
Date: Tue, 10 Oct 2023 11:42:35 +0200
Subject: [PATCH] rpi: fix boot on RPi4 after commit
c771e5b8c2a186fb072b6c6f571d4a3cc86efba9 boo#1216036
---
board/raspberrypi/rpi/rpi.env | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/board/raspberrypi/rpi/rpi.env b/board/raspberrypi/rpi/rpi.env
index 30228285ed..02210b97b5 100644
--- a/board/raspberrypi/rpi/rpi.env
+++ b/board/raspberrypi/rpi/rpi.env
@@ -74,4 +74,4 @@ pxefile_addr_r=0x02500000
fdt_addr_r=0x02600000
ramdisk_addr_r=0x02700000
-boot_targets=mmc usb pxe dhcp
+boot_targets=mmc0 mmc1 mmc2 usb pxe dhcp

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Fri Oct 13 08:21:12 UTC 2023 - Guillaume Gardet <guillaume.gardet@arm.com>
Use upstream patch instead downstream workaround to fix boo#1216036
* Patches dropped:
0017-rpi-fix-boot-on-RPi4-after-commit-c.patch
* Patches added:
0017-bootstd-Scan-all-bootdevs-in-a-boot.patch
-------------------------------------------------------------------
Tue Oct 10 09:51:42 UTC 2023 - Guillaume GARDET <guillaume.gardet@opensuse.org>

View File

@ -239,7 +239,7 @@ Patch0013: 0013-Disable-timer-check-in-file-loading.patch
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-rpi-fix-boot-on-RPi4-after-commit-c.patch
Patch0017: 0017-bootstd-Scan-all-bootdevs-in-a-boot.patch
# Patches: end
BuildRequires: bc
BuildRequires: bison