From: Gabor Juhos Date: Sat, 29 Sep 2007 14:27:54 +0000 (+0000) Subject: get rid of per-profile base-files X-Git-Tag: reboot~27968 X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=438dfe5c6fbfa63f5841fda9b4ec44b2f7712674;p=openwrt%2Fstaging%2Fchunkeey.git get rid of per-profile base-files SVN-Revision: 9069 --- diff --git a/package/base-files/Makefile b/package/base-files/Makefile index d81ec4f1c4..f5bf1adce7 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -1,5 +1,5 @@ -# -# 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. @@ -130,19 +130,14 @@ define Package/base-files$(TARGET)/install 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 diff --git a/target/linux/adm5120/base-files/default/etc/diag.sh b/target/linux/adm5120/base-files/default/etc/diag.sh deleted file mode 100755 index 3d5d9d84aa..0000000000 --- a/target/linux/adm5120/base-files/default/etc/diag.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/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 -} diff --git a/target/linux/adm5120/base-files/default/lib/adm5120.sh b/target/linux/adm5120/base-files/default/lib/adm5120.sh deleted file mode 100755 index d599a09b15..0000000000 --- a/target/linux/adm5120/base-files/default/lib/adm5120.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/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 diff --git a/target/linux/adm5120/base-files/etc/diag.sh b/target/linux/adm5120/base-files/etc/diag.sh new file mode 100755 index 0000000000..3d5d9d84aa --- /dev/null +++ b/target/linux/adm5120/base-files/etc/diag.sh @@ -0,0 +1,48 @@ +#!/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 +} diff --git a/target/linux/adm5120/base-files/lib/adm5120.sh b/target/linux/adm5120/base-files/lib/adm5120.sh new file mode 100755 index 0000000000..d599a09b15 --- /dev/null +++ b/target/linux/adm5120/base-files/lib/adm5120.sh @@ -0,0 +1,50 @@ +#!/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 diff --git a/target/linux/adm5120/router_le/base-files/default/sbin/wget2nand b/target/linux/adm5120/router_le/base-files/default/sbin/wget2nand deleted file mode 100755 index adb56b946f..0000000000 --- a/target/linux/adm5120/router_le/base-files/default/sbin/wget2nand +++ /dev/null @@ -1,64 +0,0 @@ -#!/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" diff --git a/target/linux/adm5120/router_le/base-files/sbin/wget2nand b/target/linux/adm5120/router_le/base-files/sbin/wget2nand new file mode 100755 index 0000000000..adb56b946f --- /dev/null +++ b/target/linux/adm5120/router_le/base-files/sbin/wget2nand @@ -0,0 +1,64 @@ +#!/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" diff --git a/target/linux/amazon/base-files/default/etc/config/network b/target/linux/amazon/base-files/default/etc/config/network deleted file mode 100644 index 72e39f88a4..0000000000 --- a/target/linux/amazon/base-files/default/etc/config/network +++ /dev/null @@ -1,14 +0,0 @@ -# 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 diff --git a/target/linux/amazon/base-files/etc/config/network b/target/linux/amazon/base-files/etc/config/network new file mode 100644 index 0000000000..72e39f88a4 --- /dev/null +++ b/target/linux/amazon/base-files/etc/config/network @@ -0,0 +1,14 @@ +# 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 diff --git a/target/linux/amcc/base-files/default/etc/inittab b/target/linux/amcc/base-files/default/etc/inittab deleted file mode 100644 index 859dc530ce..0000000000 --- a/target/linux/amcc/base-files/default/etc/inittab +++ /dev/null @@ -1,5 +0,0 @@ -::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 diff --git a/target/linux/amcc/base-files/etc/inittab b/target/linux/amcc/base-files/etc/inittab new file mode 100644 index 0000000000..859dc530ce --- /dev/null +++ b/target/linux/amcc/base-files/etc/inittab @@ -0,0 +1,5 @@ +::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 diff --git a/target/linux/ar7/base-files/default/etc/config/network b/target/linux/ar7/base-files/default/etc/config/network deleted file mode 100644 index 5fa112cc6e..0000000000 --- a/target/linux/ar7/base-files/default/etc/config/network +++ /dev/null @@ -1,41 +0,0 @@ -# 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" diff --git a/target/linux/ar7/base-files/default/etc/diag.sh b/target/linux/ar7/base-files/default/etc/diag.sh deleted file mode 100644 index 22acc71abf..0000000000 --- a/target/linux/ar7/base-files/default/etc/diag.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/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 -} diff --git a/target/linux/ar7/base-files/default/etc/init.d/adam2 b/target/linux/ar7/base-files/default/etc/init.d/adam2 deleted file mode 100755 index 6b786270ea..0000000000 --- a/target/linux/ar7/base-files/default/etc/init.d/adam2 +++ /dev/null @@ -1,13 +0,0 @@ -#!/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>&- -} diff --git a/target/linux/ar7/base-files/etc/config/network b/target/linux/ar7/base-files/etc/config/network new file mode 100644 index 0000000000..5fa112cc6e --- /dev/null +++ b/target/linux/ar7/base-files/etc/config/network @@ -0,0 +1,41 @@ +# 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" diff --git a/target/linux/ar7/base-files/etc/diag.sh b/target/linux/ar7/base-files/etc/diag.sh new file mode 100644 index 0000000000..22acc71abf --- /dev/null +++ b/target/linux/ar7/base-files/etc/diag.sh @@ -0,0 +1,19 @@ +#!/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 +} diff --git a/target/linux/ar7/base-files/etc/init.d/adam2 b/target/linux/ar7/base-files/etc/init.d/adam2 new file mode 100755 index 0000000000..6b786270ea --- /dev/null +++ b/target/linux/ar7/base-files/etc/init.d/adam2 @@ -0,0 +1,13 @@ +#!/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>&- +} diff --git a/target/linux/at91/base-files/default/etc/inittab b/target/linux/at91/base-files/default/etc/inittab deleted file mode 100644 index a627ce5ffa..0000000000 --- a/target/linux/at91/base-files/default/etc/inittab +++ /dev/null @@ -1,6 +0,0 @@ -::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 diff --git a/target/linux/at91/base-files/default/etc/ipkg.conf b/target/linux/at91/base-files/default/etc/ipkg.conf deleted file mode 100644 index 10c4f67c66..0000000000 --- a/target/linux/at91/base-files/default/etc/ipkg.conf +++ /dev/null @@ -1,3 +0,0 @@ -src snapshots http://vlink.guthrie.homedns.org/vlink3 -dest root / -dest ram /tmp diff --git a/target/linux/at91/base-files/etc/inittab b/target/linux/at91/base-files/etc/inittab new file mode 100644 index 0000000000..a627ce5ffa --- /dev/null +++ b/target/linux/at91/base-files/etc/inittab @@ -0,0 +1,6 @@ +::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 diff --git a/target/linux/at91/base-files/etc/ipkg.conf b/target/linux/at91/base-files/etc/ipkg.conf new file mode 100644 index 0000000000..10c4f67c66 --- /dev/null +++ b/target/linux/at91/base-files/etc/ipkg.conf @@ -0,0 +1,3 @@ +src snapshots http://vlink.guthrie.homedns.org/vlink3 +dest root / +dest ram /tmp diff --git a/target/linux/atheros/base-files/default/etc/preinit.arch b/target/linux/atheros/base-files/default/etc/preinit.arch deleted file mode 100755 index 7e911ab2ad..0000000000 --- a/target/linux/atheros/base-files/default/etc/preinit.arch +++ /dev/null @@ -1,8 +0,0 @@ -# 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 -} diff --git a/target/linux/atheros/base-files/etc/preinit.arch b/target/linux/atheros/base-files/etc/preinit.arch new file mode 100755 index 0000000000..7e911ab2ad --- /dev/null +++ b/target/linux/atheros/base-files/etc/preinit.arch @@ -0,0 +1,8 @@ +# 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 +} diff --git a/target/linux/au1000/base-files/default/etc/diag.sh b/target/linux/au1000/base-files/default/etc/diag.sh deleted file mode 100644 index d97461532a..0000000000 --- a/target/linux/au1000/base-files/default/etc/diag.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/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 -} diff --git a/target/linux/au1000/base-files/etc/diag.sh b/target/linux/au1000/base-files/etc/diag.sh new file mode 100644 index 0000000000..d97461532a --- /dev/null +++ b/target/linux/au1000/base-files/etc/diag.sh @@ -0,0 +1,25 @@ +#!/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 +} diff --git a/target/linux/brcm-2.4/base-files/default/etc/diag.sh b/target/linux/brcm-2.4/base-files/default/etc/diag.sh deleted file mode 100644 index 3b08554c64..0000000000 --- a/target/linux/brcm-2.4/base-files/default/etc/diag.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/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 -} diff --git a/target/linux/brcm-2.4/base-files/default/etc/init.d/netconfig b/target/linux/brcm-2.4/base-files/default/etc/init.d/netconfig deleted file mode 100755 index 643ba35d31..0000000000 --- a/target/linux/brcm-2.4/base-files/default/etc/init.d/netconfig +++ /dev/null @@ -1,154 +0,0 @@ -#!/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 -} diff --git a/target/linux/brcm-2.4/base-files/default/etc/preinit.arch b/target/linux/brcm-2.4/base-files/default/etc/preinit.arch deleted file mode 100755 index 43df591ab7..0000000000 --- a/target/linux/brcm-2.4/base-files/default/etc/preinit.arch +++ /dev/null @@ -1,58 +0,0 @@ -. /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 - diff --git a/target/linux/brcm-2.4/base-files/default/lib/upgrade/platform.sh b/target/linux/brcm-2.4/base-files/default/lib/upgrade/platform.sh deleted file mode 100644 index ac53b9d591..0000000000 --- a/target/linux/brcm-2.4/base-files/default/lib/upgrade/platform.sh +++ /dev/null @@ -1,24 +0,0 @@ -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 diff --git a/target/linux/brcm-2.4/base-files/default/sbin/hotplug.failsafe b/target/linux/brcm-2.4/base-files/default/sbin/hotplug.failsafe deleted file mode 100755 index 0544339de8..0000000000 --- a/target/linux/brcm-2.4/base-files/default/sbin/hotplug.failsafe +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -case "$1" in - button) kill -USR1 1;; -esac diff --git a/target/linux/brcm-2.4/base-files/etc/diag.sh b/target/linux/brcm-2.4/base-files/etc/diag.sh new file mode 100644 index 0000000000..3b08554c64 --- /dev/null +++ b/target/linux/brcm-2.4/base-files/etc/diag.sh @@ -0,0 +1,28 @@ +#!/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 +} diff --git a/target/linux/brcm-2.4/base-files/etc/init.d/netconfig b/target/linux/brcm-2.4/base-files/etc/init.d/netconfig new file mode 100755 index 0000000000..643ba35d31 --- /dev/null +++ b/target/linux/brcm-2.4/base-files/etc/init.d/netconfig @@ -0,0 +1,154 @@ +#!/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 +} diff --git a/target/linux/brcm-2.4/base-files/etc/preinit.arch b/target/linux/brcm-2.4/base-files/etc/preinit.arch new file mode 100755 index 0000000000..43df591ab7 --- /dev/null +++ b/target/linux/brcm-2.4/base-files/etc/preinit.arch @@ -0,0 +1,58 @@ +. /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 + diff --git a/target/linux/brcm-2.4/base-files/lib/upgrade/platform.sh b/target/linux/brcm-2.4/base-files/lib/upgrade/platform.sh new file mode 100644 index 0000000000..ac53b9d591 --- /dev/null +++ b/target/linux/brcm-2.4/base-files/lib/upgrade/platform.sh @@ -0,0 +1,24 @@ +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 diff --git a/target/linux/brcm-2.4/base-files/sbin/hotplug.failsafe b/target/linux/brcm-2.4/base-files/sbin/hotplug.failsafe new file mode 100755 index 0000000000..0544339de8 --- /dev/null +++ b/target/linux/brcm-2.4/base-files/sbin/hotplug.failsafe @@ -0,0 +1,4 @@ +#!/bin/sh +case "$1" in + button) kill -USR1 1;; +esac diff --git a/target/linux/etrax/base-files/default/etc/config/network b/target/linux/etrax/base-files/default/etc/config/network deleted file mode 100644 index b3632fd068..0000000000 --- a/target/linux/etrax/base-files/default/etc/config/network +++ /dev/null @@ -1,15 +0,0 @@ -# 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 diff --git a/target/linux/etrax/base-files/default/etc/ipkg.conf b/target/linux/etrax/base-files/default/etc/ipkg.conf deleted file mode 100644 index a5ffc79bc7..0000000000 --- a/target/linux/etrax/base-files/default/etc/ipkg.conf +++ /dev/null @@ -1,3 +0,0 @@ -src snapshots http://www.acmesystems.it/download/owrt/packages -dest root / -dest ram /tmp diff --git a/target/linux/etrax/base-files/default/etc/passwd b/target/linux/etrax/base-files/default/etc/passwd deleted file mode 100644 index c5c9e46cc0..0000000000 --- a/target/linux/etrax/base-files/default/etc/passwd +++ /dev/null @@ -1,2 +0,0 @@ -root:$1$6upaSrHM$W/0IQ8kf7IYxCxEkJQ2D60:0:0:root:/root:/bin/ash -nobody:*:65534:65534:nobody:/var:/bin/false diff --git a/target/linux/etrax/base-files/etc/config/network b/target/linux/etrax/base-files/etc/config/network new file mode 100644 index 0000000000..b3632fd068 --- /dev/null +++ b/target/linux/etrax/base-files/etc/config/network @@ -0,0 +1,15 @@ +# 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 diff --git a/target/linux/etrax/base-files/etc/ipkg.conf b/target/linux/etrax/base-files/etc/ipkg.conf new file mode 100644 index 0000000000..a5ffc79bc7 --- /dev/null +++ b/target/linux/etrax/base-files/etc/ipkg.conf @@ -0,0 +1,3 @@ +src snapshots http://www.acmesystems.it/download/owrt/packages +dest root / +dest ram /tmp diff --git a/target/linux/etrax/base-files/etc/passwd b/target/linux/etrax/base-files/etc/passwd new file mode 100644 index 0000000000..c5c9e46cc0 --- /dev/null +++ b/target/linux/etrax/base-files/etc/passwd @@ -0,0 +1,2 @@ +root:$1$6upaSrHM$W/0IQ8kf7IYxCxEkJQ2D60:0:0:root:/root:/bin/ash +nobody:*:65534:65534:nobody:/var:/bin/false diff --git a/target/linux/iop32x/base-files/default/etc/config/network b/target/linux/iop32x/base-files/default/etc/config/network deleted file mode 100644 index 1d9b55b2d3..0000000000 --- a/target/linux/iop32x/base-files/default/etc/config/network +++ /dev/null @@ -1,11 +0,0 @@ -# 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 diff --git a/target/linux/iop32x/base-files/etc/config/network b/target/linux/iop32x/base-files/etc/config/network new file mode 100644 index 0000000000..1d9b55b2d3 --- /dev/null +++ b/target/linux/iop32x/base-files/etc/config/network @@ -0,0 +1,11 @@ +# 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 diff --git a/target/linux/ixp4xx/base-files/default/etc/config/network b/target/linux/ixp4xx/base-files/default/etc/config/network deleted file mode 100644 index 1d5ded3728..0000000000 --- a/target/linux/ixp4xx/base-files/default/etc/config/network +++ /dev/null @@ -1,13 +0,0 @@ -# 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 diff --git a/target/linux/ixp4xx/base-files/etc/config/network b/target/linux/ixp4xx/base-files/etc/config/network new file mode 100644 index 0000000000..1d5ded3728 --- /dev/null +++ b/target/linux/ixp4xx/base-files/etc/config/network @@ -0,0 +1,13 @@ +# 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 diff --git a/target/linux/rb532/base-files/default/etc/config/network b/target/linux/rb532/base-files/default/etc/config/network deleted file mode 100644 index 8279690574..0000000000 --- a/target/linux/rb532/base-files/default/etc/config/network +++ /dev/null @@ -1,12 +0,0 @@ -# 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 - diff --git a/target/linux/rb532/base-files/default/etc/diag.sh b/target/linux/rb532/base-files/default/etc/diag.sh deleted file mode 100644 index d8f9a88257..0000000000 --- a/target/linux/rb532/base-files/default/etc/diag.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/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 -} diff --git a/target/linux/rb532/base-files/default/sbin/cf2nand b/target/linux/rb532/base-files/default/sbin/cf2nand deleted file mode 100755 index fb3717499b..0000000000 --- a/target/linux/rb532/base-files/default/sbin/cf2nand +++ /dev/null @@ -1,62 +0,0 @@ -#!/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 - diff --git a/target/linux/rb532/base-files/default/sbin/wget2nand b/target/linux/rb532/base-files/default/sbin/wget2nand deleted file mode 100755 index 67e4a94a81..0000000000 --- a/target/linux/rb532/base-files/default/sbin/wget2nand +++ /dev/null @@ -1,65 +0,0 @@ -#!/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" diff --git a/target/linux/rb532/base-files/etc/config/network b/target/linux/rb532/base-files/etc/config/network new file mode 100644 index 0000000000..8279690574 --- /dev/null +++ b/target/linux/rb532/base-files/etc/config/network @@ -0,0 +1,12 @@ +# 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 + diff --git a/target/linux/rb532/base-files/etc/diag.sh b/target/linux/rb532/base-files/etc/diag.sh new file mode 100644 index 0000000000..d8f9a88257 --- /dev/null +++ b/target/linux/rb532/base-files/etc/diag.sh @@ -0,0 +1,19 @@ +#!/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 +} diff --git a/target/linux/rb532/base-files/sbin/cf2nand b/target/linux/rb532/base-files/sbin/cf2nand new file mode 100755 index 0000000000..fb3717499b --- /dev/null +++ b/target/linux/rb532/base-files/sbin/cf2nand @@ -0,0 +1,62 @@ +#!/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 + diff --git a/target/linux/rb532/base-files/sbin/wget2nand b/target/linux/rb532/base-files/sbin/wget2nand new file mode 100755 index 0000000000..67e4a94a81 --- /dev/null +++ b/target/linux/rb532/base-files/sbin/wget2nand @@ -0,0 +1,65 @@ +#!/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" diff --git a/target/linux/rdc/base-files/default/etc/diag.sh b/target/linux/rdc/base-files/default/etc/diag.sh deleted file mode 100644 index 8d5c38262c..0000000000 --- a/target/linux/rdc/base-files/default/etc/diag.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/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 -} diff --git a/target/linux/rdc/base-files/default/etc/inittab b/target/linux/rdc/base-files/default/etc/inittab deleted file mode 100644 index 02b920c8d0..0000000000 --- a/target/linux/rdc/base-files/default/etc/inittab +++ /dev/null @@ -1,5 +0,0 @@ -::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 diff --git a/target/linux/rdc/base-files/etc/diag.sh b/target/linux/rdc/base-files/etc/diag.sh new file mode 100644 index 0000000000..8d5c38262c --- /dev/null +++ b/target/linux/rdc/base-files/etc/diag.sh @@ -0,0 +1,19 @@ +#!/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 +} diff --git a/target/linux/rdc/base-files/etc/inittab b/target/linux/rdc/base-files/etc/inittab new file mode 100644 index 0000000000..02b920c8d0 --- /dev/null +++ b/target/linux/rdc/base-files/etc/inittab @@ -0,0 +1,5 @@ +::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 diff --git a/target/linux/sibyte/base-files/default/etc/config/network b/target/linux/sibyte/base-files/default/etc/config/network deleted file mode 100644 index 9b65652f06..0000000000 --- a/target/linux/sibyte/base-files/default/etc/config/network +++ /dev/null @@ -1,14 +0,0 @@ -# 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 diff --git a/target/linux/sibyte/base-files/default/etc/inittab b/target/linux/sibyte/base-files/default/etc/inittab deleted file mode 100644 index a6f4e17f01..0000000000 --- a/target/linux/sibyte/base-files/default/etc/inittab +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright (C) 2006 OpenWrt.org - -::sysinit:/etc/init.d/rcS -duart/0::askfirst:/bin/ash --login -#tts/1::askfirst:/bin/ash --login diff --git a/target/linux/sibyte/base-files/etc/config/network b/target/linux/sibyte/base-files/etc/config/network new file mode 100644 index 0000000000..9b65652f06 --- /dev/null +++ b/target/linux/sibyte/base-files/etc/config/network @@ -0,0 +1,14 @@ +# 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 diff --git a/target/linux/sibyte/base-files/etc/inittab b/target/linux/sibyte/base-files/etc/inittab new file mode 100644 index 0000000000..a6f4e17f01 --- /dev/null +++ b/target/linux/sibyte/base-files/etc/inittab @@ -0,0 +1,5 @@ +# Copyright (C) 2006 OpenWrt.org + +::sysinit:/etc/init.d/rcS +duart/0::askfirst:/bin/ash --login +#tts/1::askfirst:/bin/ash --login diff --git a/target/linux/x86/base-files/default/etc/preinit.arch b/target/linux/x86/base-files/default/etc/preinit.arch deleted file mode 100644 index f29f0d448b..0000000000 --- a/target/linux/x86/base-files/default/etc/preinit.arch +++ /dev/null @@ -1,2 +0,0 @@ -mount -t proc none /proc -grep 'failsafe=' /proc/cmdline && export FAILSAFE=true diff --git a/target/linux/x86/base-files/default/lib/upgrade/platform.sh b/target/linux/x86/base-files/default/lib/upgrade/platform.sh deleted file mode 100644 index ffd0b93ab4..0000000000 --- a/target/linux/x86/base-files/default/lib/upgrade/platform.sh +++ /dev/null @@ -1,27 +0,0 @@ -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 diff --git a/target/linux/x86/base-files/etc/preinit.arch b/target/linux/x86/base-files/etc/preinit.arch new file mode 100644 index 0000000000..f29f0d448b --- /dev/null +++ b/target/linux/x86/base-files/etc/preinit.arch @@ -0,0 +1,2 @@ +mount -t proc none /proc +grep 'failsafe=' /proc/cmdline && export FAILSAFE=true diff --git a/target/linux/x86/base-files/lib/upgrade/platform.sh b/target/linux/x86/base-files/lib/upgrade/platform.sh new file mode 100644 index 0000000000..ffd0b93ab4 --- /dev/null +++ b/target/linux/x86/base-files/lib/upgrade/platform.sh @@ -0,0 +1,27 @@ +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