uboot-armsr: add support for QEMU armv7/armv8
[openwrt/staging/nbd.git] / package / boot / uboot-armsr / patches / 001-v2023.07-bootstd-Use-blk-uclass-device-numbers-to-set-efi-bootdev.patch
1 From: Simon Glass <sjg@chromium.org>
2 To: U-Boot Mailing List <u-boot@lists.denx.de>
3 Subject: [PATCH v10 7/9] bootstd: Use blk uclass device numbers to set efi
4 bootdev
5 Date: Mon, 24 Apr 2023 13:49:50 +1200
6 Message-ID:
7 <20230424134946.v10.7.Ia5f5e39c882ac22b5f71c4d576941b34e868eeba@changeid>
8
9 From: Mathew McBride <matt@traverse.com.au>
10
11 When loading a file from a block device, efiload_read_file
12 was using the seq_num of the device (e.g "35" of virtio_blk#35)
13 instead of the block device id (e.g what you get from running
14 the corresponding device scan command, like "virtio 0")
15
16 This cause EFI booting from these devices to fail as an
17 invalid device number is passed to blk_get_device_part_str:
18
19 Scanning bootdev 'virtio-blk#35.bootdev':
20 distro_efi_read_bootflow_file start (efi,fname=<NULL>)
21 distro_efi_read_bootflow_file start (efi,fname=<NULL>)
22 setting bootdev virtio, 35, efi/boot/bootaa64.efi, 00000000beef9a40, 170800
23 efi_dp_from_name calling blk_get_device_part_str
24 dev=virtio devnr=35 path=efi/boot/bootaa64.efi
25 blk_get_device_part_str (virtio,35)
26 blk_get_device_by_str (virtio, 35)
27 ** Bad device specification virtio 35 **
28 Using default device tree: dtb/qemu-arm.dtb
29 No device tree available
30 0 efi ready virtio 1 virtio-blk#35.bootdev.par efi/boot/bootaa64.efi
31 ** Booting bootflow 'virtio-blk#35.bootdev.part_1' with efi
32 blk_get_device_part_str (virtio,0:1)
33 blk_get_device_by_str (virtio, 0)
34 No UEFI binary known at beef9a40 (image buf=00000000beef9a40,addr=0000000000000000)
35 Boot failed (err=-22)
36
37 Signed-off-by: Mathew McBride <matt@traverse.com.au>
38 Signed-off-by: Simon Glass <sjg@chromium.org>
39 Signed-off-by: Petr Štetiar <ynezz@true.cz> [backport to 2023.04]
40 ---
41
42 (no changes since v8)
43
44 Changes in v8:
45 - Add new patch to use blk uclass device numbers to set efi bootdev
46
47 boot/bootmeth_efi.c | 3 ++-
48 1 file changed, 2 insertions(+), 1 deletion(-)
49
50 --- a/boot/bootmeth_efi.c
51 +++ b/boot/bootmeth_efi.c
52 @@ -117,7 +117,9 @@ static int efiload_read_file(struct blk_
53 * this can go away.
54 */
55 media_dev = dev_get_parent(bflow->dev);
56 - snprintf(devnum_str, sizeof(devnum_str), "%x", dev_seq(media_dev));
57 + snprintf(devnum_str, sizeof(devnum_str), "%x:%x",
58 + desc ? desc->devnum : dev_seq(media_dev),
59 + bflow->part);
60
61 strlcpy(dirname, bflow->fname, sizeof(dirname));
62 last_slash = strrchr(dirname, '/');