batman makefiles / configs / init scripts revised

vis package added


git-svn-id: svn://svn.openwrt.org/openwrt/packages@15332 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
marek 2009-04-21 19:16:40 +00:00
parent deeb71e81c
commit cebd3edf9d
8 changed files with 117 additions and 40 deletions

View File

@ -4,6 +4,7 @@
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# $Id: Makefile 5624 2006-11-23 00:29:07Z nbd $
include $(TOPDIR)/rules.mk
@ -11,7 +12,6 @@ PKG_NAME:=batman-adv
PKG_REV:=1220
PKG_VERSION:=r$(PKG_REV)
PKG_RELEASE:=1
PKG_BRANCH:=batman-adv-userspace
PKG_SOURCE_PROTO:=svn
PKG_SOURCE_VERSION:=$(PKG_REV)
@ -70,7 +70,7 @@ define KernelPackage/batman-adv-kernelland/description
Kernel routing module for B.A.T.M.A.N. layer 2
endef
MAKE_ARGS += \
MAKE_BATADV_USERSPACE_ARGS += \
CFLAGS="$(TARGET_CFLAGS)" \
CCFLAGS="$(TARGET_CFLAGS)" \
OFLAGS="$(TARGET_CFLAGS)" \
@ -82,7 +82,7 @@ MAKE_ARGS += \
STRIP="/bin/true" \
batmand-adv install
MAKE_KMOD_ARGS += \
MAKE_BATADV_KERNELLAND_ARGS += \
CROSS_COMPILE="$(TARGET_CROSS)" \
ARCH="$(LINUX_KARCH)" \
PATH="$(TARGET_PATH)" \
@ -90,7 +90,7 @@ MAKE_KMOD_ARGS += \
LINUX_VERSION="$(LINUX_VERSION)" \
REVISION="$(PKG_REV)" modules
MAKE_TOOL_ARGS += \
MAKE_BATTOOL_ARGS += \
CFLAGS="$(TARGET_CFLAGS)" \
CCFLAGS="$(TARGET_CFLAGS)" \
OFLAGS="$(TARGET_CFLAGS)" \
@ -105,16 +105,16 @@ MAKE_TOOL_ARGS += \
define Build/Configure
endef
ifneq ($(CONFIG_PACKAGE_batman-adv-userspace),n)
BUILD_ADV = $(MAKE) -C $(PKG_BUILD_DIR)/batman-adv-userspace $(MAKE_ARGS)
ifneq ($(CONFIG_DEVEL)$(CONFIG_PACKAGE_batman-adv-userspace),)
BUILD_ADV = $(MAKE) -C $(PKG_BUILD_DIR)/batman-adv-userspace $(MAKE_BATADV_USERSPACE_ARGS)
endif
ifneq ($(CONFIG_PACKAGE_kmod-batman-adv-kernelland),n)
BUILD_KMOD_ADV = $(MAKE) -C "$(LINUX_DIR)" $(MAKE_KMOD_ARGS)
ifneq ($(CONFIG_DEVEL)$(CONFIG_PACKAGE_kmod-batman-adv-kernelland),)
BUILD_KMOD_ADV = $(MAKE) -C "$(LINUX_DIR)" $(MAKE_BATADV_KERNELLAND_ARGS)
endif
ifneq ($(CONFIG_PACKAGE_battool),n)
BUILD_BATTOOL = $(MAKE) -C $(PKG_TOOL_BUILD_DIR) $(MAKE_TOOL_ARGS)
ifneq ($(CONFIG_DEVEL)$(CONFIG_PACKAGE_battool),)
BUILD_BATTOOL = $(MAKE) -C $(PKG_TOOL_BUILD_DIR) $(MAKE_BATTOOL_ARGS)
endif
define Build/Compile

View File

@ -26,12 +26,8 @@ start () {
fi
}
restart () {
$0 stop
sleep 3
$0 start
}
stop () {
echo "" > /proc/net/batman-adv/interfaces
echo "" > /proc/net/batman-adv/interfaces
}

View File

@ -24,12 +24,8 @@ start () {
batmand-adv $batman_args >/dev/null 2>&1
}
restart () {
$0 stop
sleep 3
$0 start
}
stop () {
killall batmand-adv
killall batmand-adv
}

View File

@ -4,25 +4,25 @@
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# $Id: Makefile 14803 2009-03-09 05:50:38Z marek $
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=batmand
PKG_REV:=1235
PKG_REV:=1249
PKG_VERSION:=r$(PKG_REV)
PKG_RELEASE:=2
#PKG_BRANCH:=batman-0.3
PKG_RELEASE:=1
PKG_EXTRA_CFLAGS=-DDEBUG_MALLOC -DMEMORY_USAGE -DPROFILE_DATA -DREVISION_VERSION=\"\ rv$(PKG_REV)\"
PKG_SOURCE_PROTO:=svn
PKG_SOURCE_VERSION:=$(PKG_REV)
PKG_SOURCE_SUBDIR:=$(if $(PKG_BRANCH),$(PKG_BRANCH),$(PKG_NAME))-$(PKG_VERSION)
PKG_SOURCE_URL:=http://downloads.open-mesh.net/svn/batman/$(if $(PKG_BRANCH),tags/$(PKG_BRANCH),trunk/batman/)
PKG_SOURCE_URL:=http://downloads.open-mesh.net/svn/batman/trunk/
PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_SOURCE_SUBDIR)
PKG_KMOD_BUILD_DIR:=$(PKG_BUILD_DIR)/linux/modules
PKG_KMOD_BUILD_DIR:=$(PKG_BUILD_DIR)/batman/linux/modules
include $(INCLUDE_DIR)/package.mk
@ -43,6 +43,18 @@ define Package/batmand/description
B.A.T.M.A.N. layer 3 routing daemon
endef
define Package/vis
$(call Package/batmand/Default)
SECTION:=net
CATEGORY:=Network
DEPENDS:=+libpthread
TITLE:=visualization server for B.A.T.M.A.N. layer 3
endef
define Package/vis/description
visualization server for B.A.T.M.A.N. layer 3
endef
define KernelPackage/batgat
$(call Package/batmand/Default)
SUBMENU:=Network Support
@ -54,10 +66,10 @@ endef
define KernelPackage/batgat/description
Kernel gateway module for B.A.T.M.A.N.
Kernel gateway module for B.A.T.M.A.N. for better tunnel performance
endef
MAKE_ARGS += \
MAKE_BATMAND_ARGS += \
EXTRA_CFLAGS='$(TARGET_CFLAGS) $(PKG_EXTRA_CFLAGS)' \
CCFLAGS="$(TARGET_CFLAGS)" \
OFLAGS="$(TARGET_CFLAGS)" \
@ -68,20 +80,48 @@ MAKE_ARGS += \
INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
STRIP="/bin/true" \
batmand install
MAKE_VIS_ARGS += \
EXTRA_CFLAGS='$(TARGET_CFLAGS) $(PKG_EXTRA_CFLAGS)' \
CCFLAGS="$(TARGET_CFLAGS)" \
OFLAGS="$(TARGET_CFLAGS)" \
REVISION="$(PKG_REV)" \
CC="$(TARGET_CC)" \
NODEBUG=1 \
UNAME="Linux" \
INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
STRIP="/bin/true" \
vis install
MAKE_BATGAT_ARGS += \
CROSS_COMPILE="$(TARGET_CROSS)" \
ARCH="$(LINUX_KARCH)" \
PATH="$(TARGET_PATH)" \
SUBDIRS="$(PKG_KMOD_BUILD_DIR)" \
LINUX_VERSION="$(LINUX_VERSION)" \
REVISION="$(PKG_REV)" modules
define Build/Configure
endef
ifneq ($(DEVEL_CONFIG)$(CONFIG_PACKAGE_batmand),)
BUILD_BATMAND := $(MAKE) -C $(PKG_BUILD_DIR)/batman $(MAKE_BATMAND_ARGS)
endif
ifneq ($(CONFIG_DEVEL)$(CONFIG_PACKAGE_vis),)
BUILD_VIS := $(MAKE) -C $(PKG_BUILD_DIR)/vis $(MAKE_VIS_ARGS)
endif
ifneq ($(CONFIG_DEVEL)$(CONFIG_PACKAGE_kmod-batgat),)
BUILD_BATGAT := $(MAKE) -C "$(LINUX_DIR)" $(MAKE_BATGAT_ARGS)
endif
define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) $(MAKE_ARGS)
$(BUILD_BATMAND)
$(BUILD_VIS)
cp $(PKG_KMOD_BUILD_DIR)/Makefile.kbuild $(PKG_KMOD_BUILD_DIR)/Makefile
$(MAKE) -C "$(LINUX_DIR)" \
CROSS_COMPILE="$(TARGET_CROSS)" \
ARCH="$(LINUX_KARCH)" \
PATH="$(TARGET_PATH)" \
SUBDIRS="$(PKG_KMOD_BUILD_DIR)" \
LINUX_VERSION="$(LINUX_VERSION)" \
REVISION="$(PKG_REV)" modules
$(BUILD_BATGAT)
endef
define Package/batmand/install
@ -91,5 +131,13 @@ define Package/batmand/install
$(INSTALL_DATA) ./files/etc/config/batmand $(1)/etc/config
endef
define Package/vis/install
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/config $(1)/etc/init.d
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/vis $(1)/usr/sbin/
$(INSTALL_BIN) ./files/etc/init.d/vis $(1)/etc/init.d
$(INSTALL_DATA) ./files/etc/config/vis $(1)/etc/config
endef
$(eval $(call BuildPackage,batmand))
$(eval $(call BuildPackage,vis))
$(eval $(call KernelPackage,batgat))

View File

@ -7,4 +7,6 @@ config batmand general
option routing_class
option visualisation_srv
option policy_routing_script
option disable_client_nat
option disable_aggregation

View File

@ -0,0 +1,3 @@
config vis general
option interface ath0

View File

@ -15,6 +15,8 @@ start () {
routing_class=$(uci get batmand.general.routing_class)
visualisation_srv=$(uci get batmand.general.visualisation_srv)
policy_routing_script=$(uci get batmand.general.policy_routing_script)
disable_client_nat=$(uci get batmand.general.disable_client_nat)
disable_aggregation=$(uci get batmand.general.disable_aggregation)
batman_args=""
if [ $announce ]; then
@ -44,11 +46,21 @@ start () {
if [ $policy_routing_script ]; then
batman_args=${batman_args}'--policy-routing-script '$policy_routing_script' '
fi
if [ $disable_client_nat ]; then
batman_args=${batman_args}'--disable-client-nat '
fi
if [ $disable_aggregation ]; then
batman_args=${batman_args}'--disable-aggregation '
fi
batman_args=${batman_args}$interface
batmand $batman_args >/dev/null 2>&1
}
stop () {
killall batmand
killall batmand
}

View File

@ -0,0 +1,20 @@
#!/bin/sh /etc/rc.common
START=90
. /lib/config/uci.sh
uci_load vis
start () {
interface=$(uci get vis.general.interface)
if [ "$interface" = "" ]; then
echo $1 Error, you must specify at least a network interface
exit
fi
vis_args=$interface
vis $vis_args >/dev/null 2>&1
}
stop () {
killall vis
}