From: "Linus Lüssing" <linus.luessing@c0d3.blue>
To: b.a.t.m.a.n@lists.open-mesh.org
Subject: [B.A.T.M.A.N.] [PATCH RFCv4 3/3] compat: disable multicast optimizations for old kernels
Date: Mon, 4 May 2015 22:47:23 +0200 [thread overview]
Message-ID: <1430772443-3545-1-git-send-email-linus.luessing@c0d3.blue> (raw)
In-Reply-To: <1430691231-9120-1-git-send-email-linus.luessing@c0d3.blue>
With this patch, the Makefile searches for the symbols needed
for the multicast optimizations in the kernel's .config and
Module.symvers. If they are not there, a warning is issued during "make"
and the multicast.c is excluded from the build process.
The advantage of this is that there's no need for hackish substitutions
in the original code base. Also, this approach is independant of the
actual kernel version, so it's easily possible to backport the upstream
functions to your own, older kernel if you desire.
Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
---
Makefile | 6 ++++++
check-dependencies.sh | 29 +++++++++++++++++++++++++++++
2 files changed, 35 insertions(+)
create mode 100755 check-dependencies.sh
diff --git a/Makefile b/Makefile
index ee3be1d..a66ec66 100644
--- a/Makefile
+++ b/Makefile
@@ -50,6 +50,12 @@ ifneq ($(REVISION),)
NOSTDINC_FLAGS += -DBATADV_SOURCE_VERSION=\"$(REVISION)\"
endif
+ifeq ($(CONFIG_BATMAN_ADV_MCAST),y)
+ifneq ($(shell $(PWD)/check-dependencies.sh $(KERNELPATH); echo $$?),0)
+ override CONFIG_BATMAN_ADV_MCAST=n
+endif
+endif
+
BUILD_FLAGS := \
M=$(PWD)/net/batman-adv \
CONFIG_BATMAN_ADV=m \
diff --git a/check-dependencies.sh b/check-dependencies.sh
new file mode 100755
index 0000000..86e0654
--- /dev/null
+++ b/check-dependencies.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+DEPS_CONFIG_BATMAN_ADV_MCAST="CONFIG_IPV6:ipv6_mc_check_mld ip_mc_check_igmp"
+
+KERNELPATH="$1"
+RET=0
+
+for s in $DEPS_CONFIG_BATMAN_ADV_MCAST; do
+ if [ -n "${s##*:*}" ]; then
+ conf=""
+ dep="$s"
+ else
+ conf="${s%%:*}"
+ dep="${s#*:}"
+ fi
+
+ [ -n "$conf" ] && ! egrep -q "$conf=(m|y)" ${KERNELPATH}/.config && \
+ continue
+
+ grep -q "$dep" ${KERNELPATH}/Module.symvers && continue
+
+ echo "WARNING: Missing built-in symbol \"$dep\" -" \
+ "disabling CONFIG_BATMAN_ADV_MCAST (Kernel too old?)" \
+ >&2
+
+ RET=1
+done
+
+exit $RET
--
1.7.10.4
prev parent reply other threads:[~2015-05-04 20:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-03 22:13 [B.A.T.M.A.N.] [PATCH RFCv4 0/3] batman-adv: Unicasting multicast reports to querier-node only Linus Lüssing
2015-05-03 22:13 ` [B.A.T.M.A.N.] [PATCH RFCv4 1/3] batman-adv: Forward IGMP/MLD reports to selected querier (only) Linus Lüssing
2015-05-03 22:13 ` [B.A.T.M.A.N.] [PATCH RFCv4 2/3] batman-adv: Increase BATADV_TVLV_MCAST version number to 2 Linus Lüssing
2015-05-04 20:47 ` Linus Lüssing [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1430772443-3545-1-git-send-email-linus.luessing@c0d3.blue \
--to=linus.luessing@c0d3.blue \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).