1. 小K没有RJ45接口, 只能通过无线连接. 在蓝灯慢闪时可以搜到无线OK_SP3, 连接此即可. 无密码.
连接成功后, 可以看到网关为192.168.10.253, 此IP就是我们下步要用到的.
2. ssh登陆192.168.10.253, 用户名: root, 密码: admin.
用的openwrt的r39365版本, 余下空间790K左右, 删除了opkg, 需重新拷贝2个文件, /bin/opkg, /etc/opkg.conf
-
root@OpenWrt:~# logread
-
Thu Jan 1 08:00:11 1970 kern.notice kernel: [ 0.000000] Linux version 3.10.26 (zhaoyuanbiao@ubuntu) (gcc version 4.6.4 (OpenWrt/Linaro GCC 4.6-2013.05 r39365) ) #2 Thu Mar 27 18:14:15 CST 2014
-
Thu Jan 1 08:00:11 1970 kern.debug kernel: [ 0.000000] MyLoader: sysp=00d73bc7, boardp=ed0c292e, parts=97cba183
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.000000] bootconsole [early0] enabled
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.000000] CPU revision is: 00019374 (MIPS 24Kc)
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.000000] SoC: Atheros AR9330 rev 1
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.000000] Clocks: CPU:400.000MHz, DDR:400.000MHz, AHB:200.000MHz, Ref:25.000MHz
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.000000] Determined physical RAM map:
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.000000] memory: 02000000 @ 00000000 (usable)
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.000000] Initrd not found or empty - disabling initrd
-
Thu Jan 1 08:00:11 1970 kern.warn kernel: [ 0.000000] Zone ranges:
-
Thu Jan 1 08:00:11 1970 kern.warn kernel: [ 0.000000] Normal [mem 0x00000000-0x01ffffff]
-
Thu Jan 1 08:00:11 1970 kern.warn kernel: [ 0.000000] Movable zone start for each node
-
Thu Jan 1 08:00:11 1970 kern.warn kernel: [ 0.000000] Early memory node ranges
-
Thu Jan 1 08:00:11 1970 kern.warn kernel: [ 0.000000] node 0: [mem 0x00000000-0x01ffffff]
-
Thu Jan 1 08:00:11 1970 kern.debug kernel: [ 0.000000] On node 0 totalpages: 8192
-
Thu Jan 1 08:00:11 1970 kern.debug kernel: [ 0.000000] free_area_init_node: node 0, pgdat 803049b0, node_mem_map 81000000
-
Thu Jan 1 08:00:11 1970 kern.debug kernel: [ 0.000000] Normal zone: 64 pages used for memmap
-
Thu Jan 1 08:00:11 1970 kern.debug kernel: [ 0.000000] Normal zone: 0 pages reserved
-
Thu Jan 1 08:00:11 1970 kern.debug kernel: [ 0.000000] Normal zone: 8192 pages, LIFO batch:0
-
Thu Jan 1 08:00:11 1970 kern.warn kernel: [ 0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
-
Thu Jan 1 08:00:11 1970 kern.warn kernel: [ 0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
-
Thu Jan 1 08:00:11 1970 kern.debug kernel: [ 0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
-
Thu Jan 1 08:00:11 1970 kern.debug kernel: [ 0.000000] pcpu-alloc: [0] 0
-
Thu Jan 1 08:00:11 1970 kern.warn kernel: [ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 8128
-
Thu Jan 1 08:00:11 1970 kern.notice kernel: [ 0.000000] Kernel command line: board=TL-WR703N console=ttyATH0,115200 rootfstype=squashfs,jffs2 noinitrd
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.000000] PID hash table entries: 128 (order: -3, 512 bytes)
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.000000] Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.000000] Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.000000] Writing ErrCtl register=00000000
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.000000] Readback ErrCtl register=00000000
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.000000] Memory: 28784k/32768k available (2201k kernel code, 3984k reserved, 592k data, 276k init, 0k highmem)
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.000000] NR_IRQS:51
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.080000] Calibrating delay loop... 265.42 BogoMIPS (lpj=1327104)
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.080000] pid_max: default: 32768 minimum: 301
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.080000] Mount-cache hash table entries: 512
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.090000] NET: Registered protocol family 16
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.100000] MIPS: machine is TP-LINK TL-WR703N v1
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.350000] bio: create slab <bio-0> at 0
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.360000] Switching to clocksource MIPS
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.360000] NET: Registered protocol family 2
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.370000] TCP established hash table entries: 512 (order: 0, 4096 bytes)
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.370000] TCP bind hash table entries: 512 (order: -1, 2048 bytes)
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.370000] TCP: Hash tables configured (established 512 bind 512)
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.380000] TCP: reno registered
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.380000] UDP hash table entries: 256 (order: 0, 4096 bytes)
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.390000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.400000] NET: Registered protocol family 1
-
Thu Jan 1 08:00:11 1970 kern.debug kernel: [ 0.400000] PCI: CLS 0 bytes, default 32
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.420000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.420000] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.430000] msgmni has been set to 56
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.440000] io scheduler noop registered
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.440000] io scheduler deadline registered (default)
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.450000] Serial: 8250/16550 driver, 1 ports, IRQ sharing disabled
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.450000] ar933x-uart: ttyATH0 at MMIO 0x18020000 (irq = 11) is a AR933X UART
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.460000] console [ttyATH0] enabled, bootconsole disabled
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.470000] ath79-spi ath79-spi: master is unqueued, this is deprecated
-
Thu Jan 1 08:00:11 1970 kern.warn kernel: [ 0.480000] m25p80 spi0.0: found w25q32, expected m25p80
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.480000] m25p80 spi0.0: w25q32 (4096 Kbytes)
-
Thu Jan 1 08:00:11 1970 kern.notice kernel: [ 0.490000] 5 tp-link partitions found on MTD device spi0.0
-
Thu Jan 1 08:00:11 1970 kern.notice kernel: [ 0.490000] Creating 5 MTD partitions on "spi0.0":
-
Thu Jan 1 08:00:11 1970 kern.notice kernel: [ 0.500000] 0x000000000000-0x000000020000 : "u-boot"
-
Thu Jan 1 08:00:11 1970 kern.notice kernel: [ 0.500000] 0x000000020000-0x0000001199c0 : "kernel"
-
Thu Jan 1 08:00:11 1970 kern.warn kernel: [ 0.510000] mtd: partition "kernel" must either start or end on erase block boundary or be smaller than an erase block -- forcing read-only
-
Thu Jan 1 08:00:11 1970 kern.notice kernel: [ 0.520000] 0x0000001199c0-0x0000003f0000 : "rootfs"
-
Thu Jan 1 08:00:11 1970 kern.warn kernel: [ 0.530000] mtd: partition "rootfs" must either start or end on erase block boundary or be smaller than an erase block -- forcing read-only
-
Thu Jan 1 08:00:11 1970 kern.notice kernel: [ 0.540000] mtd: device 2 (rootfs) set to be root filesystem
-
Thu Jan 1 08:00:11 1970 kern.notice kernel: [ 0.540000] 1 squashfs-split partitions found on MTD device rootfs
-
Thu Jan 1 08:00:11 1970 kern.notice kernel: [ 0.550000] 0x0000002f0000-0x0000003f0000 : "rootfs_data"
-
Thu Jan 1 08:00:11 1970 kern.notice kernel: [ 0.560000] 0x0000003f0000-0x000000400000 : "art"
-
Thu Jan 1 08:00:11 1970 kern.notice kernel: [ 0.560000] 0x000000020000-0x0000003f0000 : "firmware"
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 0.580000] libphy: ag71xx_mdio: probed
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 1.140000] ag71xx ag71xx.0: connected to PHY at ag71xx-mdio.1:04 [uid=004dd041, driver=Generic PHY]
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 1.150000] eth0: Atheros AG71xx at 0xb9000000, irq 4, mode:MII
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 1.150000] TCP: cubic registered
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 1.150000] NET: Registered protocol family 17
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 1.160000] 8021q: 802.1Q VLAN Support v1.8
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 1.170000] VFS: Mounted root (squashfs filesystem) readonly on device 31:2.
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 1.180000] Freeing unused kernel memory: 276K (8031b000 - 80360000)
-
Thu Jan 1 08:00:11 1970 kern.notice kernel: [ 7.550000] jffs2: notice: (294) jffs2_build_xattr_subsystem: complete building xattr subsystem, 4 of xdatum (1 unchecked, 3 orphan) and 60 of xref (0 dead, 47 orphan) found.
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 8.740000] NET: Registered protocol family 10
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 8.750000] nf_conntrack version 0.5.0 (454 buckets, 1816 max)
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 8.770000] ip6_tables: (C) 2000-2006 Netfilter Core Team
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 8.790000] Loading modules backported from Linux version master-2013-11-05-0-gafa3093
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 8.800000] Backport generated by backports.git backports-20130802-0-gdb67a3f
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 8.810000] ip_tables: (C) 2000-2006 Netfilter Core Team
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 8.860000] xt_time: kernel timezone is -0000
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 8.890000] cfg80211: Calling CRDA to update world regulatory domain
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 8.890000] cfg80211: World regulatory domain updated:
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 8.900000] cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 8.900000] cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 8.910000] cfg80211: (2457000 KHz - 2482000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 8.920000] cfg80211: (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 8.930000] cfg80211: (5170000 KHz - 5250000 KHz @ 80000 KHz), (300 mBi, 2000 mBm)
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 8.930000] cfg80211: (5735000 KHz - 5835000 KHz @ 80000 KHz), (300 mBi, 2000 mBm)
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 8.940000] cfg80211: (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 0 mBm)
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 9.020000] PPP generic driver version 2.4.2
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 9.020000] NET: Registered protocol family 24
-
Thu Jan 1 08:00:11 1970 kern.debug kernel: [ 9.100000] ath: EEPROM regdomain: 0x0
-
Thu Jan 1 08:00:11 1970 kern.debug kernel: [ 9.100000] ath: EEPROM indicates default country code should be used
-
Thu Jan 1 08:00:11 1970 kern.debug kernel: [ 9.100000] ath: doing EEPROM country->regdmn map search
-
Thu Jan 1 08:00:11 1970 kern.debug kernel: [ 9.100000] ath: country maps to regdmn code: 0x3a
-
Thu Jan 1 08:00:11 1970 kern.debug kernel: [ 9.100000] ath: Country alpha2 being used: US
-
Thu Jan 1 08:00:11 1970 kern.debug kernel: [ 9.100000] ath: Regpair used: 0x3a
-
Thu Jan 1 08:00:11 1970 kern.debug kernel: [ 9.110000] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 9.120000] cfg80211: Calling CRDA for country: US
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 9.120000] cfg80211: Regulatory domain changed to country: US
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 9.130000] cfg80211: DFS Master region FCC
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 9.130000] cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 9.140000] cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2700 mBm)
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 9.150000] cfg80211: (5170000 KHz - 5250000 KHz @ 80000 KHz), (300 mBi, 1700 mBm)
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 9.160000] cfg80211: (5250000 KHz - 5330000 KHz @ 80000 KHz), (300 mBi, 2400 mBm)
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 9.160000] cfg80211: (5490000 KHz - 5600000 KHz @ 80000 KHz), (300 mBi, 2400 mBm)
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 9.170000] cfg80211: (5650000 KHz - 5710000 KHz @ 40000 KHz), (300 mBi, 2400 mBm)
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 9.180000] cfg80211: (5735000 KHz - 5835000 KHz @ 80000 KHz), (300 mBi, 3000 mBm)
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 9.190000] cfg80211: (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 4000 mBm)
-
Thu Jan 1 08:00:11 1970 kern.info kernel: [ 9.200000] ieee80211 phy0: Atheros AR9330 Rev:1 mem=0xb8100000, irq=2
-
Thu Jan 1 08:00:13 1970 authpriv.info dropbear[545]: Not backgrounding
-
Thu Jan 1 08:00:15 1970 kern.info kernel: [ 15.370000] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
-
Thu Jan 1 08:00:15 1970 kern.info kernel: [ 15.370000] device eth0 entered promiscuous mode
-
Thu Jan 1 08:00:15 1970 kern.info kernel: [ 15.380000] IPv6: ADDRCONF(NETDEV_UP): br-lan: link is not ready
-
Thu Jan 1 08:00:15 1970 daemon.notice netifd: Interface 'lan' is now up
-
Thu Jan 1 08:00:15 1970 daemon.notice netifd: Interface 'loopback' is now up
-
Thu Jan 1 08:00:16 1970 user.notice firewall: Reloading firewall due to ifup of lan (br-lan)
-
Thu Jan 1 08:00:16 1970 kern.info kernel: [ 16.980000] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
-
Thu Jan 1 08:00:17 1970 kern.info kernel: [ 16.990000] device wlan0 entered promiscuous mode
-
Thu Jan 1 08:00:17 1970 kern.info kernel: [ 17.030000] br-lan: port 2(wlan0) entered forwarding state
-
Thu Jan 1 08:00:17 1970 kern.info kernel: [ 17.030000] br-lan: port 2(wlan0) entered forwarding state
-
Thu Jan 1 08:00:17 1970 kern.info kernel: [ 17.030000] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
-
Thu Jan 1 08:00:17 1970 kern.info kernel: [ 17.040000] IPv6: ADDRCONF(NETDEV_CHANGE): br-lan: link becomes ready
-
Thu Jan 1 08:00:19 1970 kern.info kernel: [ 19.030000] br-lan: port 2(wlan0) entered forwarding state
-
Thu Jan 1 08:00:20 1970 daemon.info hostapd: wlan0: STA 08:10:75:d9:0c:3a IEEE 802.11: authenticated
-
Thu Jan 1 08:00:20 1970 daemon.info hostapd: wlan0: STA 08:10:75:d9:0c:3a IEEE 802.11: associated (aid 1)
-
Thu Jan 1 08:00:20 1970 user.emerg syslog: setting up led flashing
-
Thu Jan 1 08:00:20 1970 user.emerg syslog: setting up led Relay
-
Thu Jan 1 08:00:21 1970 daemon.info dnsmasq[782]: started, version 2.66 cachesize 150
-
Thu Jan 1 08:00:21 1970 daemon.info dnsmasq[782]: compile time options: no-IPv6 GNU-getopt no-DBus no-i18n no-IDN DHCP no-DHCPv6 no-Lua TFTP no-conntrack no-ipset no-auth
-
Thu Jan 1 08:00:21 1970 daemon.info dnsmasq-dhcp[782]: DHCP, IP range 192.168.10.100 -- 192.168.10.249, lease time 12h
-
Thu Jan 1 08:00:21 1970 daemon.info dnsmasq[782]: using local addresses only for domain lan
-
Thu Jan 1 08:00:21 1970 daemon.warn dnsmasq[782]: no servers found in /tmp/resolv.conf.auto, will retry
-
Thu Jan 1 08:00:21 1970 daemon.info dnsmasq[782]: read /etc/hosts - 1 addresses
-
Thu Jan 1 08:00:21 1970 daemon.info dnsmasq-dhcp[782]: read /etc/ethers - 0 addresses
-
Thu Jan 1 08:00:21 1970 user.emerg syslog: - init complete -
-
Thu Jan 1 08:00:23 1970 daemon.info dnsmasq-dhcp[782]: DHCPREQUEST(br-lan) 192.168.10.224 08:10:75:d9:0c:3a
-
Thu Jan 1 08:00:23 1970 daemon.info dnsmasq-dhcp[782]: DHCPACK(br-lan) 192.168.10.224 08:10:75:d9:0c:3a P9
-
Thu Jan 1 08:00:33 1970 authpriv.info dropbear[873]: Child connection from 192.168.10.224:4287
-
Thu Jan 1 08:00:35 1970 authpriv.notice dropbear[873]: Password auth succeeded for 'root' from 192.168.10.224:4287
-
root@OpenWrt:~
点击(此处)折叠或打开
3. 启动内容: /etc/rc.local
-
# Put your custom commands here that should be executed once
-
# the system init finished. By default this file does nothing.
-
sleep 5
-
/sbin/kkeps_on &
-
/sbin/kkeps_off &
-
/sbin/kkeps_seekwifi &
-
/sbin/kkeps_reconect &
-
-
exit 0
4. 定时任务: /etc/crontabs/root
无.
5. 相关的button和led的处理.
/etc/config/system
-
config system
-
option hostname 'OpenWrt'
-
option zonename 'Asia/Shanghai'
-
option timezone 'CST-8'
-
option conloglevel '8'
-
option cronloglevel '8'
-
-
config timeserver 'ntp'
-
list server '0.openwrt.pool.ntp.org'
-
list server '1.openwrt.pool.ntp.org'
-
list server '2.openwrt.pool.ntp.org'
-
list server '3.openwrt.pool.ntp.org'
-
option enable_server '0'
-
-
config restorefactory
-
option button 'reset'
-
option action 'pressed'
-
option timeout '2'
-
-
config led
-
option name 'flashing'
-
option sysfs 'tp-link:blue:config' #修改内核源码
-
option trigger 'timer'
-
option delayon '800'
-
option delayoff '800'
-
-
config led
-
option name 'Relay'
-
option sysfs 'tp-link:blue:relay' #修改内核源码
-
option trigger 'none'
-
option default '0'
-
/etc/hotplug.d/button/50-restorefactory, 必须chmod +x
-
#!/bin/sh
-
-
system_config() {
-
config_get button "$1" button "reset"
-
config_get action "$1" action "pressed"
-
config_get timeout "$1" timeout "2"
-
}
-
-
config_load system
-
config_foreach system_config restorefactory
-
-
[ "$BUTTON" = "$button" ] && {
-
-
[ -f /tmp/run/restorefactory.pid ] && read PID < /tmp/run/restorefactory.pid && kill $PID && rm /tmp/run/restorefactory.pid && logger -p user.info -t "restorefactory" "restore to factory defaults aborted"
-
-
[ "$ACTION" = "$action" ] && {
-
-
if [ "$timeout" -gt 0 ]
-
then
-
sleep "$timeout" && firstboot && reboot &
-
echo $! > /tmp/run/restorefactory.pid
-
logger -p user.info -t "restorefactory" "restoring to factory defaults in $timeout seconds"
-
elif [ "$timeout" -eq 0 ]
-
then
-
firstboot && reboot &
-
else
-
logger -p user.info -t "restorefactory" "invalid timeout value ($timeout)"
-
fi
-
}
-
}
-
-
[ "$BUTTON" = "$button" ] && [ "$ACTION" = "$action" ] && {
-
SW=$(uci get system.@led[-1].default)
-
[ $SW == '0' ] && uci set system.@led[-1].default=1
-
[ $SW == '0' ] || uci set system.@led[-1].default=0
-
uci commit
-
/etc/init.d/led restart
-
}
/etc/init.d/led
-
#!/bin/sh /etc/rc.common
-
# (C) 2008 openwrt.org
-
-
START=96
-
-
load_led() {
-
local name
-
local sysfs
-
local trigger
-
local dev
-
local mode
-
local default
-
local delayon
-
local delayoff
-
local interval
-
-
config_get sysfs $1 sysfs
-
config_get name $1 name "$sysfs"
-
config_get trigger $1 trigger "none"
-
config_get dev $1 dev
-
config_get mode $1 mode "link"
-
config_get_bool default $1 default "nil"
-
config_get delayon $1 delayon
-
config_get delayoff $1 delayoff
-
config_get interval $1 interval "50"
-
config_get port_state $1 port_state
-
config_get delay $1 delay "150"
-
config_get message $1 message ""
-
-
if [ "$trigger" = "rssi" ]; then
-
# handled by rssileds userspace process
-
return
-
fi
-
-
[ -e /sys/class/leds/${sysfs}/brightness ] && {
-
echo "setting up led ${name}"
-
[ "$default" != nil ] && {
-
[ $default -eq 1 ] &&
-
echo 1 >/sys/class/leds/${sysfs}/brightness
-
[ $default -eq 1 ] ||
-
echo 0 >/sys/class/leds/${sysfs}/brightness
-
}
-
echo $trigger > /sys/class/leds/${sysfs}/trigger
-
case "$trigger" in
-
"netdev")
-
[ -n "$dev" ] && {
-
echo $dev > /sys/class/leds/${sysfs}/device_name
-
echo $mode > /sys/class/leds/${sysfs}/mode
-
}
-
;;
-
-
"timer")
-
[ -n "$delayon" ] && \
-
echo $delayon > /sys/class/leds/${sysfs}/delay_on
-
[ -n "$delayoff" ] && \
-
echo $delayoff > /sys/class/leds/${sysfs}/delay_off
-
;;
-
-
"usbdev")
-
[ -n "$dev" ] && {
-
echo $dev > /sys/class/leds/${sysfs}/device_name
-
echo $interval > /sys/class/leds/${sysfs}/activity_interval
-
}
-
;;
-
-
"port_state")
-
[ -n "$port_state" ] && \
-
echo $port_state > /sys/class/leds/${sysfs}/port_state
-
;;
-
-
"morse")
-
echo $message > /sys/class/leds/${sysfs}/message
-
echo $delay > /sys/class/leds/${sysfs}/delay
-
;;
-
-
switch[0-9]*)
-
local port_mask
-
-
config_get port_mask $1 port_mask
-
[ -n "$port_mask" ] && \
-
echo $port_mask > /sys/class/leds/${sysfs}/port_mask
-
;;
-
esac
-
}
-
}
-
-
start() {
-
[ -e /sys/class/leds/ ] && {
-
config_load system
-
config_foreach load_led led
-
}
-
}
/etc/rc.button下共有4个文件.
/etc/rc.button/failsafe
-
#!/bin/sh
-
-
[ "${TYPE}" = "switch" ] || echo ${BUTTON} > /tmp/failsafe_button
/etc/rc.button/reset
-
#!/bin/sh
-
-
[ "${ACTION}" = "released" ] || exit 0
-
-
. /lib/functions.sh
-
-
logger "$BUTTON pressed for $SEEN seconds"
-
-
if [ "$SEEN" -gt 2 ]
-
then
-
echo "FACTORY RESET" > /dev/console
-
jffs2reset -y && reboot &
-
fi
/etc/rc.button/rfkill
-
#!/bin/sh
-
-
[ "${ACTION}" = "released" -o -n "${TYPE}" ] || exit 0
-
-
. /lib/functions.sh
-
-
local rfkill_state=0
-
-
wifi_rfkill_set() {
-
uci set wireless.$1.disabled=$rfkill_state
-
}
-
-
wifi_rfkill_check() {
-
local disabled
-
config_get disabled $1 disabled
-
[ "$disabled" = "1" ] || rfkill_state=1
-
}
-
-
config_load wireless
-
case "${TYPE}" in
-
"switch")
-
[ "${ACTION}" = "released" ] && rfkill_state=1
-
;;
-
*)
-
config_foreach wifi_rfkill_check wifi-device
-
;;
-
esac
-
config_foreach wifi_rfkill_set wifi-device
-
uci commit wireless
-
wifi up
/etc/rc.button/wps
-
#!/bin/sh
-
-
for dir in /var/run/hostapd-*; do
-
[ -d "$dir" ] || continue
-
hostapd_cli -p "$dir" wps_pbc
-
done
5. 网络配置,
/etc/config/network
-
config interface 'loopback'
-
option ifname 'lo'
-
option proto 'static'
-
option ipaddr '127.0.0.1'
-
option netmask '255.0.0.0'
-
-
config globals 'globals'
-
option ula_prefix 'fd77:3705:edc7::/48'
-
-
config interface 'lan'
-
option ifname 'eth0'
-
option type 'bridge'
-
option proto 'static'
-
option ipaddr '192.168.10.253'
-
option netmask '255.255.255.0'
-
option ip6assign '60'
/etc/config/wireless
-
config wifi-device radio0
-
option type mac80211
-
option channel 11
-
option hwmode 11ng
-
option path 'platform/ar933x_wmac'
-
option htmode HT20
-
list ht_capab SHORT-GI-20
-
list ht_capab SHORT-GI-40
-
list ht_capab RX-STBC1
-
list ht_capab DSSS_CCK-40
-
# REMOVE THIS LINE TO ENABLE WIFI:
-
option disabled 0
-
-
config wifi-iface
-
option device radio0
-
option network lan
-
option mode ap
-
option ssid 0K_SP3
-
option encryption none
最后刷自己的固件了. winscp将自己的固件xxx.bin拷贝/tmp, 执行命令:
mtd -r wirte /tmp/xxx.bin firmware
阅读(6955) | 评论(0) | 转发(3) |