forked from freifunk-franken/firmware
Compare commits
43 Commits
Author | SHA1 | Date |
---|---|---|
Clemens John | 08f4447ef3 | |
Clemens John | 36835bab87 | |
Clemens John | 68e923d678 | |
Clemens John | 000e5a0db9 | |
Tim Niemeyer | 1dc9d09db6 | |
Clemens John | 5e3770f4c7 | |
Clemens John | 32eb5afce8 | |
Tim Niemeyer | f9e5a17fa0 | |
Tim Niemeyer | daa4beb3da | |
Tim Niemeyer | afc562976d | |
Marc René Schädler | ba79a3518f | |
Marc René Schädler | 4a4b0288c5 | |
Marc René Schädler | 6d11476ed8 | |
Marc René Schädler | 323fb5b8a2 | |
Tim Niemeyer | 234910ff82 | |
Clemens John | aefc306b8a | |
Clemens John | 85f30e9dac | |
Clemens John | fee8871d5c | |
Clemens John | 36654608b5 | |
Tim Niemeyer | 7768c08dc9 | |
Tim Niemeyer | 3eb0c322b5 | |
Tim Niemeyer | 404fa9ec3f | |
Tim Niemeyer | edd81d8537 | |
Tim Niemeyer | 81504bc3d0 | |
Tim Niemeyer | 049e130f8d | |
Clemens John | 3554fa4d38 | |
Clemens John | 64fc3d85ee | |
Tim Niemeyer | c09b57cd9b | |
Tim Niemeyer | e7bebc212d | |
Clemens John | d5f7ada84b | |
Tim Niemeyer | 8a1cf2842a | |
Bjoern Franke | eaf5a01dd0 | |
Tim Niemeyer | ba0edcc318 | |
Tim Niemeyer | 75dde4d677 | |
Tim Niemeyer | 63483b24b7 | |
Tim Niemeyer | 64aed914b3 | |
Tim Niemeyer | 7fbcb948c8 | |
Clemens John | df5b88178b | |
Clemens John | 25748f4a16 | |
Tim Niemeyer | 452898aaee | |
Tim Niemeyer | 2503f2bc26 | |
Tim Niemeyer | 658b02f906 | |
Tim Niemeyer | 76d7c3febb |
|
@ -46,6 +46,8 @@ board_flash() {
|
|||
elif [ -f /usr/sbin/invoke-rc.d ];then
|
||||
invoke-rc.d tftpd-hpa start || invoke-rc.d tftpd-hpa start || invoke-rc.d tftpd-hpa start || echo "FAILED TO START TFTD"
|
||||
invoke-rc.d network-manager stop
|
||||
elif [ -f /usr/sbin/systemctl ];then
|
||||
systemctl start tftpd.socket tftpd.service
|
||||
fi
|
||||
|
||||
ifconfig $1 up
|
||||
|
@ -67,6 +69,8 @@ board_flash() {
|
|||
elif [ -f /usr/sbin/invoke-rc.d ];then
|
||||
invoke-rc.d tftpd-hpa stop
|
||||
invoke-rc.d network-manager start
|
||||
elif [ -f /usr/sbin/systemctl ];then
|
||||
systemctl stop tftpd.socket tftpd.service
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
machine=wr841n8
|
||||
target=$builddir/$machine
|
||||
|
||||
board_prepare() {
|
||||
# Fix multicast on eth0 (see OpenWRT r35564)
|
||||
cat build_patches/wr841n8-enable_multicast_eth1.patch | patch -p1 -d $target
|
||||
}
|
||||
|
||||
board_prebuild() {
|
||||
cp ./bsp/$machine/.config $target/.config
|
||||
cp -r ./bsp/$machine/root_file_system/* $target/files/
|
||||
}
|
||||
|
||||
board_postbuild() {
|
||||
cp $target/bin/ar71xx/openwrt-ar71xx-generic-tl-wr841n-v8-squashfs-*.bin ./bin/
|
||||
}
|
||||
|
||||
board_flash() {
|
||||
echo "nothing implemented"
|
||||
}
|
||||
|
||||
board_clean() {
|
||||
/bin/rm -rf $target bin/*$machine*
|
||||
}
|
||||
|
|
@ -7,9 +7,10 @@ config 'script'
|
|||
config 'api'
|
||||
option 'ipv4_address' '1'
|
||||
option 'ipv6_interface' 'br-mesh'
|
||||
option 'ipv6_address' 'fe80::201:2ff:fe03:405'
|
||||
option 'ipv6_address' 'fe80::ff:feee:1'
|
||||
option 'timeout' '5'
|
||||
option 'retry' '5'
|
||||
option 'api_key' '1'
|
||||
|
||||
config 'crawl'
|
||||
option 'method' 'hash'
|
||||
|
@ -20,4 +21,4 @@ config 'crawl'
|
|||
option 'update_hash' '1'
|
||||
|
||||
config 'netmon'
|
||||
option 'autoadd_ipv6_address' '1'
|
||||
option 'autoadd_ipv6_address' '1'
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
config 'wifi-device' 'wifi0'
|
||||
option 'type' 'atheros'
|
||||
option 'disabled' '0'
|
||||
option 'channel' '6'
|
||||
option 'channel' '1'
|
||||
option 'bgscan' '0'
|
||||
option 'diversity' '1'
|
||||
option 'hwmode' '11g'
|
||||
|
@ -10,7 +10,7 @@ config 'wifi-iface'
|
|||
option 'device' 'wifi0'
|
||||
option 'network' 'wlanmesh'
|
||||
option 'mode' 'adhoc'
|
||||
option 'ssid' 'batman.oldenburg.freifunk.net'
|
||||
option 'ssid' 'batman.franken.freifunk.net'
|
||||
option 'bssid' '02:CA:FF:EE:BA:BE'
|
||||
option 'encryption' 'none'
|
||||
option 'hidden' '1'
|
||||
|
@ -19,5 +19,5 @@ config 'wifi-iface'
|
|||
option 'device' 'wifi0'
|
||||
option 'network' 'mesh'
|
||||
option 'mode' 'ap'
|
||||
option 'ssid' 'oldenburg.freifunk.net'
|
||||
option 'ssid' 'franken.freifunk.net'
|
||||
option 'encryption' 'none'
|
||||
|
|
|
@ -27,34 +27,53 @@ fi
|
|||
API_RETRY=$(($API_RETRY - 1))
|
||||
|
||||
if [[ $API_IPV4_ADRESS != "1" ]]; then
|
||||
netmon_api=$API_IPV4_ADRESS
|
||||
netmon_api=$API_IPV4_ADRESS
|
||||
else
|
||||
netmon_api="[$API_IPV6_ADRESS"%"$API_IPV6_INTERFACE]"
|
||||
netmon_api="[$API_IPV6_ADRESS"%"$API_IPV6_INTERFACE]"
|
||||
fi
|
||||
|
||||
if [ $SCRIPT_ERROR_LEVEL -gt "1" ]; then
|
||||
err() {
|
||||
echo "$(date) [configurator]: $1" >> $SCRIPT_LOGFILE
|
||||
}
|
||||
err() {
|
||||
echo "$(date) [configurator]: $1" >> $SCRIPT_LOGFILE
|
||||
}
|
||||
else
|
||||
err() {
|
||||
:
|
||||
}
|
||||
err() {
|
||||
:
|
||||
}
|
||||
fi
|
||||
|
||||
sync_hostname() {
|
||||
err "Syncing hostname"
|
||||
api_return=$(wget -T $API_TIMEOUT -q -O - "http://$netmon_api/api_csv_configurator.php?section=get_hostname&authentificationmethod=$CRAWL_METHOD&nickname=$CRAWL_NICKNAME&password=$CRAWL_PASSWORD&router_auto_update_hash=$CRAWL_UPDATE_HASH&router_id=$CRAWL_ROUTER_ID")
|
||||
netmon_hostname=${api_return%,*}
|
||||
netmon_hostname=${netmon_hostname#*,}
|
||||
if [ "$netmon_hostname" != "" ]; then
|
||||
if [ "$netmon_hostname" != "`cat /proc/sys/kernel/hostname`" ]; then
|
||||
err "Setting new hostname: $netmon_hostname"
|
||||
uci set system.@system[0].hostname=$netmon_hostname
|
||||
uci commit
|
||||
echo $netmon_hostname > /proc/sys/kernel/hostname
|
||||
api_return=$(wget -T $API_TIMEOUT -q -O - "http://$netmon_api/api_csv_configurator.php?section=get_hostname&authentificationmethod=$CRAWL_METHOD&nickname=$CRAWL_NICKNAME&password=$CRAWL_PASSWORD&router_auto_update_hash=$CRAWL_UPDATE_HASH&router_id=$CRAWL_ROUTER_ID")
|
||||
ret=${api_return%%,*}
|
||||
if [ "$ret" != "success" ]; then
|
||||
err "Ther was an error fetching the hostname"
|
||||
exit 0
|
||||
elif [ "$ret" = "success" ]; then
|
||||
netmon_hostname=${api_return%,*}
|
||||
netmon_hostname=${netmon_hostname#*,}
|
||||
|
||||
#check for valid hostname as specified in rfc 1123
|
||||
#see http://stackoverflow.com/a/3824105
|
||||
regex='^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])'
|
||||
regex=$regex'(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*$'
|
||||
if [ ${#netmon_hostname} -le 255 ]; then
|
||||
if echo -n $netmon_hostname | egrep -q "$regex"; then
|
||||
if [ "$netmon_hostname" != "`cat /proc/sys/kernel/hostname`" ]; then
|
||||
err "Setting new hostname: $netmon_hostname"
|
||||
uci set system.@system[0].hostname=$netmon_hostname
|
||||
uci commit
|
||||
echo $netmon_hostname > /proc/sys/kernel/hostname
|
||||
else
|
||||
err "Hostname is up to date"
|
||||
fi
|
||||
else
|
||||
err "Hostname ist malformed"
|
||||
exit 0
|
||||
fi
|
||||
else
|
||||
err "Hostname is up to date"
|
||||
err "Hostname exceeds the maximum length of 255 characters"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
@ -63,37 +82,38 @@ assign_router() {
|
|||
hostname=`cat /proc/sys/kernel/hostname`
|
||||
|
||||
#Choose right login String
|
||||
#Here maybe a ; to much at the end..??
|
||||
login_strings=$(awk '{ mac=toupper($1); gsub(":", "", mac); printf mac ";" }' /sys/class/net/br-mesh/address /sys/class/net/eth0/address /sys/class/net/ath0/address 2> /dev/null)
|
||||
ergebnis=$(wget -T $API_TIMEOUT -q -O - "http://$netmon_api/api_csv_configurator.php?section=test_login_strings&login_strings=$login_strings")
|
||||
router_auto_assign_login_string=${ergebnis#*;}
|
||||
ergebnis=${ergebnis%;*}
|
||||
#Here maybe a ; to much at the end..??
|
||||
login_strings=$(awk '{ mac=toupper($1); gsub(":", "", mac); printf mac ";" }' /sys/class/net/br-mesh/address /sys/class/net/eth0/address /sys/class/net/ath0/address 2> /dev/null)
|
||||
ergebnis=$(wget -T $API_TIMEOUT -q -O - "http://$netmon_api/api_csv_configurator.php?section=test_login_strings&login_strings=$login_strings")
|
||||
router_auto_assign_login_string=${ergebnis#*;}
|
||||
ergebnis=${ergebnis%;*}
|
||||
if [ "$ergebnis" = "error" ]; then
|
||||
router_auto_assign_login_string=${login_strings%%;*}
|
||||
err "A router with this login string does not exist: $login_strings"
|
||||
err "Using $router_auto_assign_login_string as login string"
|
||||
err "A router with this login string does not exist: $login_strings"
|
||||
err "Using $router_auto_assign_login_string as login string"
|
||||
fi
|
||||
|
||||
#Try to assign Router with choosen login string
|
||||
ergebnis=$(wget -T $API_TIMEOUT -q -O - "http://$netmon_api/api_csv_configurator.php?section=router_auto_assign&router_auto_assign_login_string=$router_auto_assign_login_string&hostname=$hostname")
|
||||
ret=${ergebnis%%;*}
|
||||
errstr=${ergebnis#*;}
|
||||
errstr=${errstr%%;*}
|
||||
ergebnis=$(wget -T $API_TIMEOUT -q -O - "http://$netmon_api/api_csv_configurator.php?section=router_auto_assign&router_auto_assign_login_string=$router_auto_assign_login_string&hostname=$hostname")
|
||||
ret=${ergebnis%%;*}
|
||||
errstr=${ergebnis#*;}
|
||||
errstr=${errstr%%;*}
|
||||
if [ "$ret" != "success" ]; then
|
||||
err "The router has not been assigned to a router in Netmon"
|
||||
err "Failure on router_auto_assign: $errstr. Exiting"
|
||||
exit 0
|
||||
err "The router has not been assigned to a router in Netmon"
|
||||
err "Failure on router_auto_assign: $errstr. Exiting"
|
||||
exit 0
|
||||
elif [ "$ret" = "success" ]; then
|
||||
update_hash=${ergebnis%;*}
|
||||
update_hash=${update_hash##*;}
|
||||
update_hash=${ergebnis%;*;*}
|
||||
update_hash=${update_hash##*;}
|
||||
api_key=${ergebnis##*;}
|
||||
#write new config
|
||||
uci set configurator.@crawl[0].router_id=$errstr
|
||||
uci set configurator.@crawl[0].update_hash=$update_hash
|
||||
|
||||
uci set configurator.@api[0].api_key=$api_key
|
||||
#set also new router id for nodewatcher
|
||||
#uci set nodewatcher.@crawl[0].router_id=$errstr
|
||||
|
||||
err "The router $errstr has been assigned with a router in Netmon"
|
||||
err "The router $errstr has been assigned with a router in Netmon"
|
||||
uci commit
|
||||
|
||||
CRAWL_METHOD=`uci get configurator.@crawl[0].method`
|
||||
|
@ -106,16 +126,18 @@ assign_router() {
|
|||
|
||||
autoadd_ipv6_address() {
|
||||
err "Doing IPv6 autoadd"
|
||||
ipv6_link_local_addr=$(ip addr show dev br-mesh scope link | awk '/inet6/{print $2}')
|
||||
ergebnis=$(wget -T $API_TIMEOUT -q -O - "http://$netmon_api/api_csv_configurator.php?section=autoadd_ipv6_address&authentificationmethod=$CRAWL_METHOD&nickname=$CRAWL_NICKNAME&password=$CRAWL_PASSWORD&router_auto_update_hash=$CRAWL_UPDATE_HASH&router_id=$CRAWL_ROUTER_ID&ip=$ipv6_link_local_addr")
|
||||
ret=${ergebnis%%,*}
|
||||
ipv6_link_local_addr=$(ip addr show dev br-mesh scope link | awk '/inet6/{print $2}')
|
||||
ipv6_link_local_netmask=${ipv6_link_local_addr##*/}
|
||||
ipv6_link_local_addr=${ipv6_link_local_addr%%/*}
|
||||
ergebnis=$(wget -T $API_TIMEOUT -q -O - "http://$netmon_api/api_csv_configurator.php?section=autoadd_ipv6_address&authentificationmethod=$CRAWL_METHOD&nickname=$CRAWL_NICKNAME&password=$CRAWL_PASSWORD&router_auto_update_hash=$CRAWL_UPDATE_HASH&router_id=$CRAWL_ROUTER_ID&networkinterface_name=br-mesh&ip=$ipv6_link_local_addr&netmask=$ipv6_link_local_netmask&ipv=6")
|
||||
ret=${ergebnis%%,*}
|
||||
if [ "$ret" = "success" ]; then
|
||||
uci set configurator.@netmon[0].autoadd_ipv6_address='0'
|
||||
uci commit
|
||||
err "The IPv6 address of the router $CRAWL_ROUTER_ID has been added to the router in Netmon"
|
||||
err "IPv6 Autoadd has been disabled cause it is no longer necesarry"
|
||||
else
|
||||
routerid=${ergebnis##*,}
|
||||
routerid=${ergebnis##*,}
|
||||
if [ "$routerid" == "$CRAWL_ROUTER_ID" ]; then
|
||||
err "The IPv6 address already exists in Netmon on this router. Maybe because of a previos assignment"
|
||||
uci set configurator.@netmon[0].autoadd_ipv6_address='0'
|
||||
|
@ -128,23 +150,23 @@ autoadd_ipv6_address() {
|
|||
}
|
||||
|
||||
if [ $CRAWL_METHOD == "login" ]; then
|
||||
err "Authentification method is: username and passwort"
|
||||
err "Authentification method is: username and passwort"
|
||||
elif [ $CRAWL_METHOD == "hash" ]; then
|
||||
err "Authentification method: autoassign and hash"
|
||||
err "Checking if the router is already assigned to a router in Netmon"
|
||||
err "Authentification method: autoassign and hash"
|
||||
err "Checking if the router is already assigned to a router in Netmon"
|
||||
if [ $CRAWL_UPDATE_HASH == "1" ]; then
|
||||
err "The router is not assigned to a router in Netmon"
|
||||
err "Trying to assign the router"
|
||||
err "The router is not assigned to a router in Netmon"
|
||||
err "Trying to assign the router"
|
||||
assign_router
|
||||
if [[ $AUTOADD_IPV6_ADDRESS = "1" ]]; then
|
||||
autoadd_ipv6_address
|
||||
fi
|
||||
else
|
||||
err "The router is already assigned to a router in Netmon"
|
||||
err "The router is already assigned to a router in Netmon"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $SCRIPT_SYNC_HOSTNAME = "1" ]]; then
|
||||
sync_hostname
|
||||
if [[ $AUTOADD_IPV6_ADDRESS = "1" ]]; then
|
||||
autoadd_ipv6_address
|
||||
fi
|
||||
|
||||
if [[ $SCRIPT_SYNC_HOSTNAME = "1" ]]; then
|
||||
sync_hostname
|
||||
fi
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
#!/bin/ash
|
||||
|
||||
# functions
|
||||
#FIXME: define here your favorite methods to get the values
|
||||
get_wlan_client_interface() {
|
||||
echo "wlan0"
|
||||
}
|
||||
|
||||
get_wlan_mesh_interface() {
|
||||
echo "wlan0-1"
|
||||
}
|
||||
|
||||
get_eth_client_interface() {
|
||||
echo ""
|
||||
}
|
||||
|
||||
get_eth_mesh_interface() {
|
||||
echo ""
|
||||
}
|
||||
|
||||
get_bridge_interface() {
|
||||
echo "br-mesh"
|
||||
}
|
||||
|
||||
get_batman_interface() {
|
||||
echo "bat0"
|
||||
}
|
||||
|
||||
get_vpn_interface() {
|
||||
test -f /etc/fastdstart.sh || exit;
|
||||
local $(grep -o project=.* /etc/fastdstart.sh)
|
||||
echo ${project}VPN | tr -d '"'
|
||||
}
|
||||
|
||||
get_debug_level() {
|
||||
echo "0"
|
||||
}
|
||||
|
||||
print_definitions() {
|
||||
echo "# interfaces"
|
||||
echo "WLAN_CLIENT_INTERFACE=$(get_wlan_client_interface)"
|
||||
echo "WLAN_MESH_INTERFACE=$(get_wlan_mesh_interface)"
|
||||
echo "ETH_CLIENT_INTERFACE=$(get_eth_client_interface)"
|
||||
echo "ETH_MESH_INTERFACE=$(get_eth_mesh_interface)"
|
||||
echo "BRIDGE_INTERFACE=$(get_bridge_interface)"
|
||||
echo "BATMAN_INTERFACE=$(get_batman_interface)"
|
||||
echo "VPN_INTERFACE=$(get_vpn_interface)"
|
||||
echo ""
|
||||
echo "# variables"
|
||||
echo "DEBUG=$(get_debug_level)"
|
||||
}
|
||||
|
||||
# program
|
||||
print_definitions
|
|
@ -3,7 +3,7 @@
|
|||
SERVER="no"
|
||||
#SERVERNAME="--servername--"
|
||||
|
||||
project="ffol"
|
||||
project="fff"
|
||||
|
||||
test_internet_host1="mastersword.de"
|
||||
test_internet_host2="109.163.229.254"
|
||||
|
@ -35,44 +35,39 @@ if ping -w5 -c3 "$test_internet_host1" &>/dev/null ||
|
|||
|
||||
mkdir /tmp/fastd_${project}_peers
|
||||
ln -s /tmp/fastd_${project}_peers /etc/fastd/$project/peers
|
||||
echo '#!/bin/sh' > /etc/fastd/$project/up.sh
|
||||
echo 'ip link set up dev $1' >> /etc/fastd/$project/up.sh
|
||||
|
||||
if [ "$SERVER" == "no" ]; then
|
||||
echo 'batctl if add $1' >> /etc/fastd/$project/up.sh
|
||||
|
||||
secret=$(fastd --generate-key 2>&1 | grep -i secret | awk '{ print $2 }')
|
||||
echo "" >> /etc/config/fastd
|
||||
echo "config fastd $project" >> /etc/config/fastd
|
||||
echo " option enabled 1" >> /etc/config/fastd
|
||||
echo " list config_peer_dir '/etc/fastd/$project/peers'" >> /etc/config/fastd
|
||||
echo " option syslog_level 'verbose'" >> /etc/config/fastd
|
||||
echo " option method null" >> /etc/config/fastd
|
||||
echo " option mode 'tap'" >> /etc/config/fastd
|
||||
echo " option bind '0.0.0.0:10000'" >> /etc/config/fastd
|
||||
echo " option interface '${project}VPN'" >> /etc/config/fastd
|
||||
echo " option mtu 1426" >> /etc/config/fastd
|
||||
echo " option secret '$secret'" >> /etc/config/fastd
|
||||
echo " option up '/etc/fastd/${project}/up.sh \$1'" >> /etc/config/fastd
|
||||
fi
|
||||
echo "#!/bin/sh" > /etc/fastd/$project/up.sh
|
||||
echo "ip link set up dev ${project}VPN" >> /etc/fastd/$project/up.sh
|
||||
echo "batctl if add ${project}VPN" >> /etc/fastd/$project/up.sh
|
||||
chmod +x /etc/fastd/$project/up.sh
|
||||
|
||||
secret=$(fastd --generate-key 2>&1 | grep -i secret | awk '{ print $2 }')
|
||||
echo "include peers from \"/etc/fastd/$project/peers\";" >> /etc/fastd/${project}/${project}.conf
|
||||
echo "log level warn;" >> /etc/fastd/${project}/${project}.conf
|
||||
echo "method \"null\";" >> /etc/fastd/${project}/${project}.conf
|
||||
# http://lists.nord-west.net/pipermail/freifunk-ol-dev/2013-July/000322.html
|
||||
# echo "bind 0.0.0.0:10000;" >> /etc/fastd/${project}/${project}.conf
|
||||
echo "interface \"${project}VPN\";" >> /etc/fastd/${project}/${project}.conf
|
||||
echo "mtu 1426;" >> /etc/fastd/${project}/${project}.conf
|
||||
echo "secret \"$secret\";" >> /etc/fastd/${project}/${project}.conf
|
||||
echo "on up \"/etc/fastd/${project}/up.sh\";" >> /etc/fastd/${project}/${project}.conf
|
||||
fi
|
||||
|
||||
if [ ! -d /tmp/fastd_${project}_peers ]; then
|
||||
mkdir /tmp/fastd_${project}_peers
|
||||
fi
|
||||
|
||||
pubkey=$(/etc/init.d/fastd show_key $project)
|
||||
pubkey=$(fastd -c /etc/fastd/$project/$project.conf --show-key --machine-readable)
|
||||
#port=666
|
||||
|
||||
|
||||
# fire up
|
||||
if [ "$(/sbin/ifconfig -a | grep -i ethernet | grep $project)" == "" ]; then
|
||||
/etc/init.d/fastd start $project
|
||||
/bin/rm /var/run/fastd.$project.pid
|
||||
fastd -c /etc/fastd/$project/$project.conf -d --pid-file /var/run/fastd.$project.pid --syslog-level verbose
|
||||
fi
|
||||
|
||||
# register
|
||||
wget -T15 "http://mastersword.de/~reddog/fastd/?name=$hostname&port=$port&key=$pubkey" -O /tmp/fastd_${project}_output
|
||||
wget -T15 "http://mastersword.de/~reddog/fff/?name=$hostname&port=$port&key=$pubkey" -O /tmp/fastd_${project}_output
|
||||
|
||||
filenames=$(awk '/^####/ { gsub(/^####/, "", $0); gsub(/.conf/, "", $0); print $0; }' /tmp/fastd_${project}_output)
|
||||
for file in $filenames; do
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
# Put your custom commands here that should be executed once
|
||||
# the system init finished. By default this file does nothing.
|
||||
|
||||
# collect environment info and write to dot-script
|
||||
/etc/environment.sh > /tmp/environment
|
||||
|
||||
# todo: all devices or only dir300 ?
|
||||
if uci get network.mesh.macaddr
|
||||
then
|
||||
|
@ -29,7 +32,7 @@ batctl if add br-ethmesh1
|
|||
batctl if add br-ethmesh2
|
||||
|
||||
# Starting NTP-Client Daemon
|
||||
ntpd -p "fe80::201:2ff:fe03:405%br-mesh"
|
||||
ntpd -p "fe80::ff:feee:1%br-mesh"
|
||||
|
||||
. /etc/firewall.user
|
||||
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
/etc/shadow
|
|
@ -0,0 +1,164 @@
|
|||
#!/bin/ash
|
||||
|
||||
# environment
|
||||
. "/tmp/environment" || exit 1
|
||||
|
||||
# constants
|
||||
MINUTE=60
|
||||
HOUR=3600
|
||||
DAY=86400
|
||||
TIMEOUT_SHORT=$((4*$MINUTE))
|
||||
TIMEOUT_MEDIUM=$((29*$MINUTE))
|
||||
TIMEOUT_LONG=$DAY
|
||||
STATEFILE="/tmp/wlanwatchdogstate"
|
||||
DEBUGFILE="/root/wlanwatchdog_debug.log.gz"
|
||||
|
||||
# variables
|
||||
STATE=
|
||||
SINCE=
|
||||
|
||||
# functions
|
||||
debug_output() {
|
||||
echo "==== DEBUG OUTPUT ===="
|
||||
echo "date: $(date)"
|
||||
echo "=== INTERFACES ==="
|
||||
ifconfig 2>&1
|
||||
echo "=== BATMAN ==="
|
||||
echo "== ORIGINATORS =="
|
||||
batctl o 2>&1
|
||||
echo "== STATISTICS =="
|
||||
batctl s 2>&1
|
||||
echo "== GATEWAYS =="
|
||||
batctl gwl 2>&1
|
||||
echo "=== BRIDGE ==="
|
||||
echo "== $BRIDGE_INTERFACE =="
|
||||
brctl showmacs $BRIDGE_INTERFACE 2>&1
|
||||
echo "=== CONNECTIVITY TESTS ==="
|
||||
echo "== PING GATEWAY OVER MESH =="
|
||||
ping -6 -c3 $(uci get configurator.@api[0].ipv6_address)%$(uci get configurator.@api[0].ipv6_interface) 2>&1
|
||||
echo "== PING HOST OVER INTERNET =="
|
||||
ping -4 -c3 freifunk-ol.de 2>&1
|
||||
echo "=== WLAN ==="
|
||||
echo "== $WLAN_CLIENT_INTERFACE =="
|
||||
iw dev $WLAN_CLIENT_INTERFACE station dump 2>&1
|
||||
echo "== $WLAN_MESH_INTERFACE =="
|
||||
iw dev $WLAN_MESH_INTERFACE station dump 2>&1
|
||||
echo "== SCAN =="
|
||||
iwlist scanning 2>&1
|
||||
echo "=== WATCHDOG LOG ==="
|
||||
cat "/var/log/wlanwatchdog.log"
|
||||
}
|
||||
|
||||
get_time() {
|
||||
date +%s
|
||||
}
|
||||
|
||||
count_originators() {
|
||||
local COUNT=0
|
||||
if [ -n "$BATMAN_INTERFACE" ]; then
|
||||
COUNT=$(tail -n +3 /sys/kernel/debug/batman_adv/$BATMAN_INTERFACE/originators 2> /dev/null | grep -v "nodes in range" | wc -l)
|
||||
fi
|
||||
echo $COUNT
|
||||
}
|
||||
|
||||
count_clients() {
|
||||
local COUNT=0
|
||||
local NUMBER=
|
||||
if [ -n "$BRIDGE_INTERFACE" ] && [ -n "$WLAN_CLIENT_INTERFACE" ]; then
|
||||
NUMBER=$(brctl showstp $BRIDGE_INTERFACE 2> /dev/null | grep $WLAN_CLIENT_INTERFACE | cut -d" " -f2 | tr -d "()")
|
||||
fi
|
||||
if [ -n "$BRIDGE_INTERFACE" ] && [ -n "$NUMBER" ]; then
|
||||
COUNT=$(brctl showmacs $BRIDGE_INTERFACE 2> /dev/null | grep -v yes | cut -f1 | grep "$NUMBER" | wc -l)
|
||||
fi
|
||||
echo $COUNT
|
||||
}
|
||||
|
||||
count_neighbours() {
|
||||
local COUNT=0
|
||||
#FIXME: this counts all nodes that accessable via the WLAN mesh interface
|
||||
if [ -n "$BATMAN_INTERFACE" ] && [ -n "$WLAN_MESH_INTERFACE" ]; then
|
||||
COUNT=$(tail -n +3 /sys/kernel/debug/batman_adv/$BATMAN_INTERFACE/originators | grep "$WLAN_MESH_INTERFACE" | wc -l)
|
||||
fi
|
||||
echo $COUNT
|
||||
}
|
||||
|
||||
scan_wlan() {
|
||||
#FIXME: if you can; is there an easier way to get the current frequency?
|
||||
#FIXME: this should reanimate the wlan driver; do passive and active scanning the job equally well?
|
||||
local FREQUENCY=$(iwlist $WLAN_MESH_INTERFACE frequency 2> /dev/null | grep -o "Current Frequency=[0-9.]\+ GHz" | grep -o "[0-9.]*" | tr -d ".")
|
||||
[ -n "$FREQUENCY" ] && iw $WLAN_MESH_INTERFACE scan freq $FREQUENCY passive 1> /dev/null 2> /dev/null
|
||||
}
|
||||
|
||||
fsm_load() {
|
||||
if [ -f "$STATEFILE" ]
|
||||
then
|
||||
STATE=""
|
||||
SINCE=""
|
||||
. "$STATEFILE" || return 1
|
||||
fi
|
||||
}
|
||||
|
||||
fsm_save() {
|
||||
echo -e "STATE=${STATE}\nSINCE=${SINCE}" > "$STATEFILE" || return 1
|
||||
}
|
||||
|
||||
fsm_entry() {
|
||||
SINCE=$(get_time)
|
||||
case $STATE in
|
||||
pending)
|
||||
scan_wlan
|
||||
;;
|
||||
error)
|
||||
if [ -n "$DEBUG" ] && [ $DEBUG -eq 1 ]; then
|
||||
debug_output | gzip > ${DEBUGFILE}
|
||||
fi
|
||||
reboot
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
fsm_transition() {
|
||||
local AGE=-1
|
||||
[ -n "$SINCE" ] && AGE=$(( $(get_time) - $SINCE ))
|
||||
local OLDSTATE=$STATE
|
||||
case $STATE in
|
||||
working)
|
||||
if [ $(count_neighbours) -eq 0 ] && [ $(count_clients) -eq 0 ]
|
||||
then
|
||||
STATE=pending
|
||||
fi
|
||||
;;
|
||||
pending)
|
||||
if [ $AGE -ge $TIMEOUT_MEDIUM ]
|
||||
then
|
||||
STATE=error
|
||||
elif [ $(count_originators) -eq 0 ] && [ $AGE -ge $TIMEOUT_SHORT ]
|
||||
then
|
||||
STATE=error
|
||||
elif [ $(count_neighbours) -gt 0 ] || [ $(count_clients) -gt 0 ]
|
||||
then
|
||||
STATE=working
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
if [ $AGE -ge $TIMEOUT_LONG ]
|
||||
then
|
||||
STATE=error
|
||||
elif [ $(count_neighbours) -gt 0 ] || [ $(count_clients) -gt 0 ]
|
||||
then
|
||||
STATE=working
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if [ ! "$OLDSTATE" == "$STATE" ]
|
||||
then
|
||||
echo "$(date) '$OLDSTATE' -> '$STATE'"
|
||||
fsm_entry
|
||||
fi
|
||||
}
|
||||
|
||||
# program
|
||||
fsm_load
|
||||
fsm_transition
|
||||
fsm_save
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# Automatically generated make config: don't edit
|
||||
# OpenWrt version: Attitude Adjustment (r35298)
|
||||
# Sun Feb 3 12:57:06 2013
|
||||
# Sat Jun 22 12:46:18 2013
|
||||
#
|
||||
CONFIG_HAVE_DOT_CONFIG=y
|
||||
# CONFIG_TARGET_ppc40x is not set
|
||||
|
@ -2289,7 +2289,7 @@ CONFIG_PACKAGE_wavemon=y
|
|||
# CONFIG_PACKAGE_e169-stats is not set
|
||||
# CONFIG_PACKAGE_elinks is not set
|
||||
# CONFIG_PACKAGE_etherwake is not set
|
||||
# CONFIG_PACKAGE_ethtool is not set
|
||||
CONFIG_PACKAGE_ethtool=y
|
||||
# CONFIG_PACKAGE_ettercap is not set
|
||||
# CONFIG_PACKAGE_faifa is not set
|
||||
# CONFIG_PACKAGE_fakeidentd is not set
|
||||
|
@ -2327,7 +2327,7 @@ CONFIG_PACKAGE_iw=y
|
|||
# CONFIG_PACKAGE_madwimax is not set
|
||||
# CONFIG_PACKAGE_memcached is not set
|
||||
# CONFIG_PACKAGE_mgen is not set
|
||||
# CONFIG_PACKAGE_mii-tool is not set
|
||||
CONFIG_PACKAGE_mii-tool=y
|
||||
# CONFIG_PACKAGE_mini-snmpd is not set
|
||||
# CONFIG_PACKAGE_mosquitto is not set
|
||||
# CONFIG_PACKAGE_mosquitto-client is not set
|
||||
|
|
|
@ -2,14 +2,14 @@ config 'wifi-device' 'wifi0'
|
|||
option 'type' 'mac80211'
|
||||
option 'phy' 'phy0'
|
||||
option 'disabled' '0'
|
||||
option 'channel' '6'
|
||||
option 'channel' '1'
|
||||
option 'hwmode' '11g'
|
||||
|
||||
config 'wifi-iface'
|
||||
option 'device' 'wifi0'
|
||||
option 'network' 'wlanmesh'
|
||||
option 'mode' 'adhoc'
|
||||
option 'ssid' 'batman.oldenburg.freifunk.net'
|
||||
option 'ssid' 'batman.franken.freifunk.net'
|
||||
option 'bssid' '02:CA:FF:EE:BA:BE'
|
||||
option 'encryption' 'none'
|
||||
option 'hidden' '1'
|
||||
|
@ -18,5 +18,5 @@ config 'wifi-iface'
|
|||
option 'device' 'wifi0'
|
||||
option 'network' 'mesh'
|
||||
option 'mode' 'ap'
|
||||
option 'ssid' 'oldenburg.freifunk.net'
|
||||
option 'ssid' 'franken.freifunk.net'
|
||||
option 'encryption' 'none'
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
# Put your custom commands here that should be executed once
|
||||
# the system init finished. By default this file does nothing.
|
||||
|
||||
# collect environment info and write to dot-script
|
||||
/etc/environment.sh > /tmp/environment
|
||||
|
||||
# todo: all devices or only dir300 ?
|
||||
if uci get network.mesh.macaddr
|
||||
then
|
||||
|
@ -41,7 +44,7 @@ batctl if add wlan0-1
|
|||
batctl if add eth0.3
|
||||
|
||||
# Starting NTP-Client Daemon
|
||||
ntpd -p "fe80::201:2ff:fe03:405%br-mesh"
|
||||
ntpd -p "fe80::ff:feee:1%br-mesh"
|
||||
|
||||
#. /etc/firewall.user
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# Automatically generated make config: don't edit
|
||||
# OpenWrt version: Attitude Adjustment (r35298)
|
||||
# Sun Feb 3 12:57:06 2013
|
||||
# Sat Jun 22 12:46:18 2013
|
||||
#
|
||||
CONFIG_HAVE_DOT_CONFIG=y
|
||||
# CONFIG_TARGET_ppc40x is not set
|
||||
|
@ -2289,7 +2289,7 @@ CONFIG_PACKAGE_wavemon=y
|
|||
# CONFIG_PACKAGE_e169-stats is not set
|
||||
# CONFIG_PACKAGE_elinks is not set
|
||||
# CONFIG_PACKAGE_etherwake is not set
|
||||
# CONFIG_PACKAGE_ethtool is not set
|
||||
CONFIG_PACKAGE_ethtool=y
|
||||
# CONFIG_PACKAGE_ettercap is not set
|
||||
# CONFIG_PACKAGE_faifa is not set
|
||||
# CONFIG_PACKAGE_fakeidentd is not set
|
||||
|
@ -2327,7 +2327,7 @@ CONFIG_PACKAGE_iw=y
|
|||
# CONFIG_PACKAGE_madwimax is not set
|
||||
# CONFIG_PACKAGE_memcached is not set
|
||||
# CONFIG_PACKAGE_mgen is not set
|
||||
# CONFIG_PACKAGE_mii-tool is not set
|
||||
CONFIG_PACKAGE_mii-tool=y
|
||||
# CONFIG_PACKAGE_mini-snmpd is not set
|
||||
# CONFIG_PACKAGE_mosquitto is not set
|
||||
# CONFIG_PACKAGE_mosquitto-client is not set
|
||||
|
|
|
@ -2,14 +2,14 @@ config 'wifi-device' 'wifi0'
|
|||
option 'type' 'mac80211'
|
||||
option 'phy' 'phy0'
|
||||
option 'disabled' '0'
|
||||
option 'channel' '6'
|
||||
option 'channel' '1'
|
||||
option 'hwmode' '11g'
|
||||
|
||||
config 'wifi-iface'
|
||||
option 'device' 'wifi0'
|
||||
option 'network' 'wlanmesh'
|
||||
option 'mode' 'adhoc'
|
||||
option 'ssid' 'batman.oldenburg.freifunk.net'
|
||||
option 'ssid' 'batman.franken.freifunk.net'
|
||||
option 'bssid' '02:CA:FF:EE:BA:BE'
|
||||
option 'encryption' 'none'
|
||||
option 'hidden' '1'
|
||||
|
@ -18,6 +18,6 @@ config 'wifi-iface'
|
|||
option 'device' 'wifi0'
|
||||
option 'network' 'mesh'
|
||||
option 'mode' 'ap'
|
||||
option 'ssid' 'oldenburg.freifunk.net'
|
||||
option 'ssid' 'franken.freifunk.net'
|
||||
option 'encryption' 'none'
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
# Put your custom commands here that should be executed once
|
||||
# the system init finished. By default this file does nothing.
|
||||
|
||||
# collect environment info and write to dot-script
|
||||
/etc/environment.sh > /tmp/environment
|
||||
|
||||
#. /etc/firewall.user
|
||||
|
||||
|
@ -35,6 +37,6 @@ fi
|
|||
batctl if add wlan0-1
|
||||
|
||||
# Starting NTP-Client Daemon
|
||||
ntpd -p "fe80::201:2ff:fe03:405%br-mesh"
|
||||
ntpd -p "fe80::ff:feee:1%br-mesh"
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# Automatically generated make config: don't edit
|
||||
# OpenWrt version: Attitude Adjustment (r35298)
|
||||
# Mon Apr 1 16:14:08 2013
|
||||
# Sat Jun 22 12:43:05 2013
|
||||
#
|
||||
CONFIG_HAVE_DOT_CONFIG=y
|
||||
# CONFIG_TARGET_ppc40x is not set
|
||||
|
@ -2488,7 +2488,7 @@ CONFIG_PACKAGE_wavemon=y
|
|||
# CONFIG_PACKAGE_e169-stats is not set
|
||||
# CONFIG_PACKAGE_elinks is not set
|
||||
# CONFIG_PACKAGE_etherwake is not set
|
||||
# CONFIG_PACKAGE_ethtool is not set
|
||||
CONFIG_PACKAGE_ethtool=y
|
||||
# CONFIG_PACKAGE_ettercap is not set
|
||||
# CONFIG_PACKAGE_faifa is not set
|
||||
# CONFIG_PACKAGE_fakeidentd is not set
|
||||
|
@ -2526,7 +2526,7 @@ CONFIG_PACKAGE_iw=y
|
|||
# CONFIG_PACKAGE_madwimax is not set
|
||||
# CONFIG_PACKAGE_memcached is not set
|
||||
# CONFIG_PACKAGE_mgen is not set
|
||||
# CONFIG_PACKAGE_mii-tool is not set
|
||||
CONFIG_PACKAGE_mii-tool=y
|
||||
# CONFIG_PACKAGE_mini-snmpd is not set
|
||||
# CONFIG_PACKAGE_mosquitto is not set
|
||||
# CONFIG_PACKAGE_mosquitto-client is not set
|
||||
|
@ -3310,7 +3310,7 @@ CONFIG_PACKAGE_ubusd=y
|
|||
# CONFIG_PACKAGE_ap51-flash is not set
|
||||
# CONFIG_PACKAGE_apcupsd is not set
|
||||
# CONFIG_PACKAGE_at is not set
|
||||
CONFIG_PACKAGE_ath9k-watchdog=y
|
||||
# CONFIG_PACKAGE_ath9k-watchdog is not set
|
||||
# CONFIG_PACKAGE_avrdude is not set
|
||||
# CONFIG_PACKAGE_avrusbboot is not set
|
||||
# CONFIG_PACKAGE_bandwidthd is not set
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
config wifi-device radio0
|
||||
option type mac80211
|
||||
option channel 6
|
||||
option channel 1
|
||||
option phy phy0
|
||||
option hwmode 11ng
|
||||
option htmode HT20
|
||||
|
@ -14,7 +14,7 @@ config wifi-iface
|
|||
option network wlanmesh
|
||||
option mode adhoc
|
||||
option bssid '02:CA:FF:EE:BA:BE'
|
||||
option ssid 'batman.oldenburg.freifunk.net'
|
||||
option ssid 'batman.franken.freifunk.net'
|
||||
option mcast_rate 6000
|
||||
# option bintval 1000
|
||||
option 'encryption' 'none'
|
||||
|
@ -24,5 +24,5 @@ config wifi-iface
|
|||
option device radio0
|
||||
option network mesh
|
||||
option mode ap
|
||||
option ssid 'oldenburg.freifunk.net'
|
||||
option ssid 'franken.freifunk.net'
|
||||
option 'encryption' 'none'
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
*/5 * * * * sh /etc/fastdstart.sh; sh /etc/nodewatcher.sh; sh /etc/configurator.sh
|
||||
|
||||
*/5 * * * * sh /etc/wlanwatchdog.sh >> /var/log/wlanwatchdog.log 2>&1
|
||||
|
||||
#15 01 * * * rdate -s time.fu-berlin.de > /dev/null
|
||||
|
||||
#Enable zapp script if you are running a gateway
|
||||
#*/1 * * * * /etc/init.d/zapp
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
# Put your custom commands here that should be executed once
|
||||
# the system init finished. By default this file does nothing.
|
||||
|
||||
# collect environment info and write to dot-script
|
||||
/etc/environment.sh > /tmp/environment
|
||||
|
||||
#Set Mac-Addr of wr1043nd wifi interface if not right
|
||||
#HARDWARE_MACADDR=`ifconfig -a wlan0 | grep 'HWaddr' | awk '{ print $5}'`
|
||||
|
@ -32,7 +34,7 @@ batctl if add wlan0-1
|
|||
batctl if add eth0.3
|
||||
|
||||
# Starting NTP-Client Daemon
|
||||
ntpd -p "fe80::201:2ff:fe03:405%br-mesh"
|
||||
ntpd -p "fe80::ff:feee:1%br-mesh"
|
||||
|
||||
. /etc/firewall.user
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# Automatically generated make config: don't edit
|
||||
# OpenWrt version: Attitude Adjustment (r35298)
|
||||
# Mon Apr 1 15:30:02 2013
|
||||
# Sat Jun 22 12:44:10 2013
|
||||
#
|
||||
CONFIG_HAVE_DOT_CONFIG=y
|
||||
# CONFIG_TARGET_ppc40x is not set
|
||||
|
@ -2485,7 +2485,7 @@ CONFIG_PACKAGE_wavemon=y
|
|||
# CONFIG_PACKAGE_e169-stats is not set
|
||||
# CONFIG_PACKAGE_elinks is not set
|
||||
# CONFIG_PACKAGE_etherwake is not set
|
||||
# CONFIG_PACKAGE_ethtool is not set
|
||||
CONFIG_PACKAGE_ethtool=y
|
||||
# CONFIG_PACKAGE_ettercap is not set
|
||||
# CONFIG_PACKAGE_faifa is not set
|
||||
# CONFIG_PACKAGE_fakeidentd is not set
|
||||
|
@ -2523,7 +2523,7 @@ CONFIG_PACKAGE_iw=y
|
|||
# CONFIG_PACKAGE_madwimax is not set
|
||||
# CONFIG_PACKAGE_memcached is not set
|
||||
# CONFIG_PACKAGE_mgen is not set
|
||||
# CONFIG_PACKAGE_mii-tool is not set
|
||||
CONFIG_PACKAGE_mii-tool=y
|
||||
# CONFIG_PACKAGE_mini-snmpd is not set
|
||||
# CONFIG_PACKAGE_mosquitto is not set
|
||||
# CONFIG_PACKAGE_mosquitto-client is not set
|
||||
|
@ -3307,7 +3307,7 @@ CONFIG_PACKAGE_ubusd=y
|
|||
# CONFIG_PACKAGE_ap51-flash is not set
|
||||
# CONFIG_PACKAGE_apcupsd is not set
|
||||
# CONFIG_PACKAGE_at is not set
|
||||
CONFIG_PACKAGE_ath9k-watchdog=y
|
||||
# CONFIG_PACKAGE_ath9k-watchdog is not set
|
||||
# CONFIG_PACKAGE_avrdude is not set
|
||||
# CONFIG_PACKAGE_avrusbboot is not set
|
||||
# CONFIG_PACKAGE_bandwidthd is not set
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
config wifi-device radio0
|
||||
option type mac80211
|
||||
option channel 6
|
||||
option channel 1
|
||||
option phy phy0
|
||||
option hwmode 11ng
|
||||
|
||||
|
@ -9,7 +9,7 @@ config wifi-iface
|
|||
option network wlanmesh
|
||||
option mode adhoc
|
||||
option bssid '02:CA:FF:EE:BA:BE'
|
||||
option ssid 'batman.oldenburg.freifunk.net'
|
||||
option ssid 'batman.franken.freifunk.net'
|
||||
option mcast_rate 6000
|
||||
# option bintval 1000
|
||||
option 'encryption' 'none'
|
||||
|
@ -19,5 +19,5 @@ config wifi-iface
|
|||
option device radio0
|
||||
option network mesh
|
||||
option mode ap
|
||||
option ssid 'oldenburg.freifunk.net'
|
||||
option ssid 'franken.freifunk.net'
|
||||
option 'encryption' 'none'
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
*/5 * * * * sh /etc/fastdstart.sh; sh /etc/nodewatcher.sh; sh /etc/configurator.sh
|
||||
|
||||
*/5 * * * * sh /etc/wlanwatchdog.sh >> /var/log/wlanwatchdog.log 2>&1
|
||||
|
||||
#15 01 * * * rdate -s time.fu-berlin.de > /dev/null
|
||||
|
||||
#Enable zapp script if you are running a gateway
|
||||
#*/1 * * * * /etc/init.d/zapp
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
# Put your custom commands here that should be executed once
|
||||
# the system init finished. By default this file does nothing.
|
||||
|
||||
# collect environment info and write to dot-script
|
||||
/etc/environment.sh > /tmp/environment
|
||||
|
||||
#Set Mac-Addr of wr1043nd wifi interface if not right
|
||||
WLAN0_MACADDR=$(cat /sys/class/net/wlan0/address)
|
||||
|
@ -32,7 +34,7 @@ batctl if add wlan0-1
|
|||
batctl if add eth0.3
|
||||
|
||||
# Starting NTP-Client Daemon
|
||||
ntpd -p "fe80::201:2ff:fe03:405%br-mesh"
|
||||
ntpd -p "fe80::ff:feee:1%br-mesh"
|
||||
|
||||
. /etc/firewall.user
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# Automatically generated make config: don't edit
|
||||
# OpenWrt version: Attitude Adjustment (r35298)
|
||||
# Mon Apr 1 15:30:02 2013
|
||||
# Sat Jun 22 12:44:10 2013
|
||||
#
|
||||
CONFIG_HAVE_DOT_CONFIG=y
|
||||
# CONFIG_TARGET_ppc40x is not set
|
||||
|
@ -2485,7 +2485,7 @@ CONFIG_PACKAGE_wavemon=y
|
|||
# CONFIG_PACKAGE_e169-stats is not set
|
||||
# CONFIG_PACKAGE_elinks is not set
|
||||
# CONFIG_PACKAGE_etherwake is not set
|
||||
# CONFIG_PACKAGE_ethtool is not set
|
||||
CONFIG_PACKAGE_ethtool=y
|
||||
# CONFIG_PACKAGE_ettercap is not set
|
||||
# CONFIG_PACKAGE_faifa is not set
|
||||
# CONFIG_PACKAGE_fakeidentd is not set
|
||||
|
@ -2523,7 +2523,7 @@ CONFIG_PACKAGE_iw=y
|
|||
# CONFIG_PACKAGE_madwimax is not set
|
||||
# CONFIG_PACKAGE_memcached is not set
|
||||
# CONFIG_PACKAGE_mgen is not set
|
||||
# CONFIG_PACKAGE_mii-tool is not set
|
||||
CONFIG_PACKAGE_mii-tool=y
|
||||
# CONFIG_PACKAGE_mini-snmpd is not set
|
||||
# CONFIG_PACKAGE_mosquitto is not set
|
||||
# CONFIG_PACKAGE_mosquitto-client is not set
|
||||
|
@ -3307,7 +3307,7 @@ CONFIG_PACKAGE_ubusd=y
|
|||
# CONFIG_PACKAGE_ap51-flash is not set
|
||||
# CONFIG_PACKAGE_apcupsd is not set
|
||||
# CONFIG_PACKAGE_at is not set
|
||||
CONFIG_PACKAGE_ath9k-watchdog=y
|
||||
# CONFIG_PACKAGE_ath9k-watchdog is not set
|
||||
# CONFIG_PACKAGE_avrdude is not set
|
||||
# CONFIG_PACKAGE_avrusbboot is not set
|
||||
# CONFIG_PACKAGE_bandwidthd is not set
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
config wifi-device radio0
|
||||
option type mac80211
|
||||
option channel 6
|
||||
option channel 1
|
||||
option phy phy0
|
||||
option hwmode 11ng
|
||||
|
||||
|
@ -9,7 +9,7 @@ config wifi-iface
|
|||
option network wlanmesh
|
||||
option mode adhoc
|
||||
option bssid '02:CA:FF:EE:BA:BE'
|
||||
option ssid 'batman.oldenburg.freifunk.net'
|
||||
option ssid 'batman.franken.freifunk.net'
|
||||
option mcast_rate 6000
|
||||
# option bintval 1000
|
||||
option 'encryption' 'none'
|
||||
|
@ -19,5 +19,5 @@ config wifi-iface
|
|||
option device radio0
|
||||
option network mesh
|
||||
option mode ap
|
||||
option ssid 'oldenburg.freifunk.net'
|
||||
option ssid 'franken.freifunk.net'
|
||||
option 'encryption' 'none'
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
*/5 * * * * sh /etc/fastdstart.sh; sh /etc/nodewatcher.sh; sh /etc/configurator.sh
|
||||
|
||||
*/5 * * * * sh /etc/wlanwatchdog.sh >> /var/log/wlanwatchdog.log 2>&1
|
||||
|
||||
#15 01 * * * rdate -s time.fu-berlin.de > /dev/null
|
||||
|
||||
#Enable zapp script if you are running a gateway
|
||||
#*/1 * * * * /etc/init.d/zapp
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
# Put your custom commands here that should be executed once
|
||||
# the system init finished. By default this file does nothing.
|
||||
|
||||
# collect environment info and write to dot-script
|
||||
/etc/environment.sh > /tmp/environment
|
||||
|
||||
#Set Mac-Addr of wr1043nd wifi interface if not right
|
||||
WLAN0_MACADDR=$(cat /sys/class/net/wlan0/address)
|
||||
|
@ -32,7 +34,7 @@ batctl if add wlan0-1
|
|||
batctl if add eth0.3
|
||||
|
||||
# Starting NTP-Client Daemon
|
||||
ntpd -p "fe80::201:2ff:fe03:405%br-mesh"
|
||||
ntpd -p "fe80::ff:feee:1%br-mesh"
|
||||
|
||||
. /etc/firewall.user
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,41 @@
|
|||
|
||||
config 'interface' 'loopback'
|
||||
option 'ifname' 'lo'
|
||||
option 'proto' 'static'
|
||||
option 'ipaddr' '127.0.0.1'
|
||||
option 'netmask' '255.0.0.0'
|
||||
|
||||
config 'interface' 'wlanmesh'
|
||||
option 'ifname' 'wlan1'
|
||||
option 'mtu' '1528'
|
||||
|
||||
config 'interface' 'mesh'
|
||||
option 'type' 'bridge'
|
||||
option 'ifname' 'eth1.1 wlan0 bat0 tap0'
|
||||
option 'auto' '1'
|
||||
|
||||
config 'interface' 'wan'
|
||||
option 'ifname' 'eth0'
|
||||
option 'proto' 'dhcp'
|
||||
|
||||
config 'interface' 'ethmesh'
|
||||
option 'ifname' 'eth1.3'
|
||||
option 'mtu' '1528'
|
||||
|
||||
config 'switch'
|
||||
option 'name' 'eth1'
|
||||
option 'reset' '1'
|
||||
option 'enable_vlan' '1'
|
||||
|
||||
#1. und 2. LAN Port
|
||||
config 'switch_vlan'
|
||||
option 'device' 'eth1'
|
||||
option 'vlan' '1'
|
||||
option 'ports' '1 4 0t'
|
||||
|
||||
#3. und 4. LAN Port
|
||||
config 'switch_vlan'
|
||||
option 'device' 'eth1'
|
||||
option 'vlan' '3'
|
||||
option 'ports' '3 2 0t'
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
config 'script'
|
||||
option 'version' '25'
|
||||
option 'error_level' '0'
|
||||
option 'logfile' '/var/log/nodewatcher.log'
|
||||
option 'data_file' '/tmp/crawldata/node.data'
|
||||
|
||||
config 'network'
|
||||
option 'mesh_interface' 'br-mesh'
|
||||
option 'client_interfaces' 'wlan0 eth1.1'
|
|
@ -0,0 +1,13 @@
|
|||
|
||||
config system
|
||||
option hostname 'OpenWrt'
|
||||
option timezone 'CET-1CEST,M3.5.0,M10.5.0/3'
|
||||
|
||||
config rdate
|
||||
option interface 'wan'
|
||||
|
||||
config led 'status_led'
|
||||
option name 'status'
|
||||
option sysfs 'tp-link:green:system'
|
||||
option trigger 'heartbeat'
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
config wifi-device radio0
|
||||
option type mac80211
|
||||
option channel 1
|
||||
option phy phy0
|
||||
option hwmode 11ng
|
||||
|
||||
config wifi-iface
|
||||
option device radio0
|
||||
option network wlanmesh
|
||||
option mode adhoc
|
||||
option bssid '02:CA:FF:EE:BA:BE'
|
||||
option ssid 'batman.franken.freifunk.net'
|
||||
option mcast_rate 6000
|
||||
# option bintval 1000
|
||||
option 'encryption' 'none'
|
||||
option 'hidden' '1'
|
||||
|
||||
config wifi-iface
|
||||
option device radio0
|
||||
option network mesh
|
||||
option mode ap
|
||||
option ssid 'franken.freifunk.net'
|
||||
option 'encryption' 'none'
|
|
@ -0,0 +1,9 @@
|
|||
*/5 * * * * sh /etc/fastdstart.sh; sh /etc/nodewatcher.sh; sh /etc/configurator.sh
|
||||
|
||||
*/5 * * * * sh /etc/wlanwatchdog.sh >> /var/log/wlanwatchdog.log 2>&1
|
||||
|
||||
#15 01 * * * rdate -s time.fu-berlin.de > /dev/null
|
||||
|
||||
#Enable zapp script if you are running a gateway
|
||||
#*/1 * * * * /etc/init.d/zapp
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
# Put your custom commands here that should be executed once
|
||||
# the system init finished. By default this file does nothing.
|
||||
|
||||
# collect environment info and write to dot-script
|
||||
/etc/environment.sh > /tmp/environment
|
||||
|
||||
#Set Mac-Addr of wr1043nd wifi interface if not right
|
||||
WLAN0_MACADDR=$(cat /sys/class/net/wlan0/address)
|
||||
BRMESH_MACADDR=$(cat /sys/class/net/br-mesh/address)
|
||||
|
||||
if [[ "$WLAN0_MACADDR=" != "$BRMESH_MACADDR=" ]]; then
|
||||
echo "Fixing wrong MAC on br-mesh"
|
||||
uci set network.mesh.macaddr=$WLAN0_MACADDR
|
||||
uci commit
|
||||
ifconfig br-mesh hw ether $WLAN0_MACADDR
|
||||
ifconfig br-mesh down
|
||||
ifconfig br-mesh up
|
||||
fi
|
||||
|
||||
if uci get network.ethmesh.macaddr
|
||||
then
|
||||
echo "MAC for ETH-BATMAN is set already"
|
||||
else
|
||||
echo "Fixing MAC on eth1.3 (ethmesh)"
|
||||
NEW=$(awk -F: '{ printf("%02x:%02x:%02x:%02x:%02x:%02x\n", ("0x"$1)+2, "0x"$2, "0x"$3, "0x"$4, "0x"$5, "0x"$6 ) }' /sys/class/net/eth1/address)
|
||||
uci set network.ethmesh.macaddr=$NEW
|
||||
uci commit
|
||||
ifconfig eth1.3 hw ether $NEW
|
||||
ifconfig eth1.3 down
|
||||
ifconfig eth1.3 up
|
||||
fi
|
||||
|
||||
batctl if add wlan0-1
|
||||
batctl if add eth1.3
|
||||
|
||||
# Starting NTP-Client Daemon
|
||||
ntpd -p "fe80::ff:feee:1%br-mesh"
|
||||
|
||||
. /etc/firewall.user
|
||||
|
||||
/etc/init.d/qos disable
|
||||
/etc/init.d/qos stop
|
||||
|
||||
#busybox-httpd for crawldata
|
||||
mkdir /tmp/crawldata
|
||||
httpd -h /tmp/crawldata
|
||||
|
||||
exit 0
|
|
@ -0,0 +1,78 @@
|
|||
kernel.panic=3
|
||||
net.ipv4.conf.default.arp_ignore=1
|
||||
net.ipv4.conf.all.arp_ignore=1
|
||||
net.ipv4.conf.all.forwarding=0
|
||||
net.ipv4.conf.all.send_redirects=0
|
||||
net.ipv4.tcp_ecn=0
|
||||
net.ipv4.tcp_fin_timeout=30
|
||||
net.ipv4.tcp_keepalive_time=120
|
||||
net.ipv4.tcp_syncookies=1
|
||||
net.ipv4.tcp_timestamps=0
|
||||
net.ipv4.netfilter.ip_conntrack_checksum=0
|
||||
net.ipv4.netfilter.ip_conntrack_max=16384
|
||||
net.ipv4.netfilter.ip_conntrack_tcp_timeout_established=3600
|
||||
net.ipv4.netfilter.ip_conntrack_udp_timeout=60
|
||||
net.ipv4.netfilter.ip_conntrack_udp_timeout_stream=180
|
||||
net.core.netdev_max_backlog=30
|
||||
net.netfilter.nf_conntrack_checksum=0
|
||||
|
||||
#Controls source route verification
|
||||
net.ipv4.conf.default.rp_filter=1
|
||||
|
||||
#Do not accept source routing
|
||||
net.ipv4.conf.all.accept_source_route=0
|
||||
net.ipv4.conf.all.accept_redirects=0
|
||||
net.ipv4.conf.default.accept_source_route=0
|
||||
net.ipv4.conf.default.accept_redirects=0
|
||||
net.ipv4.icmp_echo_ignore_broadcasts=1
|
||||
net.ipv4.icmp_ignore_bogus_error_responses=1
|
||||
net.ipv4.ip_forward=0
|
||||
# net.ipv6.conf.all.forwarding=1
|
||||
|
||||
# disable bridge firewalling by default
|
||||
net.bridge.bridge-nf-call-arptables=0
|
||||
net.bridge.bridge-nf-call-ip6tables=0
|
||||
net.bridge.bridge-nf-call-iptables=0
|
||||
|
||||
net.ipv6.conf.default.accept_dad=0
|
||||
net.ipv6.conf.default.accept_ra=0
|
||||
net.ipv6.conf.default.accept_redirects=0
|
||||
net.ipv6.conf.all.accept_dad=0
|
||||
net.ipv6.conf.all.accept_ra=1
|
||||
net.ipv6.conf.all.accept_redirects=0
|
||||
|
||||
# Number of Router Solicitations to send until assuming no routers are present.
|
||||
# This is host and not router
|
||||
net.ipv6.conf.default.router_solicitations = 0
|
||||
net.ipv6.conf.all.router_solicitations = 0
|
||||
|
||||
# Accept Router Preference in RA?
|
||||
net.ipv6.conf.default.accept_ra_rtr_pref = 0
|
||||
net.ipv6.conf.all.accept_ra_rtr_pref = 1
|
||||
|
||||
# Learn Prefix Information in Router Advertisement
|
||||
net.ipv6.conf.default.accept_ra_pinfo = 0
|
||||
net.ipv6.conf.all.accept_ra_pinfo = 1
|
||||
|
||||
# Setting controls whether the system will accept Hop Limit settings from a router advertisement
|
||||
net.ipv6.conf.default.accept_ra_defrtr = 0
|
||||
net.ipv6.conf.all.accept_ra_defrtr = 1
|
||||
|
||||
#router advertisements can cause the system to assign a global unicast address to an interface
|
||||
net.ipv6.conf.default.autoconf = 0
|
||||
net.ipv6.conf.all.autoconf = 1
|
||||
|
||||
#how many neighbor solicitations to send out per address?
|
||||
net.ipv6.conf.default.dad_transmits = 3
|
||||
net.ipv6.conf.all.dad_transmits = 3
|
||||
|
||||
# How many global unicast IPv6 addresses can be assigned to each interface?
|
||||
net.ipv6.conf.default.max_addresses = 0
|
||||
net.ipv6.conf.all.max_addresses = 0
|
||||
|
||||
|
||||
# Allow IPv6 RAs on WAN Port
|
||||
net.ipv6.conf.eth0.accept_ra_defrtr = 1
|
||||
net.ipv6.conf.eth0.accept_ra_pinfo = 1
|
||||
net.ipv6.conf.eth0.autoconf = 1
|
||||
net.ipv6.conf.eth0.accept_ra_rtr_pref = 1
|
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# Automatically generated make config: don't edit
|
||||
# OpenWrt version: Attitude Adjustment (r35298)
|
||||
# Mon Apr 1 16:22:12 2013
|
||||
# Sat Jun 22 12:45:21 2013
|
||||
#
|
||||
CONFIG_HAVE_DOT_CONFIG=y
|
||||
# CONFIG_TARGET_ppc40x is not set
|
||||
|
@ -2485,7 +2485,7 @@ CONFIG_PACKAGE_wavemon=y
|
|||
# CONFIG_PACKAGE_e169-stats is not set
|
||||
# CONFIG_PACKAGE_elinks is not set
|
||||
# CONFIG_PACKAGE_etherwake is not set
|
||||
# CONFIG_PACKAGE_ethtool is not set
|
||||
CONFIG_PACKAGE_ethtool=y
|
||||
# CONFIG_PACKAGE_ettercap is not set
|
||||
# CONFIG_PACKAGE_faifa is not set
|
||||
# CONFIG_PACKAGE_fakeidentd is not set
|
||||
|
@ -2523,7 +2523,7 @@ CONFIG_PACKAGE_iw=y
|
|||
# CONFIG_PACKAGE_madwimax is not set
|
||||
# CONFIG_PACKAGE_memcached is not set
|
||||
# CONFIG_PACKAGE_mgen is not set
|
||||
# CONFIG_PACKAGE_mii-tool is not set
|
||||
CONFIG_PACKAGE_mii-tool=y
|
||||
# CONFIG_PACKAGE_mini-snmpd is not set
|
||||
# CONFIG_PACKAGE_mosquitto is not set
|
||||
# CONFIG_PACKAGE_mosquitto-client is not set
|
||||
|
@ -3307,7 +3307,7 @@ CONFIG_PACKAGE_ubusd=y
|
|||
# CONFIG_PACKAGE_ap51-flash is not set
|
||||
# CONFIG_PACKAGE_apcupsd is not set
|
||||
# CONFIG_PACKAGE_at is not set
|
||||
CONFIG_PACKAGE_ath9k-watchdog=y
|
||||
# CONFIG_PACKAGE_ath9k-watchdog is not set
|
||||
# CONFIG_PACKAGE_avrdude is not set
|
||||
# CONFIG_PACKAGE_avrusbboot is not set
|
||||
# CONFIG_PACKAGE_bandwidthd is not set
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
config wifi-device radio0
|
||||
option type mac80211
|
||||
option channel 6
|
||||
option channel 1
|
||||
option phy phy0
|
||||
option hwmode 11ng
|
||||
|
||||
|
@ -9,7 +9,7 @@ config wifi-iface
|
|||
option network wlanmesh
|
||||
option mode adhoc
|
||||
option bssid '02:CA:FF:EE:BA:BE'
|
||||
option ssid 'batman.oldenburg.freifunk.net'
|
||||
option ssid 'batman.franken.freifunk.net'
|
||||
option mcast_rate 6000
|
||||
# option bintval 1000
|
||||
option 'encryption' 'none'
|
||||
|
@ -19,5 +19,5 @@ config wifi-iface
|
|||
option device radio0
|
||||
option network mesh
|
||||
option mode ap
|
||||
option ssid 'oldenburg.freifunk.net'
|
||||
option ssid 'franken.freifunk.net'
|
||||
option 'encryption' 'none'
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
*/5 * * * * sh /etc/fastdstart.sh; sh /etc/nodewatcher.sh; sh /etc/configurator.sh
|
||||
|
||||
*/5 * * * * sh /etc/wlanwatchdog.sh >> /var/log/wlanwatchdog.log 2>&1
|
||||
|
||||
#15 01 * * * rdate -s time.fu-berlin.de > /dev/null
|
||||
|
||||
#Enable zapp script if you are running a gateway
|
||||
#*/1 * * * * /etc/init.d/zapp
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
# Put your custom commands here that should be executed once
|
||||
# the system init finished. By default this file does nothing.
|
||||
|
||||
# collect environment info and write to dot-script
|
||||
/etc/environment.sh > /tmp/environment
|
||||
|
||||
#Set Mac-Addr of wr1043nd wifi interface if not right
|
||||
WLAN0_MACADDR=$(cat /sys/class/net/wlan0/address)
|
||||
|
@ -32,7 +34,7 @@ batctl if add wlan0-1
|
|||
batctl if add eth0.3
|
||||
|
||||
# Starting NTP-Client Daemon
|
||||
ntpd -p "fe80::201:2ff:fe03:405%br-mesh"
|
||||
ntpd -p "fe80::ff:feee:1%br-mesh"
|
||||
|
||||
. /etc/firewall.user
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
src-svn packages svn://svn.openwrt.org/openwrt/packages@35298
|
||||
#src-svn batman http://downloads.open-mesh.org/svn/openwrt-feed@22
|
||||
src-git fastd git://git.metameute.de/lff/pkg_fastd;v7-1
|
||||
src-git packagesol git://freifunk-ol.de/ffol/packages.git;v0.3.999
|
||||
src-git fastd git://git.metameute.de/lff/pkg_fastd;v8-1
|
||||
src-git packagesol git://freifunk-ol.de/ffol/packages.git;0.3.999d
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
--- a/arch/mips/ath79/dev-wmac.c
|
||||
+++ b/arch/mips/ath79/dev-wmac.c
|
||||
@@ -44,7 +44,7 @@ static struct platform_device ath79_wmac
|
||||
},
|
||||
};
|
||||
|
||||
-static void __init ar913x_wmac_setup(void)
|
||||
+static int ar913x_wmac_reset(void)
|
||||
{
|
||||
/* reset the WMAC */
|
||||
ath79_device_reset_set(AR913X_RESET_AMBA2WMAC);
|
||||
@@ -53,10 +53,19 @@ static void __init ar913x_wmac_setup(voi
|
||||
ath79_device_reset_clear(AR913X_RESET_AMBA2WMAC);
|
||||
mdelay(10);
|
||||
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static void __init ar913x_wmac_setup(void)
|
||||
+{
|
||||
+ ar913x_wmac_reset();
|
||||
+
|
||||
ath79_wmac_resources[0].start = AR913X_WMAC_BASE;
|
||||
ath79_wmac_resources[0].end = AR913X_WMAC_BASE + AR913X_WMAC_SIZE - 1;
|
||||
ath79_wmac_resources[1].start = ATH79_CPU_IRQ_IP2;
|
||||
ath79_wmac_resources[1].end = ATH79_CPU_IRQ_IP2;
|
||||
+
|
||||
+ ath79_wmac_data.external_reset = ar913x_wmac_reset;
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
--- a/arch/mips/ath79/dev-wmac.c
|
||||
+++ b/arch/mips/ath79/dev-wmac.c
|
||||
@@ -15,6 +15,7 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/irq.h>
|
||||
+#include <linux/etherdevice.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/ath9k_platform.h>
|
||||
|
||||
@@ -22,6 +23,7 @@
|
||||
#include <asm/mach-ath79/ar71xx_regs.h>
|
||||
#include "dev-wmac.h"
|
||||
|
||||
+static u8 ath79_wmac_mac[ETH_ALEN];
|
||||
static struct ath9k_platform_data ath79_wmac_data;
|
||||
|
||||
static struct resource ath79_wmac_resources[] = {
|
||||
@@ -143,7 +145,7 @@ static void qca955x_wmac_setup(void)
|
||||
ath79_wmac_data.is_clk_25mhz = true;
|
||||
}
|
||||
|
||||
-void __init ath79_register_wmac(u8 *cal_data)
|
||||
+void __init ath79_register_wmac(u8 *cal_data, u8 *mac_addr)
|
||||
{
|
||||
if (soc_is_ar913x())
|
||||
ar913x_wmac_setup();
|
||||
@@ -160,5 +162,10 @@ void __init ath79_register_wmac(u8 *cal_
|
||||
memcpy(ath79_wmac_data.eeprom_data, cal_data,
|
||||
sizeof(ath79_wmac_data.eeprom_data));
|
||||
|
||||
+ if (mac_addr) {
|
||||
+ memcpy(ath79_wmac_mac, mac_addr, sizeof(ath79_wmac_mac));
|
||||
+ ath79_wmac_data.macaddr = ath79_wmac_mac;
|
||||
+ }
|
||||
+
|
||||
platform_device_register(&ath79_wmac_device);
|
||||
}
|
||||
--- a/arch/mips/ath79/dev-wmac.h
|
||||
+++ b/arch/mips/ath79/dev-wmac.h
|
||||
@@ -12,6 +12,6 @@
|
||||
#ifndef _ATH79_DEV_WMAC_H
|
||||
#define _ATH79_DEV_WMAC_H
|
||||
|
||||
-void ath79_register_wmac(u8 *cal_data);
|
||||
+void ath79_register_wmac(u8 *cal_data, u8 *mac_addr);
|
||||
|
||||
#endif /* _ATH79_DEV_WMAC_H */
|
||||
--- a/arch/mips/ath79/mach-ap81.c
|
||||
+++ b/arch/mips/ath79/mach-ap81.c
|
||||
@@ -98,7 +98,7 @@ static void __init ap81_setup(void)
|
||||
ap81_gpio_keys);
|
||||
ath79_register_spi(&ap81_spi_data, ap81_spi_info,
|
||||
ARRAY_SIZE(ap81_spi_info));
|
||||
- ath79_register_wmac(cal_data);
|
||||
+ ath79_register_wmac(cal_data, NULL);
|
||||
ath79_register_usb();
|
||||
}
|
||||
|
||||
--- a/arch/mips/ath79/mach-db120.c
|
||||
+++ b/arch/mips/ath79/mach-db120.c
|
||||
@@ -134,7 +134,7 @@ static void __init db120_setup(void)
|
||||
ath79_register_spi(&db120_spi_data, db120_spi_info,
|
||||
ARRAY_SIZE(db120_spi_info));
|
||||
ath79_register_usb();
|
||||
- ath79_register_wmac(art + DB120_WMAC_CALDATA_OFFSET);
|
||||
+ ath79_register_wmac(art + DB120_WMAC_CALDATA_OFFSET, NULL);
|
||||
db120_pci_init(art + DB120_PCIE_CALDATA_OFFSET);
|
||||
}
|
||||
|
||||
--- a/arch/mips/ath79/mach-ap121.c
|
||||
+++ b/arch/mips/ath79/mach-ap121.c
|
||||
@@ -91,7 +91,7 @@ static void __init ap121_setup(void)
|
||||
ath79_register_spi(&ap121_spi_data, ap121_spi_info,
|
||||
ARRAY_SIZE(ap121_spi_info));
|
||||
ath79_register_usb();
|
||||
- ath79_register_wmac(cal_data);
|
||||
+ ath79_register_wmac(cal_data, NULL);
|
||||
}
|
||||
|
||||
MIPS_MACHINE(ATH79_MACH_AP121, "AP121", "Atheros AP121 reference board",
|
|
@ -0,0 +1,47 @@
|
|||
--- a/arch/mips/ath79/common.h
|
||||
+++ b/arch/mips/ath79/common.h
|
||||
@@ -26,6 +26,7 @@ void ath79_ddr_wb_flush(unsigned int reg
|
||||
void ath79_gpio_function_enable(u32 mask);
|
||||
void ath79_gpio_function_disable(u32 mask);
|
||||
void ath79_gpio_function_setup(u32 set, u32 clear);
|
||||
+void ath79_gpio_output_select(unsigned gpio, u8 val);
|
||||
void ath79_gpio_init(void);
|
||||
|
||||
#endif /* __ATH79_COMMON_H */
|
||||
--- a/arch/mips/ath79/gpio.c
|
||||
+++ b/arch/mips/ath79/gpio.c
|
||||
@@ -198,6 +198,34 @@ void ath79_gpio_function_setup(u32 set,
|
||||
spin_unlock_irqrestore(&ath79_gpio_lock, flags);
|
||||
}
|
||||
|
||||
+void __init ath79_gpio_output_select(unsigned gpio, u8 val)
|
||||
+{
|
||||
+ void __iomem *base = ath79_gpio_base;
|
||||
+ unsigned long flags;
|
||||
+ unsigned int reg;
|
||||
+ u32 t, s;
|
||||
+
|
||||
+ BUG_ON(!soc_is_ar934x());
|
||||
+
|
||||
+ if (gpio >= AR934X_GPIO_COUNT)
|
||||
+ return;
|
||||
+
|
||||
+ reg = AR934X_GPIO_REG_OUT_FUNC0 + 4 * (gpio / 4);
|
||||
+ s = 8 * (gpio % 4);
|
||||
+
|
||||
+ spin_lock_irqsave(&ath79_gpio_lock, flags);
|
||||
+
|
||||
+ t = __raw_readl(base + reg);
|
||||
+ t &= ~(0xff << s);
|
||||
+ t |= val << s;
|
||||
+ __raw_writel(t, base + reg);
|
||||
+
|
||||
+ /* flush write */
|
||||
+ (void) __raw_readl(base + reg);
|
||||
+
|
||||
+ spin_unlock_irqrestore(&ath79_gpio_lock, flags);
|
||||
+}
|
||||
+
|
||||
void __init ath79_gpio_init(void)
|
||||
{
|
||||
int err;
|
|
@ -0,0 +1,61 @@
|
|||
--- a/arch/mips/ath79/early_printk.c
|
||||
+++ b/arch/mips/ath79/early_printk.c
|
||||
@@ -56,6 +56,46 @@ static void prom_putchar_dummy(unsigned
|
||||
/* nothing to do */
|
||||
}
|
||||
|
||||
+static void prom_enable_uart(u32 id)
|
||||
+{
|
||||
+ void __iomem *gpio_base;
|
||||
+ u32 uart_en;
|
||||
+ u32 t;
|
||||
+
|
||||
+ switch (id) {
|
||||
+ case REV_ID_MAJOR_AR71XX:
|
||||
+ uart_en = AR71XX_GPIO_FUNC_UART_EN;
|
||||
+ break;
|
||||
+
|
||||
+ case REV_ID_MAJOR_AR7240:
|
||||
+ case REV_ID_MAJOR_AR7241:
|
||||
+ case REV_ID_MAJOR_AR7242:
|
||||
+ uart_en = AR724X_GPIO_FUNC_UART_EN;
|
||||
+ break;
|
||||
+
|
||||
+ case REV_ID_MAJOR_AR913X:
|
||||
+ uart_en = AR913X_GPIO_FUNC_UART_EN;
|
||||
+ break;
|
||||
+
|
||||
+ case REV_ID_MAJOR_AR9330:
|
||||
+ case REV_ID_MAJOR_AR9331:
|
||||
+ uart_en = AR933X_GPIO_FUNC_UART_EN;
|
||||
+ break;
|
||||
+
|
||||
+ case REV_ID_MAJOR_AR9341:
|
||||
+ case REV_ID_MAJOR_AR9342:
|
||||
+ case REV_ID_MAJOR_AR9344:
|
||||
+ /* TODO */
|
||||
+ default:
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ gpio_base = (void __iomem *)(KSEG1ADDR(AR71XX_GPIO_BASE));
|
||||
+ t = __raw_readl(gpio_base + AR71XX_GPIO_REG_FUNC);
|
||||
+ t |= uart_en;
|
||||
+ __raw_writel(t, gpio_base + AR71XX_GPIO_REG_FUNC);
|
||||
+}
|
||||
+
|
||||
static void prom_putchar_init(void)
|
||||
{
|
||||
void __iomem *base;
|
||||
@@ -85,8 +125,10 @@ static void prom_putchar_init(void)
|
||||
|
||||
default:
|
||||
_prom_putchar = prom_putchar_dummy;
|
||||
- break;
|
||||
+ return;
|
||||
}
|
||||
+
|
||||
+ prom_enable_uart(id);
|
||||
}
|
||||
|
||||
void prom_putchar(unsigned char ch)
|
|
@ -0,0 +1,153 @@
|
|||
--- a/arch/mips/ath79/mach-pb44.c
|
||||
+++ b/arch/mips/ath79/mach-pb44.c
|
||||
@@ -8,23 +8,48 @@
|
||||
* by the Free Software Foundation.
|
||||
*/
|
||||
|
||||
+#include <linux/delay.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/i2c-gpio.h>
|
||||
#include <linux/i2c/pcf857x.h>
|
||||
+#include <linux/i2c/pcf857x.h>
|
||||
+#include <linux/spi/flash.h>
|
||||
+#include <linux/spi/vsc7385.h>
|
||||
|
||||
-#include "machtypes.h"
|
||||
+#include <asm/mach-ath79/ar71xx_regs.h>
|
||||
+#include <asm/mach-ath79/ath79.h>
|
||||
+
|
||||
+#include "dev-eth.h"
|
||||
#include "dev-gpio-buttons.h"
|
||||
#include "dev-leds-gpio.h"
|
||||
#include "dev-spi.h"
|
||||
#include "dev-usb.h"
|
||||
+#include "machtypes.h"
|
||||
#include "pci.h"
|
||||
|
||||
#define PB44_GPIO_I2C_SCL 0
|
||||
#define PB44_GPIO_I2C_SDA 1
|
||||
|
||||
+#define PB44_PCF8757_VSC7395_CS 0
|
||||
+#define PB44_PCF8757_STEREO_CS 1
|
||||
+#define PB44_PCF8757_SLIC_CS0 2
|
||||
+#define PB44_PCF8757_SLIC_TEST 3
|
||||
+#define PB44_PCF8757_SLIC_INT0 4
|
||||
+#define PB44_PCF8757_SLIC_INT1 5
|
||||
+#define PB44_PCF8757_SW_RESET 6
|
||||
+#define PB44_PCF8757_SW_JUMP 8
|
||||
+#define PB44_PCF8757_LED_JUMP1 9
|
||||
+#define PB44_PCF8757_LED_JUMP2 10
|
||||
+#define PB44_PCF8757_TP24 11
|
||||
+#define PB44_PCF8757_TP25 12
|
||||
+#define PB44_PCF8757_TP26 13
|
||||
+#define PB44_PCF8757_TP27 14
|
||||
+#define PB44_PCF8757_TP28 15
|
||||
+
|
||||
#define PB44_GPIO_EXP_BASE 16
|
||||
+#define PB44_GPIO_VSC7395_CS (PB44_GPIO_EXP_BASE + PB44_PCF8757_VSC7395_CS)
|
||||
#define PB44_GPIO_SW_RESET (PB44_GPIO_EXP_BASE + 6)
|
||||
#define PB44_GPIO_SW_JUMP (PB44_GPIO_EXP_BASE + 8)
|
||||
#define PB44_GPIO_LED_JUMP1 (PB44_GPIO_EXP_BASE + 9)
|
||||
@@ -92,21 +117,66 @@ static struct ath79_spi_controller_data
|
||||
.cs_line = 0,
|
||||
};
|
||||
|
||||
+static struct ath79_spi_controller_data pb44_spi1_data = {
|
||||
+ .cs_type = ATH79_SPI_CS_TYPE_GPIO,
|
||||
+ .cs_line = PB44_GPIO_VSC7395_CS,
|
||||
+};
|
||||
+
|
||||
+static void pb44_vsc7395_reset(void)
|
||||
+{
|
||||
+ ath79_device_reset_set(AR71XX_RESET_GE1_PHY);
|
||||
+ udelay(10);
|
||||
+ ath79_device_reset_clear(AR71XX_RESET_GE1_PHY);
|
||||
+ mdelay(50);
|
||||
+}
|
||||
+
|
||||
+static struct vsc7385_platform_data pb44_vsc7395_data = {
|
||||
+ .reset = pb44_vsc7395_reset,
|
||||
+ .ucode_name = "vsc7395_ucode_pb44.bin",
|
||||
+ .mac_cfg = {
|
||||
+ .tx_ipg = 6,
|
||||
+ .bit2 = 1,
|
||||
+ .clk_sel = 0,
|
||||
+ },
|
||||
+};
|
||||
+
|
||||
+static const char *pb44_part_probes[] = {
|
||||
+ "RedBoot",
|
||||
+ NULL,
|
||||
+};
|
||||
+
|
||||
+static struct flash_platform_data pb44_flash_data = {
|
||||
+ .part_probes = pb44_part_probes,
|
||||
+};
|
||||
+
|
||||
static struct spi_board_info pb44_spi_info[] = {
|
||||
{
|
||||
.bus_num = 0,
|
||||
.chip_select = 0,
|
||||
.max_speed_hz = 25000000,
|
||||
.modalias = "m25p64",
|
||||
+ .platform_data = &pb44_flash_data,
|
||||
.controller_data = &pb44_spi0_data,
|
||||
},
|
||||
+ {
|
||||
+ .bus_num = 0,
|
||||
+ .chip_select = 1,
|
||||
+ .max_speed_hz = 25000000,
|
||||
+ .modalias = "spi-vsc7385",
|
||||
+ .platform_data = &pb44_vsc7395_data,
|
||||
+ .controller_data = &pb44_spi1_data,
|
||||
+ }
|
||||
};
|
||||
|
||||
static struct ath79_spi_platform_data pb44_spi_data = {
|
||||
.bus_num = 0,
|
||||
- .num_chipselect = 1,
|
||||
+ .num_chipselect = 2,
|
||||
};
|
||||
|
||||
+#define PB44_WAN_PHYMASK BIT(0)
|
||||
+#define PB44_LAN_PHYMASK 0
|
||||
+#define PB44_MDIO_PHYMASK (PB44_LAN_PHYMASK | PB44_WAN_PHYMASK)
|
||||
+
|
||||
static void __init pb44_init(void)
|
||||
{
|
||||
i2c_register_board_info(0, pb44_i2c_board_info,
|
||||
@@ -122,6 +192,22 @@ static void __init pb44_init(void)
|
||||
ARRAY_SIZE(pb44_spi_info));
|
||||
ath79_register_usb();
|
||||
ath79_register_pci();
|
||||
+
|
||||
+ ath79_register_mdio(0, ~PB44_MDIO_PHYMASK);
|
||||
+
|
||||
+ ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
|
||||
+ ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
|
||||
+ ath79_eth0_data.phy_mask = PB44_WAN_PHYMASK;
|
||||
+
|
||||
+ ath79_register_eth(0);
|
||||
+
|
||||
+ ath79_init_mac(ath79_eth1_data.mac_addr, ath79_mac_base, 1);
|
||||
+ ath79_eth1_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
|
||||
+ ath79_eth1_data.speed = SPEED_1000;
|
||||
+ ath79_eth1_data.duplex = DUPLEX_FULL;
|
||||
+ ath79_eth1_pll_data.pll_1000 = 0x110000;
|
||||
+
|
||||
+ ath79_register_eth(1);
|
||||
}
|
||||
|
||||
MIPS_MACHINE(ATH79_MACH_PB44, "PB44", "Atheros PB44 reference board",
|
||||
--- a/arch/mips/ath79/Kconfig
|
||||
+++ b/arch/mips/ath79/Kconfig
|
||||
@@ -58,6 +58,7 @@ config ATH79_MACH_DB120
|
||||
config ATH79_MACH_PB44
|
||||
bool "Atheros PB44 reference board"
|
||||
select SOC_AR71XX
|
||||
+ select ATH79_DEV_ETH
|
||||
select ATH79_DEV_GPIO_BUTTONS
|
||||
select ATH79_DEV_LEDS_GPIO
|
||||
select ATH79_DEV_SPI
|
|
@ -0,0 +1,166 @@
|
|||
--- a/arch/mips/ath79/dev-wmac.c
|
||||
+++ b/arch/mips/ath79/dev-wmac.c
|
||||
@@ -148,6 +148,137 @@ static void qca955x_wmac_setup(void)
|
||||
ath79_wmac_data.is_clk_25mhz = true;
|
||||
}
|
||||
|
||||
+static bool __init
|
||||
+ar93xx_wmac_otp_read_word(void __iomem *base, int addr, u32 *data)
|
||||
+{
|
||||
+ int timeout = 1000;
|
||||
+ u32 val;
|
||||
+
|
||||
+ __raw_readl(base + AR9300_OTP_BASE + (4 * addr));
|
||||
+ while (timeout--) {
|
||||
+ val = __raw_readl(base + AR9300_OTP_STATUS);
|
||||
+ if ((val & AR9300_OTP_STATUS_TYPE) == AR9300_OTP_STATUS_VALID)
|
||||
+ break;
|
||||
+
|
||||
+ udelay(10);
|
||||
+ }
|
||||
+
|
||||
+ if (!timeout)
|
||||
+ return false;
|
||||
+
|
||||
+ *data = __raw_readl(base + AR9300_OTP_READ_DATA);
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+static bool __init
|
||||
+ar93xx_wmac_otp_read(void __iomem *base, int addr, u8 *dest, int len)
|
||||
+{
|
||||
+ u32 data;
|
||||
+ int i;
|
||||
+
|
||||
+ for (i = 0; i < len; i++) {
|
||||
+ int offset = 8 * ((addr - i) % 4);
|
||||
+
|
||||
+ if (!ar93xx_wmac_otp_read_word(base, (addr - i) / 4, &data))
|
||||
+ return false;
|
||||
+
|
||||
+ dest[i] = (data >> offset) & 0xff;
|
||||
+ }
|
||||
+
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
+static bool __init
|
||||
+ar93xx_wmac_otp_uncompress(void __iomem *base, int addr, int len, u8 *dest,
|
||||
+ int dest_start, int dest_len)
|
||||
+{
|
||||
+ int dest_bytes = 0;
|
||||
+ int offset = 0;
|
||||
+ int end = addr - len;
|
||||
+ u8 hdr[2];
|
||||
+
|
||||
+ while (addr > end) {
|
||||
+ if (!ar93xx_wmac_otp_read(base, addr, hdr, 2))
|
||||
+ return false;
|
||||
+
|
||||
+ addr -= 2;
|
||||
+ offset += hdr[0];
|
||||
+
|
||||
+ if (offset <= dest_start + dest_len &&
|
||||
+ offset + len >= dest_start) {
|
||||
+ int data_offset = 0;
|
||||
+ int dest_offset = 0;
|
||||
+ int copy_len;
|
||||
+
|
||||
+ if (offset < dest_start)
|
||||
+ data_offset = dest_start - offset;
|
||||
+ else
|
||||
+ dest_offset = offset - dest_start;
|
||||
+
|
||||
+ copy_len = len - data_offset;
|
||||
+ if (copy_len > dest_len - dest_offset)
|
||||
+ copy_len = dest_len - dest_offset;
|
||||
+
|
||||
+ ar93xx_wmac_otp_read(base, addr - data_offset,
|
||||
+ dest + dest_offset,
|
||||
+ copy_len);
|
||||
+
|
||||
+ dest_bytes += copy_len;
|
||||
+ }
|
||||
+ addr -= hdr[1];
|
||||
+ }
|
||||
+ return !!dest_bytes;
|
||||
+}
|
||||
+
|
||||
+bool __init ar93xx_wmac_read_mac_address(u8 *dest)
|
||||
+{
|
||||
+ void __iomem *base;
|
||||
+ bool ret = false;
|
||||
+ int addr = 0x1ff;
|
||||
+ unsigned int len;
|
||||
+ u32 hdr_u32;
|
||||
+ u8 *hdr = (u8 *) &hdr_u32;
|
||||
+ u8 mac[6] = { 0x00, 0x02, 0x03, 0x04, 0x05, 0x06 };
|
||||
+ int mac_start = 2, mac_end = 8;
|
||||
+
|
||||
+ BUG_ON(!soc_is_ar933x() && !soc_is_ar934x());
|
||||
+ base = ioremap_nocache(AR933X_WMAC_BASE, AR933X_WMAC_SIZE);
|
||||
+ while (addr > sizeof(hdr)) {
|
||||
+ if (!ar93xx_wmac_otp_read(base, addr, hdr, sizeof(hdr)))
|
||||
+ break;
|
||||
+
|
||||
+ if (hdr_u32 == 0 || hdr_u32 == ~0)
|
||||
+ break;
|
||||
+
|
||||
+ len = (hdr[1] << 4) | (hdr[2] >> 4);
|
||||
+ addr -= 4;
|
||||
+
|
||||
+ switch (hdr[0] >> 5) {
|
||||
+ case 0:
|
||||
+ if (len < mac_end)
|
||||
+ break;
|
||||
+
|
||||
+ ar93xx_wmac_otp_read(base, addr - mac_start, mac, 6);
|
||||
+ ret = true;
|
||||
+ break;
|
||||
+ case 3:
|
||||
+ ret |= ar93xx_wmac_otp_uncompress(base, addr, len, mac,
|
||||
+ mac_start, 6);
|
||||
+ break;
|
||||
+ default:
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ addr -= len + 2;
|
||||
+ }
|
||||
+
|
||||
+ iounmap(base);
|
||||
+ if (ret)
|
||||
+ memcpy(dest, mac, 6);
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+
|
||||
void __init ath79_register_wmac(u8 *cal_data, u8 *mac_addr)
|
||||
{
|
||||
if (soc_is_ar913x())
|
||||
--- a/arch/mips/ath79/dev-wmac.h
|
||||
+++ b/arch/mips/ath79/dev-wmac.h
|
||||
@@ -13,5 +13,6 @@
|
||||
#define _ATH79_DEV_WMAC_H
|
||||
|
||||
void ath79_register_wmac(u8 *cal_data, u8 *mac_addr);
|
||||
+bool ar93xx_wmac_read_mac_address(u8 *dest);
|
||||
|
||||
#endif /* _ATH79_DEV_WMAC_H */
|
||||
--- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
|
||||
+++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h
|
||||
@@ -129,6 +129,14 @@
|
||||
#define QCA955X_NFC_BASE 0x1b000200
|
||||
#define QCA955X_NFC_SIZE 0xb8
|
||||
|
||||
+#define AR9300_OTP_BASE 0x14000
|
||||
+#define AR9300_OTP_STATUS 0x15f18
|
||||
+#define AR9300_OTP_STATUS_TYPE 0x7
|
||||
+#define AR9300_OTP_STATUS_VALID 0x4
|
||||
+#define AR9300_OTP_STATUS_ACCESS_BUSY 0x2
|
||||
+#define AR9300_OTP_STATUS_SM_BUSY 0x1
|
||||
+#define AR9300_OTP_READ_DATA 0x15f1c
|
||||
+
|
||||
/*
|
||||
* DDR_CTRL block
|
||||
*/
|
|
@ -0,0 +1,31 @@
|
|||
--- a/arch/mips/ath79/dev-wmac.c
|
||||
+++ b/arch/mips/ath79/dev-wmac.c
|
||||
@@ -279,6 +279,16 @@ bool __init ar93xx_wmac_read_mac_address
|
||||
return ret;
|
||||
}
|
||||
|
||||
+void __init ath79_wmac_disable_2ghz(void)
|
||||
+{
|
||||
+ ath79_wmac_data.disable_2ghz = true;
|
||||
+}
|
||||
+
|
||||
+void __init ath79_wmac_disable_5ghz(void)
|
||||
+{
|
||||
+ ath79_wmac_data.disable_5ghz = true;
|
||||
+}
|
||||
+
|
||||
void __init ath79_register_wmac(u8 *cal_data, u8 *mac_addr)
|
||||
{
|
||||
if (soc_is_ar913x())
|
||||
--- a/arch/mips/ath79/dev-wmac.h
|
||||
+++ b/arch/mips/ath79/dev-wmac.h
|
||||
@@ -13,6 +13,9 @@
|
||||
#define _ATH79_DEV_WMAC_H
|
||||
|
||||
void ath79_register_wmac(u8 *cal_data, u8 *mac_addr);
|
||||
+void ath79_wmac_disable_2ghz(void);
|
||||
+void ath79_wmac_disable_5ghz(void);
|
||||
+
|
||||
bool ar93xx_wmac_read_mac_address(u8 *dest);
|
||||
|
||||
#endif /* _ATH79_DEV_WMAC_H */
|
|
@ -0,0 +1,31 @@
|
|||
--- a/arch/mips/ath79/dev-wmac.c
|
||||
+++ b/arch/mips/ath79/dev-wmac.c
|
||||
@@ -76,10 +76,27 @@ static void __init ar913x_wmac_setup(voi
|
||||
|
||||
static int ar933x_wmac_reset(void)
|
||||
{
|
||||
+ int retries = 20;
|
||||
+
|
||||
ath79_device_reset_set(AR933X_RESET_WMAC);
|
||||
ath79_device_reset_clear(AR933X_RESET_WMAC);
|
||||
|
||||
- return 0;
|
||||
+ while (1) {
|
||||
+ u32 bootstrap;
|
||||
+
|
||||
+ bootstrap = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP);
|
||||
+ if ((bootstrap & AR933X_BOOTSTRAP_EEPBUSY) == 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ if (retries-- == 0)
|
||||
+ break;
|
||||
+
|
||||
+ udelay(10000);
|
||||
+ retries++;
|
||||
+ }
|
||||
+
|
||||
+ pr_err("ar933x: WMAC reset timed out");
|
||||
+ return -ETIMEDOUT;
|
||||
}
|
||||
|
||||
static int ar933x_r1_get_wmac_revision(void)
|
|
@ -0,0 +1,28 @@
|
|||
--- a/drivers/net/wireless/ath/ath9k/hw.c
|
||||
+++ b/drivers/net/wireless/ath/ath9k/hw.c
|
||||
@@ -1374,7 +1374,10 @@ static bool ath9k_hw_set_reset(struct at
|
||||
|
||||
REGWRITE_BUFFER_FLUSH(ah);
|
||||
|
||||
- udelay(50);
|
||||
+ if (AR_SREV_9100(ah))
|
||||
+ mdelay(10);
|
||||
+ else
|
||||
+ udelay(50);
|
||||
|
||||
REG_WRITE(ah, AR_RTC_RC, 0);
|
||||
if (!ath9k_hw_wait(ah, AR_RTC_RC, AR_RTC_RC_M, 0, AH_WAIT_TIMEOUT)) {
|
||||
@@ -1385,8 +1388,12 @@ static bool ath9k_hw_set_reset(struct at
|
||||
if (!AR_SREV_9100(ah))
|
||||
REG_WRITE(ah, AR_RC, 0);
|
||||
|
||||
- if (AR_SREV_9100(ah))
|
||||
+ if (AR_SREV_9100(ah) && type != ATH9K_RESET_WARM) {
|
||||
+ if (ah->external_reset)
|
||||
+ ah->external_reset();
|
||||
+
|
||||
udelay(50);
|
||||
+ }
|
||||
|
||||
return true;
|
||||
}
|
|
@ -1,20 +1,13 @@
|
|||
Index: package/base-files/files/sbin/sysupgrade
|
||||
===================================================================
|
||||
--- package/base-files/files/sbin/sysupgrade (Revision 35186)
|
||||
--- package/base-files/files/sbin/sysupgrade (Revision 35298)
|
||||
+++ package/base-files/files/sbin/sysupgrade (Arbeitskopie)
|
||||
@@ -76,6 +76,15 @@
|
||||
exit 1
|
||||
}
|
||||
|
||||
+if [ "$SAVE_CONFIG" = "1" -a "$FORCE" = "0" ]; then
|
||||
+ echo "Please let the image serve you with a new config."
|
||||
+ echo "Use -n flag to get the new config!"
|
||||
+ echo ""
|
||||
+ echo "If you don't want to flash a Freifunk-Image you can force"
|
||||
+ echo "a sysupgrade without -n using the -F parameter."
|
||||
+ exit 1
|
||||
+fi
|
||||
+
|
||||
[ -n "$ARGV" -a -n "$NEED_IMAGE" ] && {
|
||||
cat <<-EOF
|
||||
-b|--create-backup and -r|--restore-backup do not perform a firmware upgrade.
|
||||
@@ -90,7 +90,7 @@
|
||||
add_uci_conffiles() {
|
||||
local file="$1"
|
||||
( find $(sed -ne '/^[[:space:]]*$/d; /^#/d; p' \
|
||||
- /etc/sysupgrade.conf /lib/upgrade/keep.d/* 2>/dev/null) \
|
||||
+ /etc/sysupgrade.conf 2>/dev/null) \
|
||||
-type f 2>/dev/null;
|
||||
opkg list-changed-conffiles ) | sort -u > "$file"
|
||||
return 0
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
Index: trunk/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c
|
||||
===================================================================
|
||||
--- trunk/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c (revision 35535)
|
||||
+++ trunk/target/linux/ar71xx/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_ar7240.c (revision 35564)
|
||||
@@ -210,4 +210,5 @@
|
||||
|
||||
#define AR934X_REG_FLOOD_MASK 0x2c
|
||||
+#define AR934X_FLOOD_MASK_MC_DP(_p) BIT(16 + (_p))
|
||||
#define AR934X_FLOOD_MASK_BC_DP(_p) BIT(25 + (_p))
|
||||
|
||||
@@ -581,7 +582,8 @@
|
||||
ar7240sw_reg_set(mii, AR934X_REG_QM_CTRL,
|
||||
AR934X_QM_CTRL_ARP_EN);
|
||||
- /* Enable Broadcast frames transmitted to the CPU */
|
||||
+ /* Enable Broadcast/Multicast frames transmitted to the CPU */
|
||||
ar7240sw_reg_set(mii, AR934X_REG_FLOOD_MASK,
|
||||
- AR934X_FLOOD_MASK_BC_DP(0));
|
||||
+ AR934X_FLOOD_MASK_BC_DP(0) |
|
||||
+ AR934X_FLOOD_MASK_MC_DP(0));
|
||||
|
||||
/* Enable MIB counters */
|
51
buildscript
51
buildscript
|
@ -19,24 +19,27 @@ prepare() {
|
|||
#fix for building toolchain on texinfo>=5
|
||||
cp -a build_patches/toolchain $target
|
||||
|
||||
# This changes the default behavior of sysupgrade to not save the config
|
||||
cat build_patches/sysupgrade_no_config_save.patch | patch -p0 -d $target
|
||||
# This changes the default behavior of sysupgrade to not save the config
|
||||
cat build_patches/sysupgrade_no_config_save.patch | patch -p0 -d $target
|
||||
|
||||
# This adds the sysctl load just before the network comes up
|
||||
cat build_patches/invoke_sysctl_before_network.patch | patch -p0 -d $target
|
||||
# This adds the sysctl load just before the network comes up
|
||||
cat build_patches/invoke_sysctl_before_network.patch | patch -p0 -d $target
|
||||
|
||||
#backport ath9k-fixes from openwrt r35786
|
||||
cp build_patches/mac80211/* $target/package/mac80211/patches
|
||||
#backport mac80211
|
||||
svn up -r 38351 $target/package/mac80211
|
||||
svn up -r 37378 $target/target/linux/generic/files/include/linux/ath9k_platform.h
|
||||
|
||||
#backport kernelpatches from openwrt r36664
|
||||
cp build_patches/linux/ar71xx/patches-3.3/* $target/target/linux/ar71xx/patches-3.3
|
||||
|
||||
#batman-adv: distributed arp table fixes
|
||||
cat build_patches/changeset_35324.diff | patch -p1 -d $target/feeds
|
||||
|
||||
#batman-adv: fix dat NULL pointer dereference
|
||||
cat build_patches/changeset_35609.diff | patch -p1 -d $target/feeds
|
||||
|
||||
#saves ~200MB for each build
|
||||
mkdir ./dl
|
||||
ln -s ../../dl $target/dl
|
||||
#saves ~200MB for each build
|
||||
test -d ./dl || mkdir ./dl
|
||||
ln -s ../../dl $target/dl
|
||||
|
||||
board_prepare
|
||||
}
|
||||
|
@ -51,7 +54,7 @@ prebuild() {
|
|||
board_prebuild
|
||||
|
||||
#insert actual firware version informations into release file
|
||||
version=$(git describe --tags --dirty)
|
||||
version=$(git describe --tags --dirty)
|
||||
|
||||
echo "FIRMWARE_VERSION=\"$version\"" > $target/files/etc/firmware_release
|
||||
echo "RELEASE_DATE=\"build date: "`date`"\"" >> $target/files/etc/firmware_release
|
||||
|
@ -65,16 +68,17 @@ build() {
|
|||
|
||||
opath=$(pwd)
|
||||
cd $target
|
||||
cpus=$(grep processor /proc/cpuinfo | wc -l)
|
||||
|
||||
case "$1" in
|
||||
"debug")
|
||||
make V=99
|
||||
;;
|
||||
"fast")
|
||||
ionice -c 2 -- nice -n 1 -- make -j12
|
||||
ionice -c 2 -- nice -n 1 -- make -j$[$cpus*2]
|
||||
;;
|
||||
*)
|
||||
ionice -c 3 -- nice -n 10 -- make -j8
|
||||
ionice -c 3 -- nice -n 10 -- make -j$[$cpus+1]
|
||||
;;
|
||||
esac
|
||||
# actually this does northing!
|
||||
|
@ -102,6 +106,16 @@ clean() {
|
|||
/bin/rm -rf bin $builddir
|
||||
}
|
||||
|
||||
|
||||
buildall() {
|
||||
for bsp in $(cd bsp; /bin/ls *.bsp; cd ..)
|
||||
do
|
||||
./buildscript select $bsp
|
||||
./buildscript prepare
|
||||
./buildscript build $1
|
||||
done
|
||||
}
|
||||
|
||||
routers() {
|
||||
echo "router-types: "
|
||||
echo " dir300"
|
||||
|
@ -114,7 +128,7 @@ routers() {
|
|||
echo " wr1043nd"
|
||||
}
|
||||
|
||||
if [ "$1" != "select" ]; then
|
||||
if [ "$1" != "select" ] && [ "$1" != "buildall" ]; then
|
||||
if [ ! -h selected_bsp ]; then
|
||||
echo "Please select a Board-Support-Package using:"
|
||||
echo "$0 select"
|
||||
|
@ -194,6 +208,14 @@ case "$1" in
|
|||
clean
|
||||
fi
|
||||
;;
|
||||
"buildall")
|
||||
if [ "$2" = "help" ]; then
|
||||
echo "This option builds the firmware for all routers."
|
||||
echo "Usage: $0 $1"
|
||||
else
|
||||
buildall $2
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "This is the Build Environment Script of the Freifunk Community Oldenburg."
|
||||
echo "Usage: $0 command"
|
||||
|
@ -202,6 +224,7 @@ case "$1" in
|
|||
echo " build"
|
||||
echo " flash"
|
||||
echo " download"
|
||||
echo " buildall"
|
||||
echo ""
|
||||
echo "If you need help to one of these options just type $0 command help"
|
||||
;;
|
||||
|
|
Loading…
Reference in New Issue