Merge patch series "boot: fix crash in bootflow menu with EFI BOOTMGR support + typos"
Quentin Schulz <foss+uboot@0leil.net> says:
bootflow menu currently crashes U-Boot with a NULL pointer dereference
because bootflow->dev is NULL for global bootmeths (such as EFI BOOTMGR).
Therefore, let's check if the bootflow is associated with a global
bootmeth before trying to make it part of the menu.
While this makes U-Boot not crash anymore, bootflow menu doesn't work
for me (I have never had a happy path with it, but I haven't actually
tried it before today :) ) and this was basically just implemented
following Simon's suggestion sent over IRC. No clue if this is enough or
just a quick band-aid patch.
This also fixes typos in multiple places.
diff --git a/configs/xilinx_versal_net_virt_defconfig b/configs/xilinx_versal_net_virt_defconfig
index 377081c..53ef81e 100644
--- a/configs/xilinx_versal_net_virt_defconfig
+++ b/configs/xilinx_versal_net_virt_defconfig
@@ -27,6 +27,7 @@
CONFIG_BOARD_EARLY_INIT_R=y
CONFIG_CLOCKS=y
CONFIG_SYS_PROMPT="Versal NET> "
+CONFIG_CMD_SMBIOS=y
CONFIG_CMD_BOOTMENU=y
CONFIG_CMD_GREPENV=y
CONFIG_CMD_NVEDIT_EFI=y
diff --git a/configs/xilinx_versal_virt_defconfig b/configs/xilinx_versal_virt_defconfig
index 59fdd30..915f0b9 100644
--- a/configs/xilinx_versal_virt_defconfig
+++ b/configs/xilinx_versal_virt_defconfig
@@ -28,6 +28,7 @@
CONFIG_BOARD_EARLY_INIT_R=y
CONFIG_CLOCKS=y
CONFIG_SYS_PROMPT="Versal> "
+CONFIG_CMD_SMBIOS=y
CONFIG_CMD_BOOTMENU=y
CONFIG_CMD_GREPENV=y
CONFIG_CMD_NVEDIT_EFI=y
diff --git a/configs/xilinx_zynqmp_kria_defconfig b/configs/xilinx_zynqmp_kria_defconfig
index 3d1cfe8..58e88b2 100644
--- a/configs/xilinx_zynqmp_kria_defconfig
+++ b/configs/xilinx_zynqmp_kria_defconfig
@@ -54,6 +54,7 @@
CONFIG_SYS_SPI_U_BOOT_OFFS=0x80000
CONFIG_SPL_ATF=y
CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
+CONFIG_CMD_SMBIOS=y
CONFIG_CMD_BOOTMENU=y
CONFIG_CMD_GREPENV=y
CONFIG_CMD_NVEDIT_EFI=y
diff --git a/configs/xilinx_zynqmp_virt_defconfig b/configs/xilinx_zynqmp_virt_defconfig
index a9e6503..fa912ae 100644
--- a/configs/xilinx_zynqmp_virt_defconfig
+++ b/configs/xilinx_zynqmp_virt_defconfig
@@ -52,6 +52,7 @@
CONFIG_SYS_SPI_U_BOOT_OFFS=0x100000
CONFIG_SPL_ATF=y
CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
+CONFIG_CMD_SMBIOS=y
CONFIG_CMD_BOOTMENU=y
CONFIG_CMD_THOR_DOWNLOAD=y
CONFIG_THOR_RESET_OFF=y
diff --git a/include/sysinfo.h b/include/sysinfo.h
index 524c7d6..8a77ef4 100644
--- a/include/sysinfo.h
+++ b/include/sysinfo.h
@@ -43,8 +43,17 @@
SYSINFO_ID_NONE,
/* For SMBIOS tables */
+ SYSINFO_ID_SMBIOS_SYSTEM_MANUFACTURER,
+ SYSINFO_ID_SMBIOS_SYSTEM_PRODUCT,
SYSINFO_ID_SMBIOS_SYSTEM_VERSION,
+ SYSINFO_ID_SMBIOS_SYSTEM_SERIAL,
+ SYSINFO_ID_SMBIOS_SYSTEM_SKU,
+ SYSINFO_ID_SMBIOS_SYSTEM_FAMILY,
+ SYSINFO_ID_SMBIOS_BASEBOARD_MANUFACTURER,
+ SYSINFO_ID_SMBIOS_BASEBOARD_PRODUCT,
SYSINFO_ID_SMBIOS_BASEBOARD_VERSION,
+ SYSINFO_ID_SMBIOS_BASEBOARD_SERIAL,
+ SYSINFO_ID_SMBIOS_BASEBOARD_ASSET_TAG,
/* For show_board_info() */
SYSINFO_ID_BOARD_MODEL,
diff --git a/lib/smbios.c b/lib/smbios.c
index a822acd..fb6eaf1 100644
--- a/lib/smbios.c
+++ b/lib/smbios.c
@@ -383,8 +383,12 @@
memset(t, 0, sizeof(struct smbios_type1));
fill_smbios_header(t, SMBIOS_SYSTEM_INFORMATION, len, handle);
smbios_set_eos(ctx, t->eos);
- t->manufacturer = smbios_add_prop(ctx, "manufacturer", NULL);
- t->product_name = smbios_add_prop(ctx, "product", NULL);
+ t->manufacturer = smbios_add_prop_si(ctx, "manufacturer",
+ SYSINFO_ID_SMBIOS_SYSTEM_MANUFACTURER,
+ NULL);
+ t->product_name = smbios_add_prop_si(ctx, "product",
+ SYSINFO_ID_SMBIOS_SYSTEM_PRODUCT,
+ NULL);
t->version = smbios_add_prop_si(ctx, "version",
SYSINFO_ID_SMBIOS_SYSTEM_VERSION,
NULL);
@@ -392,11 +396,15 @@
t->serial_number = smbios_add_prop(ctx, NULL, serial_str);
strncpy((char *)t->uuid, serial_str, sizeof(t->uuid));
} else {
- t->serial_number = smbios_add_prop(ctx, "serial", NULL);
+ t->serial_number = smbios_add_prop_si(ctx, "serial",
+ SYSINFO_ID_SMBIOS_SYSTEM_SERIAL,
+ NULL);
}
t->wakeup_type = SMBIOS_WAKEUP_TYPE_UNKNOWN;
- t->sku_number = smbios_add_prop(ctx, "sku", NULL);
- t->family = smbios_add_prop(ctx, "family", NULL);
+ t->sku_number = smbios_add_prop_si(ctx, "sku",
+ SYSINFO_ID_SMBIOS_SYSTEM_SKU, NULL);
+ t->family = smbios_add_prop_si(ctx, "family",
+ SYSINFO_ID_SMBIOS_SYSTEM_FAMILY, NULL);
len = t->length + smbios_string_table_len(ctx);
*current += len;
@@ -415,12 +423,22 @@
memset(t, 0, sizeof(struct smbios_type2));
fill_smbios_header(t, SMBIOS_BOARD_INFORMATION, len, handle);
smbios_set_eos(ctx, t->eos);
- t->manufacturer = smbios_add_prop(ctx, "manufacturer", NULL);
- t->product_name = smbios_add_prop(ctx, "product", NULL);
+ t->manufacturer = smbios_add_prop_si(ctx, "manufacturer",
+ SYSINFO_ID_SMBIOS_BASEBOARD_MANUFACTURER,
+ NULL);
+ t->product_name = smbios_add_prop_si(ctx, "product",
+ SYSINFO_ID_SMBIOS_BASEBOARD_PRODUCT,
+ NULL);
t->version = smbios_add_prop_si(ctx, "version",
SYSINFO_ID_SMBIOS_BASEBOARD_VERSION,
NULL);
- t->asset_tag_number = smbios_add_prop(ctx, "asset-tag", NULL);
+
+ t->serial_number = smbios_add_prop_si(ctx, "serial",
+ SYSINFO_ID_SMBIOS_BASEBOARD_SERIAL,
+ NULL);
+ t->asset_tag_number = smbios_add_prop_si(ctx, "asset-tag",
+ SYSINFO_ID_SMBIOS_BASEBOARD_ASSET_TAG,
+ NULL);
t->feature_flags = SMBIOS_BOARD_FEATURE_HOSTING;
t->board_type = SMBIOS_BOARD_MOTHERBOARD;
t->chassis_handle = handle + 1;
@@ -573,8 +591,14 @@
ctx.node = ofnode_null();
if (IS_ENABLED(CONFIG_OF_CONTROL) && CONFIG_IS_ENABLED(SYSINFO)) {
uclass_first_device(UCLASS_SYSINFO, &ctx.dev);
- if (ctx.dev)
+ if (ctx.dev) {
+ int ret;
+
parent_node = dev_read_subnode(ctx.dev, "smbios");
+ ret = sysinfo_detect(ctx.dev);
+ if (ret)
+ return ret;
+ }
} else {
ctx.dev = NULL;
}