Skip to content

Commit a95af5a

Browse files
author
David Sommerseth
committed
Added dmidump utility
This is a simple utility which dumps DMI/SMBIOS data straight to a file, written i C and should not depend on anything extra. Useful to get DMI/SMBIOS data without installing python and/or python-dmidecode. The data dump can be parsed by python-dmidecode later on on a different box.
1 parent 3849ca0 commit a95af5a

2 files changed

Lines changed: 20 additions & 2 deletions

File tree

Makefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,19 @@ PY := python$(PY_VER)
1313
SO = build/lib.linux-$(shell uname -m)-$(PY_VER)/dmidecodemod.so
1414

1515
###############################################################################
16-
.PHONY: build install uninstall clean tarball rpm unit version
16+
.PHONY: build dmidump install uninstall clean tarball rpm unit version
17+
18+
all : build dmidump
1719

1820
build: $(PY)-dmidecodemod.so
1921
$(PY)-dmidecodemod.so: $(SO)
2022
cp $< $@
2123
$(SO):
2224
$(PY) src/setup.py build
2325

26+
dmidump : src/util.o src/efi.o
27+
$(CC) -o $@ src/dmidump.c $^ -g -Wall -D_DMIDUMP_MAIN_
28+
2429
install:
2530
$(PY) src/setup.py install
2631

@@ -29,7 +34,7 @@ uninstall:
2934

3035
clean:
3136
-$(PY) src/setup.py clean --all
32-
-rm -f *.so lib/*.o core
37+
-rm -f *.so lib/*.o core dmidump
3338
-rm -rf build
3439
-rm -rf rpm
3540
-rm -rf src/setup_common.py[oc]

src/dmidump.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,17 @@ int dump(const char *memdev, const char *dumpfile)
152152

153153
return ret == 0 ? found : ret;
154154
}
155+
156+
157+
#ifdef _DMIDUMP_MAIN_
158+
int main(int argc, char **argv)
159+
{
160+
if( argc != 3 ) {
161+
fprintf(stderr, "Usage: %s </dev/mem device> <destfile>\n", argv[0]);
162+
return 1;
163+
}
164+
dump(argv[1], argv[2]);
165+
166+
return 0;
167+
}
155168
#endif

0 commit comments

Comments
 (0)