From patchwork Thu Feb 11 22:25:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 5028 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=79.140.41.39; helo=v3-1039.vlinux.de; envelope-from=sven@narfation.org; receiver=b.a.t.m.a.n@lists.open-mesh.org Authentication-Results: open-mesh.org; dmarc=pass header.from=narfation.org Authentication-Results: open-mesh.org; dkim=pass reason="1024-bit key; unprotected key" header.d=narfation.org header.i=@narfation.org header.b=ix6phJ/I; dkim-adsp=pass; dkim-atps=neutral Received: from v3-1039.vlinux.de (narfation.org [79.140.41.39]) by open-mesh.org (Postfix) with ESMTPS id 30E748157E for ; Thu, 11 Feb 2016 23:25:58 +0100 (CET) Received: from sven-edge.localnet (p200300C593C061FD0000000000002E16.dip0.t-ipconnect.de [IPv6:2003:c5:93c0:61fd::2e16]) by v3-1039.vlinux.de (Postfix) with ESMTPSA id E34181C8001 for ; Thu, 11 Feb 2016 23:25:57 +0100 (CET) Authentication-Results: v3-1039.vlinux.de; dmarc=none header.from=narfation.org DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=narfation.org; s=20121; t=1455229558; bh=+6zBgBsE4Zs4oVHnR2tgD7QKBnQ0WUg0RkZQUejn9mk=; h=From:To:Subject:Date:From; b=ix6phJ/ILA/SzdSOOrDEm37veXbpsRaxVLB/sS892a34BwgBK/ShP0ArKufNcCit9 gqqUX9uiG1OWLeRTQoz1njWmyC9NsUqn/AnblhmbrnrVp/YIAVfh1SOf08tvMoR2Rp 7Lo+nsXUmP+FOtdKEQE/to0a7rWhdnQWZQr3II0k= From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Thu, 11 Feb 2016 23:25:56 +0100 Message-ID: <1674394.xTpvsLY2Zu@sven-edge> User-Agent: KMail/4.14.10 (Linux/4.3.0-1-amd64; KDE/4.14.14; x86_64; ; ) MIME-Version: 1.0 Subject: [B.A.T.M.A.N.] mac80211 compat layer for OpenWrt X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Feb 2016 22:25:59 -0000 Hi, it looks like the next version (with B.A.T.M.A.N. V support and cfg80211 dependency) has to be build against the mac80211 compat version. OpenWrt right now uses Linux 3.18, 4.1, 4.3 and 4.4. These kernel versions don't require many changes (which are not already part of the compat layer) to get batman- adv building against it. But most of the required changes are rather ugly (see batman-adv/patches/0000-compat-hacks.patch). But at least it builds with them. I have the basic changes for openwrt-routing attached. Maybe someone has some visions how to continue from here. I've also attached the patch to build the current state of B.A.T.M.A.N. V on OpenWrt. Kind regards, Sven From: Sven Eckelmann Date: Thu, 21 Jan 2016 16:04:20 +0100 Subject: [PATCH] batman-adv: Use the mac80211 compat layer --- batman-adv/Makefile | 40 +++++++++++++++++--------- batman-adv/patches/0000-compat-hacks.patch | 46 ++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 14 deletions(-) create mode 100644 batman-adv/patches/0000-compat-hacks.patch diff --git a/batman-adv/Makefile b/batman-adv/Makefile index 1eb6bbe..6e24d4d 100644 --- a/batman-adv/Makefile +++ b/batman-adv/Makefile @@ -27,7 +27,7 @@ define KernelPackage/batman-adv URL:=https://www.open-mesh.org/ MAINTAINER:=Marek Lindner SUBMENU:=Network Support - DEPENDS:=+KMOD_BATMAN_ADV_BLA:kmod-lib-crc16 +kmod-crypto-core +kmod-crypto-crc32c +kmod-lib-crc32c + DEPENDS:=+KMOD_BATMAN_ADV_BLA:kmod-lib-crc16 +kmod-crypto-core +kmod-crypto-crc32c +kmod-lib-crc32c +kmod-cfg80211 TITLE:=B.A.T.M.A.N. Adv FILES:=$(PKG_BUILD_DIR)/net/batman-adv/batman-adv.$(LINUX_KMOD_SUFFIX) AUTOLOAD:=$(call AutoLoad,50,batman-adv) @@ -47,20 +47,36 @@ define Package/kmod-batman-adv/conffiles /etc/config/batman-adv endef -MAKE_BATMAN_ADV_ARGS += \ - CROSS_COMPILE="$(TARGET_CROSS)" \ - KERNELPATH="$(LINUX_DIR)" \ - ARCH="$(LINUX_KARCH)" \ - PATH="$(TARGET_PATH)" \ - SUBDIRS="$(PKG_BUILD_DIR)" \ - PWD="$(PKG_BUILD_DIR)" \ - LINUX_VERSION="$(LINUX_VERSION)" \ +PKG_EXTRA_KCONFIG:= \ + CONFIG_BATMAN_ADV=m \ CONFIG_BATMAN_ADV_DEBUG=$(if $(CONFIG_KMOD_BATMAN_ADV_DEBUG_LOG),y,n) \ CONFIG_BATMAN_ADV_BLA=$(if $(CONFIG_KMOD_BATMAN_ADV_BLA),y,n) \ CONFIG_BATMAN_ADV_DAT=$(if $(CONFIG_KMOD_BATMAN_ADV_DAT),y,n) \ CONFIG_BATMAN_ADV_MCAST=$(if $(CONFIG_KMOD_BATMAN_ADV_MCAST),y,n) \ CONFIG_BATMAN_ADV_NC=$(if $(CONFIG_KMOD_BATMAN_ADV_NC),y,n) \ - REVISION="" all + +PKG_EXTRA_CFLAGS:= \ + $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=m,%,$(filter %=m,$(PKG_EXTRA_KCONFIG)))) \ + $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=y,%,$(filter %=y,$(PKG_EXTRA_KCONFIG)))) \ + +NOSTDINC_FLAGS = \ + -I$(PKG_BUILD_DIR)/net/batman-adv \ + -I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \ + -I$(STAGING_DIR)/usr/include/mac80211-backport \ + -I$(STAGING_DIR)/usr/include/mac80211/uapi \ + -I$(STAGING_DIR)/usr/include/mac80211 \ + -include backport/backport.h + +define Build/Compile + +$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \ + ARCH="$(LINUX_KARCH)" \ + CROSS_COMPILE="$(TARGET_CROSS)" \ + SUBDIRS="$(PKG_BUILD_DIR)/net/batman-adv" \ + $(PKG_EXTRA_KCONFIG) \ + EXTRA_CFLAGS="$(PKG_EXTRA_CFLAGS)" \ + NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \ + modules +endef define Build/Prepare $(call Build/Prepare/Default) @@ -68,10 +84,6 @@ define Build/Prepare $(PKG_BUILD_DIR)/net/batman-adv/main.h endef -define Build/Compile - $(MAKE) -C "$(PKG_BUILD_DIR)" $(MAKE_BATMAN_ADV_ARGS) -endef - define Build/Clean rm -rf $(BUILD_DIR)/$(PKG_NAME)/ endef diff --git a/batman-adv/patches/0000-compat-hacks.patch b/batman-adv/patches/0000-compat-hacks.patch new file mode 100644 index 0000000..78bdc51 --- /dev/null +++ b/batman-adv/patches/0000-compat-hacks.patch @@ -0,0 +1,46 @@ +diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c +index 730cfa8..39e5694 100644 +--- a/net/batman-adv/hard-interface.c ++++ b/net/batman-adv/hard-interface.c +@@ -47,6 +47,24 @@ + #include "sysfs.h" + #include "translation-table.h" + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0) ++ ++#define dev_get_iflink(_net_dev) ((_net_dev)->iflink) ++ ++#endif /* < KERNEL_VERSION(4, 1, 0) */ ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0) ++ ++#define netdev_master_upper_dev_link(dev, upper_dev, upper_priv, upper_info) \ ++ netdev_set_master(dev, upper_dev) ++ ++#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) ++ ++#define netdev_master_upper_dev_link(dev, upper_dev, upper_priv, upper_info) \ ++ netdev_master_upper_dev_link(dev, upper_dev) ++ ++#endif /* < KERNEL_VERSION(4, 5, 0) */ ++ + /** + * batadv_hardif_release - release hard interface from lists and queue for + * free after rcu grace period +diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c +index 6c65de9..06d0330 100644 +--- a/net/batman-adv/soft-interface.c ++++ b/net/batman-adv/soft-interface.c +@@ -60,6 +60,12 @@ + #include "sysfs.h" + #include "translation-table.h" + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) ++ ++#define IFF_NO_QUEUE 0; dev->tx_queue_len = 0 ++ ++#endif /* < KERNEL_VERSION(4, 3, 0) */ ++ + static int batadv_get_settings(struct net_device *dev, struct ethtool_cmd *cmd); + static void batadv_get_drvinfo(struct net_device *dev, + struct ethtool_drvinfo *info);