From 5d7c080ae5dc1f8d5ca4fb1dd93a15ea96ca8c72 Mon Sep 17 00:00:00 2001 From: Leonard Anderweit Date: Tue, 18 Nov 2025 15:30:20 +0100 Subject: bootstd: rauc: Don't check root part filesystem Only check if the root partition exists when scanning for the slots partitions and not if the filesystem can be accessed. It is not needed to access the filesystem of the root partition as it might not be supported by u-boot or be encrypted. Signed-off-by: Leonard Anderweit Tested-by: Martin Schwan --- boot/bootmeth_rauc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'boot') diff --git a/boot/bootmeth_rauc.c b/boot/bootmeth_rauc.c index f5d5a971e87..1096daedb5a 100644 --- a/boot/bootmeth_rauc.c +++ b/boot/bootmeth_rauc.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -121,10 +122,9 @@ static int distro_rauc_scan_parts(struct bootflow *bflow) if (ret) return log_msg_ret("part", ret); fs_close(); - ret = fs_set_blk_dev_with_part(desc, slot->root_part); + ret = part_get_info(desc, slot->root_part, NULL); if (ret) return log_msg_ret("part", ret); - fs_close(); } } str_free_list(boot_order_list); -- cgit v1.3.1 From 962711498ddac6179f1d1f3fa123397ba02a381b Mon Sep 17 00:00:00 2001 From: Leonard Anderweit Date: Tue, 18 Nov 2025 15:30:21 +0100 Subject: bootstd: rauc: Only require partitions for one slot Partitions can be become unusable due to power cuts or failed updates. Use the bootmeth RAUC if partitions for at least one slot exist. The bootmeth can then select the working slot. Signed-off-by: Leonard Anderweit Tested-by: Martin Schwan --- boot/bootmeth_rauc.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'boot') diff --git a/boot/bootmeth_rauc.c b/boot/bootmeth_rauc.c index 1096daedb5a..833715e1395 100644 --- a/boot/bootmeth_rauc.c +++ b/boot/bootmeth_rauc.c @@ -99,6 +99,7 @@ static int distro_rauc_scan_parts(struct bootflow *bflow) struct distro_rauc_priv *priv; char *boot_order; const char **boot_order_list; + bool slot_found = false; int ret; int i; @@ -120,16 +121,20 @@ static int distro_rauc_scan_parts(struct bootflow *bflow) if (desc) { ret = fs_set_blk_dev_with_part(desc, slot->boot_part); if (ret) - return log_msg_ret("part", ret); + continue; fs_close(); ret = part_get_info(desc, slot->root_part, NULL); if (ret) - return log_msg_ret("part", ret); + continue; + slot_found = true; } } str_free_list(boot_order_list); - return 0; + if (slot_found) + return 0; + + return -1; } static int distro_rauc_read_bootflow(struct udevice *dev, struct bootflow *bflow) -- cgit v1.3.1 From 209bbc4e0032228c6ea17e2172a8a6b89756c4f5 Mon Sep 17 00:00:00 2001 From: Adriana Nicolae Date: Thu, 27 Nov 2025 08:28:34 -0800 Subject: boot/bootfdt: Add smbios3-entrypoint to FDT for non-EFI boots The Linux kernel can discover SMBIOS tables through two primary methods: 1. Via EFI tables, when using EFI boot; 2. Via the 'smbios3-entrypoint' property in the /chosen node of the device tree. When U-Boot boots a Linux kernel using a non-EFI command ("bootm", "bootz", or "booti"), the kernel relies on the device tree to detect the hardware. If SMBIOS tables are available in U-Boot, they should be passed to the kernel via this device tree property. This patch modifies boot_fdt_prepare(), to inject the SMBIOSv3 table address into the device tree if there is a table generated by U-boot. The "board_fdt_chosen_smbios" is weak in order to leave the possibilty for specific boards to select custom SMBIOS addresses. The changes in this patch are added in the context of supporting this device tree property in linux kernel: https://lkml.org/lkml/2025/10/24/1393 Device tree schema was updated to include the "smbios3-entrypoint" node in pull request: https://github.com/devicetree-org/dt-schema/pull/177 Signed-off-by: Adriana Nicolae --- boot/fdt_support.c | 19 +++++++++++++++++++ test/cmd/fdt.c | 9 +++++++++ test/dm/fdtdec.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+) (limited to 'boot') diff --git a/boot/fdt_support.c b/boot/fdt_support.c index 92f2f534ee0..1c215e548db 100644 --- a/boot/fdt_support.c +++ b/boot/fdt_support.c @@ -27,6 +27,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -333,6 +334,7 @@ int fdt_chosen(void *fdt) int nodeoffset; int err; const char *str; /* used to set string properties */ + ulong smbiosaddr; /* SMBIOS table address */ err = fdt_check_header(fdt); if (err < 0) { @@ -387,6 +389,23 @@ int fdt_chosen(void *fdt) return err; } + if (CONFIG_IS_ENABLED(GENERATE_SMBIOS_TABLE)) { + /* Inject SMBIOS address when we have a valid address. + * This is useful for systems using booti/bootm instead of bootefi. + * Failure to set this property is non-fatal, we only generate a + * warning. + */ + smbiosaddr = gd_smbios_start(); + if (smbiosaddr) { + err = fdt_setprop_u64(fdt, nodeoffset, "smbios3-entrypoint", + smbiosaddr); + if (err < 0) { + printf("WARNING: could not set smbios3-entrypoint %s.\n", + fdt_strerror(err)); + } + } + } + return fdt_fixup_stdout(fdt, nodeoffset); } diff --git a/test/cmd/fdt.c b/test/cmd/fdt.c index 4c3c6308ab4..a121b294185 100644 --- a/test/cmd/fdt.c +++ b/test/cmd/fdt.c @@ -1274,6 +1274,7 @@ static int fdt_test_chosen(struct unit_test_state *uts) char fdt[8192]; struct udevice *dev; ulong addr; + ulong smbiosaddr = gd_smbios_start(); ut_assertok(make_test_fdt(uts, fdt, sizeof(fdt), &addr)); fdt_shrink_to_minimum(fdt, 4096); /* Resize with 4096 extra bytes */ @@ -1292,6 +1293,10 @@ static int fdt_test_chosen(struct unit_test_state *uts) ut_assert(0 < console_record_readline(uts->actual_str, sizeof(uts->actual_str))); ut_asserteq_str("chosen {", uts->actual_str); + if (CONFIG_IS_ENABLED(GENERATE_SMBIOS_TABLE)) + ut_assert_nextline("\tsmbios3-entrypoint = <0x%08x 0x%08x>;", + upper_32_bits(smbiosaddr), + lower_32_bits(smbiosaddr)); ut_assert_nextlinen("\tu-boot,version = "); /* Ignore the version string */ if (env_bootargs) ut_assert_nextline("\tbootargs = \"%s\";", env_bootargs); @@ -1316,6 +1321,10 @@ static int fdt_test_chosen(struct unit_test_state *uts) lower_32_bits(0x1234 + 0x5678 - 1)); ut_assert_nextline("\tlinux,initrd-start = <0x%08x 0x%08x>;", upper_32_bits(0x1234), lower_32_bits(0x1234)); + if (CONFIG_IS_ENABLED(GENERATE_SMBIOS_TABLE)) + ut_assert_nextline("\tsmbios3-entrypoint = <0x%08x 0x%08x>;", + upper_32_bits(smbiosaddr), + lower_32_bits(smbiosaddr)); ut_assert_nextlinen("\tu-boot,version = "); /* Ignore the version string */ if (env_bootargs) ut_assert_nextline("\tbootargs = \"%s\";", env_bootargs); diff --git a/test/dm/fdtdec.c b/test/dm/fdtdec.c index 1f24f1d5dff..ea5a494612c 100644 --- a/test/dm/fdtdec.c +++ b/test/dm/fdtdec.c @@ -7,6 +7,9 @@ #include #include #include +#include +#include +#include #include DECLARE_GLOBAL_DATA_PTR; @@ -129,3 +132,48 @@ static int dm_test_fdtdec_add_reserved_memory(struct unit_test_state *uts) } DM_TEST(dm_test_fdtdec_add_reserved_memory, UTF_SCAN_PDATA | UTF_SCAN_FDT | UTF_FLAT_TREE); + +static int dm_test_fdt_chosen_smbios(struct unit_test_state *uts) +{ + void *blob; + ulong val; + struct smbios3_entry *entry; + int chosen, blob_sz; + const fdt64_t *prop; + + if (!CONFIG_IS_ENABLED(GENERATE_SMBIOS_TABLE)) { + return -EAGAIN; + } + + blob_sz = fdt_totalsize(gd->fdt_blob) + 4096; + blob = memalign(8, blob_sz); + ut_assertnonnull(blob); + + /* Make a writable copy of the fdt blob */ + ut_assertok(fdt_open_into(gd->fdt_blob, blob, blob_sz)); + + /* Mock SMBIOS table */ + entry = map_sysmem(gd->arch.smbios_start, sizeof(struct smbios3_entry)); + memcpy(entry->anchor, "_SM3_", 5); + entry->length = sizeof(struct smbios3_entry); + unmap_sysmem(entry); + + /* Force fdt_chosen to run */ + ut_assertok(fdt_chosen(blob)); + + chosen = fdt_path_offset(blob, "/chosen"); + ut_assert(chosen >= 0); + + /* Verify the property exists */ + prop = fdt_getprop(blob, chosen, "smbios3-entrypoint", NULL); + ut_assertnonnull(prop); + + /* Verify the property matches smbios_start */ + val = fdt64_to_cpu(*prop); + ut_asserteq_64(gd->arch.smbios_start, val); + + free(blob); + + return 0; +} +DM_TEST(dm_test_fdt_chosen_smbios, UTF_SCAN_PDATA | UTF_SCAN_FDT); -- cgit v1.3.1