summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Sommerseth <davids@redhat.com>2009-06-18 15:00:57 +0200
committerDavid Sommerseth <davids@redhat.com>2009-06-18 15:03:24 +0200
commita95af5acd4f2591e2c0d42f0284897cd3de90230 (patch)
treec0ecfc48ed635f11c27336a177df35178cdfb6a1
parent3849ca0a4abf5eb661758e1341a6e595d3013c2c (diff)
downloadpython-dmidecode-a95af5acd4f2591e2c0d42f0284897cd3de90230.tar.gz
python-dmidecode-a95af5acd4f2591e2c0d42f0284897cd3de90230.tar.xz
python-dmidecode-a95af5acd4f2591e2c0d42f0284897cd3de90230.zip
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.
-rw-r--r--Makefile9
-rw-r--r--src/dmidump.c13
2 files changed, 20 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 5097afd..3b2e226 100644
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,9 @@ PY := python$(PY_VER)
SO = build/lib.linux-$(shell uname -m)-$(PY_VER)/dmidecodemod.so
###############################################################################
-.PHONY: build install uninstall clean tarball rpm unit version
+.PHONY: build dmidump install uninstall clean tarball rpm unit version
+
+all : build dmidump
build: $(PY)-dmidecodemod.so
$(PY)-dmidecodemod.so: $(SO)
@@ -21,6 +23,9 @@ $(PY)-dmidecodemod.so: $(SO)
$(SO):
$(PY) src/setup.py build
+dmidump : src/util.o src/efi.o
+ $(CC) -o $@ src/dmidump.c $^ -g -Wall -D_DMIDUMP_MAIN_
+
install:
$(PY) src/setup.py install
@@ -29,7 +34,7 @@ uninstall:
clean:
-$(PY) src/setup.py clean --all
- -rm -f *.so lib/*.o core
+ -rm -f *.so lib/*.o core dmidump
-rm -rf build
-rm -rf rpm
-rm -rf src/setup_common.py[oc]
diff --git a/src/dmidump.c b/src/dmidump.c
index 4ecbb4d..a07c975 100644
--- a/src/dmidump.c
+++ b/src/dmidump.c
@@ -152,4 +152,17 @@ int dump(const char *memdev, const char *dumpfile)
return ret == 0 ? found : ret;
}
+
+
+#ifdef _DMIDUMP_MAIN_
+int main(int argc, char **argv)
+{
+ if( argc != 3 ) {
+ fprintf(stderr, "Usage: %s </dev/mem device> <destfile>\n", argv[0]);
+ return 1;
+ }
+ dump(argv[1], argv[2]);
+
+ return 0;
+}
#endif