* [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Allow to disable features
@ 2011-12-07 12:29 Sven Eckelmann
2011-12-07 12:27 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Don't try to read commit information from target kernel Sven Eckelmann
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Sven Eckelmann @ 2011-12-07 12:29 UTC (permalink / raw)
To: b.a.t.m.a.n
The user could not disable features which were enabled in the target kernel as
explained in b3d474c54bca76797e88878f29f100a7d5c7e02b. We have to undef
batman-adv specific preprocessor variables and generate an own header that sets
them according to the user settings.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
Makefile | 17 +++++++++++------
compat.h | 7 +++++++
gen-compat-autoconf.sh | 35 +++++++++++++++++++++++++++++++++++
3 files changed, 53 insertions(+), 6 deletions(-)
create mode 100755 gen-compat-autoconf.sh
diff --git a/Makefile b/Makefile
index e78e797..99fd366 100644
--- a/Makefile
+++ b/Makefile
@@ -18,10 +18,9 @@
# 02110-1301, USA
#
-# uncomment the CONFIG_* line to enable the related feature
-# features enabled in the target kernel configuration cannot be disabled
+# changing the CONFIG_* line to 'y' enables the related feature
# B.A.T.M.A.N. debugging:
-# CONFIG_BATMAN_ADV_DEBUG=y
+export CONFIG_BATMAN_ADV_DEBUG=n
PWD:=$(shell pwd)
KERNELPATH ?= /lib/modules/$(shell uname -r)/build
@@ -31,6 +30,7 @@ $(warning $(KERNELPATH) is missing, please set KERNELPATH)
endif
export KERNELPATH
+RM ?= rm -f
REVISION= $(shell if [ -d .git ]; then \
echo $$(git describe --always --dirty --match "v*" |sed 's/^v//' 2> /dev/null || echo "[unknown]"); \
@@ -41,14 +41,19 @@ batman-adv-y += compat.o
ifneq ($(REVISION),)
ccflags-y += -DSOURCE_VERSION=\"$(REVISION)\"
endif
-ccflags-$(CONFIG_BATMAN_ADV_DEBUG) += -DCONFIG_BATMAN_ADV_DEBUG
include $(PWD)/Makefile.kbuild
-all:
+all: config
$(MAKE) -C $(KERNELPATH) M=$(PWD) PWD=$(PWD) modules
clean:
+ $(RM) compat-autoconf.h*
$(MAKE) -C $(KERNELPATH) M=$(PWD) PWD=$(PWD) clean
-install:
+install: config
$(MAKE) -C $(KERNELPATH) M=$(PWD) PWD=$(PWD) INSTALL_MOD_DIR=kernel/net/batman-adv/ modules_install
+
+config:
+ $(PWD)/gen-compat-autoconf.sh $(PWD)/compat-autoconf.h
+
+.PHONY: all clean install config
diff --git a/compat.h b/compat.h
index 964c066..6480614 100644
--- a/compat.h
+++ b/compat.h
@@ -27,6 +27,13 @@
#include <linux/version.h> /* LINUX_VERSION_CODE */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33))
+#include <linux/autoconf.h>
+#else
+#include <generated/autoconf.h>
+#endif
+#include "compat-autoconf.h"
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33)
#define __always_unused __attribute__((unused))
diff --git a/gen-compat-autoconf.sh b/gen-compat-autoconf.sh
new file mode 100755
index 0000000..440accc
--- /dev/null
+++ b/gen-compat-autoconf.sh
@@ -0,0 +1,35 @@
+#! /bin/sh
+
+set -e
+
+TARGET=${1:="compat-autoconf.h"}
+TMP="${TARGET}.tmp"
+
+echo -n > "${TMP}"
+
+gen_config() {
+ KEY="${1}"
+ VALUE="${2}"
+
+ echo "#undef ${KEY}"
+ case "${VALUE}" in
+ y)
+ echo "#define ${KEY} 1"
+ ;;
+ m)
+ echo "#define ${KEY} 1"
+ ;;
+ n)
+ # leave it undefined
+ ;;
+ *)
+ echo "#define ${KEY} \"${VALUE}\""
+ ;;
+ esac
+}
+
+# write config variables
+gen_config 'CONFIG_BATMAN_ADV_DEBUG' ${CONFIG_BATMAN_ADV_DEBUG:="n"} >> "${TMP}"
+
+# only regenerate compat-autoconf.h when config was changed
+diff "${TMP}" "${TARGET}" > /dev/null 2>&1 || cp "${TMP}" "${TARGET}"
--
1.7.7.3
^ permalink raw reply related [flat|nested] 6+ messages in thread* [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Don't try to read commit information from target kernel
2011-12-07 12:29 [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Allow to disable features Sven Eckelmann
@ 2011-12-07 12:27 ` Sven Eckelmann
2011-12-08 10:41 ` Marek Lindner
2011-12-08 9:26 ` [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Allow to disable features Marek Lindner
2011-12-08 10:39 ` Marek Lindner
2 siblings, 1 reply; 6+ messages in thread
From: Sven Eckelmann @ 2011-12-07 12:27 UTC (permalink / raw)
To: b.a.t.m.a.n
It is possible that the kernel used to build the batman-adv module also
contains a .git directory. The makefile should not try to run git-describe
inside this kernel to prevent that wrong version information is stored in the
generated module.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
Makefile | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 99fd366..e2276be 100644
--- a/Makefile
+++ b/Makefile
@@ -32,8 +32,8 @@ endif
export KERNELPATH
RM ?= rm -f
-REVISION= $(shell if [ -d .git ]; then \
- echo $$(git describe --always --dirty --match "v*" |sed 's/^v//' 2> /dev/null || echo "[unknown]"); \
+REVISION= $(shell if [ -d "$(PWD)/.git" ]; then \
+ echo $$(git --git-dir="$(PWD)/.git" describe --always --dirty --match "v*" |sed 's/^v//' 2> /dev/null || echo "[unknown]"); \
fi)
CONFIG_BATMAN_ADV=m
--
1.7.7.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Allow to disable features
2011-12-07 12:29 [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Allow to disable features Sven Eckelmann
2011-12-07 12:27 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Don't try to read commit information from target kernel Sven Eckelmann
@ 2011-12-08 9:26 ` Marek Lindner
2011-12-08 9:35 ` Sven Eckelmann
2011-12-08 10:39 ` Marek Lindner
2 siblings, 1 reply; 6+ messages in thread
From: Marek Lindner @ 2011-12-08 9:26 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
On Wednesday, December 07, 2011 20:29:11 Sven Eckelmann wrote:
> -# uncomment the CONFIG_* line to enable the related feature
> -# features enabled in the target kernel configuration cannot be disabled
> +# changing the CONFIG_* line to 'y' enables the related feature
> # B.A.T.M.A.N. debugging:
> -# CONFIG_BATMAN_ADV_DEBUG=y
> +export CONFIG_BATMAN_ADV_DEBUG=n
Haven't tried it yet but does it mean the newly added 'activate this feature
from the commandline' does not work anymore ?
For example: make CONFIG_BATMAN_ADV_DEBUG=y
Regards,
Marek
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Allow to disable features
2011-12-07 12:29 [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Allow to disable features Sven Eckelmann
2011-12-07 12:27 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Don't try to read commit information from target kernel Sven Eckelmann
2011-12-08 9:26 ` [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Allow to disable features Marek Lindner
@ 2011-12-08 10:39 ` Marek Lindner
2 siblings, 0 replies; 6+ messages in thread
From: Marek Lindner @ 2011-12-08 10:39 UTC (permalink / raw)
To: The list for a Better Approach To Mobile Ad-hoc Networking
On Wednesday, December 07, 2011 20:29:11 Sven Eckelmann wrote:
> The user could not disable features which were enabled in the target kernel
> as explained in b3d474c54bca76797e88878f29f100a7d5c7e02b. We have to undef
> batman-adv specific preprocessor variables and generate an own header that
> sets them according to the user settings.
Applied in revision 9134518.
Thanks,
Marek
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-12-08 10:41 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-07 12:29 [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Allow to disable features Sven Eckelmann
2011-12-07 12:27 ` [B.A.T.M.A.N.] [PATCH 2/2] batman-adv: Don't try to read commit information from target kernel Sven Eckelmann
2011-12-08 10:41 ` Marek Lindner
2011-12-08 9:26 ` [B.A.T.M.A.N.] [PATCH 1/2] batman-adv: Allow to disable features Marek Lindner
2011-12-08 9:35 ` Sven Eckelmann
2011-12-08 10:39 ` Marek Lindner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox