chid: Provide a command to access chid features
Provide a simple command which supports showing the information which goes into calculating a CHID. The information is obtained entirely from SMBIOS tables at present. Co-developed-by: Claude <noreply@anthropic.com> Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
10
cmd/Kconfig
10
cmd/Kconfig
@@ -280,6 +280,16 @@ config CMD_SMBIOS
|
||||
help
|
||||
Display the SMBIOS information.
|
||||
|
||||
config CMD_CHID
|
||||
bool "chid"
|
||||
depends on CHID
|
||||
default y
|
||||
help
|
||||
Computer Hardware ID (CHID) utilities. This provides commands to
|
||||
extract hardware identification data from SMBIOS tables according
|
||||
to the Microsoft CHID specification. This is used by Windows Update
|
||||
and fwupd for hardware identification and firmware updates.
|
||||
|
||||
endmenu
|
||||
|
||||
menu "Boot commands"
|
||||
|
||||
@@ -46,6 +46,7 @@ obj-$(CONFIG_CMD_CAT) += cat.o
|
||||
obj-$(CONFIG_CMD_CACHE) += cache.o
|
||||
obj-$(CONFIG_CMD_CBFS) += cbfs.o
|
||||
obj-$(CONFIG_CMD_CEDIT) += cedit.o
|
||||
obj-$(CONFIG_CMD_CHID) += chid.o
|
||||
obj-$(CONFIG_CMD_CLK) += clk.o
|
||||
obj-$(CONFIG_CMD_CLS) += cls.o
|
||||
obj-$(CONFIG_CMD_CONFIG) += config.o
|
||||
|
||||
43
cmd/chid.c
Normal file
43
cmd/chid.c
Normal file
@@ -0,0 +1,43 @@
|
||||
// SPDX-License-Identifier: GPL-2.0+
|
||||
/*
|
||||
* Command for Computer Hardware Identifiers (Windows CHID)
|
||||
*
|
||||
* Copyright 2025 Simon Glass <sjg@chromium.org>
|
||||
*/
|
||||
|
||||
#include <chid.h>
|
||||
#include <command.h>
|
||||
#include <vsprintf.h>
|
||||
|
||||
static int do_chid_show(struct cmd_tbl *cmdtp, int flag, int argc,
|
||||
char *const argv[])
|
||||
{
|
||||
struct chid_data chid;
|
||||
int ret;
|
||||
|
||||
ret = chid_from_smbios(&chid);
|
||||
if (ret) {
|
||||
printf("Failed to get CHID data from SMBIOS (err=%dE)\n", ret);
|
||||
return CMD_RET_FAILURE;
|
||||
}
|
||||
|
||||
printf("Manufacturer: %s\n", chid.manuf);
|
||||
printf("Family: %s\n", chid.family);
|
||||
printf("Product Name: %s\n", chid.product_name);
|
||||
printf("Product SKU: %s\n", chid.product_sku);
|
||||
printf("Baseboard Manuf: %s\n", chid.board_manuf);
|
||||
printf("Baseboard Product: %s\n", chid.board_product);
|
||||
printf("BIOS Vendor: %s\n", chid.bios_vendor);
|
||||
printf("BIOS Version: %s\n", chid.bios_version);
|
||||
printf("BIOS Major: %u\n", chid.bios_major);
|
||||
printf("BIOS Minor: %u\n", chid.bios_minor);
|
||||
printf("Enclosure Type: %u\n", chid.enclosure_type);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
U_BOOT_LONGHELP(chid,
|
||||
"show - Show CHID data extracted from SMBIOS");
|
||||
|
||||
U_BOOT_CMD_WITH_SUBCMDS(chid, "Computer Hardware ID utilities", chid_help_text,
|
||||
U_BOOT_SUBCMD_MKENT(show, 1, 1, do_chid_show));
|
||||
Reference in New Issue
Block a user