mac80211 compat layer for OpenWrt
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 <[email protected]>
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
batman-adv/Makefile +26 -14
@@ -27,7 +27,7 @@ define KernelPackage/batman-adv URL:=https://www.open-mesh.org/ MAINTAINER:=Marek Lindner <[email protected]> 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
batman-adv/patches/0000-compat-hacks.patch new file +46 -0
46 lines not on this page · raw message
On Thursday 11 February 2016 23:25:56 Sven Eckelmann wrote:
[...]
Quoted 2 lines
I've also attached the patch to build the current state of B.A.T.M.A.N. V on OpenWrt.
Btw. the previously proposed way to select the routing algorithm at runtime in OpenWrt requires an additional patch. The setting in /etc/config/network would look something like:
config interface 'batnet'
option mtu '1532'
option proto 'batadv'
option mesh 'bat0'
option routing_algo 'BATMAN_IV'
Kind regards,
Sven
From: Sven Eckelmann <[email protected]>
Date: Tue, 19 Jan 2016 12:40:10 +0100
Subject: [PATCH] openwrt-feed-batman-adv: Allow to select routing algorithm
The network config section for proto batadv now allows to select the routing algorithm via the option routing_algo. This allows to chose between BATMAN_IV and BATMAN_V when BATMAN_V is released. This option is only useful when a new batman-adv device is created and not when only a device is added to an already existing batman-adv device.
Forwarded: https://lists.open-mesh.org/pipermail/b.a.t.m.a.n/2016-January/014225.html
--- batman-adv/files/lib/netifd/proto/batadv.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
batman-adv/files/lib/netifd/proto/batadv.sh +6 -2
@@ -6,14 +6,18 @@ init_proto "$@" proto_batadv_init_config() { proto_config_add_string "mesh" + proto_config_add_string "routing_algo" } proto_batadv_setup() { local config="$1" local iface="$2" - local mesh - json_get_vars mesh + local mesh routing_algo + json_get_vars mesh routing_algo + + [ -n "$routing_algo" ] || routing_algo="BATMAN_IV" + echo "$routing_algo" > "/sys/module/batman_adv/parameters/routing_algo" echo "$mesh" > "/sys/class/net/$iface/batman_adv/mesh_iface" proto_init_update "$iface" 1