batman-adv: update to latest release (2010.0.0)
authorMarek Lindner <lindner_marek@yahoo.de>
Thu, 1 Jul 2010 15:10:19 +0000 (15:10 +0000)
committerMarek Lindner <lindner_marek@yahoo.de>
Thu, 1 Jul 2010 15:10:19 +0000 (15:10 +0000)
* simplified Makefile (thanks Nico!)
* moved the branches into an extra feed
* updated the init script to match the latest features

SVN-Revision: 22017

net/batman-advanced/Config.in
net/batman-advanced/Makefile
net/batman-advanced/files/etc/config/batman-adv
net/batman-advanced/files/etc/init.d/batman-adv

index e463359..ad11d3a 100644 (file)
@@ -1,26 +1,3 @@
-choice
-       prompt "branch"
-       depends PACKAGE_kmod-batman-adv
-       default BATMAN_ADV_MAINTENANCE
-       help
-         This option allows you to select the version of B.A.T.M.A.N.-Advanced.
-
-config BATMAN_ADV_MAINTENANCE
-       bool "maintenance"
-       help
-         This version contains the latest release version plus some additional
-         bug fixes cherrypicked from the batman-adv trunk.
-
-         If unsure, select this.
-
-config BATMAN_ADV_DEV
-       bool "development"
-       help
-         This version contains a version from batman-adv's trunk which offers
-         new, but not that well tested, features.
-
-         If unsure, select "maintenance".
-endchoice
 
 config KMOD_BATMAN_ADV_DEBUG_LOG
        bool "enable verbose debug logging"
index 85dd03b..037fdbe 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2008 OpenWrt.org
+# Copyright (C) 2010 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -10,128 +10,38 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=batman-adv
 
-# Versions to download for maintenance build
-PKG_REV_MAINT:=1611
-PKG_KMOD_VERSION_MAINT:=5c4633c532a7a9b5adfe5dbf3f5e97fff307216e
-# just for the package version numbering
-PKG_VERSION_MAINT:=0.2.1
-# Versions to download for development build
-PKG_REV_DEV:=1715
-PKG_KMOD_VERSION_DEV:=520e8f9d66bc972e6f818c57e063efffb7f52be4
-# just for the package version numbering
-PKG_VERSION_DEV:=0.3.0a
-## Make sure git-commit hash and svn revision number fit! ##
-
-PKG_RELEASE:=1
-PKG_SOURCE_SUBDIR:=$(PKG_NAME)
-
-PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
-
-ifneq ($(CONFIG_BATMAN_ADV_DEV),)
-       PKG_REV:=$(PKG_REV_DEV)
-       PKG_VERSION:=$(PKG_VERSION_DEV)
-       PKG_KMOD_VERSION=$(PKG_KMOD_VERSION_DEV)
-       PKG_KMOD_URL=http://git.open-mesh.org/snapshot/$(PKG_KMOD_VERSION)/
-       PKG_KMOD_FNAME=batman-adv-dev-$(PKG_REV).tar.gz
-       PKG_TOOL_VERSION=$(PKG_REV)
-       PKG_TOOL_PROTO=svn
-       PKG_TOOL_URL=http://downloads.open-mesh.org/svn/batman/trunk/batctl
-       PKG_TOOL_FNAME:=batctl-dev-$(PKG_TOOL_VERSION).tar.gz
-else
-       PKG_REV:=$(PKG_REV_MAINT)
-       PKG_VERSION:=$(PKG_VERSION_MAINT)
-       PKG_KMOD_VERSION=$(PKG_KMOD_VERSION_MAINT)
-       PKG_KMOD_URL=http://git.open-mesh.org/snapshot/$(PKG_KMOD_VERSION)/
-       PKG_KMOD_FNAME=batman-adv-maint-$(PKG_REV).tar.gz
-       PKG_TOOL_VERSION=$(PKG_REV)
-       PKG_TOOL_PROTO=svn
-       PKG_TOOL_URL=http://downloads.open-mesh.org/svn/batman/branches/batctl-0.2.x/
-       PKG_TOOL_FNAME:=batctl-maint-$(PKG_TOOL_VERSION).tar.gz
-endif
+PKG_VERSION:=2010.0.0
+PKG_MD5SUM:=2a7dc62e23d8940ff70c87b0504cab95
+BATCTL_MD5SUM:=a13cc78988c8a6422756e979ba561aca
 
-PKG_KMOD_BUILD_DIR:=$(PKG_BUILD_DIR)/batman-adv
-PKG_TOOL_BUILD_DIR:=$(PKG_BUILD_DIR)/batctl
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://downloads.open-mesh.org/batman/releases/batman-adv-$(PKG_VERSION)
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_TOOL_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/batctl-$(PKG_VERSION)
 
 include $(INCLUDE_DIR)/package.mk
 include $(INCLUDE_DIR)/kernel.mk
 
-# have to set this variable after including the Makefiles
-ifneq ($(CONFIG_BATMAN_ADV_DEV),)
-       STAMP_PREPARED:=$(STAMP_PREPARED)_dev
-else
-       STAMP_PREPARED:=$(STAMP_PREPARED)_maint
-endif
-STAMP_PREPARED:=$(STAMP_PREPARED)$(if $(CONFIG_KMOD_BATMAN_ADV_BATCTL),_batctl)
-STAMP_BUILT:=$(STAMP_BUILT)$(if $(CONFIG_KMOD_BATMAN_ADV_DEBUG_LOG),_debug)
-
-define Package/batman-adv/Default
+define KernelPackage/batman-adv
   URL:=http://www.open-mesh.org/
   MAINTAINER:=Marek Lindner <lindner_marek@yahoo.de>
-endef
-
-define KernelPackage/batman-adv
-$(call Package/batman-adv/Default)
   SUBMENU:=Network Support
   DEPENDS:=@LINUX_2_6
-  TITLE:=B.A.T.M.A.N. layer 2
-  FILES:=$(PKG_KMOD_BUILD_DIR)/batman-adv.$(LINUX_KMOD_SUFFIX)
+  TITLE:=B.A.T.M.A.N. Adv
+  FILES:=$(PKG_BUILD_DIR)/batman-adv.$(LINUX_KMOD_SUFFIX)
   AUTOLOAD:=$(call AutoLoad,50,batman-adv)
 endef
 
-define KernelPackage/batman-adv/config
-       source "$(SOURCE)/Config.in"
-endef
-
 define KernelPackage/batman-adv/description
-B.A.T.M.A.N. layer 2
-endef
-
-define Download/batman-adv
-  FILE:=$(PKG_KMOD_FNAME)
-  URL:=$(PKG_KMOD_URL)
-endef
-$(eval $(call Download,batman-adv))
-
-ifneq ($(DEVELOPER)$(CONFIG_KMOD_BATMAN_ADV_BATCTL),)
-define Download/batctl
-  FILE:=$(PKG_TOOL_FNAME)
-  URL:=$(PKG_TOOL_URL)@$(PKG_TOOL_VERSION)
-  PROTO:=$(PKG_TOOL_PROTO)
-  VERSION:=$(PKG_TOOL_VERSION)
-  SUBDIR:=$(PKG_SOURCE_SUBDIR)/batctl
+B.A.T.M.A.N. advanced is a kernel module which allows to
+build layer 2 mesh networks. This package contains the
+version $(PKG_VERSION) of the kernel module plus its user space
+configuration & managerment tool batctl.
 endef
-$(eval $(call Download,batctl))
-endif
 
-ifneq ($(DEVELOPER)$(CONFIG_KMOD_BATMAN_ADV_BATCTL),)
-ifneq ($(DEVELOPER)$(CONFIG_BATMAN_ADV_DEV),)
-define Download/batman
-  FILE:=batman-$(PKG_REV).tar.gz
-  URL:=http://downloads.open-mesh.org/svn/batman/trunk/batman
-  PROTO:=svn
-  VERSION:=$(PKG_REV)
-  SUBDIR:=$(PKG_SOURCE_SUBDIR)/batman
-endef
-$(eval $(call Download,batman))
-endif
-endif
-
-define Build/Prepare
-       tar xzf "$(DL_DIR)/$(PKG_KMOD_FNAME)" -C "$(PKG_BUILD_DIR)"
-ifneq ($(DEVELOPER)$(CONFIG_KMOD_BATMAN_ADV_BATCTL),)
-       tar xzf "$(DL_DIR)/$(PKG_TOOL_FNAME)" -C "$(BUILD_DIR)"
-ifneq ($(DEVELOPER)$(CONFIG_BATMAN_ADV_DEV),)
-       tar xzf "$(DL_DIR)/batman-$(PKG_REV).tar.gz" -C "$(BUILD_DIR)"
-endif
-endif
-       #mv "$(PKG_BUILD_DIR)/batman-adv" "$(PKG_KMOD_BUILD_DIR)"
-       $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR),)
-ifneq ($(CONFIG_BATMAN_ADV_DEV),)
-       $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/dev,)
-else
-       $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/maint,)
-endif
-       cp $(PKG_KMOD_BUILD_DIR)/Makefile.kbuild $(PKG_KMOD_BUILD_DIR)/Makefile
+define KernelPackage/batman-adv/config
+       source "$(SOURCE)/Config.in"
 endef
 
 MAKE_BATMAN_ADV_ARGS += \
@@ -139,15 +49,15 @@ MAKE_BATMAN_ADV_ARGS += \
        ARCH="$(LINUX_KARCH)" \
        PATH="$(TARGET_PATH)" \
        $(if $(CONFIG_KMOD_BATMAN_ADV_DEBUG_LOG),EXTRA_CFLAGS="-DCONFIG_BATMAN_ADV_DEBUG") \
-       SUBDIRS="$(PKG_KMOD_BUILD_DIR)" \
+       SUBDIRS="$(PKG_BUILD_DIR)" \
        LINUX_VERSION="$(LINUX_VERSION)" \
-       REVISION="$(PKG_REV)" modules
+       REVISION="" modules
 
 MAKE_BATCTL_ARGS += \
        CFLAGS="$(TARGET_CFLAGS)" \
        CCFLAGS="$(TARGET_CFLAGS)" \
        OFLAGS="$(TARGET_CFLAGS)" \
-       REVISION="$(PKG_REV)" \
+       REVISION="" \
        CC="$(TARGET_CC)" \
        NODEBUG=1 \
        UNAME="Linux" \
@@ -155,33 +65,42 @@ MAKE_BATCTL_ARGS += \
        STRIP="/bin/true" \
        batctl install
 
-define Build/Configure
+ifneq ($(DEVELOPER)$(CONFIG_KMOD_BATMAN_ADV_BATCTL),)
+define Download/batctl
+  FILE:=batctl-$(PKG_VERSION).tar.gz
+  URL:=$(PKG_SOURCE_URL)
+  MD5SUM:=$(BATCTL_MD5SUM)
 endef
+$(eval $(call Download,batctl))
 
-ifneq ($(DEVELOPER)$(CONFIG_PACKAGE_kmod-batman-adv),)
-        BUILD_KMOD_ADV = $(MAKE) -C "$(LINUX_DIR)" $(MAKE_BATMAN_ADV_ARGS)
-        BUILD_BATCTL = $(MAKE) -C $(PKG_TOOL_BUILD_DIR) $(MAKE_BATCTL_ARGS)
+BUILD_BATCTL = $(MAKE) -C $(PKG_TOOL_BUILD_DIR) $(MAKE_BATCTL_ARGS)
 endif
 
 define Build/Compile
-       $(BUILD_KMOD_ADV)
-ifneq ($(DEVELOPER)$(CONFIG_KMOD_BATMAN_ADV_BATCTL),)
+       tar xzf "$(DL_DIR)/batctl-$(PKG_VERSION).tar.gz" -C "$(BUILD_DIR)/$(PKG_NAME)"
+       cp $(PKG_BUILD_DIR)/Makefile.kbuild $(PKG_BUILD_DIR)/Makefile
+       $(MAKE) -C "$(LINUX_DIR)" $(MAKE_BATMAN_ADV_ARGS)
        $(BUILD_BATCTL)
-endif
 endef
 
 define Build/Clean
-        rm -rf $(PKG_KMOD_BUILD_DIR)
+        rm -rf $(BUILD_DIR)/$(PKG_NAME)/
 endef
 
+ifneq ($(DEVELOPER)$(CONFIG_KMOD_BATMAN_ADV_BATCTL),)
 define KernelPackage/batman-adv/install
        $(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d
        $(INSTALL_BIN) ./files/etc/init.d/batman-adv $(1)/etc/init.d
        $(INSTALL_DATA) ./files/etc/config/batman-adv $(1)/etc/config
-ifneq ($(DEVELOPER)$(CONFIG_KMOD_BATMAN_ADV_BATCTL),)
        $(INSTALL_DIR) $(1)/usr/sbin
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/batctl $(1)/usr/sbin/
-endif
 endef
+else
+define KernelPackage/batman-adv/install
+       $(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/etc/init.d/batman-adv $(1)/etc/init.d
+       $(INSTALL_DATA) ./files/etc/config/batman-adv $(1)/etc/config
+endef
+endif
 
 $(eval $(call KernelPackage,batman-adv))
index 1cb3709..9c09691 100644 (file)
@@ -3,3 +3,5 @@ config 'mesh' 'bat0'
        option 'interfaces' 'wlan0'
        option 'orig_interval'
        option 'log_level'
+       option 'aggregate_ogm'
+       option 'vis_mode'
index 5f346a7..49f948f 100644 (file)
@@ -1,84 +1,68 @@
 #!/bin/sh /etc/rc.common
 START=90
 
-MODULE_DIR="/sys/module/batman_adv"
-
-detect_version() {
-       local version
-       
-       if [ ! -d "$MODULE_DIR" ]; then
-               echo "batman-adv module directory not found - is the module loaded ?" >&2
-               return 1
-       fi
-       
-       version=$(cat $MODULE_DIR/version)
+is_module_loaded() {
 
-       if [ "$version" != "${version#0.3*}" ]; then
-               BAT_VER="0.3"
-       elif [ "$version" != "${version#0.2*}" ]; then
-               BAT_VER="0.2"
-       else
-               echo "Error - unknown version encountered: $version" >&2
-               return 1
+       if [ ! -d "/sys/module/batman_adv" ]; then
+               echo "batman-adv module directory not found - was the kernel module loaded ?" >&2
+               return 0
        fi
-       
-       return 0
+
+       return 1
 }
 
 start_mesh () {
        local meshif="$1"
-       
-       detect_version
-       [ $? -ne 0 ] && return 1
+       local interfaces orig_interval log_level aggregate_ogm vis_mode
+
+       is_module_loaded
+       [ $? -ne 1 ] && return
 
        config_get interfaces "$meshif" interfaces
        config_get orig_interval "$meshif" orig_interval
        config_get log_level "$meshif" log_level
+       config_get aggregate_ogm "$meshif" aggregate_ogm
+       config_get vis_mode "$meshif" vis_mode
 
        if [ "$interfaces" = "" ]; then
                echo Error, you must specify at least a network interface
                return
        fi
-       
-       for interface in $interfaces 
-          do 
-               if [ "$BAT_VER" = "0.2" ]; then
-                       echo $interface > /proc/net/batman-adv/interfaces 
-               else
-                       [ ! -f "/sys/class/net/$interface/batman_adv/mesh_iface" ] && echo "Can't add interface $interface - ignoring" && continue
-                       echo $meshif > /sys/class/net/$interface/batman_adv/mesh_iface
-               fi
-          done         
-       
+
+       for interface in $interfaces
+          do
+               [ ! -f "/sys/class/net/$interface/batman_adv/mesh_iface" ] && echo "Can't add interface $interface - ignoring" && continue
+               echo $meshif > /sys/class/net/$interface/batman_adv/mesh_iface
+          done
+
        if [ $orig_interval ]; then
-               if [ "$BAT_VER" = "0.2" ]; then
-                       echo $orig_interval > /proc/net/batman-adv/orig_interval 
-               else
-                       echo $orig_interval > /sys/class/net/$meshif/batman_adv/originator_interval
-               fi
+               echo $orig_interval > /sys/class/net/$meshif/batman_adv/originator_interval
        fi
-       
+
        if [ $log_level ]; then
                echo $log_level > /sys/module/batman_adv/parameters/debug 2>&-
        fi
+
+       if [ $aggregate_ogm ]; then
+               echo $aggregate_ogm > /sys/class/net/$meshif/batman_adv/aggregate_ogm
+       fi
+
+       if [ $vis_mode ]; then
+               echo $vis_mode > /sys/class/net/$meshif/batman_adv/vis_mode
+       fi
 }
 
 stop_mesh() {
        local meshif="$1"
-       
-       detect_version
-        [ $? -ne 0 ] && return 1
-        
-        if [ "$BAT_VER" = "0.2" ]; then
-               echo "" > /proc/net/batman-adv/interfaces
-               return
-       fi
-       
+
+       is_module_loaded
+       [ $? -ne 1 ] && return
+
        for iface in $(ls /sys/class/net/*)
           do
                 [ ! -f "$iface/batman_adv/mesh_iface" ] && continue
                 [ "$(head -1 $iface/batman_adv/mesh_iface)" != "status: $meshif" ] && continue
-                
+
                 echo "none" > $iface/batman_adv/mesh_iface
           done
 }
@@ -86,8 +70,8 @@ stop_mesh() {
 # can also be used with "batman-adv start bat0"
 start() {
        config_load batman-adv
-       
-       if [ -n "$1" ]; then 
+
+       if [ -n "$1" ]; then
                start_mesh $1
        else
                config_foreach start_mesh mesh
@@ -97,7 +81,7 @@ start() {
 # can also be used with "batman-adv stop bat0"
 stop () {
        config_load batman-adv
-       
+
        if [ -n "$1" ]; then
                stop_mesh $1
        else
@@ -105,4 +89,4 @@ stop () {
        fi
 }
 
-        
+