Browse Source

add atm network script

order network scripts. Add atm example. enable reboot option
for mtd.
Waldemar Brodkorb 15 years ago
parent
commit
08409051be

+ 0 - 0
package/base-files/extra/etc/network/if-post-down.d/bridge → package/base-files/extra/etc/network/if-post-down.d/01-bridge


+ 43 - 0
package/base-files/extra/etc/network/if-pre-up.d/01-atm

@@ -0,0 +1,43 @@
+#!/bin/sh
+
+if [ ! -x /usr/sbin/br2684ctl ]
+then
+  exit 0
+fi
+
+[ "$METHOD" == "atm" ] || exit 0
+
+[ "$IF_ATM_ENCAPS" ] || encap=0
+[ "$IF_ATM_PAYLOAD" ] || payload=1
+[ "$IF_ATM_VPI" ] || $IF_ATM_VPI=1
+[ "$IF_ATM_VCI" ] || $IF_ATM_VCI=32
+
+case "$IF_ATM_PAYLOAD" in
+bridged)
+        payload=1
+        ;;
+routed)
+        payload=0
+        ;;
+*)
+        echo "Wrong payload, use either bridged or routed"
+        exit 1
+        ;;
+esac
+
+case "$IF_ATM_ENCAPS" in
+llc)
+        encap=0
+        ;;
+vc)
+        encap=1
+        ;;
+*)
+        echo "Wrong Encapsulation use either llc or vc"
+        exit 1
+        ;;
+esac
+
+br2684ctl -b -c 0 -e $encap -p $payload -a $IF_ATM_VPI.$IF_ATM_VCI
+ifconfig nas0 up
+exit 0

+ 0 - 0
package/base-files/extra/etc/network/if-pre-up.d/bridge → package/base-files/extra/etc/network/if-pre-up.d/02-bridge


+ 14 - 0
package/mpd/files/mpd.conf

@@ -15,3 +15,17 @@ audio_output {
 }
 # Volume control mixer 
 mixer_type			"alsa"
+
+# shout example
+#audio_output {
+#        type              "shout"
+#        name              "personal mpd stream"
+#        host              "127.0.0.1"
+#        port              "8000"
+#        mount             "/mpd"
+#        quality           "5.0"
+#        format            "44100:16:2"
+#        user              "source"
+#        password          "musicrockz"
+#}
+

+ 16 - 4
package/mtd/src/mtd.c

@@ -43,6 +43,7 @@
 #include <string.h>
 
 #include <mtd/mtd-user.h>
+#include <linux/reboot.h>
 
 #define BUFSIZE (16 * 1024)
 #define MAX_ARGS 8
@@ -253,15 +254,16 @@ usage(void)
 	"        -q                      quiet mode (once: no [w] on writing,\n"
 	"                                           twice: no status messages)\n"
 	"        -e <device>             erase <device> before executing the command\n\n"
-	"Example: To write linux.trx to mtd1 labeled as linux\n"
-	"         mtd write linux.trx linux\n\n");
+	"        -r                      reboot after successful command\n"
+	"Example: To write linux.img to mtd partition labeled as linux\n"
+	"         mtd write linux.img linux\n\n");
 	exit(1);
 }
 
 int
 main(int argc, char **argv)
 {
-	int ch, i, imagefd = -1, quiet, unlocked;
+	int ch, i, imagefd = -1, quiet, unlocked, boot;
 	char *erase[MAX_ARGS], *device;
 	const char *imagefile = NULL;
 	enum {
@@ -271,6 +273,7 @@ main(int argc, char **argv)
 	} cmd;
 
 	erase[0] = NULL;
+	boot = 0;
 	buflen = 0;
 	quiet = 0;
 
@@ -282,6 +285,9 @@ main(int argc, char **argv)
 			case 'q':
 				quiet++;
 				break;
+			case 'r':
+				boot = 1;
+				break;
 			case 'e':
 				i = 0;
 				while ((erase[i] != NULL) && ((i + 1) < MAX_ARGS))
@@ -373,7 +379,13 @@ main(int argc, char **argv)
 				fprintf(stderr, "\n");
 			break;
 	}
-
+	
 	sync();
+	if (boot) {
+		fprintf(stderr, "\nRebooting ... ");
+		fflush(stdout);
+		fflush(stderr);
+		syscall(SYS_reboot,LINUX_REBOOT_MAGIC1,LINUX_REBOOT_MAGIC2,LINUX_REBOOT_CMD_RESTART,NULL);
+	}	
 	return 0;
 }

+ 1 - 1
package/ppp/files/ppp.pre-up

@@ -36,7 +36,7 @@ sed "$REPLACE" < /etc/ppp/templates/$IF_USE_TEMPLATE > /etc/ppp/peers/$IF_PROVID
 [ "$IF_PPP_ENCAPS" ] || encap=0
 [ "$IF_PPP_PAYLOAD" ] || payload=1
 [ "$IF_PPP_VPI" ] || $IF_PPP_VPI=1
-[ "$IF_PPP_PAYLOAD" ] || $IF_PPP_VCI=32
+[ "$IF_PPP_VCI" ] || $IF_PPP_VCI=32
 
 case "$IF_PPP_PAYLOAD" in
 bridged)

+ 1 - 3
target/ag241/TODO

@@ -1,3 +1 @@
-- update with mtd, reboot feature in mtd
-- startupscript for bridged nas device
--
+- update with mtd

+ 9 - 0
target/ag241/files/etc/network/interfaces

@@ -0,0 +1,9 @@
+auto lo
+iface lo inet loopback
+
+auto nas0
+iface nas0 inet atm
+
+auto br0
+iface br0 inet manual
+	bridge-ports eth0 nas0