summaryrefslogtreecommitdiffstats
path: root/flashrom.c
diff options
context:
space:
mode:
authorCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2010-03-27 16:36:40 +0000
committerCarl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>2010-03-27 16:36:40 +0000
commit132e2ec6320f7ffe406a443760343c2d8953c221 (patch)
treeb0f52ef021fec7484b4ce8fa7f85adfc7a50e3fc /flashrom.c
parentb811461abb08bb7cada46c6d081a7eaa164db352 (diff)
downloadast2050-flashrom-132e2ec6320f7ffe406a443760343c2d8953c221.zip
ast2050-flashrom-132e2ec6320f7ffe406a443760343c2d8953c221.tar.gz
Add runtime and build environment info to the flashrom version message
This patch uses code from Idwer Vollering and Maciej Pijanka. I've added Makefile support and compiler version printing and restructured the code heavily. The code prints runtime system information and buildtime libpci information (I couldn't find any runtime libpci version function). Due to our ability to cross-compile flashrom, buildtime system information from "uname -mrs" doesn't help diagnosing any problems. That's why only libpci and gcc are buildtime info, and the rest is runtime info. Examples: openSUSE 10.3, i686, gcc 4.2.1, with PCI support: flashrom v0.9.1-r971 on Linux 2.6.22.19-0.2-default (i686), built with libpci 2.2.6, GCC 4.2.1 (SUSE Linux) openSUSE 10.3, i686, llvm-clang-2.6.99svn97231, with PCI support: flashrom v0.9.1-r971 on Linux 2.6.22.19-0.2-default (i686), built with libpci 2.2.6, LLVM 1/clang 1 openSUSE 11.1, x86_64, gcc 4.3.2, with PCI support: flashrom v0.9.1-r972 on Linux 2.6.27.29-0.1-default (x86_64), built with libpci 3.0.1, GCC 4.3.2 [gcc-4_3-branch revision 141291] openSUSE 10.3, i686, gcc 4.2.1, without PCI support: flashrom v0.9.1-r971 on Linux 2.6.22.19-0.2-default (i686), built with GCC 4.2.1 (SUSE Linux) Windows/cygwin, i686, gcc 4.3.4, without PCI support: flashrom v0.9.1-r973 on CYGWIN_NT-5.1 1.7.1(0.218/5/3) (i686), built with GCC 4.3.4 20090804 (release) 1 FreeBSD 8.0, i386, gcc 4.2.1, with PCI support: flashrom v0.9.1-r973 on FreeBSD 8.0-RELEASE-p2 (i386), built with libpci 3.1.7, GCC 4.2.1 20070719 [FreeBSD] Corresponding to flashrom svn r987. Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net> Signed-off-by: Idwer Vollering <vidwer@gmail.com> Acked-by: Maciej Pijanka <maciej.pijanka@gmail.com>
Diffstat (limited to 'flashrom.c')
-rw-r--r--flashrom.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/flashrom.c b/flashrom.c
index f5c0721..2450dee 100644
--- a/flashrom.c
+++ b/flashrom.c
@@ -27,6 +27,9 @@
#include <string.h>
#include <stdlib.h>
#include <getopt.h>
+#if HAVE_UTSNAME == 1
+#include <sys/utsname.h>
+#endif
#include "flash.h"
#include "flashchips.h"
@@ -1133,9 +1136,44 @@ void list_programmers(char *delim)
printf("\n");
}
+void print_sysinfo(void)
+{
+#if HAVE_UTSNAME == 1
+ struct utsname osinfo;
+ uname(&osinfo);
+
+ msg_ginfo(" on %s %s (%s)", osinfo.sysname, osinfo.release,
+ osinfo.machine);
+#else
+ msg_ginfo(" on unknown machine");
+#endif
+ msg_ginfo(", built with");
+#if NEED_PCI == 1
+#ifdef PCILIB_VERSION
+ msg_ginfo(" libpci %s,", PCILIB_VERSION);
+#else
+ msg_ginfo(" unknown PCI library,");
+#endif
+#endif
+#ifdef __clang__
+ msg_ginfo(" LLVM %i/clang %i", __llvm__, __clang__);
+#elif defined(__GNUC__)
+ msg_ginfo(" GCC");
+#ifdef __VERSION__
+ msg_ginfo(" %s", __VERSION__);
+#else
+ msg_ginfo(" unknown version");
+#endif
+#else
+ msg_ginfo(" unknown compiler");
+#endif
+ msg_ginfo("\n");
+}
+
void print_version(void)
{
- printf("flashrom v%s\n", flashrom_version);
+ printf("flashrom v%s", flashrom_version);
+ print_sysinfo();
}
int selfcheck(void)
OpenPOWER on IntegriCloud