
Hi Heinrich,
On Mon, Jan 1, 2024 at 11:50 AM Heinrich Schuchardt heinrich.schuchardt@canonical.com wrote:
An EFI binary dmidump.efi is provided that can be used to check the SMBIOS table for consistency and to dump it as a file.
The tool provides the following commands:
check Check the SMBIOS table for consistency.
exit Leave the tool.
help Show available commands.
save Save the SMBIOS table to a file on the EFI system partition. The file can be further analyzed with the dmidecode command line tool::
dmidecode --from-dump <filename>
Specifying 'nocolor' as load option data suppresses colored output and clearing of the screen.
Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com
v2: fix an incorrect variable usage when checking the result of memcmp
lib/efi_loader/Makefile | 7 + lib/efi_loader/dmidump.c | 595 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 602 insertions(+) create mode 100644 lib/efi_loader/dmidump.c
Does this tool need tests?
Can you please split up do_save() a bit and also move the command loop into its own function? Otherwise it looks good to me.
diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile index 24d33d5409..71880d330e 100644 --- a/lib/efi_loader/Makefile +++ b/lib/efi_loader/Makefile @@ -16,6 +16,8 @@ CFLAGS_boothart.o := $(CFLAGS_EFI) -Os -ffreestanding CFLAGS_REMOVE_boothart.o := $(CFLAGS_NON_EFI) CFLAGS_helloworld.o := $(CFLAGS_EFI) -Os -ffreestanding CFLAGS_REMOVE_helloworld.o := $(CFLAGS_NON_EFI) +CFLAGS_dmidump.o := $(CFLAGS_EFI) -Os -ffreestanding +CFLAGS_REMOVE_dmidump.o := $(CFLAGS_NON_EFI) CFLAGS_dtbdump.o := $(CFLAGS_EFI) -Os -ffreestanding CFLAGS_REMOVE_dtbdump.o := $(CFLAGS_NON_EFI) CFLAGS_initrddump.o := $(CFLAGS_EFI) -Os -ffreestanding
Is there a way to have a list of these tools such that the flags stuff is done automatically and doesn't need to be repeated each time?
@@ -31,6 +33,11 @@ always += helloworld.efi targets += helloworld.o endif
+ifneq ($(CONFIG_GENERATE_SMBIOS_TABLE),) +always += dmidump.efi +targets += dmidump.o
How about smbios_tool ? I think 'dmi' is a bit of an obfuscation.
+endif
ifeq ($(CONFIG_GENERATE_ACPI_TABLE),) always += dtbdump.efi targets += dtbdump.o
[..]
Regards, SImon