From 9b305384e499a08d7918f042647d892257d8d733 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 31 May 2006 12:33:06 +0000 Subject: allow building of kernel-specific stuff in package/ instead of target/linux/package/ and merge target/linux/package/base-files into package/base-files git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@3855 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- package/base-files/Makefile | 54 ++++++--- package/base-files/ar7-2.4/etc/config/network | 27 +++++ package/base-files/ar7-2.4/etc/init.d/S00adam2 | 8 ++ package/base-files/aruba-2.6/etc/config/network | 5 + package/base-files/aruba-2.6/etc/init.d/S00aruba | 4 + package/base-files/aruba-2.6/init | 3 + package/base-files/au1000-2.6/etc/config/network | 12 ++ package/base-files/au1000-2.6/sbin/mount_root | 23 ++++ .../base-files/brcm-2.4/etc/hotplug.d/net/09-net | 43 +++++++ package/base-files/brcm-2.4/etc/init.d/S04nvram | 66 ++++++++++ .../base-files/brcm-2.4/etc/init.d/S05netconfig | 108 +++++++++++++++++ .../base-files/brcm-2.6/etc/hotplug.d/net/09-net | 33 +++++ .../base-files/brcm-2.6/etc/init.d/S05netconfig | 108 +++++++++++++++++ package/base-files/sibyte-2.6/etc/config/network | 12 ++ package/base-files/sibyte-2.6/etc/inittab | 3 + package/base-files/sibyte-2.6/init | 6 + package/base-files/src/adam2patcher.c | 59 +++++++++ package/base-files/src/jffs2root.c | 133 +++++++++++++++++++++ package/base-files/x86-2.4/etc/config/network | 12 ++ package/base-files/x86-2.6/etc/config/network | 12 ++ package/base-files/xscale-2.6/etc/config/network | 5 + package/base-files/xscale-2.6/etc/init.d/S00xscale | 4 + package/base-files/xscale-2.6/init | 3 + 23 files changed, 729 insertions(+), 14 deletions(-) create mode 100644 package/base-files/ar7-2.4/etc/config/network create mode 100755 package/base-files/ar7-2.4/etc/init.d/S00adam2 create mode 100644 package/base-files/aruba-2.6/etc/config/network create mode 100755 package/base-files/aruba-2.6/etc/init.d/S00aruba create mode 100755 package/base-files/aruba-2.6/init create mode 100644 package/base-files/au1000-2.6/etc/config/network create mode 100755 package/base-files/au1000-2.6/sbin/mount_root create mode 100644 package/base-files/brcm-2.4/etc/hotplug.d/net/09-net create mode 100755 package/base-files/brcm-2.4/etc/init.d/S04nvram create mode 100755 package/base-files/brcm-2.4/etc/init.d/S05netconfig create mode 100644 package/base-files/brcm-2.6/etc/hotplug.d/net/09-net create mode 100755 package/base-files/brcm-2.6/etc/init.d/S05netconfig create mode 100644 package/base-files/sibyte-2.6/etc/config/network create mode 100644 package/base-files/sibyte-2.6/etc/inittab create mode 100755 package/base-files/sibyte-2.6/init create mode 100644 package/base-files/src/adam2patcher.c create mode 100644 package/base-files/src/jffs2root.c create mode 100644 package/base-files/x86-2.4/etc/config/network create mode 100644 package/base-files/x86-2.6/etc/config/network create mode 100644 package/base-files/xscale-2.6/etc/config/network create mode 100755 package/base-files/xscale-2.6/etc/init.d/S00xscale create mode 100755 package/base-files/xscale-2.6/init (limited to 'package') diff --git a/package/base-files/Makefile b/package/base-files/Makefile index 2637949699..536857657f 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -3,14 +3,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=base-files -PKG_RELEASE:=7 +PKG_RELEASE:=8 PKG_BUILD_DIR:=$(BUILD_DIR)/base-files -BOARD:=$(shell LANG=C grep ^CONFIG_LINUX_2_._ $(TOPDIR)/.config|sed -e "s/=y//" \ - -e "s/.*_//"| tr "[:upper:]" "[:lower:]") -KERNEL:=$(shell LANG=C grep ^CONFIG_LINUX_2_._ $(TOPDIR)/.config|sed -e "s/=y//" \ - -e "s/CONFIG_LINUX_//" -e "s/_BRCM//" -e "s/_/./"| tr "[:upper:]" "[:lower:]") - REV:=$(shell LANG=C svn info | awk '/^Revision:/ { print$$2 }' ) ifeq ($(REV),) REV:=0 @@ -18,16 +13,23 @@ endif include $(TOPDIR)/package/rules.mk -#FIXME: use the version from ./toolchain/uclibc -UCLIBC_VERSION:=0.9.28 -LIBGCC_VERSION:=$(CONFIG_GCC_VERSION) +ifneq ($(DUMP),1) +include $(BUILD_DIR)/kernel.mk +include $(TOPDIR)/target/linux/rules.mk +TARGET:=-$(BOARD)-$(KERNEL) + +UCLIBC_VERSION:=${shell cat $(STAGING_DIR)/uclibc_version} +LIBGCC_VERSION:=${shell cat $(STAGING_DIR)/gcc_version} +endif + +CONFIG_PACKAGE_base-files$(TARGET):=CONFIG_PACKAGE_base-files -define Package/base-files +define Package/base-files$(TARGET) SECTION:=base CATEGORY:=Base system DEFAULT:=y TITLE:=OpenWrt system scripts - DESCRIPTION:=OpenWrt system scripts + DESCRIPTION:=Base filesystem for OpenWrt endef define Package/libgcc @@ -40,7 +42,7 @@ define Package/libgcc endef define Package/uclibc - $(call Package/base-files) + $(call Package/base-files$(TARGET)) VERSION:=$(UCLIBC_VERSION)-$(PKG_RELEASE) TITLE:=C library DESCRIPTION:=C library for embedded systems @@ -51,11 +53,35 @@ define Build/Prepare mkdir -p $(PKG_BUILD_DIR) endef + +define Build/Compile/ar7 + $(TARGET_CC) -o $(PKG_BUILD_DIR)/adam2patcher src/adam2patcher.c +endef + +define Build/Compile/brcm + $(TARGET_CC) -o $(PKG_BUILD_DIR)/jffs2root src/jffs2root.c +endef + define Build/Compile +$(call Build/Compile/$(BOARD)) +endef + + +define Package/base-files$(TARGET)/install-ar7 + mkdir -p $(1)/sbin + $(CP) $(PKG_BUILD_DIR)/adam2patcher $(1)/sbin +endef +define Package/base-files$(TARGET)/install-brcm + mkdir -p $(1)/sbin + $(CP) $(PKG_BUILD_DIR)/jffs2root $(1)/sbin endef -define Package/base-files/install +define Package/base-files$(TARGET)/install +$(call Package/base-files$(TARGET)/install-$(BOARD),$(1)) $(CP) ./default/* $(1) + if [ -d $(BOARD)-$(KERNEL) ]; then \ + $(CP) $(BOARD)-$(KERNEL)/* $(1)/; \ + fi $(SED) 's,$$$$R,r$(REV),g' $(1)/etc/banner $(SED) 's,$$$$S,$(BOARD)-$(KERNEL),g' $(1)/etc/ipkg.conf mkdir -p $(1)/dev @@ -92,6 +118,6 @@ define Package/libgcc/install $(CP) $(STAGING_DIR)/lib/libgcc_s.so.* $(1)/lib/ endef -$(eval $(call BuildPackage,base-files)) +$(eval $(call BuildPackage,base-files$(TARGET))) $(eval $(call BuildPackage,libgcc)) $(eval $(call BuildPackage,uclibc)) diff --git a/package/base-files/ar7-2.4/etc/config/network b/package/base-files/ar7-2.4/etc/config/network new file mode 100644 index 0000000000..353538bf49 --- /dev/null +++ b/package/base-files/ar7-2.4/etc/config/network @@ -0,0 +1,27 @@ +# Network configuration file +# Uncomment the following statements to change the network configuration + +## LAN configuration +lan_ifname="eth0" +lan_proto="static" +lan_ipaddr="192.168.1.1" +lan_netmask="255.255.255.0" +# lan_gateway="" +# lan_dns="" + +## WAN configuration +# wan_proto=pppoe +wan_ifname=ppp0 +wan_device=nas0 +atm_vpi=8 +atm_vci=35 +# ppp_username=my_username +# ppp_passwd=my_passwd + +## WAN configuration (pppoe) +pppoe_atm=1 +ppp_mtu=1492 + +## WAN configuration (pppoa) +# ppp_mtu=1500 + diff --git a/package/base-files/ar7-2.4/etc/init.d/S00adam2 b/package/base-files/ar7-2.4/etc/init.d/S00adam2 new file mode 100755 index 0000000000..0ca4c01453 --- /dev/null +++ b/package/base-files/ar7-2.4/etc/init.d/S00adam2 @@ -0,0 +1,8 @@ +#!/bin/sh +# ADAM2 patcher for Netgear DG834 and compatible +MD5="$(md5sum /dev/mtdblock/0 | awk '{print $1}')" +[ "$MD5" = "0530bfdf00ec155f4182afd70da028c1" ] && { + mtd unlock adam2 + /sbin/adam2patcher /dev/mtdblock/0 +} +rm -f /etc/init.d/S00adam2 /sbin/adam2patcher >&- 2>&- diff --git a/package/base-files/aruba-2.6/etc/config/network b/package/base-files/aruba-2.6/etc/config/network new file mode 100644 index 0000000000..f60332cd8c --- /dev/null +++ b/package/base-files/aruba-2.6/etc/config/network @@ -0,0 +1,5 @@ +# Network configuration file + +## LAN configuration +lan_ifname="eth0" +lan_proto="dhcp" diff --git a/package/base-files/aruba-2.6/etc/init.d/S00aruba b/package/base-files/aruba-2.6/etc/init.d/S00aruba new file mode 100755 index 0000000000..9836de423b --- /dev/null +++ b/package/base-files/aruba-2.6/etc/init.d/S00aruba @@ -0,0 +1,4 @@ +#!/bin/sh +mount none /proc -t proc +mount_root failsafe +mount -o remount,rw /dev/root / diff --git a/package/base-files/aruba-2.6/init b/package/base-files/aruba-2.6/init new file mode 100755 index 0000000000..8ca48a04c1 --- /dev/null +++ b/package/base-files/aruba-2.6/init @@ -0,0 +1,3 @@ +#!/bin/ash +mount none /dev -t devfs +exec /bin/busybox init diff --git a/package/base-files/au1000-2.6/etc/config/network b/package/base-files/au1000-2.6/etc/config/network new file mode 100644 index 0000000000..2cc9e26717 --- /dev/null +++ b/package/base-files/au1000-2.6/etc/config/network @@ -0,0 +1,12 @@ +# Network configuration file + +## LAN configuration +lan_ifname="br0" +lan_ifnames="eth0 ath0" +lan_proto="static" +lan_ipaddr="192.168.1.1" +lan_netmask="255.255.255.0" + +## WAN configuration +wan_ifname="" +wan_proto="none" diff --git a/package/base-files/au1000-2.6/sbin/mount_root b/package/base-files/au1000-2.6/sbin/mount_root new file mode 100755 index 0000000000..5dd1b0c562 --- /dev/null +++ b/package/base-files/au1000-2.6/sbin/mount_root @@ -0,0 +1,23 @@ +#!/bin/sh +size=$(awk '/Mem:/ {l=5242880;print((s=$2/2)&- + if [ $? = 0 ] ; then + if [ $(cat /proc/mtd | wc -l) = 6 ]; then + mtd erase filesystem + jffs2root --move + else + mount -o remount,rw /dev/root / + fi + else + . /bin/firstboot + fi +fi + +mount none /tmp -t tmpfs -o remount,nosuid,nodev,mode=1777 +mkdir -p /dev/pts +mount none /dev/pts -t devpts +mount -t sysfs none /sys 2>&- diff --git a/package/base-files/brcm-2.4/etc/hotplug.d/net/09-net b/package/base-files/brcm-2.4/etc/hotplug.d/net/09-net new file mode 100644 index 0000000000..9dd77963ba --- /dev/null +++ b/package/base-files/brcm-2.4/etc/hotplug.d/net/09-net @@ -0,0 +1,43 @@ +#!/bin/sh +setup_wl() +{ + [ -f /proc/net/wl0 ] && { + lsmod | grep wlcompat >&- || insmod wlcompat + } + iwconfig "$INTERFACE" 2>&- | grep -v 'no wireless' >&- && { + /sbin/wifi + } +} +setup_eth() +{ + [ -d /proc/switch ] || { + insmod switch-core + insmod switch-robo || insmod switch-adm + } + if="$(echo "$INTERFACE" | sed s,eth,et,)" + ifconfig "$INTERFACE" up 2>&- >&- + [ -d "/proc/switch/$INTERFACE" ] || return 0 + echo "1" > "/proc/switch/$INTERFACE/reset" + echo "1" > "/proc/switch/$INTERFACE/enable_vlan" + for vlan in $(seq 0 15); do + eval "hwname=\"\${vlan${vlan}hwname}\"" + [ "$hwname" = "$if" ] && { + eval "vports=\"\${vlan${vlan}ports}\"" + [ -n "$vports" ] && echo "$vports" > "/proc/switch/$INTERFACE/vlan/$vlan/ports" + $DEBUG vconfig add "$INTERFACE" "$vlan" + } + done +} + +do_register() +{ + case "${INTERFACE%%[0-9]*}" in + eth) setup_eth;; + wl) setup_wl;; + esac +} + + +case "$ACTION" in + add|register) do_register;; +esac diff --git a/package/base-files/brcm-2.4/etc/init.d/S04nvram b/package/base-files/brcm-2.4/etc/init.d/S04nvram new file mode 100755 index 0000000000..4de124735b --- /dev/null +++ b/package/base-files/brcm-2.4/etc/init.d/S04nvram @@ -0,0 +1,66 @@ +#!/bin/sh +# NVRAM setup +# +# This file handles the NVRAM quirks of various hardware. + +# WGT634u +grep 'mtd0: 00060000' /proc/mtd 2>&- >&- && exit + +alias debug=${DEBUG:-:} + +nvram_default() { + [ -z "$(nvram get $1)" ] && nvram set "$1=$2" +} + +nvram_set() { # for the linksys fixup part + [ "$(nvram get "$1")" = "$2" -a "$2" != "" ] || { + COMMIT=1 + /usr/sbin/nvram set "$1=$2" + } +} + +# work around braindead CFE defaults in linksys routers +boardtype=$(nvram get boardtype) +boardnum=$(nvram get boardnum) +boardflags=$(($(nvram get boardflags))) +adm_switch="$(( ($boardflags & 0x80) >> 7 ))" + +case "$(( $boardtype ))" in + "1800") #0x708 + if [ "$adm_switch" = 0 ]; then + nvram_set sdram_init "$(printf 0x%04x $(( $(/usr/sbin/nvram get sdram_init) | 0x0100 )))" + [ "$COMMIT" = 1 ] && { + nvram_set sdram_config 0x0062 + nvram_set clkfreq 216 + nvram_set sdram_ncdl 0x0 + nvram_set pa0itssit 62 + nvram_set pa0b0 0x15eb + nvram_set pa0b1 0xfa82 + nvram_set pa0b2 0xfe66 + nvram_set pa0maxpwr 0x4e + } + fi + ;; + "1127") #0x467 + nvram_set sdram_init "$(printf 0x%04x $(( $(/usr/sbin/nvram get sdram_init) | 0x0100 )))" + [ "$COMMIT" = 1 ] && { + nvram_set sdram_config 0x0062 + nvram_set sdram_ncdl 0x0 + nvram_set pa0itssit 62 + nvram_set pa0b0 0x168b + nvram_set pa0b1 0xfabf + nvram_set pa0b2 0xfeaf + nvram_set pa0maxpwr 0x4e + } + ;; +esac +[ "$COMMIT" = "1" ] && nvram commit + +# hack for some motorola routers +nvram unset wl0gpio0 + +[ "$(nvram get il0macaddr)" = "00:90:4c:5f:00:2a" ] && { + # if default wifi mac, set two higher than the lan mac + nvram set il0macaddr=$(nvram get et0macaddr| + awk '{OFS=FS=":";for(x=7,y=2;--x;){$x=sprintf("%02x",(y+="0x"$x)%256);y/=256}print}') +} diff --git a/package/base-files/brcm-2.4/etc/init.d/S05netconfig b/package/base-files/brcm-2.4/etc/init.d/S05netconfig new file mode 100755 index 0000000000..6a626f54a5 --- /dev/null +++ b/package/base-files/brcm-2.4/etc/init.d/S05netconfig @@ -0,0 +1,108 @@ +#!/bin/sh +[ -e /etc/config/network ] && exit 0 + +mkdir -p /etc/config + +( + if grep 'mtd0: 00060000' /proc/mtd 2>&- >&-; then + # WGT634u + echo boardtype=wgt634u + else + strings /dev/mtdblock/3 + fi +) | awk ' +function p(name) { + if (c[name] != "") print name "=\"" c[name] "\"" +} + +BEGIN { + FS="=" + c["lan_ifname"]="br0" + c["lan_ifnames"]="vlan0 eth1" + c["wan_proto"]="none" + c["wan_ifname"]="vlan1" + c["vlan0ports"]="1 2 3 4 5*" + c["vlan1ports"]="0 5" +} + +($1 == "boardnum") || ($1 == "boardtype") || ($1 == "boardflags") { + nvram[$1] = $2 +} + +END { + # v1 hardware + if (nvram["boardtype"] == "bcm94710dev") { + # Linksys WRT54G v1.x + if (nvram["boardnum"] == "42") { + c["vlan0ports"]="" + c["vlan1ports"]="" + c["lan_ifnames"]="vlan2 eth2" + } + + # Asus WL-500g + if (nvram["boardnum"] == "asusX") { + c["lan_ifnames"]="eth0 eth1 eth2" # FIXME + # wan_ifname=eth1 + } + } + if (nvram["boardtype"] == "wgt634u") { + c["vlan0ports"] = "0 1 2 3 5*" + c["vlan1ports"] = "4 5" + c["lan_ifnames"] = "vlan0 ath0" + } + if ((nvram["boardtype"] == "0x0467") || (nvram["boardtype"] == "0x042f")) { + c["vlan0ports"] = "0 1 2 3 5*" + c["vlan1ports"] = "4 5" + } + + # WAP54G + if ((nvram["boardnum"] == "2") || \ + (nvram["boardnum"] == "1024")) { + c["lan_ifnames"]="eth0 eth1" + c["wan_ifname"]="" + } + + print "#### VLAN configuration " + print "vlan0hwname=et0" + print "vlan1hwname=et0" + p("vlan0ports") + p("vlan1ports") + print "" + print "" + + print "#### LAN configuration" + print "lan_proto=\"static\"" + p("lan_ifname") + p("lan_ifnames") + print "lan_ipaddr=\"192.168.1.1\"" + print "lan_netmask=\"255.255.255.0\"" + print "# lan_dns=\"192.168.1.1\"" + print "# lan_gateway=\"192.168.1.1\"" + + print "" + print "" + + print "#### WAN configuration" + print "# wan_proto: WAN protocol, available protocols:" + print "# none: disable" + print "# dhcp: DHCP" + print "# static: Static IP" + print "# pppoe: PPP over Ethernet" + print "# pptp: Point-to-Point tunneling Protocol" + print "# for pppoe and pptp you need to use wan_ifname=\"ppp0\"" + print "" + print "wan_proto=dhcp" + p("wan_ifname") + print "wan_device=\"" c["wan_ifname"] "\"" + print "# wan_ipaddr=\"192.168.0.2\"" + print "# wan_netmask=\"255.255.255.0\"" + print "# wan_gateway=\"192.168.0.1\"" + print "# wan_dns=\"192.168.0.1\"" + print "" + print "## PPP over Ethernet and PPTP" + print "# wan_ifname=\"ppp0\"" + print "# ppp_username=\"my_username\"" + print "# ppp_passwd=\"my_password\"" + print "# pptp_server_ip=\"192.168.0.1\"" +} +' > /etc/config/network diff --git a/package/base-files/brcm-2.6/etc/hotplug.d/net/09-net b/package/base-files/brcm-2.6/etc/hotplug.d/net/09-net new file mode 100644 index 0000000000..8bbf604df8 --- /dev/null +++ b/package/base-files/brcm-2.6/etc/hotplug.d/net/09-net @@ -0,0 +1,33 @@ +#!/bin/sh +setup_eth() +{ + [ -d /proc/switch ] || { + insmod switch-core + insmod switch-robo || insmod switch-adm + } + if="$(echo "$INTERFACE" | sed s,eth,et,)" + ifconfig "$INTERFACE" up 2>&- >&- + [ -d "/proc/switch/$INTERFACE" ] || return 0 + echo "1" > "/proc/switch/$INTERFACE/reset" + echo "1" > "/proc/switch/$INTERFACE/enable_vlan" + for vlan in $(seq 0 15); do + eval "hwname=\"\${vlan${vlan}hwname}\"" + [ "$hwname" = "$if" ] && { + eval "vports=\"\${vlan${vlan}ports}\"" + [ -n "$vports" ] && echo "$vports" > "/proc/switch/$INTERFACE/vlan/$vlan/ports" + $DEBUG vconfig add "$INTERFACE" "$vlan" + } + done +} + +do_register() +{ + case "${INTERFACE%%[0-9]*}" in + eth) setup_eth;; + esac +} + + +case "$ACTION" in + add|register) do_register;; +esac diff --git a/package/base-files/brcm-2.6/etc/init.d/S05netconfig b/package/base-files/brcm-2.6/etc/init.d/S05netconfig new file mode 100755 index 0000000000..6a626f54a5 --- /dev/null +++ b/package/base-files/brcm-2.6/etc/init.d/S05netconfig @@ -0,0 +1,108 @@ +#!/bin/sh +[ -e /etc/config/network ] && exit 0 + +mkdir -p /etc/config + +( + if grep 'mtd0: 00060000' /proc/mtd 2>&- >&-; then + # WGT634u + echo boardtype=wgt634u + else + strings /dev/mtdblock/3 + fi +) | awk ' +function p(name) { + if (c[name] != "") print name "=\"" c[name] "\"" +} + +BEGIN { + FS="=" + c["lan_ifname"]="br0" + c["lan_ifnames"]="vlan0 eth1" + c["wan_proto"]="none" + c["wan_ifname"]="vlan1" + c["vlan0ports"]="1 2 3 4 5*" + c["vlan1ports"]="0 5" +} + +($1 == "boardnum") || ($1 == "boardtype") || ($1 == "boardflags") { + nvram[$1] = $2 +} + +END { + # v1 hardware + if (nvram["boardtype"] == "bcm94710dev") { + # Linksys WRT54G v1.x + if (nvram["boardnum"] == "42") { + c["vlan0ports"]="" + c["vlan1ports"]="" + c["lan_ifnames"]="vlan2 eth2" + } + + # Asus WL-500g + if (nvram["boardnum"] == "asusX") { + c["lan_ifnames"]="eth0 eth1 eth2" # FIXME + # wan_ifname=eth1 + } + } + if (nvram["boardtype"] == "wgt634u") { + c["vlan0ports"] = "0 1 2 3 5*" + c["vlan1ports"] = "4 5" + c["lan_ifnames"] = "vlan0 ath0" + } + if ((nvram["boardtype"] == "0x0467") || (nvram["boardtype"] == "0x042f")) { + c["vlan0ports"] = "0 1 2 3 5*" + c["vlan1ports"] = "4 5" + } + + # WAP54G + if ((nvram["boardnum"] == "2") || \ + (nvram["boardnum"] == "1024")) { + c["lan_ifnames"]="eth0 eth1" + c["wan_ifname"]="" + } + + print "#### VLAN configuration " + print "vlan0hwname=et0" + print "vlan1hwname=et0" + p("vlan0ports") + p("vlan1ports") + print "" + print "" + + print "#### LAN configuration" + print "lan_proto=\"static\"" + p("lan_ifname") + p("lan_ifnames") + print "lan_ipaddr=\"192.168.1.1\"" + print "lan_netmask=\"255.255.255.0\"" + print "# lan_dns=\"192.168.1.1\"" + print "# lan_gateway=\"192.168.1.1\"" + + print "" + print "" + + print "#### WAN configuration" + print "# wan_proto: WAN protocol, available protocols:" + print "# none: disable" + print "# dhcp: DHCP" + print "# static: Static IP" + print "# pppoe: PPP over Ethernet" + print "# pptp: Point-to-Point tunneling Protocol" + print "# for pppoe and pptp you need to use wan_ifname=\"ppp0\"" + print "" + print "wan_proto=dhcp" + p("wan_ifname") + print "wan_device=\"" c["wan_ifname"] "\"" + print "# wan_ipaddr=\"192.168.0.2\"" + print "# wan_netmask=\"255.255.255.0\"" + print "# wan_gateway=\"192.168.0.1\"" + print "# wan_dns=\"192.168.0.1\"" + print "" + print "## PPP over Ethernet and PPTP" + print "# wan_ifname=\"ppp0\"" + print "# ppp_username=\"my_username\"" + print "# ppp_passwd=\"my_password\"" + print "# pptp_server_ip=\"192.168.0.1\"" +} +' > /etc/config/network diff --git a/package/base-files/sibyte-2.6/etc/config/network b/package/base-files/sibyte-2.6/etc/config/network new file mode 100644 index 0000000000..2cc9e26717 --- /dev/null +++ b/package/base-files/sibyte-2.6/etc/config/network @@ -0,0 +1,12 @@ +# Network configuration file + +## LAN configuration +lan_ifname="br0" +lan_ifnames="eth0 ath0" +lan_proto="static" +lan_ipaddr="192.168.1.1" +lan_netmask="255.255.255.0" + +## WAN configuration +wan_ifname="" +wan_proto="none" diff --git a/package/base-files/sibyte-2.6/etc/inittab b/package/base-files/sibyte-2.6/etc/inittab new file mode 100644 index 0000000000..6eef29efba --- /dev/null +++ b/package/base-files/sibyte-2.6/etc/inittab @@ -0,0 +1,3 @@ +::sysinit:/etc/init.d/rcS +duart/0::askfirst:/bin/ash --login +#tts/1::askfirst:/bin/ash --login diff --git a/package/base-files/sibyte-2.6/init b/package/base-files/sibyte-2.6/init new file mode 100755 index 0000000000..1f98589eb6 --- /dev/null +++ b/package/base-files/sibyte-2.6/init @@ -0,0 +1,6 @@ +#!/bin/ash +mount none /dev -t devfs +mount none /proc -t proc +mount_root failsafe +mount -o remount,rw /dev/root / +exec /bin/busybox init diff --git a/package/base-files/src/adam2patcher.c b/package/base-files/src/adam2patcher.c new file mode 100644 index 0000000000..25a78074a6 --- /dev/null +++ b/package/base-files/src/adam2patcher.c @@ -0,0 +1,59 @@ +/* + * patcher.c - ADAM2 patcher for Netgear DG834 (and compatible) + * + * Copyright (C) 2006 Felix Fietkau + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +int main(int argc, char **argv) +{ + int fd; + char *ptr; + uint32_t *i; + + if (argc != 2) { + fprintf(stderr, "Usage: %s \n", argv[0]); + exit(1); + } + + if (((fd = open(argv[1], O_RDWR)) < 0) + || ((ptr = mmap(0, 128 * 1024, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0)) == (void *) (-1))) { + fprintf(stderr, "Can't open file\n"); + exit(1); + } + + i = (uint32_t *) &ptr[0x3944]; + if (*i == 0x0c000944) { + fprintf(stderr, "Unpatched ADAM2 detected. Patching... "); + *i = 0x00000000; + msync(i, sizeof(*i), MS_SYNC|MS_INVALIDATE); + fprintf(stderr, "done!\n"); + } else if (*i == 0x00000000) { + fprintf(stderr, "Patched ADAM2 detected.\n"); + } else { + fprintf(stderr, "Unknown ADAM2 detected. Can't patch!\n"); + } + + close(fd); +} diff --git a/package/base-files/src/jffs2root.c b/package/base-files/src/jffs2root.c new file mode 100644 index 0000000000..14662fc945 --- /dev/null +++ b/package/base-files/src/jffs2root.c @@ -0,0 +1,133 @@ +/* + * jffs2root.c + * + * Copyright (C) 2005 Mike Baker + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#define FILENAME "/dev/mtdblock/1" + +struct trx_header { + unsigned magic; /* "HDR0" */ + unsigned len; /* Length of file including header */ + unsigned crc32; /* 32-bit CRC from flag_version to end of file */ + unsigned flag_version; /* 0:15 flags, 16:31 version */ + unsigned offsets[3]; /* Offsets of partitions from start of header */ +}; + +unsigned long *crc32; + +void init_crc32() +{ + unsigned long crc; + unsigned long poly = 0xEDB88320L; + int n, bit; + if ((crc32 = (unsigned long *) malloc(256 * sizeof(unsigned long))) == (void *)-1) { + perror("malloc"); + exit(1); + } + for (n = 0; n < 256; n++) { + crc = (unsigned long) n; + for (bit = 0; bit < 8; bit++) + crc = (crc & 1) ? (poly ^ (crc >> 1)) : (crc >> 1); + crc32[n] = crc; + } +} + +unsigned int crc32buf(char *buf, size_t len) +{ + unsigned int crc = 0xFFFFFFFF; + for (; len; len--, buf++) + crc = crc32[(crc ^ *buf) & 0xff] ^ (crc >> 8); + return crc; +} + +int main(int argc, char **argv) +{ + int fd; + struct mtd_info_user mtdInfo; + unsigned long len; + struct trx_header *ptr; + char *buf; + + if (((fd = open(FILENAME, O_RDWR)) < 0) + || ((len = lseek(fd, 0, SEEK_END)) < 0) + || ((ptr = (struct trx_header *) mmap(0, len, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0)) == (void *) (-1)) + || (ptr->magic != 0x30524448)) { + printf("Error reading trx info\n"); + exit(-1); + } + close (fd); + + if (((fd = open("/dev/mtd/1", O_RDWR)) < 0) + || (ioctl(fd, MEMGETINFO, &mtdInfo))) { + fprintf(stderr, "Could not get MTD device info from %s\n", FILENAME); + close(fd); + exit(1); + } + close(fd); + + if (argc > 1 && !strcmp(argv[1],"--move")) { + if (ptr->offsets[2] >= ptr->len) { + printf("Partition already moved outside trx\n"); + } else { + init_crc32(); + ptr->offsets[2] += (mtdInfo.erasesize - 1); + ptr->offsets[2] &= ~(mtdInfo.erasesize - 1); + ptr->len = ptr->offsets[2]; + ptr->crc32 = crc32buf((void *) &(ptr->flag_version), ptr->len - offsetof(struct trx_header, flag_version)); + msync(ptr,sizeof(struct trx_header),MS_SYNC|MS_INVALIDATE); + printf("Partition moved; please reboot\n"); + } + } else if (argc > 1 && !strcmp(argv[1], "--clean")) { + buf = (char *) ptr; + if (buf[ptr->offsets[1] - 1] == 0) { + init_crc32(); + buf[ptr->offsets[1] - 1] = 1; + ptr->crc32 = crc32buf((void *) &(ptr->flag_version), ptr->len - offsetof(struct trx_header, flag_version)); + msync(ptr,sizeof(struct trx_header),MS_SYNC|MS_INVALIDATE); + printf("Partition marked as clean\n"); + } + } else { + int x; + printf(" erase: 0x%08x\n",mtdInfo.erasesize); + printf("=== trx ===\n"); + printf("mapped: 0x%08x\n", (unsigned)ptr); + printf(" magic: 0x%08x\n", ptr->magic); + printf(" len: 0x%08x\n", ptr->len); + printf(" crc: 0x%08x\n", ptr->crc32); + for (x = 0; x < 3; x++) + printf(" offset[%d]: 0x%08x\n", x, ptr->offsets[x]); + } + + munmap((void *) ptr, len); + return 0; +} diff --git a/package/base-files/x86-2.4/etc/config/network b/package/base-files/x86-2.4/etc/config/network new file mode 100644 index 0000000000..fd0f557c04 --- /dev/null +++ b/package/base-files/x86-2.4/etc/config/network @@ -0,0 +1,12 @@ +# Network configuration file + +## LAN configuration +lan_ifname="br0" +lan_ifnames="eth1 eth2" +lan_proto="static" +lan_ipaddr="192.168.1.1" +lan_netmask="255.255.255.0" + +## WAN configuration +wan_ifname="eth0" +wan_proto="dhcp" diff --git a/package/base-files/x86-2.6/etc/config/network b/package/base-files/x86-2.6/etc/config/network new file mode 100644 index 0000000000..fd0f557c04 --- /dev/null +++ b/package/base-files/x86-2.6/etc/config/network @@ -0,0 +1,12 @@ +# Network configuration file + +## LAN configuration +lan_ifname="br0" +lan_ifnames="eth1 eth2" +lan_proto="static" +lan_ipaddr="192.168.1.1" +lan_netmask="255.255.255.0" + +## WAN configuration +wan_ifname="eth0" +wan_proto="dhcp" diff --git a/package/base-files/xscale-2.6/etc/config/network b/package/base-files/xscale-2.6/etc/config/network new file mode 100644 index 0000000000..f60332cd8c --- /dev/null +++ b/package/base-files/xscale-2.6/etc/config/network @@ -0,0 +1,5 @@ +# Network configuration file + +## LAN configuration +lan_ifname="eth0" +lan_proto="dhcp" diff --git a/package/base-files/xscale-2.6/etc/init.d/S00xscale b/package/base-files/xscale-2.6/etc/init.d/S00xscale new file mode 100755 index 0000000000..9836de423b --- /dev/null +++ b/package/base-files/xscale-2.6/etc/init.d/S00xscale @@ -0,0 +1,4 @@ +#!/bin/sh +mount none /proc -t proc +mount_root failsafe +mount -o remount,rw /dev/root / diff --git a/package/base-files/xscale-2.6/init b/package/base-files/xscale-2.6/init new file mode 100755 index 0000000000..8ca48a04c1 --- /dev/null +++ b/package/base-files/xscale-2.6/init @@ -0,0 +1,3 @@ +#!/bin/ash +mount none /dev -t devfs +exec /bin/busybox init -- cgit v1.2.3