Date:2012-09-03 04:22:12 (11 years 6 months ago)
Author:Xiangfu
Commit:7ff022349bcdc1ba87de072b050a1697bf037b25
Message:files for compile MR11U as nanonote wifi gadget

Files: nanonote-TLWR11U/data/conf/config.minimal (1 diff)
nanonote-TLWR11U/data/conf/feeds.conf (1 diff)
nanonote-TLWR11U/files/etc/config/dhcp (1 diff)
nanonote-TLWR11U/files/etc/config/firewall (1 diff)
nanonote-TLWR11U/files/etc/config/fstab (1 diff)
nanonote-TLWR11U/files/etc/config/network (1 diff)
nanonote-TLWR11U/files/etc/config/uhttpd (1 diff)
nanonote-TLWR11U/files/opt/m1-wireless.lua (1 diff)
nanonote-TLWR11U/files/opt/m1-wireless.sh (1 diff)

Change Details

nanonote-TLWR11U/data/conf/config.minimal
1#
2# This file must be copied to .config in the OpenWrt root folder,
3# then run: yes "" | make oldconfig > /dev/null
4#
5
6CONFIG_TARGET_ar71xx=y
7CONFIG_TARGET_ar71xx_generic=y
8CONFIG_TARGET_ar71xx_generic_TLWR703=y
9
10CONFIG_TARGET_ROOTFS_TARGZ=y
11CONFIG_TARGET_ROOTFS_JFFS2=y
12CONFIG_TARGET_ROOTFS_SQUASHFS=y
13
14# CONFIG_BUILD_PATENTED is not set
15
16CONFIG_DEVEL=y
17CONFIG_TOOLCHAINOPTS=y
18CONFIG_GDB=y
19
20# CONFIG_SDK is not set
21
22# CONFIG_ALL is not set
23# Enable this option only you want build ALL PAKCAGE in feeds.conf
24# To skip broken module packages while compiling , run "make IGNORE_ERRORS=m"
25
26CONFIG_PACKAGE_block-mount=y
27
28CONFIG_PACKAGE_luci=y
29CONFIG_PACKAGE_luci-mod-admin-core=y
30CONFIG_PACKAGE_luci-mod-admin-full=y
31CONFIG_PACKAGE_luci-mod-rpc=y
32
33CONFIG_PACKAGE_kmod-fs-ext4=y
34CONFIG_PACKAGE_kmod-ipv6=m
35CONFIG_PACKAGE_kmod-tun=m
36
37CONFIG_PACKAGE_kmod-usb-core=y
38CONFIG_PACKAGE_kmod-usb-serial=m
39CONFIG_PACKAGE_kmod-usb-serial-ftdi=m
40CONFIG_PACKAGE_kmod-usb-serial-pl2303=m
41CONFIG_PACKAGE_kmod-usb-storage=y
42CONFIG_PACKAGE_kmod-usb2=y
43CONFIG_PACKAGE_kmod-video-core=m
44CONFIG_PACKAGE_kmod-video-uvc=m
45CONFIG_PACKAGE_kmod-video-videobuf2=m
46CONFIG_PACKAGE_kmod-at86rf230=m
47CONFIG_PACKAGE_kmod-ieee802154=m
48CONFIG_PACKAGE_kmod-mac802154=m
49CONFIG_PACKAGE_kmod-spi_atusb=m
50
51CONFIG_PACKAGE_ip=m
52CONFIG_PACKAGE_dirtpan=m
53CONFIG_PACKAGE_lowpan-tools=m
54CONFIG_PACKAGE_mjpg-streamer=m
55CONFIG_PACKAGE_swap-utils=y
56CONFIG_PACKAGE_mount-utils=m
57CONFIG_PACKAGE_strace=m
58CONFIG_PACKAGE_urjtag=m
59CONFIG_PACKAGE_xburst-tools=m
nanonote-TLWR11U/data/conf/feeds.conf
1src-git qipackages git://projects.qi-hardware.com/openwrt-packages.git
2src-svn packages svn://svn.openwrt.org/openwrt/packages
3src-svn desktop svn://svn.openwrt.org/openwrt/feeds/desktop
4
5src-svn xwrt http://x-wrt.googlecode.com/svn/trunk/package
6src-svn luci http://svn.luci.subsignal.org/luci/trunk/contrib/package
7src-svn xorg svn://svn.openwrt.org/openwrt/feeds/xorg
8
9src-svn phone svn://svn.openwrt.org/openwrt/feeds/phone
10src-svn efl svn://svn.openwrt.org/openwrt/feeds/efl
nanonote-TLWR11U/files/etc/config/dhcp
1
2config 'dnsmasq'
3    option 'domainneeded' '1'
4    option 'boguspriv' '1'
5    option 'filterwin2k' '0'
6    option 'localise_queries' '1'
7    option 'rebind_protection' '1'
8    option 'rebind_localhost' '1'
9    option 'local' '/lan/'
10    option 'domain' 'lan'
11    option 'expandhosts' '1'
12    option 'nonegcache' '0'
13    option 'authoritative' '1'
14    option 'readethers' '1'
15    option 'leasefile' '/tmp/dhcp.leases'
16    option 'resolvfile' '/tmp/resolv.conf.auto'
17
18config 'dhcp' 'lan'
19    option 'interface' 'lan'
20    option 'start' '100'
21    option 'leasetime' '12h'
22    option 'limit' '1'
23
24config 'dhcp' 'wan'
25    option 'interface' 'wan'
26    option 'ignore' '1'
27
nanonote-TLWR11U/files/etc/config/firewall
1
2config defaults
3    option syn_flood '1'
4    option input 'ACCEPT'
5    option output 'ACCEPT'
6    option forward 'REJECT'
7
8config zone
9    option name 'lan'
10    option input 'ACCEPT'
11    option output 'ACCEPT'
12    option forward 'REJECT'
13    option network 'lan USB'
14
15config zone
16    option name 'wan'
17    option input 'REJECT'
18    option output 'ACCEPT'
19    option forward 'REJECT'
20    option masq '1'
21    option mtu_fix '1'
22    option network 'wan wwan'
23
24config forwarding
25    option src 'lan'
26    option dest 'wan'
27
28config rule
29    option name 'Allow-DHCP-Renew'
30    option src 'wan'
31    option proto 'udp'
32    option dest_port '68'
33    option target 'ACCEPT'
34    option family 'ipv4'
35
36config rule
37    option name 'Allow-Ping'
38    option src 'wan'
39    option proto 'icmp'
40    option icmp_type 'echo-request'
41    option family 'ipv4'
42    option target 'ACCEPT'
43
44config rule
45    option name 'Allow-DHCPv6'
46    option src 'wan'
47    option proto 'udp'
48    option src_ip 'fe80::/10'
49    option src_port '547'
50    option dest_ip 'fe80::/10'
51    option dest_port '546'
52    option family 'ipv6'
53    option target 'ACCEPT'
54
55config rule
56    option name 'Allow-ICMPv6-Input'
57    option src 'wan'
58    option proto 'icmp'
59    list icmp_type 'echo-request'
60    list icmp_type 'destination-unreachable'
61    list icmp_type 'packet-too-big'
62    list icmp_type 'time-exceeded'
63    list icmp_type 'bad-header'
64    list icmp_type 'unknown-header-type'
65    list icmp_type 'router-solicitation'
66    list icmp_type 'neighbour-solicitation'
67    option limit '1000/sec'
68    option family 'ipv6'
69    option target 'ACCEPT'
70
71config rule
72    option name 'Allow-ICMPv6-Forward'
73    option src 'wan'
74    option dest '*'
75    option proto 'icmp'
76    list icmp_type 'echo-request'
77    list icmp_type 'destination-unreachable'
78    list icmp_type 'packet-too-big'
79    list icmp_type 'time-exceeded'
80    list icmp_type 'bad-header'
81    list icmp_type 'unknown-header-type'
82    option limit '1000/sec'
83    option family 'ipv6'
84    option target 'ACCEPT'
85
86config include
87    option path '/etc/firewall.user'
88
89config zone
90    option name 'newzone'
91    option input 'ACCEPT'
92    option forward 'REJECT'
93    option network ' '
94    option output 'ACCEPT'
95
96config rule
97    option target 'ACCEPT'
98    option src 'wan'
99    option dest_port '22'
100    option name 'ssh'
101    option family 'ipv4'
102    option proto 'tcp udp'
103
104config rule
105    option target 'ACCEPT'
106    option src 'wan'
107    option dest_port '80'
108    option name 'web'
109    option family 'ipv4'
110    option proto 'tcp udp'
111
112config redirect
113    option target 'DNAT'
114    option src 'wan'
115    option dest 'lan'
116    option proto 'tcp udp'
117    option src_dport '4444'
118    option dest_ip '192.168.42.100'
119    option dest_port '4444'
120    option name 'osc'
121
122config redirect
123    option target 'DNAT'
124    option src 'wan'
125    option dest 'lan'
126    option proto 'tcp'
127    option src_dport '21'
128    option dest_ip '192.168.42.100'
129    option dest_port '21'
130    option name 'ftp'
131
132config redirect
133    option target 'DNAT'
134    option src 'wan'
135    option dest 'lan'
136    option proto 'tcp udp'
137    option src_dport '23'
138    option dest_ip '192.168.42.100'
139    option dest_port '23'
140    option name 'telnet'
141
142config rule
143    option target 'ACCEPT'
144    option src 'wan'
145    option proto 'tcp udp'
146    option dest_port '8080'
147    option name 'mjpg'
148
nanonote-TLWR11U/files/etc/config/fstab
1config global automount
2    option from_fstab 1
3    option anon_mount 1
4
5config global autoswap
6    option from_fstab 1
7    option anon_swap 0
8
9config mount
10    option target /overlay
11    option device /dev/sda1
12    option fstype ext4
13    option options rw,sync
14    option enabled 1
15    option enabled_fsck 0
16
17config swap
18    option device /dev/sda2
19    option enabled 1
nanonote-TLWR11U/files/etc/config/network
1
2config interface 'loopback'
3    option ifname 'lo'
4    option proto 'static'
5    option ipaddr '127.0.0.1'
6    option netmask '255.0.0.0'
7
8config interface 'lan'
9    option ifname 'eth0'
10    option type 'bridge'
11    option proto 'static'
12    option netmask '255.255.255.0'
13    option ipaddr '192.168.42.1'
14
15config interface 'wwan'
16    option proto 'dhcp'
17
18config interface 'USB'
19    option type 'bridge'
20    option proto 'static'
21    option ifname 'usb0'
22    option ipaddr '192.168.254.100'
23    option netmask '255.255.255.0'
24
nanonote-TLWR11U/files/etc/config/uhttpd
1# Server configuration
2config uhttpd main
3
4    # HTTP listen addresses, multiple allowed
5    list listen_http 0.0.0.0:80
6# list listen_http [::]:80
7
8    # HTTPS listen addresses, multiple allowed
9    list listen_https 0.0.0.0:443
10# list listen_https [::]:443
11
12    # Server document root
13    option home /www
14
15    # Reject requests from RFC1918 IP addresses
16    # directed to the servers public IP(s).
17    # This is a DNS rebinding countermeasure.
18    option rfc1918_filter 1
19
20    # Certificate and private key for HTTPS.
21    # If no listen_https addresses are given,
22    # the key options are ignored.
23    option cert /etc/uhttpd.crt
24    option key /etc/uhttpd.key
25
26    # CGI url prefix, will be searched in docroot.
27    # Default is /cgi-bin
28    option cgi_prefix /cgi-bin
29
30    # List of extension->interpreter mappings.
31    # Files with an associated interpreter can
32    # be called outside of the CGI prefix and do
33    # not need to be executable.
34# list interpreter ".php=/usr/bin/php-cgi"
35# list interpreter ".cgi=/usr/bin/perl"
36
37    # Lua url prefix and handler script.
38    # Lua support is disabled if no prefix given.
39# option lua_prefix /luci
40# option lua_handler /usr/lib/lua/luci/sgi/uhttpd.lua
41
42    # CGI/Lua timeout, if the called script does not
43    # write data within the given amount of seconds,
44    # the server will terminate the request with
45    # 504 Gateway Timeout response.
46    option script_timeout 60
47
48    # Network timeout, if the current connection is
49    # blocked for the specified amount of seconds,
50    # the server will terminate the associated
51    # request process.
52    option network_timeout 30
53
54    # TCP Keep-Alive, send periodic keep-alive probes
55    # over established connections to detect dead peers.
56    # The value is given in seconds to specify the
57    # interval between subsequent probes.
58    # Setting this to 0 will disable TCP keep-alive.
59    option tcp_keepalive 1
60
61    # Basic auth realm, defaults to local hostname
62# option realm OpenWrt
63
64    # Configuration file in busybox httpd format
65# option config /etc/httpd.conf
66
67
68# Certificate defaults for px5g key generator
69config cert px5g
70
71    # Validity time
72    option days 730
73
74    # RSA key size
75    option bits 1024
76
77    # Location
78    option country DE
79    option state Berlin
80    option location Berlin
81
82    # Common name
83    option commonname OpenWrt
84
nanonote-TLWR11U/files/opt/m1-wireless.lua
1#!/usr/bin/env lua
2
3local io = require "io"
4local os = require "os"
5local table = require "table"
6
7function trim (s)
8    return (string.gsub(s, "^%s*(.-)%s*$", "%1"))
9end
10
11function split(delim, text)
12    local list = {}
13    if string.len(text) <= 0 then
14       return list
15    end
16    delim = delim or ""
17    local pos = 1
18    -- if delim matches empty string then it would give an endless loop
19    if string.find("", delim, 1) and delim ~= "" then
20       error("delim matches empty string!")
21    end
22    local first, last
23    while 1 do
24       if delim ~= "" then
25          first, last = string.find(text, delim, pos)
26       else
27          first, last = string.find(text, "%s+", pos)
28          if first == 1 then
29         pos = last+1
30         first, last = string.find(text, "%s+", pos)
31          end
32       end
33       if first then -- found?
34          table.insert(list, string.sub(text, pos, first-1))
35          pos = last+1
36       else
37          table.insert(list, string.sub(text, pos))
38          break
39       end
40    end
41    return list
42end
43
44function exec(command)
45        local pp = io.popen(command)
46        local data = pp:read("*a")
47    pp:close()
48
49        return data
50end
51
52function iwscan(iface)
53    local siface = iface or ""
54    local cnt = exec("iwlist "..siface.." scan 2>/dev/null")
55    local iws = {}
56
57    cnt = trim(cnt)
58    for i, l in pairs(split("\n Cell", cnt)) do
59       local ESSID = l:match("ESSID:\"(.-)\"")
60       if ESSID then
61          local Q = l:match("Quality[:=](.-)[ ]")
62          local A = l:match("Authentication Suites.- : (.-)\n")
63          local P = l:match("Pairwise Ciphers.- : (.-)\n")
64
65          local enc
66          if not l:find("Encryption key:on") then
67         enc = "none"
68          else
69         local wpa = l:find("WPA Version 1")
70         local rsn = l:find("WPA2 Version 1")
71         if wpa and rsn then enc = "psk+psk2"
72         elseif rsn then enc = "psk2"
73         elseif wpa then enc = "psk"
74         else enc = "wep" end
75          end
76
77          local a = Q:match("(%d-)/")
78          local b = Q:match("/(%d-)$")
79          Q = math.floor(tonumber(a)/tonumber(b)*100)
80
81          local r = Q .. "%," .. ESSID .. "," .. enc
82
83          table.insert(iws, r)
84       end
85    end
86
87    return iws
88end
89
90local t = iwscan("wlan0")
91if t == {} then
92    print();
93else
94    for k,v in pairs(t) do print(v) end
95end
96
nanonote-TLWR11U/files/opt/m1-wireless.sh
1#!/bin/sh
2
3if [ "$1" == "set" ] && [ "$#" == "4" ]; then
4  uci delete network.wwan
5  uci set network.wwan=interface
6  uci set network.wwan.proto=dhcp
7
8  uci delete wireless.@wifi-iface[0]
9  uci set wireless.@wifi-device[0].disabled=0
10  uci add wireless wifi-iface > /dev/null 2>&1
11  uci set wireless.@wifi-iface[0].device='radio0'
12  uci set wireless.@wifi-iface[0].network='wwan'
13  uci set wireless.@wifi-iface[0].mode='sta'
14
15  #none for an open network,
16  #wep for WEP,
17  #psk for WPA-PSK, or
18  #psk2
19
20  uci set wireless.@wifi-iface[0].ssid=$2
21  uci set wireless.@wifi-iface[0].key=$3
22  uci set wireless.@wifi-iface[0].encryption=$4
23
24  uci commit network
25  uci commit wireless
26  ifup wwan
27  sleep 2
28
29  exit 0
30fi
31
32
33if [ "$1" == "get" ]; then
34  ifconfig -a | grep wlan0 > /dev/null 2>&1
35
36  if [ "$?" != "0" ]; then
37    iw phy phy0 interface add wlan0 type station
38    ifconfig wlan0 up
39    sleep 1
40  fi
41
42  /opt/m1-wireless.lua
43
44  exit 0
45fi
46
47if [ "$1" == "status" ]; then
48  sleep 1
49  IP=`ifconfig wlan0 2>/dev/null | grep "inet addr" | \
50      sed -e 's/^ *//g' | cut -d":" -f2 | cut -d" " -f1`
51  if [ "$?" != 0 ] || [ "${IP}" == "" ]; then
52    echo "Disconnected"
53    echo "0.0.0.0"
54    exit 1
55  fi
56
57  ESSID=`iwconfig wlan0 2>/dev/null | grep ESSID | cut -d":" -f 2 | sed -e 's/\"//g'`
58
59  echo "${ESSID}"
60  echo "${IP}"
61
62  exit 0
63fi
64
65echo "Usage: $0 [get/set/status] PARAMS..."
66exit 1

Archive Download the corresponding diff file



interactive