From cabe489a2e8e2ee7619924e447221177f4562962 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Thu, 4 Feb 2016 01:24:00 +0100 Subject: Improve gcc detection for module compilation --- driver/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'driver') diff --git a/driver/Makefile b/driver/Makefile index 83a8c46..f2c993e 100644 --- a/driver/Makefile +++ b/driver/Makefile @@ -20,8 +20,8 @@ default: echo "No compiler of $$GCC_MAJOR series is installed" ;\ exit 1 ;\ fi ;\ - GCC_VERSION=`$$CC --version | head -n 1 | tr ' ' '\n' | grep -e "[0-9]\+\.[0-9]" | head -n 1` ;\ - if [ $$KERNEL_GCC_VERSION != $$GCC_VERSION ]; then \ + GCC_VERSION=`$$CC --version | head -n 1 | tr ' ' '\n' | grep -e "[0-9]\+\.[0-9]" | tail -n 1` ;\ + if [ $$KERNEL_GCC_VERSION != $$GCC_VERSION -a -z "$$RELAXED_GCC_CHECK" ]; then \ echo "The $$GCC_VERSION of $$GCC_MAJOR series is installed" ;\ exit 1 ;\ fi ;\ -- cgit v1.2.3 From 4f5185b37980bdf962ff7058e9f8fbb06098386c Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Thu, 4 Feb 2016 02:13:02 +0100 Subject: Report information about driver revision and build --- driver/Makefile | 11 +++++++++++ driver/base.c | 11 ++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-) (limited to 'driver') diff --git a/driver/Makefile b/driver/Makefile index f2c993e..c26a84a 100644 --- a/driver/Makefile +++ b/driver/Makefile @@ -29,6 +29,17 @@ default: else \ CC=$(CC) ;\ fi ;\ + build_revision=`bzr revno` ;\ + build_author=`bzr log -r$$build_revision | grep committer | cut -c 12-` ;\ + build_path=`pwd` ;\ + build_branch=`bzr nick` ;\ + build_lastmod=`find . -type f -name '*.[ch]' -printf '%TY/%Tm/%Td %TH:%TM:%TS %p\n' | grep -E -v 'build.h|mod.c' | sort -n | tail -n 1 | cut -d ' ' -f 1-2 | cut -d '.' -f 1` ;\ + build_changes=`bzr status -SV | cut -c 5- | tr \\\n " "` ;\ + build_user=`whoami` ;\ + build_date=`date "+%Y/%m/%d %H:%M:%S"` ;\ + build="Built at $$build_date by $$build_user" ;\ + revision="Revision $$build_revision from $$build_branch by $$build_author at $$build_path, last modification from $$build_lastmod" ;\ + echo -e "#define PCIDRIVER_BUILD \"$$build\"\\n#define PCIDRIVER_REVISION \"$$revision\"\\n#define PCIDRIVER_CHANGES \"$$build_changes\"\\n" > build.h ;\ $(MAKE) $(CFLAGS) -C $(KERNELDIR) M=$(PWD) CC=$$CC modules install: diff --git a/driver/base.c b/driver/base.c index 2768f9e..bc9ab98 100644 --- a/driver/base.c +++ b/driver/base.c @@ -164,6 +164,8 @@ #include #include +#include "../pcilib/version.h" + /* Configuration for the driver (what should be compiled in, module name, etc...) */ #include "config.h" @@ -190,6 +192,8 @@ #include "ioctl.h" +#include "build.h" + /*************************************************************************/ /* Module device table associated with this driver */ MODULE_DEVICE_TABLE(pci, pcidriver_ids); @@ -240,7 +244,12 @@ static int __init pcidriver_init(void) goto init_pcireg_fail; } - mod_info("Module loaded\n"); + mod_info("pcidriver %u.%u.%u loaded\n", PCILIB_VERSION_GET_MAJOR(PCILIB_VERSION), PCILIB_VERSION_GET_MINOR(PCILIB_VERSION), PCILIB_VERSION_GET_MICRO(PCILIB_VERSION)); + mod_info("%s\n", PCIDRIVER_BUILD); + mod_info("%s\n", PCIDRIVER_REVISION); + if (strlen(PCIDRIVER_CHANGES)) { + mod_info("Extra changes - %s\n", PCIDRIVER_CHANGES); + } return 0; -- cgit v1.2.3