[packages] add ap51-flash

git-svn-id: svn://svn.openwrt.org/openwrt/packages@19360 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
nico 2010-01-28 16:16:55 +00:00
parent 7726d53791
commit 04e89366c0
4 changed files with 103 additions and 0 deletions

41
utils/ap51-flash/Makefile Normal file
View File

@ -0,0 +1,41 @@
#
# Copyright (C) 2010 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=ap51-flash
PKG_REV:=195
PKG_VERSION:=r$(PKG_REV)
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=svn
PKG_SOURCE_VERSION:=$(PKG_REV)
PKG_SOURCE_SUBDIR:=ap51-flash-$(PKG_VERSION)
PKG_SOURCE_URL:=http://dev.open-mesh.com/downloads/svn/ap51-flash/trunk
PKG_SOURCE:=$(PKG_SOURCE_SUBDIR).tar.gz
include $(INCLUDE_DIR)/package.mk
define Package/ap51-flash
SECTION:=utils
CATEGORY:=Utilities
TITLE:=A tool for flashing (nearly) all ap51/ap61 based routers
URL:=http://dev.open-mesh.com/wiki/ap51-flash-station
DEPENDS:=+libpcap
endef
# pass optimization flags
MAKE_FLAGS += \
OFLAGS="$(TARGET_CFLAGS)" \
define Package/ap51-flash/install
$(INSTALL_DIR) $(1)/etc/config $(1)/etc/init.d $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/ap51-flash $(1)/usr/sbin/
$(INSTALL_BIN) ./files/ap51-flash.init $(1)/etc/init.d/ap51-flash
$(INSTALL_DATA) ./files/ap51-flash.conf $(1)/etc/config/ap51-flash
endef
$(eval $(call BuildPackage,ap51-flash))

View File

@ -0,0 +1,5 @@
#config flash
# option ifname eth0.1
# option rootfs /tmp/images/openwrt-atheros-root.squashfs
# option kernel /tmp/images/openwrt-atheros-vmlinux.lzma
## option ubnt /tmp/images/openwrt-atheros-ubnt5-squashfs.bin

View File

@ -0,0 +1,45 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2007 OpenWrt.org
START=20
NAME=ap51-flash
start_daemon() {
local cfg="$1"
config_get ifname "$cfg" ifname
config_get rootfs "$cfg" rootfs
config_get kernel "$cfg" kernel
config_get ubntimg "$cfg" ubntimg
if [ -n "$ifname" -a -n "$rootfs" -a -n "$kernel" ]; then
[ -n "`ls /var/run/$NAME-$ifname.pid 2> /dev/null`" ] && {
echo "Can't start more than one ap51-flash for interface $ifname!"
return 0
}
start-stop-daemon -S -b -m -p /var/run/$NAME-$ifname.pid -n $NAME -x /usr/sbin/$NAME -- $ifname $rootfs $kernel
elif [ -n "$ifname" -a -n "$ubntimg" ]; then
[ -n "`ls /var/run/$NAME-$ifname-ubnt.pid 2> /dev/null`" ] && {
echo "Can't start more than one ap51-flash (ubnt) for interface $ifname!"
return 0
}
start-stop-daemon -S -b -m -p /var/run/$NAME-$ifname-ubnt.pid -n $NAME -x /usr/sbin/$NAME -- $ifname $ubntimg
fi
}
start() {
config_load ap51-flash
config_foreach start_daemon flash
}
stop() {
# Terminating all ap51-flash processes
echo "WARNING: Going to teminate all ap51-flash processes! (hope you made sure that they're not flashing right now)"
echo "OR you can stop this with Ctrl+c within 10 seconds"
sleep 10
local pidfile
for pidfile in `ls /var/run/${NAME}-*.pid 2> /dev/null`; do
start-stop-daemon -K -s TERM -p "${pidfile}" -n "${NAME}" >/dev/null
rm -f "${pidfile}"
done
}

View File

@ -0,0 +1,12 @@
--- a/Makefile
+++ b/Makefile
@@ -21,7 +21,8 @@ AR = $(CROSS)ar
STRIP = $(CROSS)strip
OBJCOPY = $(CROSS)objcopy
WINDRES = $(CROSS)windres
-CFLAGS = -Wall -ggdb -I. -IWpdPack/Include/ -fno-strict-aliasing -fpack-struct -Os
+OFLAGS = -Os -ggdb
+CFLAGS = -Wall -I. -IWpdPack/Include/ -fno-strict-aliasing -fpack-struct $(OFLAGS)
LIB_OBJS= ap51-flash.o uip.o uip_arp.o timer.o clock-arch.o psock.o packet.o
OBJS = $(LIB_OBJS) main.o
AP51_RC = ap51-flash-res