Browse Source

Plan 9 from Bell Labs 2010-04-21

David du Colombier 14 years ago
parent
commit
afe64ee3c8
4 changed files with 34 additions and 12 deletions
  1. 15 0
      cfg/pxe/example-omap
  2. 9 1
      sys/man/8/booting
  3. 9 10
      sys/src/9/kw/main.c
  4. 1 1
      sys/src/9/kw/plug.words

+ 15 - 0
cfg/pxe/example-omap

@@ -0,0 +1,15 @@
+# igepv2
+ethaddr=acde48000254
+# 512 MB at 0x80000000 (vs 256 MB on beagle)
+*maxmem=0xa0000000
+# 720 MHz (vs 500 MHz on beagle)
+*cpumhz=720
+
+# beagle/igep configuration
+nvram=/boot/nvram
+nvroff=0
+nvrlen=512
+nobootprompt=tcp
+
+# aoeif=ether0
+# aoedev=e!#æ/aoe/1.0

+ 9 - 1
sys/man/8/booting

@@ -180,12 +180,20 @@ attribute).
 First,
 .IP
 .EX
-cd /cfg/pxe; cp example-kw \fIMAC
+cd /cfg/pxe; cp example-omap \fIMAC
 .EE
 .PP
 and edit
 .L /cfg/pxe/\fIMAC
 to taste.
+Be sure to edit the line for
+.L ethaddr
+to
+.IP
+.EX
+ethaddr=\fIMAC
+.EE
+.PP
 Type this at U-boot once:
 .IP
 .EX

+ 9 - 10
sys/src/9/kw/main.c

@@ -19,6 +19,7 @@
 #define BOOTARGS	((char*)CONFADDR)
 #define	BOOTARGSLEN	(16*KiB)		/* limit in devenv.c */
 #define	MAXCONF		64
+#define MAXCONFLINE	160
 
 #define isascii(c) ((uchar)(c) > 0 && (uchar)(c) < 0177)
 
@@ -45,7 +46,7 @@ char debug[256];
 
 /* store plan9.ini contents here at least until we stash them in #ec */
 static char confname[MAXCONF][KNAMELEN];
-static char *confval[MAXCONF];
+static char confval[MAXCONF][MAXCONFLINE];
 static int nconf;
 
 static int
@@ -82,7 +83,8 @@ addconf(char *name, char *val)
 		i = nconf++;
 		strecpy(confname[i], confname[i]+sizeof(confname[i]), name);
 	}
-	confval[i] = val;
+//	confval[i] = val;
+	strecpy(confval[i], confval[i]+sizeof(confval[i]), val);
 }
 
 static void
@@ -115,13 +117,12 @@ writeconf(void)
 
 /*
  * assumes that we have loaded our /cfg/pxe/mac file at 0x1000 with
- * tftp in u-boot.
+ * tftp in u-boot.  no longer uses malloc, so can be called early.
  */
 static void
 plan9iniinit(void)
 {
 	char *k, *v, *next;
-	static char *kd, *vd;
 
 	k = (char *)CONFADDR;
 	if(!isascii(*k))
@@ -141,10 +142,7 @@ plan9iniinit(void)
 			continue;		/* mal-formed line */
 		*v++ = '\0';
 
-		kd = vd = nil;
-		kstrdup(&kd, k);
-		kstrdup(&vd, v);
-		addconf(kd, vd);
+		addconf(k, v);
 	}
 }
 
@@ -270,6 +268,9 @@ wave('9');
 	archconsole();
 wave(' ');
 
+	/* want plan9.ini to be able to affect memory sizing in confinit */
+	plan9iniinit();		/* before we step on plan9.ini in low memory */
+
 	confinit();
 	/* xinit would print if it could */
 	xinit();
@@ -290,8 +291,6 @@ wave(' ');
 	trapinit();
 	clockinit();
 
-	plan9iniinit();		/* before we step on plan9.ini in low memory */
-
 	printinit();
 	uartkirkwoodconsole();
 	/* only now can we print */

+ 1 - 1
sys/src/9/kw/plug.words

@@ -46,7 +46,7 @@ setenv bootdelay 2
 setenv bootcmd 'bootp; bootp; tftp 0x1000 /cfg/pxe/00504301c49e; bootp; tftp 0x800000; go 0x800000'
 saveenv
 
-# see cfg-pxe-example
+# see /cfg/pxe/example-kw
 
 
 	physical mem map