From 4db826209e703c08644cf9f346c52bb06a6c0da6 Mon Sep 17 00:00:00 2001 From: Godzil Date: Thu, 10 May 2018 15:20:52 +0100 Subject: [PATCH] Add (and use) git describe to get module version. --- kfusd/Makefile | 4 ++-- kfusd/kfusd.c | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/kfusd/Makefile b/kfusd/Makefile index bc6b32d..cbd837f 100755 --- a/kfusd/Makefile +++ b/kfusd/Makefile @@ -5,11 +5,11 @@ else KDIR ?= /lib/modules/$(shell uname -r)/build PWD := $(shell pwd) ROOTFS ?= - +GIT_DESCRIBE = $(shell git describe --dirty --tags) KERNEL_VER ?= 2.6.32.7 default: - $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) EXTRA_CFLAGS=-I$(PWD)/../include modules + $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) EXTRA_CFLAGS="-I$(PWD)/../include -DGIT_DESCRIBE='\"${GIT_DESCRIBE}\"'" V=1 modules install: install -d -m 0755 $(ROOTFS)/lib/modules/$(KERNEL_VER)/kernel/drivers/misc diff --git a/kfusd/kfusd.c b/kfusd/kfusd.c index 92e555f..2abc589 100755 --- a/kfusd/kfusd.c +++ b/kfusd/kfusd.c @@ -90,6 +90,9 @@ #define STATIC +#ifndef GIT_DESCRIBE +#define GIT_DESCRIBE "unknownversion-dirty" +#endif /* Define this if you want to emit debug messages (adds ~8K) */ //#define CONFIG_FUSD_DEBUG @@ -284,7 +287,8 @@ DEFINE_SEMAPHORE (fusd_devlist_sem); //#ifdef MODULE_LICENSE MODULE_AUTHOR ("Jeremy Elson (c)2001"); -MODULE_AUTHOR ("Manoel Trapier (c)2009-2012"); +MODULE_AUTHOR ("Manoel Trapier (c)2009-2018"); +MODULE_VERSION(GIT_DESCRIBE); MODULE_LICENSE ("GPL"); //#endif