-#
-# Copyright (C) 2006 OpenWrt.org
+#
+# Copyright (C) 2007 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
if [ -d $(GENERIC_PLATFORM_DIR)/base-files/. ]; then \
$(CP) $(GENERIC_PLATFORM_DIR)/base-files/* $(1)/; \
fi
- if [ -d $(PLATFORM_DIR)/base-files/default/. ]; then \
- $(CP) $(PLATFORM_DIR)/base-files/default/* $(1)/; \
+ if [ -d $(PLATFORM_DIR)/base-files/. ]; then \
+ $(CP) $(PLATFORM_DIR)/base-files/* $(1)/; \
fi
$(if $(filter-out $(PLATFORM_DIR),$(PLATFORM_SUBDIR)), \
- if [ -d $(PLATFORM_SUBDIR)/base-files/default/. ]; then \
- $(CP) $(PLATFORM_SUBDIR)/base-files/default/* $(1)/; \
+ if [ -d $(PLATFORM_SUBDIR)/base-files/. ]; then \
+ $(CP) $(PLATFORM_SUBDIR)/base-files/* $(1)/; \
fi \
)
- if [ "$(PROFILE)" != "Default" ]; then \
- if [ -d $(PLATFORM_DIR)/base-files/profile-$(PROFILE)/. ]; then \
- $(CP) $(PLATFORM_DIR)/base-files/profile-$(PROFILE)/* $(1)/; \
- fi; \
- fi
$(SED) 's,$$$$R,r$(REV),g' $(1)/etc/banner
$(SED) 's,$$$$S,$(BOARD)-$(KERNEL),g' -e 's,$$$$A,$(ARCH),g' $(1)/etc/ipkg.conf
mkdir -p $(1)/dev
+++ /dev/null
-#!/bin/sh
-#
-# Copyright (C) 2007 OpenWrt.org
-#
-# $Id$
-#
-
-. /lib/adm5120.sh
-
-led_set_attr() {
- [ -f "/sys/class/leds/$1/$2" ] && echo "$3" > "/sys/class/leds/$1/$2"
-}
-
-status_led_set_timer() {
- led_set_attr $status_led "trigger" "timer"
- led_set_attr $status_led "delay_on" "$1"
- led_set_attr $status_led "delay_off" "$2"
-}
-
-status_led_set_morse() {
- led_set_attr $status_led "trigger" "morse"
- led_set_attr $status_led "delay" "$1"
- led_set_attr $status_led "message" "$2"
-}
-
-status_led_on() {
- led_set_attr $status_led "trigger" "none"
- led_set_attr $status_led "brightness" 255
-}
-
-status_led_off() {
- led_set_attr $status_led "trigger" "none"
- led_set_attr $status_led "brightness" 0
-}
-
-set_state() {
- case "$1" in
- preinit)
- status_led_set_timer 200 200
- ;;
- failsafe)
- status_led_set_timer 50 50
- ;;
- done)
- status_led_on
- ;;
- esac
-}
+++ /dev/null
-#!/bin/sh
-#
-# Copyright (C) 2007 OpenWrt.org
-#
-# $Id$
-#
-
-board_name=""
-status_led=""
-sys_mtd_part=""
-
-adm5120_detect() {
- board_name=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /system type/ {print $2}' /proc/cpuinfo)
-
- case "$board_name" in
- "Cellvision"*)
- status_led="status"
- sys_mtd_part="firmware"
- ;;
- "Compex"*)
- status_led="diag"
- case "$board_name" in
- *-WRT)
- sys_mtd_part="trx"
- ;;
- *)
- sys_mtd_part="partition1"
- ;;
- esac
- ;;
- "Edimax"*)
- status_led="power"
- sys_mtd_part="firmware"
- ;;
- "Infineon"*)
- sys_mtd_part="firmware"
- ;;
- "Mikrotik"*)
- status_led="power"
- ;;
- "ZyXEL"*)
- status_led="power"
- sys_mtd_part="trx"
- ;;
- *)
- ;;
- esac
-}
-
-adm5120_detect
--- /dev/null
+#!/bin/sh
+#
+# Copyright (C) 2007 OpenWrt.org
+#
+# $Id$
+#
+
+. /lib/adm5120.sh
+
+led_set_attr() {
+ [ -f "/sys/class/leds/$1/$2" ] && echo "$3" > "/sys/class/leds/$1/$2"
+}
+
+status_led_set_timer() {
+ led_set_attr $status_led "trigger" "timer"
+ led_set_attr $status_led "delay_on" "$1"
+ led_set_attr $status_led "delay_off" "$2"
+}
+
+status_led_set_morse() {
+ led_set_attr $status_led "trigger" "morse"
+ led_set_attr $status_led "delay" "$1"
+ led_set_attr $status_led "message" "$2"
+}
+
+status_led_on() {
+ led_set_attr $status_led "trigger" "none"
+ led_set_attr $status_led "brightness" 255
+}
+
+status_led_off() {
+ led_set_attr $status_led "trigger" "none"
+ led_set_attr $status_led "brightness" 0
+}
+
+set_state() {
+ case "$1" in
+ preinit)
+ status_led_set_timer 200 200
+ ;;
+ failsafe)
+ status_led_set_timer 50 50
+ ;;
+ done)
+ status_led_on
+ ;;
+ esac
+}
--- /dev/null
+#!/bin/sh
+#
+# Copyright (C) 2007 OpenWrt.org
+#
+# $Id$
+#
+
+board_name=""
+status_led=""
+sys_mtd_part=""
+
+adm5120_detect() {
+ board_name=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /system type/ {print $2}' /proc/cpuinfo)
+
+ case "$board_name" in
+ "Cellvision"*)
+ status_led="status"
+ sys_mtd_part="firmware"
+ ;;
+ "Compex"*)
+ status_led="diag"
+ case "$board_name" in
+ *-WRT)
+ sys_mtd_part="trx"
+ ;;
+ *)
+ sys_mtd_part="partition1"
+ ;;
+ esac
+ ;;
+ "Edimax"*)
+ status_led="power"
+ sys_mtd_part="firmware"
+ ;;
+ "Infineon"*)
+ sys_mtd_part="firmware"
+ ;;
+ "Mikrotik"*)
+ status_led="power"
+ ;;
+ "ZyXEL"*)
+ status_led="power"
+ sys_mtd_part="trx"
+ ;;
+ *)
+ ;;
+ esac
+}
+
+adm5120_detect
+++ /dev/null
-#!/bin/sh
-# wget2nand
-# This script can be used to download a TGZ file from your build system which
-# contains the files to be installed on the NAND flash on your RB1xx card.
-# The one parameter is the URL of the TGZ file to be downloaded.
-# Licence GPL V2
-# Author david.goodenough@linkchoose.co.uk
-# Based on cf2nand from RB532 support
-. /etc/functions.sh
-
-[ -d /tmp/wget2nand ] && {
- echo "/tmp/wget2nand already exists"
- exit 1
-}
-
-# first get an address for br-lan using udhcpc
-killall udhcpc
-/sbin/udhcpc -i br-lan
-
-# need to find the wget server from the command line
-url=$1
-[ -z "$url" ] && {
- echo "No URL specified for image TGZ"
- echo "Usage : $0 URL"
- exit 1
-}
-
-boot="$(find_mtd_part 'RouterBoard NAND Boot')"
-main="$(find_mtd_part 'rootfs')"
-[ -z "$boot" -o -z "$main" ] && {
- echo "Cannot find NAND Flash partitions"
- exit 1
-}
-
-echo "Erasing filesystem."
-mtd erase Boot 2>/dev/null >/dev/null
-mtd erase Main 2>/dev/null >/dev/null
-
-echo "Mounting $main as new root and $boot as boot partition"
-
-mkdir /tmp/wget2nand/
-mkdir /tmp/wget2nand-boot
-mount -t yaffs2 "$main" /tmp/wget2nand/
-mount -t yaffs2 "$boot" /tmp/wget2nand-boot
-
-echo "Copying filesystem..."
-( wget -O - $url/openwrt-adm5120-2.6-rootfs.tgz) | ( cd /tmp/wget2nand/; tar xvz )
-wget -O /tmp/wget2nand-boot/kernel $url/openwrt-adm5120-2.6-rb1xx-vmlinux
-
-chmod +x /tmp/wget2nand-boot/kernel
-
-# make sure everything is written before we unmount the partitions
-echo "chmod ugo+x /" > /tmp/wget2nand/etc/uci-defaults/set_root_permission
-sync
-ls /tmp/wget2nand-boot/
-ls /tmp/wget2nand/
-# unmount the partitions and remove the directories into which they were mounted
-umount /tmp/wget2nand-boot
-umount /tmp/wget2nand
-rmdir /tmp/wget2nand-boot
-rmdir /tmp/wget2nand
-
-# all done
-echo "Image written, you can now reboot. Remember to change the boot source to Boot from Nand"
--- /dev/null
+#!/bin/sh
+# wget2nand
+# This script can be used to download a TGZ file from your build system which
+# contains the files to be installed on the NAND flash on your RB1xx card.
+# The one parameter is the URL of the TGZ file to be downloaded.
+# Licence GPL V2
+# Author david.goodenough@linkchoose.co.uk
+# Based on cf2nand from RB532 support
+. /etc/functions.sh
+
+[ -d /tmp/wget2nand ] && {
+ echo "/tmp/wget2nand already exists"
+ exit 1
+}
+
+# first get an address for br-lan using udhcpc
+killall udhcpc
+/sbin/udhcpc -i br-lan
+
+# need to find the wget server from the command line
+url=$1
+[ -z "$url" ] && {
+ echo "No URL specified for image TGZ"
+ echo "Usage : $0 URL"
+ exit 1
+}
+
+boot="$(find_mtd_part 'RouterBoard NAND Boot')"
+main="$(find_mtd_part 'rootfs')"
+[ -z "$boot" -o -z "$main" ] && {
+ echo "Cannot find NAND Flash partitions"
+ exit 1
+}
+
+echo "Erasing filesystem."
+mtd erase Boot 2>/dev/null >/dev/null
+mtd erase Main 2>/dev/null >/dev/null
+
+echo "Mounting $main as new root and $boot as boot partition"
+
+mkdir /tmp/wget2nand/
+mkdir /tmp/wget2nand-boot
+mount -t yaffs2 "$main" /tmp/wget2nand/
+mount -t yaffs2 "$boot" /tmp/wget2nand-boot
+
+echo "Copying filesystem..."
+( wget -O - $url/openwrt-adm5120-2.6-rootfs.tgz) | ( cd /tmp/wget2nand/; tar xvz )
+wget -O /tmp/wget2nand-boot/kernel $url/openwrt-adm5120-2.6-rb1xx-vmlinux
+
+chmod +x /tmp/wget2nand-boot/kernel
+
+# make sure everything is written before we unmount the partitions
+echo "chmod ugo+x /" > /tmp/wget2nand/etc/uci-defaults/set_root_permission
+sync
+ls /tmp/wget2nand-boot/
+ls /tmp/wget2nand/
+# unmount the partitions and remove the directories into which they were mounted
+umount /tmp/wget2nand-boot
+umount /tmp/wget2nand
+rmdir /tmp/wget2nand-boot
+rmdir /tmp/wget2nand
+
+# all done
+echo "Image written, you can now reboot. Remember to change the boot source to Boot from Nand"
+++ /dev/null
-# Copyright (C) 2006 OpenWrt.org
-
-config interface loopback
- option ifname lo
- option proto static
- option ipaddr 127.0.0.1
- option netmask 255.0.0.0
-
-config interface lan
- option ifname eth1
- option type bridge
- option proto static
- option ipaddr 192.168.1.1
- option netmask 255.255.255.0
--- /dev/null
+# Copyright (C) 2006 OpenWrt.org
+
+config interface loopback
+ option ifname lo
+ option proto static
+ option ipaddr 127.0.0.1
+ option netmask 255.0.0.0
+
+config interface lan
+ option ifname eth1
+ option type bridge
+ option proto static
+ option ipaddr 192.168.1.1
+ option netmask 255.255.255.0
+++ /dev/null
-::sysinit:/etc/init.d/rcS S boot
-::shutdown:/etc/init.d/rcS K stop
-tts/0::askfirst:/bin/ash --login
-ttyS1::askfirst:/bin/ash --login
-tty1::askfirst:/bin/ash --login
--- /dev/null
+::sysinit:/etc/init.d/rcS S boot
+::shutdown:/etc/init.d/rcS K stop
+tts/0::askfirst:/bin/ash --login
+ttyS1::askfirst:/bin/ash --login
+tty1::askfirst:/bin/ash --login
+++ /dev/null
-# Copyright (C) 2006 OpenWrt.org
-
-config interface loopback
- option ifname lo
- option proto static
- option ipaddr 127.0.0.1
- option netmask 255.0.0.0
-
-config interface lan
- option ifname eth0
- option proto static
- option ipaddr 192.168.1.1
- option netmask 255.255.255.0
-
-
-
-## Example for ATM bridging.
-## Useful for PPPoE or IP over ATM. Will create 'nas${unit}'
-#
-# config atm-bridge
-# option unit 0
-# option encaps llc
-# option vpi 8
-# option vci 35
-
-
-# config interface wan
-## PPPoE:
-# option ifname nas0
-# option proto pppoe
-
-## PPPoA:
-# option ifname atm0
-# option proto pppoa
-# option encaps llc
-# option vpi 8
-# option vci 35
-
-## Both:
-# option username "my_username"
-# option password "my_password"
+++ /dev/null
-#!/bin/sh
-# Copyright (C) 2007 OpenWrt.org
-
-set_led() {
- local led="$1"
- local state="$2"
- [ -d "/sys/class/leds/ar7:$led" ] && echo "$state" > "/sys/class/leds/ar7:$led/brightness"
-}
-
-set_state() {
- case "$1" in
- preinit)
- set_led status 1
- ;;
- done)
- set_led status 0
- ;;
- esac
-}
+++ /dev/null
-#!/bin/sh /etc/rc.common
-# ADAM2 patcher for Netgear DG834 and compatible
-# Copyright (C) 2006 OpenWrt.org
-
-START=00
-start() {
- MD5="$(md5sum /dev/mtdblock0 | awk '{print $1}')"
- [ "$MD5" = "0530bfdf00ec155f4182afd70da028c1" ] && {
- mtd unlock adam2
- /sbin/adam2patcher /dev/mtdblock0
- }
- rm -f /etc/rc.d/S${START}adam2 /etc/init.d/adam2 /sbin/adam2patcher >&- 2>&-
-}
--- /dev/null
+# Copyright (C) 2006 OpenWrt.org
+
+config interface loopback
+ option ifname lo
+ option proto static
+ option ipaddr 127.0.0.1
+ option netmask 255.0.0.0
+
+config interface lan
+ option ifname eth0
+ option proto static
+ option ipaddr 192.168.1.1
+ option netmask 255.255.255.0
+
+
+
+## Example for ATM bridging.
+## Useful for PPPoE or IP over ATM. Will create 'nas${unit}'
+#
+# config atm-bridge
+# option unit 0
+# option encaps llc
+# option vpi 8
+# option vci 35
+
+
+# config interface wan
+## PPPoE:
+# option ifname nas0
+# option proto pppoe
+
+## PPPoA:
+# option ifname atm0
+# option proto pppoa
+# option encaps llc
+# option vpi 8
+# option vci 35
+
+## Both:
+# option username "my_username"
+# option password "my_password"
--- /dev/null
+#!/bin/sh
+# Copyright (C) 2007 OpenWrt.org
+
+set_led() {
+ local led="$1"
+ local state="$2"
+ [ -d "/sys/class/leds/ar7:$led" ] && echo "$state" > "/sys/class/leds/ar7:$led/brightness"
+}
+
+set_state() {
+ case "$1" in
+ preinit)
+ set_led status 1
+ ;;
+ done)
+ set_led status 0
+ ;;
+ esac
+}
--- /dev/null
+#!/bin/sh /etc/rc.common
+# ADAM2 patcher for Netgear DG834 and compatible
+# Copyright (C) 2006 OpenWrt.org
+
+START=00
+start() {
+ MD5="$(md5sum /dev/mtdblock0 | awk '{print $1}')"
+ [ "$MD5" = "0530bfdf00ec155f4182afd70da028c1" ] && {
+ mtd unlock adam2
+ /sbin/adam2patcher /dev/mtdblock0
+ }
+ rm -f /etc/rc.d/S${START}adam2 /etc/init.d/adam2 /sbin/adam2patcher >&- 2>&-
+}
+++ /dev/null
-::sysinit:/etc/init.d/rcS S boot
-::shutdown:/etc/init.d/rcS K stop
-tts/0::askfirst:/bin/ash --login
-ttyS0::askfirst:/bin/ash --login
-
-ttyS2::respawn:/sbin/getty -L ttyS2 115200 vt100
+++ /dev/null
-src snapshots http://vlink.guthrie.homedns.org/vlink3
-dest root /
-dest ram /tmp
--- /dev/null
+::sysinit:/etc/init.d/rcS S boot
+::shutdown:/etc/init.d/rcS K stop
+tts/0::askfirst:/bin/ash --login
+ttyS0::askfirst:/bin/ash --login
+
+ttyS2::respawn:/sbin/getty -L ttyS2 115200 vt100
--- /dev/null
+src snapshots http://vlink.guthrie.homedns.org/vlink3
+dest root /
+dest ram /tmp
+++ /dev/null
-# reset button only supported on ar5315+ at the moment
-grep 'Atheros AR231[567]' /proc/cpuinfo > /dev/null && {
- ifname=eth0
- failsafe_ip
- netmsg 192.168.1.255 "Press reset now, to enter Failsafe!"
- ifconfig "$ifname" 0.0.0.0 down
- sleep 2
-}
--- /dev/null
+# reset button only supported on ar5315+ at the moment
+grep 'Atheros AR231[567]' /proc/cpuinfo > /dev/null && {
+ ifname=eth0
+ failsafe_ip
+ netmsg 192.168.1.255 "Press reset now, to enter Failsafe!"
+ ifconfig "$ifname" 0.0.0.0 down
+ sleep 2
+}
+++ /dev/null
-#!/bin/sh
-# Copyright (C) 2007 OpenWrt.org
-
-set_led() {
- local led="$1"
- local state="$2"
- [ -d "/sys/class/leds/mtx1:$led" ] && echo "$state" > "/sys/class/leds/mtx1:$led/brightness"
-}
-
-set_state() {
- case "$1" in
- preinit)
- set_led green 0
- set_led red 1
- ;;
- failsafe)
- set_led green 1
- set_led red 1
- ;;
- done)
- set_led green 1
- set_led red 0
- ;;
- esac
-}
--- /dev/null
+#!/bin/sh
+# Copyright (C) 2007 OpenWrt.org
+
+set_led() {
+ local led="$1"
+ local state="$2"
+ [ -d "/sys/class/leds/mtx1:$led" ] && echo "$state" > "/sys/class/leds/mtx1:$led/brightness"
+}
+
+set_state() {
+ case "$1" in
+ preinit)
+ set_led green 0
+ set_led red 1
+ ;;
+ failsafe)
+ set_led green 1
+ set_led red 1
+ ;;
+ done)
+ set_led green 1
+ set_led red 0
+ ;;
+ esac
+}
+++ /dev/null
-#!/bin/sh
-# Copyright (C) 2006 OpenWrt.org
-
-set_led() {
- local led="$1"
- local state="$2"
- [ -f "/proc/diag/led/$1" ] && echo "$state" > "/proc/diag/led/$1"
-}
-
-set_state() {
- case "$1" in
- preinit)
- set_led dmz 1
- set_led diag 1
- set_led power 0
- ;;
- failsafe)
- set_led diag f
- set_led power f
- set_led dmz f
- ;;
- done)
- set_led dmz 0
- set_led diag 0
- set_led power 1
- ;;
- esac
-}
+++ /dev/null
-#!/bin/sh /etc/rc.common
-# Copyright (C) 2006 OpenWrt.org
-
-START=05
-
-start() {
- [ -e /etc/config/network ] && exit 0
-
- mkdir -p /etc/config
-
- (
- if grep -E 'mtd0: 000(6|a)0000' /proc/mtd 2>&- >&-; then
- # WGT634u
- echo boardtype=wgt634u
- else
- strings "$(find_mtd_part nvram)"
- fi
- ) | awk '
- function p(cfgname, name) {
- if (c[name] != "") print " option " cfgname " \"" c[name] "\""
- }
-
- function macinc(mac, maca, i, result) {
- split(mac, maca, ":")
- for (i = 1; i <= 6; i++) maca[i] = "0x" maca[i]
- if (++maca[6] > 0xff) {
- maca[5]++
- maca[6] = 0
- }
- for (i = 1; i <= 6; i++) {
- if (i != 1) result = result ":"
- result = result sprintf("%02x", maca[i])
- }
- return result
- }
-
- BEGIN {
- FS="="
- c["lan_ifname"]="eth0.0"
- c["wan_ifname"]="eth0.1"
- c["vlan0ports"]="1 2 3 4 5*"
- c["vlan1ports"]="0 5"
- getline < "/proc/diag/model"
- model=$0
- for (i = 0; i < 6; i++) {
- if (mac_check != "") mac_check = mac_check ":"
- mac_check = mac_check "[0-9a-fA-F][0-9a-fA-F]"
- }
- }
-
- ($1 == "boardnum") || ($1 == "boardtype") || ($1 == "boardflags") || ($1 ~ /macaddr/) {
- nvram[$1] = $2
- }
-
- END {
- if ((model == "ASUS WL-HDD") || (model == "ASUS WL-300g") || (model == "Linksys WAP54G V1")) {
- c["wan_ifname"] = ""
- c["lan_ifname"] = "eth1"
- }
- if (model == "ASUS WL-500g") {
- c["wan_ifname"] = "eth1"
- c["lan_ifname"] = "eth0"
- }
- if (model == "Dell TrueMobile 2300") {
- c["vlan0ports"] = "0 1 2 3 5*"
- c["vlan1ports"] = "4 5"
- }
- if (nvram["boardtype"] == "bcm94710r4") {
- # Toshiba WRC-1000
- c["lan_ifname"] = "eth0"
- c["wan_ifname"] = "eth1"
- }
- if (nvram["boardtype"] == "wgt634u") {
- c["vlan0ports"] = "0 1 2 3 5*"
- c["vlan1ports"] = "4 5"
- }
- if (nvram["boardtype"] == "0x0467") {
- c["vlan0ports"] = "0 1 2 3 5*"
- c["vlan1ports"] = "4 5"
- }
- if ((nvram["boardtype"] == "0x042f") || (nvram["boardtype"] == "0x0472")) {
- if (nvram["boardnum"] == "45") {
- # WL-500gP
- c["vlan0ports"] = "1 2 3 4 5*"
- c["vlan1ports"] = "0 5"
- } else {
- # Generic BCM94704
- c["vlan0ports"] = "0 1 2 3 4 5u"
- c["vlan1ports"] = ""
- c["lan_ifname"] = "eth0"
- c["wan_ifname"] = "eth1"
-
- # MAC addresses on 4704 tend to be screwed up. Add a workaround here
- if (nvram["et0macaddr"] ~ mac_check) {
- c["lan_macaddr"] = nvram["et0macaddr"]
- c["wan_macaddr"] = macinc(c["lan_macaddr"])
- }
- }
- }
-
- # WAP54G
- if ((nvram["boardnum"] == "2") || \
- (nvram["boardnum"] == "1024")) {
- c["lan_ifname"]="eth0"
- c["wan_ifname"]=""
- }
-
- # ASUS WL-700gE
- # These are actually same as defaults above. For some reason this script applies
- # Generic BCM94704 settings instead so we revert to proper settings here.
- # Hopefully someone will fix this properly soon.
- if (model == "ASUS WL-700gE") {
- c["lan_ifname"]="eth0.0"
- c["wan_ifname"]="eth0.1"
- c["vlan0ports"]="1 2 3 4 5*"
- c["vlan1ports"]="0 5"
- }
-
- if (model == "Motorola WR850G V2/V3") {
- c["vlan0ports"]="0 1 2 3 5*"
- c["vlan1ports"]="4 5"
- }
-
- print "#### VLAN configuration "
- print "config switch eth0"
- p("vlan0", "vlan0ports")
- p("vlan1", "vlan1ports")
- print ""
- print ""
- print "#### Loopback configuration"
- print "config interface loopback"
- print " option ifname \"lo\""
- print " option proto static"
- print " option ipaddr 127.0.0.1"
- print " option netmask 255.0.0.0"
- print ""
- print ""
- print "#### LAN configuration"
- print "config interface lan"
- print " option type bridge"
- p("ifname", "lan_ifname")
- p("macaddr", "lan_macaddr")
- print " option proto static"
- print " option ipaddr 192.168.1.1"
- print " option netmask 255.255.255.0"
- print ""
- print ""
- print "#### WAN configuration"
- print "config interface wan"
- p("ifname", "wan_ifname")
- p("macaddr", "wan_macaddr")
- print " option proto dhcp"
- }' > /etc/config/network
-}
+++ /dev/null
-. /etc/functions.sh
-
-failsafe() {
- lock /tmp/.failsafe
- failsafe_ip
-
- echo "0 1 2 3 4 5u*" > /proc/switch/eth0/vlan/0/ports
-
- set_state failsafe
- [ -x "/usr/sbin/nvram" ] && {
- [ "$(nvram get boot_wait)" != "on" ] && {
- nvram set boot_wait=on
- nvram commit
- }
- }
-
- netmsg 192.168.1.255 "Entering Failsafe!"
- telnetd -l /bin/login <> /dev/null 2>&1
-
- ash --login
-}
-
-mount none /proc -t proc
-
-insmod diag
-set_state preinit
-echo '/sbin/hotplug.failsafe' > /proc/sys/kernel/hotplug
-
-ifname=eth0
-
-# hardware specific overrides
-case "$(cat /proc/diag/model)" in
- "Linksys WAP54G V1") ifname=eth1;;
- "ASUS WL-HDD") ifname=eth1;;
- "ASUS WL-300g") ifname=eth1;;
- "ASUS (unknown, BCM4702)") ifname=eth1;;
-esac
-
-failsafe_ip
-
-insmod switch-core
-insmod switch-robo || insmod switch-adm || rmmod switch-core
-
-[ -d /proc/switch/eth0 ] && {
- echo 1 > /proc/switch/eth0/reset
-
- # this would be easier if we blasted the message across all ports
- # but we don't want packets leaking across interfaces
- for port in $(seq 0 4); do {
- echo "$port 5u*" > /proc/switch/eth0/vlan/0/ports
- netmsg 192.168.1.255 "Press reset now, to enter Failsafe!"
- }; done
-} || netmsg 192.168.1.255 "Press reset now, to enter Failsafe!"
-
-ifconfig $ifname 0.0.0.0 down
-
-sleep 2
-
+++ /dev/null
-platform_check_image() {
- [ "$ARGC" -gt 1 ] && return 1
-
- case "$(get_magic_word "$1")" in
- # .trx files
- 4844) return 0;;
- # .bin files
- 5735) return 0;;
- *)
- echo "Invalid image type"
- return 1
- ;;
- esac
-}
-
-platform_do_upgrade() {
- get_image "$1" > $(find_mtd_part "linux")
- sync
-}
-
-brcm_prepare_mtd() {
- [ "$SAVE_CONFIG" -eq 1 ] && return 0
-}
-append sysupgrade_pre_upgrade brcm_prepare_mtd
+++ /dev/null
-#!/bin/sh
-case "$1" in
- button) kill -USR1 1;;
-esac
--- /dev/null
+#!/bin/sh
+# Copyright (C) 2006 OpenWrt.org
+
+set_led() {
+ local led="$1"
+ local state="$2"
+ [ -f "/proc/diag/led/$1" ] && echo "$state" > "/proc/diag/led/$1"
+}
+
+set_state() {
+ case "$1" in
+ preinit)
+ set_led dmz 1
+ set_led diag 1
+ set_led power 0
+ ;;
+ failsafe)
+ set_led diag f
+ set_led power f
+ set_led dmz f
+ ;;
+ done)
+ set_led dmz 0
+ set_led diag 0
+ set_led power 1
+ ;;
+ esac
+}
--- /dev/null
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006 OpenWrt.org
+
+START=05
+
+start() {
+ [ -e /etc/config/network ] && exit 0
+
+ mkdir -p /etc/config
+
+ (
+ if grep -E 'mtd0: 000(6|a)0000' /proc/mtd 2>&- >&-; then
+ # WGT634u
+ echo boardtype=wgt634u
+ else
+ strings "$(find_mtd_part nvram)"
+ fi
+ ) | awk '
+ function p(cfgname, name) {
+ if (c[name] != "") print " option " cfgname " \"" c[name] "\""
+ }
+
+ function macinc(mac, maca, i, result) {
+ split(mac, maca, ":")
+ for (i = 1; i <= 6; i++) maca[i] = "0x" maca[i]
+ if (++maca[6] > 0xff) {
+ maca[5]++
+ maca[6] = 0
+ }
+ for (i = 1; i <= 6; i++) {
+ if (i != 1) result = result ":"
+ result = result sprintf("%02x", maca[i])
+ }
+ return result
+ }
+
+ BEGIN {
+ FS="="
+ c["lan_ifname"]="eth0.0"
+ c["wan_ifname"]="eth0.1"
+ c["vlan0ports"]="1 2 3 4 5*"
+ c["vlan1ports"]="0 5"
+ getline < "/proc/diag/model"
+ model=$0
+ for (i = 0; i < 6; i++) {
+ if (mac_check != "") mac_check = mac_check ":"
+ mac_check = mac_check "[0-9a-fA-F][0-9a-fA-F]"
+ }
+ }
+
+ ($1 == "boardnum") || ($1 == "boardtype") || ($1 == "boardflags") || ($1 ~ /macaddr/) {
+ nvram[$1] = $2
+ }
+
+ END {
+ if ((model == "ASUS WL-HDD") || (model == "ASUS WL-300g") || (model == "Linksys WAP54G V1")) {
+ c["wan_ifname"] = ""
+ c["lan_ifname"] = "eth1"
+ }
+ if (model == "ASUS WL-500g") {
+ c["wan_ifname"] = "eth1"
+ c["lan_ifname"] = "eth0"
+ }
+ if (model == "Dell TrueMobile 2300") {
+ c["vlan0ports"] = "0 1 2 3 5*"
+ c["vlan1ports"] = "4 5"
+ }
+ if (nvram["boardtype"] == "bcm94710r4") {
+ # Toshiba WRC-1000
+ c["lan_ifname"] = "eth0"
+ c["wan_ifname"] = "eth1"
+ }
+ if (nvram["boardtype"] == "wgt634u") {
+ c["vlan0ports"] = "0 1 2 3 5*"
+ c["vlan1ports"] = "4 5"
+ }
+ if (nvram["boardtype"] == "0x0467") {
+ c["vlan0ports"] = "0 1 2 3 5*"
+ c["vlan1ports"] = "4 5"
+ }
+ if ((nvram["boardtype"] == "0x042f") || (nvram["boardtype"] == "0x0472")) {
+ if (nvram["boardnum"] == "45") {
+ # WL-500gP
+ c["vlan0ports"] = "1 2 3 4 5*"
+ c["vlan1ports"] = "0 5"
+ } else {
+ # Generic BCM94704
+ c["vlan0ports"] = "0 1 2 3 4 5u"
+ c["vlan1ports"] = ""
+ c["lan_ifname"] = "eth0"
+ c["wan_ifname"] = "eth1"
+
+ # MAC addresses on 4704 tend to be screwed up. Add a workaround here
+ if (nvram["et0macaddr"] ~ mac_check) {
+ c["lan_macaddr"] = nvram["et0macaddr"]
+ c["wan_macaddr"] = macinc(c["lan_macaddr"])
+ }
+ }
+ }
+
+ # WAP54G
+ if ((nvram["boardnum"] == "2") || \
+ (nvram["boardnum"] == "1024")) {
+ c["lan_ifname"]="eth0"
+ c["wan_ifname"]=""
+ }
+
+ # ASUS WL-700gE
+ # These are actually same as defaults above. For some reason this script applies
+ # Generic BCM94704 settings instead so we revert to proper settings here.
+ # Hopefully someone will fix this properly soon.
+ if (model == "ASUS WL-700gE") {
+ c["lan_ifname"]="eth0.0"
+ c["wan_ifname"]="eth0.1"
+ c["vlan0ports"]="1 2 3 4 5*"
+ c["vlan1ports"]="0 5"
+ }
+
+ if (model == "Motorola WR850G V2/V3") {
+ c["vlan0ports"]="0 1 2 3 5*"
+ c["vlan1ports"]="4 5"
+ }
+
+ print "#### VLAN configuration "
+ print "config switch eth0"
+ p("vlan0", "vlan0ports")
+ p("vlan1", "vlan1ports")
+ print ""
+ print ""
+ print "#### Loopback configuration"
+ print "config interface loopback"
+ print " option ifname \"lo\""
+ print " option proto static"
+ print " option ipaddr 127.0.0.1"
+ print " option netmask 255.0.0.0"
+ print ""
+ print ""
+ print "#### LAN configuration"
+ print "config interface lan"
+ print " option type bridge"
+ p("ifname", "lan_ifname")
+ p("macaddr", "lan_macaddr")
+ print " option proto static"
+ print " option ipaddr 192.168.1.1"
+ print " option netmask 255.255.255.0"
+ print ""
+ print ""
+ print "#### WAN configuration"
+ print "config interface wan"
+ p("ifname", "wan_ifname")
+ p("macaddr", "wan_macaddr")
+ print " option proto dhcp"
+ }' > /etc/config/network
+}
--- /dev/null
+. /etc/functions.sh
+
+failsafe() {
+ lock /tmp/.failsafe
+ failsafe_ip
+
+ echo "0 1 2 3 4 5u*" > /proc/switch/eth0/vlan/0/ports
+
+ set_state failsafe
+ [ -x "/usr/sbin/nvram" ] && {
+ [ "$(nvram get boot_wait)" != "on" ] && {
+ nvram set boot_wait=on
+ nvram commit
+ }
+ }
+
+ netmsg 192.168.1.255 "Entering Failsafe!"
+ telnetd -l /bin/login <> /dev/null 2>&1
+
+ ash --login
+}
+
+mount none /proc -t proc
+
+insmod diag
+set_state preinit
+echo '/sbin/hotplug.failsafe' > /proc/sys/kernel/hotplug
+
+ifname=eth0
+
+# hardware specific overrides
+case "$(cat /proc/diag/model)" in
+ "Linksys WAP54G V1") ifname=eth1;;
+ "ASUS WL-HDD") ifname=eth1;;
+ "ASUS WL-300g") ifname=eth1;;
+ "ASUS (unknown, BCM4702)") ifname=eth1;;
+esac
+
+failsafe_ip
+
+insmod switch-core
+insmod switch-robo || insmod switch-adm || rmmod switch-core
+
+[ -d /proc/switch/eth0 ] && {
+ echo 1 > /proc/switch/eth0/reset
+
+ # this would be easier if we blasted the message across all ports
+ # but we don't want packets leaking across interfaces
+ for port in $(seq 0 4); do {
+ echo "$port 5u*" > /proc/switch/eth0/vlan/0/ports
+ netmsg 192.168.1.255 "Press reset now, to enter Failsafe!"
+ }; done
+} || netmsg 192.168.1.255 "Press reset now, to enter Failsafe!"
+
+ifconfig $ifname 0.0.0.0 down
+
+sleep 2
+
--- /dev/null
+platform_check_image() {
+ [ "$ARGC" -gt 1 ] && return 1
+
+ case "$(get_magic_word "$1")" in
+ # .trx files
+ 4844) return 0;;
+ # .bin files
+ 5735) return 0;;
+ *)
+ echo "Invalid image type"
+ return 1
+ ;;
+ esac
+}
+
+platform_do_upgrade() {
+ get_image "$1" > $(find_mtd_part "linux")
+ sync
+}
+
+brcm_prepare_mtd() {
+ [ "$SAVE_CONFIG" -eq 1 ] && return 0
+}
+append sysupgrade_pre_upgrade brcm_prepare_mtd
--- /dev/null
+#!/bin/sh
+case "$1" in
+ button) kill -USR1 1;;
+esac
+++ /dev/null
-# Copyright (C) 2006 OpenWrt.org
-
-config interface loopback
- option ifname lo
- option proto static
- option ipaddr 127.0.0.1
- option netmask 255.0.0.0
-
-config interface lan
- option ifname eth0
- option proto static
- option ipaddr 192.168.0.90
- option netmask 255.255.255.0
- #option dns 192.168.0.1
- #option gateway 192.168.0.1
+++ /dev/null
-src snapshots http://www.acmesystems.it/download/owrt/packages
-dest root /
-dest ram /tmp
+++ /dev/null
-root:$1$6upaSrHM$W/0IQ8kf7IYxCxEkJQ2D60:0:0:root:/root:/bin/ash
-nobody:*:65534:65534:nobody:/var:/bin/false
--- /dev/null
+# Copyright (C) 2006 OpenWrt.org
+
+config interface loopback
+ option ifname lo
+ option proto static
+ option ipaddr 127.0.0.1
+ option netmask 255.0.0.0
+
+config interface lan
+ option ifname eth0
+ option proto static
+ option ipaddr 192.168.0.90
+ option netmask 255.255.255.0
+ #option dns 192.168.0.1
+ #option gateway 192.168.0.1
--- /dev/null
+src snapshots http://www.acmesystems.it/download/owrt/packages
+dest root /
+dest ram /tmp
--- /dev/null
+root:$1$6upaSrHM$W/0IQ8kf7IYxCxEkJQ2D60:0:0:root:/root:/bin/ash
+nobody:*:65534:65534:nobody:/var:/bin/false
+++ /dev/null
-# Network configuration file
-
-config interface loopback
- option ifname lo
- option proto static
- option ipaddr 127.0.0.1
- option netmask 255.0.0.0
-
-config interface lan
- option ifname eth0
- option proto dhcp
--- /dev/null
+# Network configuration file
+
+config interface loopback
+ option ifname lo
+ option proto static
+ option ipaddr 127.0.0.1
+ option netmask 255.0.0.0
+
+config interface lan
+ option ifname eth0
+ option proto dhcp
+++ /dev/null
-# Copyright (C) 2006 OpenWrt.org
-
-config interface loopback
- option ifname lo
- option proto static
- option ipaddr 127.0.0.1
- option netmask 255.0.0.0
-
-config interface lan
- option ifname eth0
- option proto static
- option ipaddr 192.168.1.1
- option netmask 255.255.255.0
--- /dev/null
+# Copyright (C) 2006 OpenWrt.org
+
+config interface loopback
+ option ifname lo
+ option proto static
+ option ipaddr 127.0.0.1
+ option netmask 255.0.0.0
+
+config interface lan
+ option ifname eth0
+ option proto static
+ option ipaddr 192.168.1.1
+ option netmask 255.255.255.0
+++ /dev/null
-# Copyright (C) 2006 OpenWrt.org
-
-config interface loopback
- option ifname lo
- option proto static
- option ipaddr 127.0.0.1
- option netmask 255.0.0.0
-
-config interface lan
- option ifname eth0
- option proto dhcp
-
+++ /dev/null
-#!/bin/sh
-# Copyright (C) 2007 OpenWrt.org
-
-set_led() {
- local led="$1"
- local state="$2"
- [ -d "/sys/class/leds/rb500led:$led" ] && echo "$state" > "/sys/class/leds/rb500led:$led/brightness"
-}
-
-set_state() {
- case "$1" in
- preinit)
- set_led amber 1
- ;;
- done)
- set_led amber 0
- ;;
- esac
-}
+++ /dev/null
-#!/bin/sh
-. /etc/functions.sh
-
-copy_kernel() {
- local input="$1"
- local output="$2"
- local cmdline="$3"
- size="$(echo -n "$cmdline" | wc -c)"
- dd if="$input" bs=3M count=1 > "$output"
- /sbin/patch-cmdline "$output" "$cmdline"
-}
-
-fstype="$(mount | grep ' / ' | awk '$5 != "rootfs" {print $5}')"
-case "$fstype" in
- ext2|jffs2) echo "Copying from $fstype to yaffs2";;
- *) echo "Invalid filesystem."; exit 1;;
-esac
-
-[ -d /tmp/cf2nand ] && {
- echo "/tmp/cf2nand already exists"
- exit 1
-}
-
-mkdir /tmp/cf2nand
-mkdir /tmp/cf2nand/rootfs
-mount -t "$fstype" /dev/root /tmp/cf2nand/rootfs || {
- echo "Mounting rootfs failed."
- exit 1
-}
-
-boot="$(find_mtd_part 'RouterBoard NAND Boot')"
-main="$(find_mtd_part 'RouterBoard NAND Main')"
-[ -z "$boot" -o -z "$main" ] && {
- echo "Cannot find NAND Flash partitions"
- exit 1
-}
-
-echo "Erasing filesystem..."
-mtd erase Boot 2>/dev/null >/dev/null
-mtd erase Main 2>/dev/null >/dev/null
-
-mkdir /tmp/cf2nand/p1
-mkdir /tmp/cf2nand/p2
-mount -t yaffs2 "$boot" /tmp/cf2nand/p1
-mount -t yaffs2 "$main" /tmp/cf2nand/p2
-
-echo "Copying kernel..."
-copy_kernel /dev/cf/card0/part1 /tmp/cf2nand/p1/kernel "root=/dev/mtdblock1 rootfstype=yaffs2 init=/etc/preinit " 2>/dev/null >/dev/null
-umount /tmp/cf2nand/p1
-rmdir /tmp/cf2nand/p1
-
-echo "Copying filesystem..."
-( cd /tmp/cf2nand/rootfs; tar c . ) | ( cd /tmp/cf2nand/p2; tar x )
-echo "chmod ugo+x /" > /tmp/cf2nand/p2/etc/uci-defaults/set_root_permission
-sync
-umount /tmp/cf2nand/p2
-rmdir /tmp/cf2nand/p2
-
-umount /tmp/cf2nand/rootfs
-rmdir /tmp/cf2nand/rootfs
-rmdir /tmp/cf2nand
-
+++ /dev/null
-#!/bin/sh
-# wget2nand
-# This script can be used to download a TGZ file from your build system which
-# contains the files to be installed on the NAND flash on your RB1xx card.
-# The one parameter is the URL of the TGZ file to be downloaded.
-# Licence GPL V2
-# Author david.goodenough@linkchoose.co.uk
-# Based on cf2nand from RB532 support
-. /etc/functions.sh
-
-[ -d /tmp/wget2nand ] && {
- echo "/tmp/wget2nand already exists"
- exit 1
-}
-
-# first get an address for br-lan using udhcpc
-killall udhcpc
-/sbin/udhcpc -i br-lan
-
-# need to find the wget server from the command line
-url=$1
-[ -z "$url" ] && {
- echo "No URL specified for image TGZ"
- echo "Usage : $0 URL"
- exit 1
-}
-
-boot="$(find_mtd_part 'RouterBoard NAND Boot')"
-main="$(find_mtd_part 'rootfs')"
-[ -z "$boot" -o -z "$main" ] && {
- echo "Cannot find NAND Flash partitions"
- exit 1
-}
-
-echo "Erasing filesystem."
-mtd erase Boot 2>/dev/null >/dev/null
-mtd erase Main 2>/dev/null >/dev/null
-
-echo "Mounting $main as new root and $boot as boot partition"
-
-mkdir /tmp/wget2nand/
-mkdir /tmp/wget2nand-boot
-mount -t yaffs2 "$main" /tmp/wget2nand/
-mount -t yaffs2 "$boot" /tmp/wget2nand-boot
-
-echo "Copying filesystem..."
-( wget -O - $url/openwrt-rb532-2.6-rootfs.tgz) | ( cd /tmp/wget2nand/; tar xvz )
-wget -O /tmp/wget2nand-boot/kernel $url/openwrt-rb532-2.6-vmlinux
-
-# No need to patch the kernel, this was done during the build process
-chmod +x /tmp/wget2nand-boot/kernel
-
-# make sure everything is written before we unmount the partitions
-echo "chmod ugo+x /" > /tmp/wget2nand/etc/uci-defaults/set_root_permission
-sync
-ls /tmp/wget2nand-boot/
-ls /tmp/wget2nand/
-# unmount the partitions and remove the directories into which they were mounted
-umount /tmp/wget2nand-boot
-umount /tmp/wget2nand
-rmdir /tmp/wget2nand-boot
-rmdir /tmp/wget2nand
-
-# all done
-echo "Image written, you can now reboot. Remember to change the boot source to Boot from Nand"
--- /dev/null
+# Copyright (C) 2006 OpenWrt.org
+
+config interface loopback
+ option ifname lo
+ option proto static
+ option ipaddr 127.0.0.1
+ option netmask 255.0.0.0
+
+config interface lan
+ option ifname eth0
+ option proto dhcp
+
--- /dev/null
+#!/bin/sh
+# Copyright (C) 2007 OpenWrt.org
+
+set_led() {
+ local led="$1"
+ local state="$2"
+ [ -d "/sys/class/leds/rb500led:$led" ] && echo "$state" > "/sys/class/leds/rb500led:$led/brightness"
+}
+
+set_state() {
+ case "$1" in
+ preinit)
+ set_led amber 1
+ ;;
+ done)
+ set_led amber 0
+ ;;
+ esac
+}
--- /dev/null
+#!/bin/sh
+. /etc/functions.sh
+
+copy_kernel() {
+ local input="$1"
+ local output="$2"
+ local cmdline="$3"
+ size="$(echo -n "$cmdline" | wc -c)"
+ dd if="$input" bs=3M count=1 > "$output"
+ /sbin/patch-cmdline "$output" "$cmdline"
+}
+
+fstype="$(mount | grep ' / ' | awk '$5 != "rootfs" {print $5}')"
+case "$fstype" in
+ ext2|jffs2) echo "Copying from $fstype to yaffs2";;
+ *) echo "Invalid filesystem."; exit 1;;
+esac
+
+[ -d /tmp/cf2nand ] && {
+ echo "/tmp/cf2nand already exists"
+ exit 1
+}
+
+mkdir /tmp/cf2nand
+mkdir /tmp/cf2nand/rootfs
+mount -t "$fstype" /dev/root /tmp/cf2nand/rootfs || {
+ echo "Mounting rootfs failed."
+ exit 1
+}
+
+boot="$(find_mtd_part 'RouterBoard NAND Boot')"
+main="$(find_mtd_part 'RouterBoard NAND Main')"
+[ -z "$boot" -o -z "$main" ] && {
+ echo "Cannot find NAND Flash partitions"
+ exit 1
+}
+
+echo "Erasing filesystem..."
+mtd erase Boot 2>/dev/null >/dev/null
+mtd erase Main 2>/dev/null >/dev/null
+
+mkdir /tmp/cf2nand/p1
+mkdir /tmp/cf2nand/p2
+mount -t yaffs2 "$boot" /tmp/cf2nand/p1
+mount -t yaffs2 "$main" /tmp/cf2nand/p2
+
+echo "Copying kernel..."
+copy_kernel /dev/cf/card0/part1 /tmp/cf2nand/p1/kernel "root=/dev/mtdblock1 rootfstype=yaffs2 init=/etc/preinit " 2>/dev/null >/dev/null
+umount /tmp/cf2nand/p1
+rmdir /tmp/cf2nand/p1
+
+echo "Copying filesystem..."
+( cd /tmp/cf2nand/rootfs; tar c . ) | ( cd /tmp/cf2nand/p2; tar x )
+echo "chmod ugo+x /" > /tmp/cf2nand/p2/etc/uci-defaults/set_root_permission
+sync
+umount /tmp/cf2nand/p2
+rmdir /tmp/cf2nand/p2
+
+umount /tmp/cf2nand/rootfs
+rmdir /tmp/cf2nand/rootfs
+rmdir /tmp/cf2nand
+
--- /dev/null
+#!/bin/sh
+# wget2nand
+# This script can be used to download a TGZ file from your build system which
+# contains the files to be installed on the NAND flash on your RB1xx card.
+# The one parameter is the URL of the TGZ file to be downloaded.
+# Licence GPL V2
+# Author david.goodenough@linkchoose.co.uk
+# Based on cf2nand from RB532 support
+. /etc/functions.sh
+
+[ -d /tmp/wget2nand ] && {
+ echo "/tmp/wget2nand already exists"
+ exit 1
+}
+
+# first get an address for br-lan using udhcpc
+killall udhcpc
+/sbin/udhcpc -i br-lan
+
+# need to find the wget server from the command line
+url=$1
+[ -z "$url" ] && {
+ echo "No URL specified for image TGZ"
+ echo "Usage : $0 URL"
+ exit 1
+}
+
+boot="$(find_mtd_part 'RouterBoard NAND Boot')"
+main="$(find_mtd_part 'rootfs')"
+[ -z "$boot" -o -z "$main" ] && {
+ echo "Cannot find NAND Flash partitions"
+ exit 1
+}
+
+echo "Erasing filesystem."
+mtd erase Boot 2>/dev/null >/dev/null
+mtd erase Main 2>/dev/null >/dev/null
+
+echo "Mounting $main as new root and $boot as boot partition"
+
+mkdir /tmp/wget2nand/
+mkdir /tmp/wget2nand-boot
+mount -t yaffs2 "$main" /tmp/wget2nand/
+mount -t yaffs2 "$boot" /tmp/wget2nand-boot
+
+echo "Copying filesystem..."
+( wget -O - $url/openwrt-rb532-2.6-rootfs.tgz) | ( cd /tmp/wget2nand/; tar xvz )
+wget -O /tmp/wget2nand-boot/kernel $url/openwrt-rb532-2.6-vmlinux
+
+# No need to patch the kernel, this was done during the build process
+chmod +x /tmp/wget2nand-boot/kernel
+
+# make sure everything is written before we unmount the partitions
+echo "chmod ugo+x /" > /tmp/wget2nand/etc/uci-defaults/set_root_permission
+sync
+ls /tmp/wget2nand-boot/
+ls /tmp/wget2nand/
+# unmount the partitions and remove the directories into which they were mounted
+umount /tmp/wget2nand-boot
+umount /tmp/wget2nand
+rmdir /tmp/wget2nand-boot
+rmdir /tmp/wget2nand
+
+# all done
+echo "Image written, you can now reboot. Remember to change the boot source to Boot from Nand"
+++ /dev/null
-#!/bin/sh
-# Copyright (C) 2007 OpenWrt.org
-
-set_led() {
- local led="$1"
- local state="$2"
- [ -d "/sys/class/leds/rdc321x:$led" ] && echo "$state" > "/sys/class/leds/rdc321x:$led/brightness"
-}
-
-set_state() {
- case "$1" in
- preinit)
- set_led dmz 1
- ;;
- done)
- set_led dmz 0
- ;;
- esac
-}
+++ /dev/null
-::sysinit:/etc/init.d/rcS S boot
-::shutdown:/etc/init.d/rcS K stop
-tts/0::askfirst:/bin/ash --login
-ttyS0::askfirst:/bin/ash --login
-ttyS1::askfirst:/bin/ash --login
--- /dev/null
+#!/bin/sh
+# Copyright (C) 2007 OpenWrt.org
+
+set_led() {
+ local led="$1"
+ local state="$2"
+ [ -d "/sys/class/leds/rdc321x:$led" ] && echo "$state" > "/sys/class/leds/rdc321x:$led/brightness"
+}
+
+set_state() {
+ case "$1" in
+ preinit)
+ set_led dmz 1
+ ;;
+ done)
+ set_led dmz 0
+ ;;
+ esac
+}
--- /dev/null
+::sysinit:/etc/init.d/rcS S boot
+::shutdown:/etc/init.d/rcS K stop
+tts/0::askfirst:/bin/ash --login
+ttyS0::askfirst:/bin/ash --login
+ttyS1::askfirst:/bin/ash --login
+++ /dev/null
-# Copyright (C) 2006 OpenWrt.org
-
-config interface loopback
- option ifname lo
- option proto static
- option ipaddr 127.0.0.1
- option netmask 255.0.0.0
-
-config interface lan
- option type bridge
- option ifname "eth0 ath0"
- option proto static
- option ipaddr 192.168.1.1
- option netmask 255.255.255.0
+++ /dev/null
-# Copyright (C) 2006 OpenWrt.org
-
-::sysinit:/etc/init.d/rcS
-duart/0::askfirst:/bin/ash --login
-#tts/1::askfirst:/bin/ash --login
--- /dev/null
+# Copyright (C) 2006 OpenWrt.org
+
+config interface loopback
+ option ifname lo
+ option proto static
+ option ipaddr 127.0.0.1
+ option netmask 255.0.0.0
+
+config interface lan
+ option type bridge
+ option ifname "eth0 ath0"
+ option proto static
+ option ipaddr 192.168.1.1
+ option netmask 255.255.255.0
--- /dev/null
+# Copyright (C) 2006 OpenWrt.org
+
+::sysinit:/etc/init.d/rcS
+duart/0::askfirst:/bin/ash --login
+#tts/1::askfirst:/bin/ash --login
+++ /dev/null
-mount -t proc none /proc
-grep 'failsafe=' /proc/cmdline && export FAILSAFE=true
+++ /dev/null
-platform_check_image() {
- [ "$ARGC" -gt 1 ] && return 1
-
- case "$(get_magic_word "$1")" in
- 48eb) return 0;;
- *)
- echo "Invalid image type"
- return 1
- ;;
- esac
-}
-
-platform_do_upgrade() {
- get_image "$1" > /dev/hda
- sync
-}
-
-x86_prepare_ext2() {
- # if we're running from ext2, we need to make sure that we have a mtd
- # partition that points to the active rootfs partition.
- # however this only matters if we actually need to preserve the config files
- [ "$SAVE_CONFIG" -eq 1 ] && return 0
- grep rootfs /proc/mtd >/dev/null || {
- echo /dev/hda2,65536,rootfs > /sys/module/block2mtd/parameters/block2mtd
- }
-}
-append sysupgrade_pre_upgrade x86_prepare_ext2
--- /dev/null
+mount -t proc none /proc
+grep 'failsafe=' /proc/cmdline && export FAILSAFE=true
--- /dev/null
+platform_check_image() {
+ [ "$ARGC" -gt 1 ] && return 1
+
+ case "$(get_magic_word "$1")" in
+ 48eb) return 0;;
+ *)
+ echo "Invalid image type"
+ return 1
+ ;;
+ esac
+}
+
+platform_do_upgrade() {
+ get_image "$1" > /dev/hda
+ sync
+}
+
+x86_prepare_ext2() {
+ # if we're running from ext2, we need to make sure that we have a mtd
+ # partition that points to the active rootfs partition.
+ # however this only matters if we actually need to preserve the config files
+ [ "$SAVE_CONFIG" -eq 1 ] && return 0
+ grep rootfs /proc/mtd >/dev/null || {
+ echo /dev/hda2,65536,rootfs > /sys/module/block2mtd/parameters/block2mtd
+ }
+}
+append sysupgrade_pre_upgrade x86_prepare_ext2