Include detailed versioning information in the binary (--version).
Signed-off-by: Idwer Vollering vidwer@gmail.com
---
Future thoughts: include the used version of libpci.
On Sat, 19 Dec 2009, Idwer Vollering wrote:
Include detailed versioning information in the binary (--version).
Signed-off-by: Idwer Vollering vidwer@gmail.com
another small addon to be added after this patch which print libpci version used for compilation (info aquired from headers)
Signed-off-by: Maciej Pijanka maciej.pijanka@gmail.com
best regards Maciej
Future thoughts: include the used version of libpci.
Index: flashrom.c
--- flashrom.c (revision 808) +++ flashrom.c (working copy) @@ -1,3 +1,4 @@
/*
- This file is part of the flashrom project.
@@ -24,6 +25,7 @@ #include <fcntl.h> #include <sys/types.h> #include <sys/stat.h> +#include <sys/utsname.h> #include <string.h> #include <stdlib.h> #include <getopt.h> @@ -968,7 +970,19 @@
void print_version(void) {
- struct utsname osinfo;
- uname (&osinfo);
+/* printf("flashrom v%s\n", flashrom_version);
- printf("sysname: %s\n", osinfo.sysname);
- printf("nodename: %s\n", osinfo.nodename);
- printf("release: %s\n", osinfo.release);
- printf("version: %s\n", osinfo.version);
- printf("machine: %s\n", osinfo.machine);
+*/
- printf("flashrom v%s, built on %s %s (%s) \n", flashrom_version, osinfo.sysname, osinfo.release,
+osinfo.machine); }
int main(int argc, char *argv[])
flashrom mailing list flashrom@flashrom.org http://www.flashrom.org/mailman/listinfo/flashrom
On 19.12.2009 23:34, Maciej Pijanka wrote:
On Sat, 19 Dec 2009, Idwer Vollering wrote:
Include detailed versioning information in the binary (--version).
Signed-off-by: Idwer Vollering vidwer@gmail.com
another small addon to be added after this patch which print libpci version used for compilation (info aquired from headers)
Signed-off-by: Maciej Pijanka maciej.pijanka@gmail.com
Thanks for your patch. Would you mind moving it to internal.c in print_sysinfo() after Idwer reposts his patch which should create print_sysinfo?
Oh, and it would be cool if you could wrap this differently: #if NEED_PCI==1 #ifdef PCILIB_VERSION printf(" compiled against libpci %s\n", PCILIB_VERSION); #else printf("compiled against unknown PCI library\n); #endif #endif
Regards, Carl-Daniel
2009/12/20 Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
On 19.12.2009 23:34, Maciej Pijanka wrote:
On Sat, 19 Dec 2009, Idwer Vollering wrote:
Include detailed versioning information in the binary (--version).
Signed-off-by: Idwer Vollering vidwer@gmail.com
another small addon to be added after this patch which print libpci version used for compilation (info aquired from headers)
Signed-off-by: Maciej Pijanka maciej.pijanka@gmail.com
Thanks for your patch. Would you mind moving it to internal.c in print_sysinfo() after Idwer reposts his patch which should create print_sysinfo?
flashrom_r808_uname-mrs_v3.diff
Oh, and it would be cool if you could wrap this differently: #if NEED_PCI==1 #ifdef PCILIB_VERSION printf(" compiled against libpci %s\n", PCILIB_VERSION); #else printf("compiled against unknown PCI library\n); #endif #endif
Regards, Carl-Daniel
-- Developer quote of the month: "We are juggling too many chainsaws and flaming arrows and tigers."
Print 'uname -mrs' from the information collected at compile time.
Signed-off-by: Idwer Vollering vidwer@gmail.com
On 20.12.2009 00:16, Idwer Vollering wrote:
Print 'uname -mrs' from the information collected at compile time.
Signed-off-by: Idwer Vollering vidwer@gmail.com
Hmm. I'm sceptical about this one because it would only serve to catch miscompilations on broken systems. And in that case, the Makefile should refuse compilation.
Regards, Carl-Daniel
On Sun, 20 Dec 2009, Carl-Daniel Hailfinger wrote:
On 20.12.2009 00:16, Idwer Vollering wrote:
Print 'uname -mrs' from the information collected at compile time.
Signed-off-by: Idwer Vollering vidwer@gmail.com
Hmm. I'm sceptical about this one because it would only serve to catch miscompilations on broken systems. And in that case, the Makefile should refuse compilation.
You have two different patches to choose from, one which embeds uname -msr into compiled binary, one which reports system uname-like output fetched at runtime.
Imo both combined give best possible info, both compile time (i would include gcc version in this too) and runtime to catch situation where binary isn't compiled on same machine as its running maybe compile time would be usefull to easilly see if user runs newly compiled binary not old one (./flashrom vs flashrom invocation).
In case of detailed compile time info libftdi version might be usefull if its compiled in. I know that there was no problems with it so far but if make something lets try at least to make that complete, sounds acceptable?
Maciej
OK, here's a patch which 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
Examples: With PCI support: flashrom v0.9.1-r971 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] 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) 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 Compatible Clang Compiler
Without PCI support: flashrom v0.9.1-r971 on Linux 2.6.27.29-0.1-default (x86_64), GCC 4.3.2 [gcc-4_3-branch revision 141291] flashrom v0.9.1-r971 on Linux 2.6.22.19-0.2-default (i686), GCC 4.2.1 (SUSE Linux) flashrom v0.9.1-r971 on Linux 2.6.22.19-0.2-default (i686), GCC 4.2.1 Compatible Clang Compiler
Idwer and Maciej, feel free to re-add your signoffs to this patch. I was unsure whether you would be OK with my variant, so I left out your signoffs.
Reviews appreciated, especially about the compiler part. I think this can be valuable (e.g. if someone compiles with clang and triggers the clang/flashrom miscompile), but I'm unsure if/how this works on Windows and DOS. I tried to make it non-explosive, but...
Output from "flashrom --version" for non-Linux platforms and unusual compilers would be appreciated.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Index: flashrom-uname/Makefile =================================================================== --- flashrom-uname/Makefile (Revision 971) +++ flashrom-uname/Makefile (Arbeitskopie) @@ -230,6 +230,8 @@ CLI_OBJS += print_wiki.o endif
+FEATURE_CFLAGS += $(shell LC_ALL=C grep -q "UTSNAME := yes" .features && printf "%s" "-D'HAVE_UTSNAME=1'") + # We could use PULLED_IN_LIBS, but that would be ugly. FEATURE_LIBS += $(shell LC_ALL=C grep -q "NEEDLIBZ := yes" .libdeps && printf "%s" "-lz")
@@ -308,12 +310,29 @@ @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest $(FTDILIBS) $(LIBS) >/dev/null 2>&1 && \ ( echo "found."; echo "FTDISUPPORT := yes" >> .features.tmp ) || \ ( echo "not found."; echo "FTDISUPPORT := no" >> .features.tmp ) + @printf "Checking for utsname support... " + @$(shell ( echo "#include <sys/utsname.h>"; \ + echo "struct utsname osinfo;"; \ + echo "int main(int argc, char **argv)"; \ + echo "{ uname (&osinfo); return 0; }"; ) > .featuretest.c ) + @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest $(LIBS) >/dev/null 2>&1 && \ + ( echo "found."; echo "UTSNAME := yes" >> .features.tmp ) || \ + ( echo "not found."; echo "UTSNAME := no" >> .features.tmp ) @$(DIFF) -q .features.tmp .features >/dev/null 2>&1 && rm .features.tmp || mv .features.tmp .features @rm -f .featuretest.c .featuretest else features: compiler @echo "FEATURES := yes" > .features.tmp + @printf "Checking for utsname support... " + @$(shell ( echo "#include <sys/utsname.h>"; \ + echo "struct utsname osinfo;"; \ + echo "int main(int argc, char **argv)"; \ + echo "{ uname (&osinfo); return 0; }"; ) > .featuretest.c ) + @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest $(LIBS) >/dev/null 2>&1 && \ + ( echo "found."; echo "UTSNAME := yes" >> .features.tmp ) || \ + ( echo "not found."; echo "UTSNAME := no" >> .features.tmp ) @$(DIFF) -q .features.tmp .features >/dev/null 2>&1 && rm .features.tmp || mv .features.tmp .features + @rm -f .featuretest.c .featuretest endif
install: $(PROGRAM) Index: flashrom-uname/flashrom.c =================================================================== --- flashrom-uname/flashrom.c (Revision 971) +++ flashrom-uname/flashrom.c (Arbeitskopie) @@ -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,41 @@ 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 +#if NEED_PCI == 1 +#ifdef PCILIB_VERSION + msg_ginfo(", built with libpci %s", PCILIB_VERSION); +#else + msg_ginfo(", built with unknown PCI library"); +#endif +#endif +#ifdef __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)
Sorry for the slightly trimmed mail.
On 23.03.2010 05:19, Carl-Daniel Hailfinger wrote:
OK, here's a patch which 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: With PCI support: flashrom v0.9.1-r971 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] 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) 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 Compatible Clang Compiler
Without PCI support: flashrom v0.9.1-r971 on Linux 2.6.27.29-0.1-default (x86_64), GCC 4.3.2 [gcc-4_3-branch revision 141291] flashrom v0.9.1-r971 on Linux 2.6.22.19-0.2-default (i686), GCC 4.2.1 (SUSE Linux) flashrom v0.9.1-r971 on Linux 2.6.22.19-0.2-default (i686), GCC 4.2.1 Compatible Clang Compiler
The wording could probably be better. Suggestions welcome.
Idwer and Maciej, feel free to re-add your signoffs to this patch. I was unsure whether you would be OK with my variant, so I left out your signoffs.
Reviews appreciated, especially about the compiler part. I think this can be valuable (e.g. if someone compiles with clang and triggers the clang/flashrom miscompile), but I'm unsure if/how this works on Windows and DOS. I tried to make it non-explosive, but...
Output from "flashrom --version" for non-Linux platforms and unusual compilers would be appreciated.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Regards, Carl-Daniel
New version: Improve reliability of utsname detection.
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: 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) 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 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]
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) flashrom v0.9.1-r971 on Linux 2.6.22.19-0.2-default (i686), built with LLVM 1/clang 1 flashrom v0.9.1-r972 on Linux 2.6.27.29-0.1-default (x86_64), built with GCC 4.3.2 [gcc-4_3-branch revision 141291]
Reviews appreciated, especially about the compiler part. I think this can be valuable (e.g. if someone compiles with clang and triggers the clang/flashrom miscompile), but I'm unsure if/how this works on Windows and DOS. I tried to make it non-explosive, but...
Output from "flashrom --version" for non-Linux platforms and unusual compilers would be appreciated.
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Index: flashrom-uname/Makefile =================================================================== --- flashrom-uname/Makefile (Revision 971) +++ flashrom-uname/Makefile (Arbeitskopie) @@ -230,6 +230,8 @@ CLI_OBJS += print_wiki.o endif
+FEATURE_CFLAGS += $(shell LC_ALL=C grep -q "UTSNAME := yes" .features && printf "%s" "-D'HAVE_UTSNAME=1'") + # We could use PULLED_IN_LIBS, but that would be ugly. FEATURE_LIBS += $(shell LC_ALL=C grep -q "NEEDLIBZ := yes" .libdeps && printf "%s" "-lz")
@@ -308,12 +310,29 @@ @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest $(FTDILIBS) $(LIBS) >/dev/null 2>&1 && \ ( echo "found."; echo "FTDISUPPORT := yes" >> .features.tmp ) || \ ( echo "not found."; echo "FTDISUPPORT := no" >> .features.tmp ) + @printf "Checking for utsname support... " + @$(shell ( echo "#include <sys/utsname.h>"; \ + echo "struct utsname osinfo;"; \ + echo "int main(int argc, char **argv)"; \ + echo "{ uname (&osinfo); return 0; }"; ) > .featuretest.c ) + @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest >/dev/null 2>&1 && \ + ( echo "found."; echo "UTSNAME := yes" >> .features.tmp ) || \ + ( echo "not found."; echo "UTSNAME := no" >> .features.tmp ) @$(DIFF) -q .features.tmp .features >/dev/null 2>&1 && rm .features.tmp || mv .features.tmp .features @rm -f .featuretest.c .featuretest else features: compiler @echo "FEATURES := yes" > .features.tmp + @printf "Checking for utsname support... " + @$(shell ( echo "#include <sys/utsname.h>"; \ + echo "struct utsname osinfo;"; \ + echo "int main(int argc, char **argv)"; \ + echo "{ uname (&osinfo); return 0; }"; ) > .featuretest.c ) + @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest >/dev/null 2>&1 && \ + ( echo "found."; echo "UTSNAME := yes" >> .features.tmp ) || \ + ( echo "not found."; echo "UTSNAME := no" >> .features.tmp ) @$(DIFF) -q .features.tmp .features >/dev/null 2>&1 && rm .features.tmp || mv .features.tmp .features + @rm -f .featuretest.c .featuretest endif
install: $(PROGRAM) Index: flashrom-uname/flashrom.c =================================================================== --- flashrom-uname/flashrom.c (Revision 971) +++ flashrom-uname/flashrom.c (Arbeitskopie) @@ -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 @@ 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)
2010/3/24 Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
New version: Improve reliability of utsname detection.
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: 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) 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 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]
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) flashrom v0.9.1-r971 on Linux 2.6.22.19-0.2-default (i686), built with LLVM 1/clang 1 flashrom v0.9.1-r972 on Linux 2.6.27.29-0.1-default (x86_64), built with GCC 4.3.2 [gcc-4_3-branch revision 141291]
Reviews appreciated, especially about the compiler part. I think this can be valuable (e.g. if someone compiles with clang and triggers the clang/flashrom miscompile), but I'm unsure if/how this works on Windows and DOS. I tried to make it non-explosive, but...
Output from "flashrom --version" for non-Linux platforms and unusual compilers would be appreciated.
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
flashrom v0.9.1-r973 on FreeBSD 8.0-RELEASE-p2 (i386), built with libpci 3.1.7, GCC 4.2.1 20070719 [FreeBSD]
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Signed-off-by: Idwer Vollering vidwer@gmail.com
Index: flashrom-uname/Makefile
--- flashrom-uname/Makefile (Revision 971) +++ flashrom-uname/Makefile (Arbeitskopie) @@ -230,6 +230,8 @@ CLI_OBJS += print_wiki.o endif
+FEATURE_CFLAGS += $(shell LC_ALL=C grep -q "UTSNAME := yes" .features && printf "%s" "-D'HAVE_UTSNAME=1'")
# We could use PULLED_IN_LIBS, but that would be ugly. FEATURE_LIBS += $(shell LC_ALL=C grep -q "NEEDLIBZ := yes" .libdeps && printf "%s" "-lz")
@@ -308,12 +310,29 @@ @$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o .featuretest $(FTDILIBS) $(LIBS) >/dev/null 2>&1 && \ ( echo "found."; echo "FTDISUPPORT := yes" >> .features.tmp ) || \ ( echo "not found."; echo "FTDISUPPORT := no" >> .features.tmp )
@printf "Checking for utsname support... "
@$(shell ( echo "#include <sys/utsname.h>"; \
echo "struct utsname osinfo;"; \
echo "int main(int argc, char **argv)"; \
echo "{ uname (&osinfo); return 0; }"; ) >
.featuretest.c )
@$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o
.featuretest >/dev/null 2>&1 && \
( echo "found."; echo "UTSNAME := yes" >> .features.tmp )
|| \
( echo "not found."; echo "UTSNAME := no" >> .features.tmp
) @$(DIFF) -q .features.tmp .features >/dev/null 2>&1 && rm .features.tmp || mv .features.tmp .features @rm -f .featuretest.c .featuretest else features: compiler @echo "FEATURES := yes" > .features.tmp
@printf "Checking for utsname support... "
@$(shell ( echo "#include <sys/utsname.h>"; \
echo "struct utsname osinfo;"; \
echo "int main(int argc, char **argv)"; \
echo "{ uname (&osinfo); return 0; }"; ) >
.featuretest.c )
@$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) .featuretest.c -o
.featuretest >/dev/null 2>&1 && \
( echo "found."; echo "UTSNAME := yes" >> .features.tmp )
|| \
( echo "not found."; echo "UTSNAME := no" >> .features.tmp
) @$(DIFF) -q .features.tmp .features >/dev/null 2>&1 && rm .features.tmp || mv .features.tmp .features
@rm -f .featuretest.c .featuretest
endif
install: $(PROGRAM) Index: flashrom-uname/flashrom.c =================================================================== --- flashrom-uname/flashrom.c (Revision 971) +++ flashrom-uname/flashrom.c (Arbeitskopie) @@ -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 @@ 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)
flashrom mailing list flashrom@flashrom.org http://www.flashrom.org/mailman/listinfo/flashrom
On 24.03.2010 23:38, Idwer Vollering wrote:
2010/3/24 Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
New version: Improve reliability of utsname detection.
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: 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) 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 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]
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) flashrom v0.9.1-r971 on Linux 2.6.22.19-0.2-default (i686), built with LLVM 1/clang 1 flashrom v0.9.1-r972 on Linux 2.6.27.29-0.1-default (x86_64), built with GCC 4.3.2 [gcc-4_3-branch revision 141291]
Reviews appreciated, especially about the compiler part. I think this can be valuable (e.g. if someone compiles with clang and triggers the clang/flashrom miscompile), but I'm unsure if/how this works on Windows and DOS. I tried to make it non-explosive, but...
Output from "flashrom --version" for non-Linux platforms and unusual compilers would be appreciated.
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
flashrom v0.9.1-r973 on FreeBSD 8.0-RELEASE-p2 (i386), built with libpci 3.1.7, GCC 4.2.1 20070719 [FreeBSD]
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Signed-off-by: Idwer Vollering vidwer@gmail.com
Anyone up for an ack?
Regards, Carl-Daniel
On Fri, 26 Mar 2010, Carl-Daniel Hailfinger wrote:
On 24.03.2010 23:38, Idwer Vollering wrote:
2010/3/24 Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
New version: Improve reliability of utsname detection.
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: 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) 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 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]
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) flashrom v0.9.1-r971 on Linux 2.6.22.19-0.2-default (i686), built with LLVM 1/clang 1 flashrom v0.9.1-r972 on Linux 2.6.27.29-0.1-default (x86_64), built with GCC 4.3.2 [gcc-4_3-branch revision 141291]
Reviews appreciated, especially about the compiler part. I think this can be valuable (e.g. if someone compiles with clang and triggers the clang/flashrom miscompile), but I'm unsure if/how this works on Windows and DOS. I tried to make it non-explosive, but...
Output from "flashrom --version" for non-Linux platforms and unusual compilers would be appreciated.
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
flashrom v0.9.1-r973 on FreeBSD 8.0-RELEASE-p2 (i386), built with libpci 3.1.7, GCC 4.2.1 20070719 [FreeBSD]
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Signed-off-by: Idwer Vollering vidwer@gmail.com
Anyone up for an ack?
Looks fine for me
Acked-by: Maciej Pijanka maciej.pijanka@gmail.com
Regards, Carl-Daniel
On 27.03.2010 14:27, Maciej Pijanka wrote:
On Fri, 26 Mar 2010, Carl-Daniel Hailfinger wrote:
On 24.03.2010 23:38, Idwer Vollering wrote:
2010/3/24 Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
New version: Improve reliability of utsname detection.
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: 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) 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 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]
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) flashrom v0.9.1-r971 on Linux 2.6.22.19-0.2-default (i686), built with LLVM 1/clang 1 flashrom v0.9.1-r972 on Linux 2.6.27.29-0.1-default (x86_64), built with GCC 4.3.2 [gcc-4_3-branch revision 141291]
Reviews appreciated, especially about the compiler part. I think this can be valuable (e.g. if someone compiles with clang and triggers the clang/flashrom miscompile), but I'm unsure if/how this works on Windows and DOS. I tried to make it non-explosive, but...
Output from "flashrom --version" for non-Linux platforms and unusual compilers would be appreciated.
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
flashrom v0.9.1-r973 on FreeBSD 8.0-RELEASE-p2 (i386), built with libpci 3.1.7, GCC 4.2.1 20070719 [FreeBSD]
Signed-off-by: Carl-Daniel Hailfinger c-d.hailfinger.devel.2006@gmx.net
Signed-off-by: Idwer Vollering vidwer@gmail.com
Anyone up for an ack?
Looks fine for me
Acked-by: Maciej Pijanka maciej.pijanka@gmail.com
Thanks, committed in r987.
Regards, Carl-Daniel
On 19.12.2009 20:41, Idwer Vollering wrote:
Include detailed versioning information in the binary (--version).
Signed-off-by: Idwer Vollering vidwer@gmail.com
Thanks for your patch. While I like the general idea, this specific implementation makes porting to Windows more difficult. Can you move all the utsname printing stuff to a separate function in internal.c which is called from print_version?
Regards, Carl-Daniel
On 20.12.2009 00:59, Carl-Daniel Hailfinger wrote:
On 19.12.2009 20:41, Idwer Vollering wrote:
Include detailed versioning information in the binary (--version).
Signed-off-by: Idwer Vollering vidwer@gmail.com
Thanks for your patch. While I like the general idea, this specific implementation makes porting to Windows more difficult. Can you move all the utsname printing stuff to a separate function in internal.c which is called from print_version?
A good name for the new function would be print_sysinfo().
Regards, Carl-Daniel