Browse Source

Adds squashfs root

master
Nemo 2 years ago
parent
commit
914426421d
1664 changed files with 122218 additions and 0 deletions
  1. +1
    -0
      squashfs-root/bin/ash
  2. BIN
      squashfs-root/bin/ated
  3. +1
    -0
      squashfs-root/bin/base64
  4. +186
    -0
      squashfs-root/bin/boardupgrade.sh
  5. BIN
      squashfs-root/bin/busybox
  6. +1
    -0
      squashfs-root/bin/cat
  7. +1
    -0
      squashfs-root/bin/chgrp
  8. +1
    -0
      squashfs-root/bin/chmod
  9. +1
    -0
      squashfs-root/bin/chown
  10. +1
    -0
      squashfs-root/bin/cp
  11. +1
    -0
      squashfs-root/bin/date
  12. +1
    -0
      squashfs-root/bin/dd
  13. +1
    -0
      squashfs-root/bin/df
  14. +1
    -0
      squashfs-root/bin/dmesg
  15. +1
    -0
      squashfs-root/bin/dnsdomainname
  16. +1
    -0
      squashfs-root/bin/echo
  17. +1
    -0
      squashfs-root/bin/egrep
  18. +1
    -0
      squashfs-root/bin/false
  19. +1
    -0
      squashfs-root/bin/fgrep
  20. +126
    -0
      squashfs-root/bin/flash.sh
  21. +11
    -0
      squashfs-root/bin/flash_check.sh
  22. +1
    -0
      squashfs-root/bin/fsync
  23. +1
    -0
      squashfs-root/bin/grep
  24. +1
    -0
      squashfs-root/bin/gunzip
  25. +1
    -0
      squashfs-root/bin/gzip
  26. +1
    -0
      squashfs-root/bin/hostname
  27. +1
    -0
      squashfs-root/bin/iostat
  28. +1
    -0
      squashfs-root/bin/ip
  29. +62
    -0
      squashfs-root/bin/ipcalc.sh
  30. +1
    -0
      squashfs-root/bin/kill
  31. +1
    -0
      squashfs-root/bin/ln
  32. +1
    -0
      squashfs-root/bin/lock
  33. +1
    -0
      squashfs-root/bin/login
  34. +14
    -0
      squashfs-root/bin/login.sh
  35. +1
    -0
      squashfs-root/bin/ls
  36. BIN
      squashfs-root/bin/mk_ecos_image
  37. +1
    -0
      squashfs-root/bin/mkdir
  38. +1
    -0
      squashfs-root/bin/mknod
  39. +1
    -0
      squashfs-root/bin/mktemp
  40. BIN
      squashfs-root/bin/mkxqimage
  41. +1
    -0
      squashfs-root/bin/more
  42. +1
    -0
      squashfs-root/bin/mount
  43. +1
    -0
      squashfs-root/bin/mountpoint
  44. +1
    -0
      squashfs-root/bin/mpstat
  45. +1
    -0
      squashfs-root/bin/mv
  46. +1
    -0
      squashfs-root/bin/netmsg
  47. +1
    -0
      squashfs-root/bin/netstat
  48. +37
    -0
      squashfs-root/bin/next_net.sh
  49. +1
    -0
      squashfs-root/bin/nice
  50. +1
    -0
      squashfs-root/bin/pidof
  51. +1
    -0
      squashfs-root/bin/ping
  52. +1
    -0
      squashfs-root/bin/ping6
  53. +1
    -0
      squashfs-root/bin/ps
  54. +1
    -0
      squashfs-root/bin/pwd
  55. +18
    -0
      squashfs-root/bin/reboot_safe.sh
  56. +1
    -0
      squashfs-root/bin/rm
  57. +1
    -0
      squashfs-root/bin/rmdir
  58. +72
    -0
      squashfs-root/bin/safeflash.sh
  59. +1
    -0
      squashfs-root/bin/sed
  60. +1
    -0
      squashfs-root/bin/sh
  61. +1
    -0
      squashfs-root/bin/sleep
  62. +1
    -0
      squashfs-root/bin/stat
  63. +1
    -0
      squashfs-root/bin/sync
  64. +1
    -0
      squashfs-root/bin/tar
  65. +1
    -0
      squashfs-root/bin/touch
  66. +1
    -0
      squashfs-root/bin/true
  67. BIN
      squashfs-root/bin/ubus
  68. +1
    -0
      squashfs-root/bin/umount
  69. +1
    -0
      squashfs-root/bin/uname
  70. +1
    -0
      squashfs-root/bin/usleep
  71. +1
    -0
      squashfs-root/bin/vi
  72. +1
    -0
      squashfs-root/bin/watch
  73. +1
    -0
      squashfs-root/bin/zcat
  74. +1
    -0
      squashfs-root/etc/TZ
  75. +136
    -0
      squashfs-root/etc/Wireless/mt7628/mt7628.dat
  76. +1
    -0
      squashfs-root/etc/Wireless/mt7628/mt7628.eeprom.bin
  77. +1
    -0
      squashfs-root/etc/Wireless/mt7628/singlesku
  78. +1
    -0
      squashfs-root/etc/Wireless/mt7628/version
  79. +0
    -0
      squashfs-root/etc/app/device_names
  80. +13
    -0
      squashfs-root/etc/banner
  81. +9
    -0
      squashfs-root/etc/config/ab
  82. +2
    -0
      squashfs-root/etc/config/account
  83. +0
    -0
      squashfs-root/etc/config/backup
  84. +11
    -0
      squashfs-root/etc/config/cfgbackup
  85. +2
    -0
      squashfs-root/etc/config/ddns
  86. +0
    -0
      squashfs-root/etc/config/deviceinfo
  87. +1
    -0
      squashfs-root/etc/config/devicelist
  88. +46
    -0
      squashfs-root/etc/config/dhcp
  89. +20
    -0
      squashfs-root/etc/config/disk
  90. +5
    -0
      squashfs-root/etc/config/dropbear
  91. +4
    -0
      squashfs-root/etc/config/fanctrl
  92. +232
    -0
      squashfs-root/etc/config/firewall
  93. +232
    -0
      squashfs-root/etc/config/firewall_default
  94. +2
    -0
      squashfs-root/etc/config/http_apk_proxy
  95. +2
    -0
      squashfs-root/etc/config/http_client_detect
  96. +2
    -0
      squashfs-root/etc/config/http_content_mark
  97. +2
    -0
      squashfs-root/etc/config/http_status_stat
  98. +2
    -0
      squashfs-root/etc/config/http_url_proxy
  99. +4
    -0
      squashfs-root/etc/config/ipv6
  100. +25
    -0
      squashfs-root/etc/config/luci

+ 1
- 0
squashfs-root/bin/ash View File

@ -0,0 +1 @@
busybox

BIN
squashfs-root/bin/ated View File


+ 1
- 0
squashfs-root/bin/base64 View File

@ -0,0 +1 @@
busybox

+ 186
- 0
squashfs-root/bin/boardupgrade.sh View File

@ -0,0 +1,186 @@
#!/bin/sh
#
. /lib/upgrade/common.sh
klogger(){
local msg1="$1"
local msg2="$2"
if [ "$msg1" = "-n" ]; then
echo -n "$msg2" >> /dev/kmsg 2>/dev/null
else
echo "$msg1" >> /dev/kmsg 2>/dev/null
fi
return 0
}
hndmsg() {
if [ -n "$msg" ]; then
echo "$msg" >> /dev/kmsg 2>/dev/null
if [ `pwd` = "/tmp" ]; then
rm -rf $filename 2>/dev/null
fi
exit 1
fi
}
upgrade_uboot() {
if [ -f uboot.bin ]; then
klogger -n "Burning uboot..."
mtd write uboot.bin Bootloader >& /dev/null
if [ $? -eq 0 ]; then
klogger "Done"
else
klogger "Error"
exit 1
fi
fi
}
upgrade_firmware() {
if [ -f firmware.bin ]; then
klogger -n "Burning firmware..."
mtd -r write firmware.bin OS1 >& /dev/null
if [ $? -eq 0 ]; then
klogger "Done"
else
klogger "Error"
exit 1
fi
fi
}
board_prepare_upgrade() {
wifi down
rmmod mt7628
if [ -f "/etc/init.d/sysapihttpd" ] ;then
/etc/init.d/sysapihttpd stop 2>/dev/null
fi
# gently stop pppd, let it close pppoe session
ifdown wan
timeout=5
while [ $timeout -gt 0 ]; do
pidof pppd >/dev/null || break
sleep 1
let timeout=timeout-1
done
# clean up upgrading environment
# call shutdown scripts with some exceptions
wait_stat=0
klogger "Calling shutdown scripts"
for i in /etc/rc.d/K*; do
# filter out K01reboot-wdt and K99umount
echo "$i" | grep -q '[0-9]\{1,100\}reboot-wdt$'
if [ $? -eq 0 ]
then
klogger "$i skipped"
continue
fi
echo "$i" | grep -q '[0-9]\{1,100\}umount$'
if [ $? -eq 0 ]
then
klogger "$i skipped"
continue
fi
if [ ! -x "$i" ]
then
continue
fi
# wait for high-priority K* scripts to finish
echo "$i" | grep -qE "K9"
if [ $? -eq 0 ]
then
if [ $wait_stat -eq 0 ]
then
wait
sleep 2
wait_stat=1
fi
$i shutdown 2>&1
else
$i shutdown 2>&1 &
fi
done
# try to kill all userspace processes
# at this point the process tree should look like
# init(1)---sh(***)---flash.sh(***)
for i in $(ps w | grep -v "flash.sh" | grep -v "/bin/ash" | grep -v "PID" | awk '{print $1}'); do
if [ $i -gt 100 ]; then
kill -9 $i 2>/dev/null
fi
done
}
board_start_upgrade_led() {
gpio 1 1
gpio 3 1
gpio l 44 2 2 1 0 4000 #led yellow flashing
}
upgrade_write_mtd() {
curr_os=`cat /proc/mtd | grep rootfs -B 1 | head -n 1 | awk '{print $NF}' | cut -b 2-4`
if [ "$curr_os" = "OS1" ]; then
target_os="OS2"
else
target_os="OS1"
fi
[ -f uboot.bin ] && {
klogger "Updating boot..."
mtd write uboot.bin Bootloader
}
[ -f firmware.bin ] && {
klogger "Updating firmware..."
mtd write firmware.bin "$target_os"
}
}
board_system_upgrade() {
local filename=$1
mkxqimage -x $filename
[ "$?" = "0" ] || {
klogger "cannot extract files"
rm -rf $filename
exit 1
}
upgrade_write_mtd
# back up etc and make sure we have enough space ( > 64kb )
etc_size=`du -sh /data/etc | cut -d "." -f 1`
free_size=`df -h | grep -m 1 "/etc" | awk '{print $4}' | cut -d "." -f 1`
if [ "$(($free_size-$etc_size))" -lt "64" ]; then
for file in /data/usr/log/*
do
echo "Remove logfile $file"
rm -rf $file
free_size=`df -h | grep -m 1 "/etc" | awk '{print $4}' | cut -d "." -f 1`
[ "$(($free_size-$etc_size))" -gt "100" ] && break
done
fi
free_size=`df -h | grep -m 1 "/etc" | awk '{print $4}' | cut -d "." -f 1`
if [ "$(($free_size-$etc_size))" -lt "1" ]; then
# do nothing and wait for miracles
echo "etc fucked up"
ls -lRh /data/etc
else
# backup etc
rm -rf /data/etc_bak
cp -prf /etc /data/etc_bak
fi
return 0
}

BIN
squashfs-root/bin/busybox View File


+ 1
- 0
squashfs-root/bin/cat View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/chgrp View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/chmod View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/chown View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/cp View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/date View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/dd View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/df View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/dmesg View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/dnsdomainname View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/echo View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/egrep View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/false View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/fgrep View File

@ -0,0 +1 @@
busybox

+ 126
- 0
squashfs-root/bin/flash.sh View File

@ -0,0 +1,126 @@
#!/bin/sh
#
. /lib/upgrade/common.sh
. /bin/boardupgrade.sh
hndmsg() {
if [ -n "$msg" ]; then
echo "$msg" >> /dev/kmsg 2>/dev/null
if [ `pwd` = "/tmp" ]; then
rm -rf $filename 2>/dev/null
fi
exit 1
fi
}
upgrade_param_check() {
if [ -z "$1" -o ! -f "$1" ]; then
klogger "USAGE: $0 input.bin [1:restore defaults, 0:don't] [1:don't reboot, 0:reboot]"
exit 1
fi
flg_ota=`nvram get flag_ota_reboot`
if [ "$flg_ota" = "1" ]; then
klogger "flag_ota_reboot is set ?"
exit 1
fi
cur_ver=`cat /usr/share/xiaoqiang/xiaoqiang_version`
klogger "Begin Ugrading..., current version: $cur_ver"
echo 3 > /proc/sys/vm/drop_caches
}
upgrade_prepare_dir() {
absolute_path=`echo "$(cd "$(dirname "$1")"; pwd)/$(basename "$1")"`
mount -o remount,size=100% /tmp
rm -rf /tmp/system_upgrade
mkdir -p /tmp/system_upgrade
if [ ${absolute_path:0:4} = "/tmp" ]; then
file_in_tmp=1
mv $absolute_path /tmp/system_upgrade/
else
file_in_tmp=0
cp $absolute_path /tmp/system_upgrade/
fi
}
upgrade_done_set_flags() {
# tell server upgrade is finished
uci set /etc/config/messaging.deviceInfo.UPGRADE_STATUS_UPLOAD=0
uci commit
klogger "messaging.deviceInfo.UPGRADE_STATUS_UPLOAD=`uci get /etc/config/messaging.deviceInfo.UPGRADE_STATUS_UPLOAD`"
klogger "/etc/config/messaging : `cat /etc/config/messaging`"
# update nvram setting when upgrading
if [ "$2" = "1" ]; then
nvram set restore_defaults=1
klogger "Restore defaults is set."
else
nvram set restore_defaults=2
fi
nvram set flag_ota_reboot=1
nvram set flag_upgrade_push=1
nvram commit
if [ "$3" = "1" ]; then
klogger "Skip rebooting..."
else
klogger "Rebooting..."
reboot
fi
}
#check pid exist
pid_file="/tmp/pid_xxxx"
if [ -f $pid_file ]; then
exist_pid=`cat $pid_file`
if [ -n $exist_pid ]; then
kill -0 $exist_pid 2>/dev/null
if [ $? -eq 0 ]; then
klogger "Upgrading, exit... $?"
exit 1
else
echo $$ > $pid_file
fi
else
echo $$ > $pid_file
fi
else
echo $$ > $pid_file
fi
upgrade_param_check $1
# image verification...
klogger -n "Verify Image: $1..."
mkxqimage -v "$1"
if [ "$?" = "0" ]; then
klogger "Checksum O.K."
else
msg="Check Failed!!!"
hndmsg
fi
# stop services
board_prepare_upgrade
board_start_upgrade_led
# prepare to extract file
filename=`basename $1`
upgrade_prepare_dir $1
cd /tmp/system_upgrade
# start board-specific upgrading...
klogger "Begin Upgrading and Rebooting..."
board_system_upgrade $filename $2 $3
# some board may reset after system upgrade and not reach here
# clean up
cd /
rm -rf /tmp/system_upgrade
upgrade_done_set_flags $1 $2 $3

+ 11
- 0
squashfs-root/bin/flash_check.sh View File

@ -0,0 +1,11 @@
#!/bin/sh
pid_file="/tmp/pid_xxxx"
if [ -f $pid_file ]; then
exist_pid=`cat $pid_file`
if [ -n $exist_pid ]; then
kill -0 $exist_pid 2>/dev/null
if [ $? -eq 0 ]; then
exit 1
fi
fi
fi

+ 1
- 0
squashfs-root/bin/fsync View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/grep View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/gunzip View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/gzip View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/hostname View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/iostat View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/ip View File

@ -0,0 +1 @@
busybox

+ 62
- 0
squashfs-root/bin/ipcalc.sh View File

@ -0,0 +1,62 @@
#!/bin/sh
awk -f - $* <<EOF
function bitcount(c) {
c=and(rshift(c, 1),0x55555555)+and(c,0x55555555)
c=and(rshift(c, 2),0x33333333)+and(c,0x33333333)
c=and(rshift(c, 4),0x0f0f0f0f)+and(c,0x0f0f0f0f)
c=and(rshift(c, 8),0x00ff00ff)+and(c,0x00ff00ff)
c=and(rshift(c,16),0x0000ffff)+and(c,0x0000ffff)
return c
}
function ip2int(ip) {
for (ret=0,n=split(ip,a,"\."),x=1;x<=n;x++) ret=or(lshift(ret,8),a[x])
return ret
}
function int2ip(ip,ret,x) {
ret=and(ip,255)
ip=rshift(ip,8)
for(;x<3;ret=and(ip,255)"."ret,ip=rshift(ip,8),x++);
return ret
}
BEGIN {
slpos=index(ARGV[1],"/")
if (slpos == 0) {
ipaddr=ip2int(ARGV[1])
netmask=ip2int(ARGV[2])
} else {
ipaddr=ip2int(substr(ARGV[1],0,slpos-1))
netmask=compl(2**(32-int(substr(ARGV[1],slpos+1)))-1)
ARGV[4]=ARGV[3]
ARGV[3]=ARGV[2]
}
network=and(ipaddr,netmask)
broadcast=or(network,compl(netmask))
start=or(network,and(ip2int(ARGV[3]),compl(netmask)))
limit=network+1
if (start<limit) start=limit
end=start+ARGV[4]
limit=or(network,compl(netmask))-1
if (end>limit) end=limit
print "IP="int2ip(ipaddr)
print "NETMASK="int2ip(netmask)
print "BROADCAST="int2ip(broadcast)
print "NETWORK="int2ip(network)
print "PREFIX="32-bitcount(compl(netmask))
# range calculations:
# ipcalc <ip> <netmask> <start> <num>
if (ARGC > 3) {
print "START="int2ip(start)
print "END="int2ip(end)
}
}
EOF

+ 1
- 0
squashfs-root/bin/kill View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/ln View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/lock View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/login View File

@ -0,0 +1 @@
busybox

+ 14
- 0
squashfs-root/bin/login.sh View File

@ -0,0 +1,14 @@
#!/bin/sh
# Copyright (C) 2006-2011 OpenWrt.org
if ( ! grep -qs '^root:[!x]\?:' /etc/shadow || \
! grep -qs '^root:[!x]\?:' /etc/passwd ) && \
[ -z "$FAILSAFE" ]
then
ft_mode=`cat /proc/xiaoqiang/ft_mode`
if [ "$ft_mode" = "1" ]; then
exec /bin/ash --login
else
busybox login
fi
fi

+ 1
- 0
squashfs-root/bin/ls View File

@ -0,0 +1 @@
busybox

BIN
squashfs-root/bin/mk_ecos_image View File


+ 1
- 0
squashfs-root/bin/mkdir View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/mknod View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/mktemp View File

@ -0,0 +1 @@
busybox

BIN
squashfs-root/bin/mkxqimage View File


+ 1
- 0
squashfs-root/bin/more View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/mount View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/mountpoint View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/mpstat View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/mv View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/netmsg View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/netstat View File

@ -0,0 +1 @@
busybox

+ 37
- 0
squashfs-root/bin/next_net.sh View File

@ -0,0 +1,37 @@
#!/bin/sh
# find at least N ip which is not contain 'gateway'
awk -f - $* <<EOF
function bitcount(c) {
c=and(rshift(c, 1),0x55555555)+and(c,0x55555555)
c=and(rshift(c, 2),0x33333333)+and(c,0x33333333)
c=and(rshift(c, 4),0x0f0f0f0f)+and(c,0x0f0f0f0f)
c=and(rshift(c, 8),0x00ff00ff)+and(c,0x00ff00ff)
c=and(rshift(c,16),0x0000ffff)+and(c,0x0000ffff)
return c
}
function ip2int(ip) {
for (ret=0,n=split(ip,a,"\."),x=1;x<=n;x++) ret=or(lshift(ret,8),a[x])
return ret
}
function int2ip(ip,ret,x) {
ret=and(ip,255)
ip=rshift(ip,8)
for(;x<3;ret=and(ip,255)"."ret,ip=rshift(ip,8),x++);
return ret
}
BEGIN {
#next_net <anchor_ip> <gateway> <count_N>
anchor = ip2int(ARGV[1])
gateway = ip2int(ARGV[2])
if ( gateway > anchor )
up = gateway
else
up = anchor
for (i = 1; i <= ARGV[3]; i++)
print int2ip(up + 256 * i)
}
EOF

+ 1
- 0
squashfs-root/bin/nice View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/pidof View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/ping View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/ping6 View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/ps View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/pwd View File

@ -0,0 +1 @@
busybox

+ 18
- 0
squashfs-root/bin/reboot_safe.sh View File

@ -0,0 +1,18 @@
#!/bin/sh
pid=`pidof flash.sh`
# If system upgrade in progress, system will reboot after upgrade.
[ -z "$pid" ] || return
#no upgrade in progress
curr_time=`date +%k%M`
[ "$curr_time" -ge "0300" -a "$curr_time" -le "0510" ] && {
#apply random delay (0-3600s) between 3:00AM to 5:10AM
base=`head -n 10 /dev/urandom | md5sum | cut -c 1-4`
delay=`echo $(($((0x$base))%3600))`
sleep $delay
}
reboot

+ 1
- 0
squashfs-root/bin/rm View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/rmdir View File

@ -0,0 +1 @@
busybox

+ 72
- 0
squashfs-root/bin/safeflash.sh View File

@ -0,0 +1,72 @@
#!/bin/sh
if [ $# != 1 ] ; then
echo "USAGE: $0 <factory.bin>"
exit 1;
fi
if [ ! -s "$1" ]
then
echo "ERROR: $1 no exist or empty."
exit 1
fi
find_mtd_part() {
local PART="$(grep "\"$1\"" /proc/mtd | awk -F: '{print $1}')"
local PREFIX=/dev/mtdblock
PART="${PART##mtd}"
[ -d /dev/mtdblock ] && PREFIX=/dev/mtdblock/
echo "${PART:+$PREFIX$PART}"
}
echo "begin ugrading..."
nsum=`md5sum $1 | awk '{print $1}'`
echo "$0 $@ MD5: $nsum"
src=`cat /proc/cmdline`;
dst="root=31:04"
echo $src | grep -q $dst
if [ $? -eq 0 ]
then
WRITECMD="mtd write $1 firmware"
exroot="firmware $nsum"
else
WRITECMD="mtd write $1 firmware2"
exroot="firmware2 $nsum"
fi
#save checksum first
echo "$exroot" > /etc/expectroot
if [ $? -ne 0 ]
then
echo "-----"
echo "WARNING: overlay filesystem unusable, can not save expectroot $exroot to /etc/expectroot."
echo "-----"
fi
#TODO: save checksum in sysflag MTD block
echo "$nsum" > /etc/romchecksum 2>/dev/null
if [ $? -ne 0 ]
then
echo "-----"
echo "WARNING: overlay filesystem unusable,can not save rom checksum to /etc/romchecksum."
echo "-----"
fi
$WRITECMD
writecode=$?
if [ $writecode -ne 0 ]
then
echo "ERROR: mtd write failed."
exit 1
fi
mtdpart="$(find_mtd_part flag_where_reboot)"
if [ -n "$mtdpart" ]
then
echo 1 > $mtdpart
else
echo "WARNING: mtd flag_where_reboot no found."
uname -a
bootinfo
fi
echo "upgrade finished..., rebooting"
reboot

+ 1
- 0
squashfs-root/bin/sed View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/sh View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/sleep View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/stat View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/sync View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/tar View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/touch View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/true View File

@ -0,0 +1 @@
busybox

BIN
squashfs-root/bin/ubus View File


+ 1
- 0
squashfs-root/bin/umount View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/uname View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/usleep View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/vi View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/watch View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/bin/zcat View File

@ -0,0 +1 @@
busybox

+ 1
- 0
squashfs-root/etc/TZ View File

@ -0,0 +1 @@
/tmp/TZ

+ 136
- 0
squashfs-root/etc/Wireless/mt7628/mt7628.dat View File

@ -0,0 +1,136 @@
#The word of "Default" must not be removed
Default
CountryRegion=1
CountryRegionABand=0
CountryCode=
BssidNum=1
SSID1=OpenWrt-MT7628
SSID2=
SSID3=
SSID4=
WirelessMode=9
TxRate=0
Channel=6
BasicRate=15
BeaconPeriod=100
DtimPeriod=1
TxPower=100
DisableOLBC=0
BGProtection=0
MaxStaNum=0
TxPreamble=0
RTSThreshold=2347
FragThreshold=2346
TxBurst=1
PktAggregate=0
TurboRate=0
WmmCapable=1
APSDCapable=1
DLSCapable=0
APAifsn=3;7;1;1
APCwmin=4;4;3;2
APCwmax=6;10;4;3
APTxop=0;0;94;47
APACM=0;0;0;0
BSSAifsn=3;7;2;2
BSSCwmin=4;4;3;2
BSSCwmax=10;10;4;3
BSSTxop=0;0;94;47
BSSACM=0;0;0;0
AckPolicy=0;0;0;0
NoForwarding=0
NoForwardingBTNBSSID=0
HideSSID=0
StationKeepAlive=0
ShortSlot=1
AutoChannelSelect=0
IEEE8021X=0
IEEE80211H=0
CSPeriod=10
WirelessEvent=1
IdsEnable=0
AuthFloodThreshold=32
AssocReqFloodThreshold=32
ReassocReqFloodThreshold=32
ProbeReqFloodThreshold=32
DisassocFloodThreshold=32
DeauthFloodThreshold=32
EapReqFooldThreshold=32
PreAuth=0
AuthMode=OPEN
EncrypType=NONE
RekeyInterval=0
RekeyMethod=DISABLE
PMKCachePeriod=10
WPAPSK1=
WPAPSK2=
WPAPSK3=
WPAPSK4=
DefaultKeyID=1
Key1Type=1;1;1;1
Key1Str1=
Key1Str2=
Key1Str3=
Key1Str4=
Key2Type=1;1;1;1
Key2Str1=
Key2Str2=
Key2Str3=
Key2Str4=
Key3Type=1;1;1;1
Key3Str1=
Key3Str2=
Key3Str3=
Key3Str4=
Key4Type=1;1;1;1
Key4Str1=
Key4Str2=
Key4Str3=
Key4Str4=
HSCounter=0
AccessPolicy0=0
AccessControlList0=
AccessPolicy1=0
AccessControlList1=
AccessPolicy2=0
AccessControlList2=
AccessPolicy3=0
AccessControlList3=
WdsEnable=0
WdsEncrypType=NONE
WdsList=EOF
WdsKey=
RADIUS_Server=192.168.2.3
RADIUS_Port=1812
RADIUS_Key=ralink
own_ip_addr=192.168.5.234
EAPifname=br-lan
PreAuthifname=br-lan
HT_HTC=0
HT_RDG=0
HT_EXTCHA=0
HT_LinkAdapt=0
HT_OpMode=0
HT_MpduDensity=5
HT_BW=1
HT_AutoBA=1
HT_AMSDU=0
HT_BAWinSize=64
HT_GI=1
HT_MCS=33
# WPS stuff
# 1 = enrollee, 2 = proxy, 4 = registrar (bitmask)
# This value is enabled later on, for WPA only
WscConfMode=6;6;6
# 1 = disabled, 2 = enabled
WscConfStatus=2
# 2 = PBC, 1 = PIN
WscMode = 2
WscDeviceName=XiaoMiRouter
WscSecurityMode=0
HT_TxStream=2
HT_RxStream=2
EntryLifeCheck=128
ed_th_nonCE=32

+ 1
- 0
squashfs-root/etc/Wireless/mt7628/mt7628.eeprom.bin View File

@ -0,0 +1 @@
/lib/wifi/mt7628.eeprom.bin

+ 1
- 0
squashfs-root/etc/Wireless/mt7628/singlesku View File

@ -0,0 +1 @@
/lib/wifi/singlesku

+ 1
- 0
squashfs-root/etc/Wireless/mt7628/version View File

@ -0,0 +1 @@
p120395

+ 0
- 0
squashfs-root/etc/app/device_names View File


+ 13
- 0
squashfs-root/etc/banner View File

@ -0,0 +1,13 @@
-----------------------------------------------------
Welcome to XiaoQiang!
-----------------------------------------------------
$$$$$$\ $$$$$$$\ $$$$$$$$\ $$\ $$\ $$$$$$\ $$\ $$\
$$ __$$\ $$ __$$\ $$ _____| $$ | $$ | $$ __$$\ $$ | $$ |
$$ / $$ |$$ | $$ |$$ | $$ | $$ | $$ / $$ |$$ |$$ /
$$$$$$$$ |$$$$$$$ |$$$$$\ $$ | $$ | $$ | $$ |$$$$$ /
$$ __$$ |$$ __$$< $$ __| $$ | $$ | $$ | $$ |$$ $$<
$$ | $$ |$$ | $$ |$$ | $$ | $$ | $$ | $$ |$$ |\$$\
$$ | $$ |$$ | $$ |$$$$$$$$\ $$$$$$$$$ | $$$$$$ |$$ | \$$\
\__| \__|\__| \__|\________| \_________/ \______/ \__| \__|

+ 9
- 0
squashfs-root/etc/config/ab View File

@ -0,0 +1,9 @@
config ab settings
option name 'settings'
option enabled 1
option last_speedtest_time '0'
option last_speedtest_date '0'
option max_log_num '5'
option current_log_num '1'

+ 2
- 0
squashfs-root/etc/config/account View File

@ -0,0 +1,2 @@
config core 'common'
option 'admin' 'b3a4190199d9ee7fe73ef9a4942a69fece39a771'

+ 0
- 0
squashfs-root/etc/config/backup View File


+ 11
- 0
squashfs-root/etc/config/cfgbackup View File

@ -0,0 +1,11 @@
config settings 'encryption'
option method 'aes'
option key 'a2ffa5c9be07488bbb04a3a47d3c5f6a'
config settings 'backup'
list item 'mi_basic_info'
list item 'mi_wifi_info'
list item 'mi_network_info'
list item 'mi_lan_info'
list item 'mi_arn_info'

+ 2
- 0
squashfs-root/etc/config/ddns View File

@ -0,0 +1,2 @@
config global 'ddns'
option status 'off'

+ 0
- 0
squashfs-root/etc/config/deviceinfo View File


+ 1
- 0
squashfs-root/etc/config/devicelist View File

@ -0,0 +1 @@
config core 'history'

+ 46
- 0
squashfs-root/etc/config/dhcp View File

@ -0,0 +1,46 @@
#
config dnsmasq
#enable domainneeded for samba
option domainneeded 1
option boguspriv 1
option localise_queries 1
option rebind_protection 0 # disable if upstream must serve RFC1918 addresses
option rebind_localhost 1 # enable for RBL checking and similar services
#list rebind_domain example.lan # whitelist RFC1918 responses for domains
option local '/lan/'
option expandhosts 1
option nonegcache 1
option authoritative 1
option logqueries 0
option logdhcp 0
option allservers 1
option clearonreload 1
option cachesize 1000
option negttl 300
option maxttl 300 # 5 min
option maxcachettl 1800 # 30 min
option local_ttl 0
option dnsforwardmax 300
option leasefile '/tmp/dhcp.leases'
option resolvfile '/tmp/resolv.conf.auto'
option client_update_ddns '1'
config dhcp lan
option interface lan
option start 5
option limit 250
option leasetime 12h
#force mean start dhcp even if already have a dhcp server running
option force 1
config dhcp wan
option interface wan
option ignore 1
config dhcp ready # for miwifi_ready
option interface ready
option start 10
option limit 20
option leasetime 5m
#force mean start dhcp even if already have a dhcp server running
option force 1

+ 20
- 0
squashfs-root/etc/config/disk View File

@ -0,0 +1,20 @@
# Copyright (C) 2006 OpenWrt.org
#
# setting.status 0: no hdd
# 1: hdd exists
#
# disk.status 0: okay, mounted
# 1: need to do fsck
# 2: no mounted
#
config disk setting
option total 1
option status 0
config disk p1
option name data
option node '/dev/mtd7'
option shared 0
option status 0
option type jffs2

+ 5
- 0
squashfs-root/etc/config/dropbear View File

@ -0,0 +1,5 @@
config dropbear
option PasswordAuth 'on'
option RootPasswordAuth 'on'
option Port '22'
# option BannerFile '/etc/banner'

+ 4
- 0
squashfs-root/etc/config/fanctrl View File

@ -0,0 +1,4 @@
config temperature
option 'highest' '64'
option 'middle' '55'
option 'lowest' '50'

+ 232
- 0
squashfs-root/etc/config/firewall View File

@ -0,0 +1,232 @@
config defaults
#temp disable syn_flood proctect.
option syn_flood 0
option input ACCEPT
option output ACCEPT
option forward REJECT
option drop_invalid 1
# Uncomment this line to disable ipv6 rules
option disable_ipv6 1
config zone
option name lan
list network 'lan'
option network 'lan'
option input ACCEPT
option output ACCEPT
option forward REJECT
config zone
option name wan
list network 'wan'
option network 'wan'
option input REJECT
option output ACCEPT
option forward REJECT
option masq 1
option mtu_fix 1
config forwarding
option src lan
option dest wan
# We need to accept udp packets on port 68,
# see https://dev.openwrt.org/ticket/4108
config rule
option name Allow-DHCP-Renew
option src wan
option proto udp
option dest_port 68
option target ACCEPT
option family ipv4
# Allow IPv4 ping
config rule
option name Allow-Ping
option src wan
option proto icmp
option icmp_type echo-request
option family ipv4
option target ACCEPT
# Allow DHCPv6 replies
# see https://dev.openwrt.org/ticket/10381
config rule
option name Allow-DHCPv6
option src wan
option proto udp
option src_ip fe80::/10
option src_port 547
option dest_ip fe80::/10
option dest_port 546
option family ipv6
option target ACCEPT
# Allow essential incoming IPv6 ICMP traffic
config rule
option name Allow-ICMPv6-Input
option src wan
option proto icmp
list icmp_type echo-request
list icmp_type echo-reply
list icmp_type destination-unreachable
list icmp_type packet-too-big
list icmp_type time-exceeded
list icmp_type bad-header
list icmp_type unknown-header-type
list icmp_type router-solicitation
list icmp_type neighbour-solicitation
list icmp_type router-advertisement
list icmp_type neighbour-advertisement
option limit 1000/sec
option family ipv6
option target ACCEPT
# Allow essential forwarded IPv6 ICMP traffic
config rule
option name Allow-ICMPv6-Forward
option src wan
option dest *
option proto icmp
list icmp_type echo-request
list icmp_type echo-reply
list icmp_type destination-unreachable
list icmp_type packet-too-big
list icmp_type time-exceeded
list icmp_type bad-header
list icmp_type unknown-header-type
option limit 1000/sec
option family ipv6
option target ACCEPT
# include a file with users custom iptables rules
#
#nat
config include 'webinitrdr'
option path '/lib/firewall.sysapi.loader webinitrdr'
option reload "1"
option enabled "1"
#nat
config include 'dnsmiwifi'
option path '/lib/firewall.sysapi.loader dnsmiwifi'
option reload "1"
option enabled "1"
config include 'macfilter'
option path '/lib/firewall.sysapi.loader macfilter'
option reload "1"
option enabled "1"
config include 'miqos'
option path '/lib/firewall.sysapi.loader miqos'
option reload "1"
config include 'turbo'
option path '/lib/firewall.sysapi.loader turbo'
option reload "1"
option enabled "1"
config include 'xqfp'
option path '/lib/firewall.sysapi.loader xqfp'
option reload "1"
config include 'firewalluser'
option path /etc/firewall.user
option reload 1
config include 'dmz_bypass_ctf'
option path '/lib/firewall.sysapi.loader dmz_bypass_ctf'
option reload '1'
config include 'rr_rule'
option path '/lib/firewall/rr.load reload'
option reload '1'
config rule 'xunleiwantcpports'
option name 'xunlei wan accept tcp port 1080 4662 2080 2062'
option src 'wan'
option dest_port '1080 4662 2080 2062'
option proto 'tcp'
option target 'ACCEPT'
config rule 'xunleiwanudpports'
option name 'xunlei wan accept udp port 4661 3027 888 666 2037 2061 2048 2066'
option src 'wan'
option dest_port '4661 3027 888 666 2037 2061 2048 2066'
option proto 'udp'
option target 'ACCEPT'
config rule 'guest_8999'
option name 'Hello wifi 8999'
option src 'guest'
option proto 'tcp'
option dest_port '8999'
option target 'ACCEPT'
config rule 'guest_8300'
option name 'Hello wifi 8300'
option src 'guest'
option proto 'tcp'
option dest_port '8300'
option target 'ACCEPT'
config rule 'guest_7080'
option name 'Hello wifi 7080'
option src 'guest'
option proto 'tcp'
option dest_port '7080'
option target 'ACCEPT'
config zone 'ready_zone'
option name 'ready'
list network 'ready'
option input 'DROP'
option forward 'DROP'
option output 'DROP'
config rule 'ready_dhcp'
option name 'DHCP for ready'
option src 'ready'
option src_port '67-68'
option dest_port '67-68'
option proto 'udp'
option target 'ACCEPT'
config rule 'ready_dhcp_out'
option name 'DHCP for ready'
option dest 'ready'
option src_port '67-68'
option dest_port '67-68'
option proto 'udp'
option target 'ACCEPT'
config rule 'ready_tbus_in'
option name 'tbus for ready'
option src 'ready'
option dest_port '784'
option proto 'tcp'
option target 'ACCEPT'
config rule 'ready_tbus_out'
option name 'tbus for ready'
option src 'ready'
option src_port '784'
option proto 'tcp'
option target 'ACCEPT'
config redirect 'nxdomain'
option name 'nxdomain'
option src 'lan'
option src_dport '80'
option src_dip '198.51.100.9' # rfc5735
option dest_port '8190'
option proto 'tcp'
option target DNAT
config rule 'ptdownload'
option name 'ingress port for PT download'
option src 'wan'
option dest_port '51413'
option proto 'tcpudp'
option target 'ACCEPT'

+ 232
- 0
squashfs-root/etc/config/firewall_default View File

@ -0,0 +1,232 @@
config defaults
#temp disable syn_flood proctect.
option syn_flood 0
option input ACCEPT
option output ACCEPT
option forward REJECT
option drop_invalid 1
# Uncomment this line to disable ipv6 rules
option disable_ipv6 1
config zone
option name lan
list network 'lan'
option network 'lan'
option input ACCEPT
option output ACCEPT
option forward REJECT
config zone
option name wan
list network 'wan'
option network 'wan'
option input REJECT
option output ACCEPT
option forward REJECT
option masq 1
option mtu_fix 1
config forwarding
option src lan
option dest wan
# We need to accept udp packets on port 68,
# see https://dev.openwrt.org/ticket/4108
config rule
option name Allow-DHCP-Renew
option src wan
option proto udp
option dest_port 68
option target ACCEPT
option family ipv4
# Allow IPv4 ping
config rule
option name Allow-Ping
option src wan
option proto icmp
option icmp_type echo-request
option family ipv4
option target ACCEPT
# Allow DHCPv6 replies
# see https://dev.openwrt.org/ticket/10381
config rule
option name Allow-DHCPv6
option src wan
option proto udp
option src_ip fe80::/10
option src_port 547
option dest_ip fe80::/10
option dest_port 546
option family ipv6
option target ACCEPT
# Allow essential incoming IPv6 ICMP traffic
config rule
option name Allow-ICMPv6-Input
option src wan
option proto icmp
list icmp_type echo-request
list icmp_type echo-reply
list icmp_type destination-unreachable
list icmp_type packet-too-big
list icmp_type time-exceeded
list icmp_type bad-header
list icmp_type unknown-header-type
list icmp_type router-solicitation
list icmp_type neighbour-solicitation
list icmp_type router-advertisement
list icmp_type neighbour-advertisement
option limit 1000/sec
option family ipv6
option target ACCEPT
# Allow essential forwarded IPv6 ICMP traffic
config rule
option name Allow-ICMPv6-Forward
option src wan
option dest *
option proto icmp
list icmp_type echo-request
list icmp_type echo-reply
list icmp_type destination-unreachable
list icmp_type packet-too-big
list icmp_type time-exceeded
list icmp_type bad-header
list icmp_type unknown-header-type
option limit 1000/sec
option family ipv6
option target ACCEPT
# include a file with users custom iptables rules
#
#nat
config include 'webinitrdr'
option path '/lib/firewall.sysapi.loader webinitrdr'
option reload "1"
option enabled "1"
#nat
config include 'dnsmiwifi'
option path '/lib/firewall.sysapi.loader dnsmiwifi'
option reload "1"
option enabled "1"
config include 'macfilter'
option path '/lib/firewall.sysapi.loader macfilter'
option reload "1"
option enabled "1"
config include 'miqos'
option path '/lib/firewall.sysapi.loader miqos'
option reload "1"
config include 'turbo'
option path '/lib/firewall.sysapi.loader turbo'
option reload "1"
option enabled "1"
config include 'xqfp'
option path '/lib/firewall.sysapi.loader xqfp'
option reload "1"
config include 'firewalluser'
option path /etc/firewall.user
option reload 1
config include 'dmz_bypass_ctf'
option path '/lib/firewall.sysapi.loader dmz_bypass_ctf'
option reload '1'
config include 'rr_rule'
option path '/lib/firewall/rr.load reload'
option reload '1'
config rule 'xunleiwantcpports'
option name 'xunlei wan accept tcp port 1080 4662 2080 2062'
option src 'wan'
option dest_port '1080 4662 2080 2062'
option proto 'tcp'
option target 'ACCEPT'
config rule 'xunleiwanudpports'
option name 'xunlei wan accept udp port 4661 3027 888 666 2037 2061 2048 2066'
option src 'wan'
option dest_port '4661 3027 888 666 2037 2061 2048 2066'
option proto 'udp'
option target 'ACCEPT'
config rule 'guest_8999'
option name 'Hello wifi 8999'
option src 'guest'
option proto 'tcp'
option dest_port '8999'
option target 'ACCEPT'
config rule 'guest_8300'
option name 'Hello wifi 8300'
option src 'guest'
option proto 'tcp'
option dest_port '8300'
option target 'ACCEPT'
config rule 'guest_7080'
option name 'Hello wifi 7080'
option src 'guest'
option proto 'tcp'
option dest_port '7080'
option target 'ACCEPT'
config zone 'ready_zone'
option name 'ready'
list network 'ready'
option input 'DROP'
option forward 'DROP'
option output 'DROP'
config rule 'ready_dhcp'
option name 'DHCP for ready'
option src 'ready'
option src_port '67-68'
option dest_port '67-68'
option proto 'udp'
option target 'ACCEPT'
config rule 'ready_dhcp_out'
option name 'DHCP for ready'
option dest 'ready'
option src_port '67-68'
option dest_port '67-68'
option proto 'udp'
option target 'ACCEPT'
config rule 'ready_tbus_in'
option name 'tbus for ready'
option src 'ready'
option dest_port '784'
option proto 'tcp'
option target 'ACCEPT'
config rule 'ready_tbus_out'
option name 'tbus for ready'
option src 'ready'
option src_port '784'
option proto 'tcp'
option target 'ACCEPT'
config redirect 'nxdomain'
option name 'nxdomain'
option src 'lan'
option src_dport '80'
option src_dip '198.51.100.9' # rfc5735
option dest_port '8190'
option proto 'tcp'
option target DNAT
config rule 'ptdownload'
option name 'ingress port for PT download'
option src 'wan'
option dest_port '51413'
option proto 'tcpudp'
option target 'ACCEPT'

+ 2
- 0
squashfs-root/etc/config/http_apk_proxy View File

@ -0,0 +1,2 @@
config global 'settings'
option enabled '0'

+ 2
- 0
squashfs-root/etc/config/http_client_detect View File

@ -0,0 +1,2 @@
config global 'settings'
option enabled '1'

+ 2
- 0
squashfs-root/etc/config/http_content_mark View File

@ -0,0 +1,2 @@
config global 'settings'
option enabled '1'

+ 2
- 0
squashfs-root/etc/config/http_status_stat View File

@ -0,0 +1,2 @@
config global 'settings'
option enabled '0'

+ 2
- 0
squashfs-root/etc/config/http_url_proxy View File

@ -0,0 +1,2 @@
config global 'settings'
option enabled '1'

+ 4
- 0
squashfs-root/etc/config/ipv6 View File

@ -0,0 +1,4 @@
config ipv6 settings
option enabled 0

+ 25
- 0
squashfs-root/etc/config/luci View File

@ -0,0 +1,25 @@
config core main
option lang zh_cn
option 'mediaurlbase' '/xiaoqiang'
option 'resourcebase' '/xiaoqiang'
config extern flash_keep
option uci "/etc/config/"
option dropbear "/etc/dropbear/"
option openvpn "/etc/openvpn/"
option passwd "/etc/passwd"
option opkg "/etc/opkg.conf"
option firewall "/etc/firewall.user"
option uploads "/lib/uci/upload/"
config internal languages
config internal sauth
option sessionpath "/tmp/luci-sessions"
option sessiontime 7200
config internal ccache
option enable 1
config internal themes
option 'xiaoqiang' '/xiaoqiang'

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save