[coreboot-gerrit] New patch to review for coreboot: util/genbuild_h: Add compiler version

Paul Menzel (paulepanter@users.sourceforge.net) gerrit at coreboot.org
Sun Jul 10 12:31:24 CEST 2016


Paul Menzel (paulepanter at users.sourceforge.net) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15592

-gerrit

commit bdc76db2995f3f91fbeab89f0e5b399e7b521e70
Author: Paul Menzel <paulepanter at users.sourceforge.net>
Date:   Sun Jul 10 12:17:45 2016 +0200

    util/genbuild_h: Add compiler version
    
    It’s useful to note the compiler used for a build, and output it in the
    banner. Linux and SeaBIOS do that for example.
    
    ```
    $ dmesg | grep gcc
    [    0.000000] Linux version 4.7.0-rc4-686-pae (debian-kernel at lists.debian.org) (gcc version 5.4.0 20160609 (Debian 5.4.0-4) ) #1 SMP Debian 4.7~rc4-1~exp1 (2016-06-20)
    $ sudo cbmem -c | grep gcc
    BUILD: gcc: (Debian 5.4.0-6) 5.4.0 20160609 binutils: (GNU Binutils for Debian) 2.26.1
    ```
    
    The version information for the two supported compilers look like below.
    
    ```
    $ gcc --version
    gcc (Debian 5.4.0-6) 5.4.0 20160609
    $ clang --version
    Ubuntu clang version 3.5-1ubuntu1 (trunk) (based on LLVM 3.5)
    Target: x86_64-pc-linux-gnu
    Thread model: posix
    ```
    
    Change-Id: Ide2d719dcbafa49cb1e75bae207981f722ae36b5
    Signed-off-by: Paul Menzel <paulepanter at users.sourceforge.net>
---
 Makefile.inc                  |  8 ++++++++
 util/genbuild_h/genbuild_h.sh | 11 +++++++++++
 2 files changed, 19 insertions(+)

diff --git a/Makefile.inc b/Makefile.inc
index 69c8843..1246ac1 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -336,6 +336,14 @@ ifneq ($(CONFIG_LOCALVERSION),"")
 export COREBOOT_EXTRA_VERSION := -$(call strip_quotes,$(CONFIG_LOCALVERSION))
 endif
 
+ifneq ($(CONFIG_COMPILER_GCC),"y")
+export COREBOOT_COMPILER := GCC
+endif
+
+ifneq ($(CONFIG_COMPILER_LLVM_CLANG),"y")
+export COREBOOT_COMPILER := LLVM_CLANG
+endif
+
 CPPFLAGS_common := -Isrc -Isrc/include -Isrc/commonlib/include -I$(obj)
 CPPFLAGS_common += -Isrc/device/oprom/include
 VB_SOURCE ?= 3rdparty/vboot
diff --git a/util/genbuild_h/genbuild_h.sh b/util/genbuild_h/genbuild_h.sh
index 044d901..7c18829 100755
--- a/util/genbuild_h/genbuild_h.sh
+++ b/util/genbuild_h/genbuild_h.sh
@@ -15,6 +15,7 @@
 #
 
 DATE=""
+COMPILER_VERSION=""
 GITREV=""
 TIMESOURCE=""
 
@@ -24,6 +25,14 @@ export TZ=UTC
 
 top=`dirname $0`/../..
 
+if [ "${COREBOOT_COMPILER}" = "GCC" ]; then
+  COMPILER_VERSION=$(gcc --version)
+elif [ "${COREBOOT_COMPILER}" = "LLVM_CLANG"]; then
+  COMPILER_VERSION=$(clang --version | head -1)
+else
+  COMPILER_VERSION="Unknown"
+fi
+
 if [ "${BUILD_TIMELESS}" = "1" ]; then
 	GITREV=Timeless
 	TIMESOURCE="fixed"
@@ -68,4 +77,6 @@ printf "#define COREBOOT_BUILD_WEEKDAY_BCD 0x$(our_date "$DATE" +%w)\n"
 printf "#define COREBOOT_DMI_DATE \"$(our_date "$DATE" +%m/%d/%Y)\"\n"
 printf "\n"
 printf "#define COREBOOT_COMPILE_TIME \"$(our_date "$DATE" +%T)\"\n"
+
+printf "#define COREBOOT_COMPILER_VERSION \"$COMPILER_VERSION\"\n"
 printf "#endif\n"



More information about the coreboot-gerrit mailing list