Browse Source

outin now works.

Change-Id: Ib409646c26a883922bcbb34e8e84a8c3dc3e6606
Signed-off-by: Keith Poole <keith.poole@gmail.com>
Keith Poole 3 years ago
parent
commit
0ab7bda4d3

+ 1 - 0
lib/namespace

@@ -18,6 +18,7 @@ bind -b #P /dev
 
 # mount points
 mount -a /srv/slashn /n
+mount -a /boot /bin
 
 # authentication
 mount -a /srv/factotum /mnt

+ 16 - 13
rc/bin/cpurc

@@ -17,7 +17,7 @@ if(test -e /rc/bin/cpurc.local)
 	. /rc/bin/cpurc.local
 
 if (~ $#sysname 0 || ~ $sysname '') {
-	sysname = helix			# default
+	sysname = harvey			# default
 	echo -n $sysname >/dev/sysname
 }
 prompt=($sysname^'# ' '	')
@@ -58,17 +58,15 @@ rm -f '#¤/caphash'
 # start listeners if it hasn't already been done (dicey check)
 if(! netstat -n | grep -s 'tcp.*Listen.* (7|9|21|22|23|25|110|113|565|993|17007|17009|17010) .*')
 	aux/listen -q tcp
-# we don't use IL, maybe you do
-if(! netstat -n | grep -v 17008 | grep -s il.*Listen)
-	aux/listen -q il
-
-if(! ps|grep -s timesync) {
-	aux/timesync -n pool.ntp.org
-	if (test -e '#r/rtc') @ {
-		sleep 10			# let timesync correct the time
-		awk '{print $1}' /dev/time >'#r/rtc'	# fix hw clock
-	} &
-}
+
+# TODO: Removed until awk works
+#if(! ps|grep -s timesync) {
+#	aux/timesync -n pool.ntp.org
+#	if (test -e '#r/rtc') @ {
+#		sleep 10			# let timesync correct the time
+#		awk '{print $1}' /dev/time >'#r/rtc'	# fix hw clock
+#	} &
+#}
 
 # cpu-specific late startup
 if(test -e /cfg/$sysname/cpustart)
@@ -76,7 +74,12 @@ if(test -e /cfg/$sysname/cpustart)
 
 # mode of /proc/*/ctl is inherited across rfork, and sets modes on
 # other /proc files, such as note, so let listen be killed.
-dontkill '^(ipconfig|factotum|mntgen|venti|fossil|cs|dns|reboot)$'
+#dontkill '^(ipconfig|factotum|mntgen|venti|fossil|cs|dns|reboot)$'
+
+# From bootfs
+/boot/listen1 -t -v tcp!*!1522  /boot/tty /boot/rc -m /boot/rcmain -i &
+/boot/tty -f'#t/eia0' /boot/rc -m/boot/rcmain -i &
+exec /boot/console /boot/tty /boot/rc -m/boot/rcmain -i
 
 # echo `{date} $sysname >>/sys/log/boot
 exit ''

+ 0 - 0
sys/log/listen


+ 0 - 0
sys/log/timesync


+ 9 - 4
sys/src/9/boot/aux.c

@@ -11,6 +11,8 @@
 #include <libc.h>
 #include <../boot/boot.h>
 
+int readline(char* bud, int len);
+
 /*
 int
 plumb(char *dir, char *dest, int *efd, char *here)
@@ -90,12 +92,15 @@ readfile(char *name, char *buf, int len)
 
 	buf[0] = 0;
 	f = open(name, OREAD);
-	if(f < 0)
+	if(f < 0){
+		fprint(2, "readfile: cannot open %s (%r)\n", name);
 		return -1;
+	}
 	n = read(f, buf, len-1);
 	if(n >= 0)
 		buf[n] = 0;
 	close(f);
+	print("readfile: success reading %s\n", name);
 	return 0;
 }
 
@@ -172,17 +177,17 @@ outin(char *prompt, char *def, int len)
 	if(cpuflag){
 		notify(catchint);
 		alarm(15*1000);
-	}
+	} 
 	print("%s[%s]: ", prompt, *def ? def : "no default");
 	memset(buf, 0, sizeof buf);
-	n = read(0, buf, len);
+	n = readline(buf, sizeof buf);
+
 	if(cpuflag){
 		alarm(0);
 		notify(0);
 	}
 
 	if(n < 0){
-		print("\n");
 		return 1;
 	}
 	if(n > 1){

+ 9 - 9
sys/src/9/boot/boot.c

@@ -15,7 +15,6 @@
 
 char	cputype[64];
 char	sys[2*64];
-char 	reply[256];
 int	printcol;
 int	mflag;
 int	fflag;
@@ -44,9 +43,6 @@ boot(int argc, char *argv[])
 	fmtinstall('r', errfmt);
 
 	bind("#c", "/dev", MBEFORE);
-	open("/dev/cons", OREAD);
-	open("/dev/cons", OWRITE);
-	open("/dev/cons", OWRITE);
 	/*
 	 * init will reinitialize its namespace.
 	 * #ec gets us plan9.ini settings (*var variables).
@@ -54,6 +50,8 @@ boot(int argc, char *argv[])
 	bind("#ec", "/env", MREPL);
 	bind("#e", "/env", MBEFORE|MCREATE);
 	bind("#s", "/srv", MREPL|MCREATE);
+	bind("#p", "/proc", MREPL|MCREATE);
+	print("Hello, I am Harvey :-)\n");
 #ifdef DEBUG
 	print("argc=%d\n", argc);
 	for(fd = 0; fd < argc; fd++)
@@ -72,13 +70,13 @@ boot(int argc, char *argv[])
 		fflag = 1;
 		break;
 	}ARGEND
-
 	readfile("#e/cputype", cputype, sizeof(cputype));
 
 	/*
 	 *  set up usb keyboard, mouse and disk, if any.
 	 */
 	usbinit();
+	print("usbinit done\n");
 
 	/*
 	 *  pick a method and initialize it
@@ -136,7 +134,7 @@ print("\n");
 		if(ai == nil)
 			print("authentication failed (%r), trying mount anyways\n");
 	}
-	if(mount(fd, afd, "/root", MREPL|MCREATE, rp) < 0)
+	if(mount(fd, afd, "/root", MREPL|MCREATE, rp, 'M') < 0)
 		fatal("mount /");
 	rsp = rp;
 	rp = getenv("rootdir");
@@ -169,7 +167,7 @@ print("\n");
 
 	cmd = getenv("init");
 	if(cmd == nil){
-		sprint(cmdbuf, "/%s/init -%s%s", cputype,
+		sprint(cmdbuf, "/%s/bin/init -%s%s", cputype,
 			cpuflag ? "c" : "t", mflag ? "m" : "");
 		cmd = cmdbuf;
 	}
@@ -219,13 +217,15 @@ static Method*
 rootserver(char *arg)
 {
 	char prompt[256];
+	int rc;
 	Method *mp;
 	char *cp;
+	char reply[256];
 	int n;
 
 	/* look for required reply */
-	readfile("#e/nobootprompt", reply, sizeof(reply));
-	if(reply[0]){
+	rc = readfile("#e/nobootprompt", reply, sizeof(reply));
+	if(rc == 0 && reply[0]){
 		mp = findmethod(reply);
 		if(mp)
 			goto HaveMethod;

+ 6 - 4
sys/src/9/boot/boot.json

@@ -15,20 +15,22 @@
 		"-fno-builtin",
 		"-mcmodel=small"
 	],
+	"Include": [
+		"/sys/src/lib.json"
+	],
 	"Install": "/sys/src/9/boot",
 	"Library": "libboot.a",
-	"Name": "Libboot",
-	"Oflags": [
-		"-static"
-	],
+	"Name": "libboot",
 	"SourceFiles": [
 		"aux.c",
 		"bootauth.c",
 		"boot.c",
 		"bootcache.c",
 		"bootip.c",
+		"console.c",
 		"embed.c",
 		"local.c",
+		"hack.c",
 		"paq.c",
 		"sac.c",
 		"settime.c"

+ 4 - 16
sys/src/9/boot/bootconf.json

@@ -1,19 +1,6 @@
 {
-	"Cflags": [
-		"-g",
-		"-Wall",
-		"-Wno-missing-braces",
-		"-Wno-parentheses",
-		"-Wno-unknown-pragmas",
-		"-Wuninitialized",
-		"-Wmaybe-uninitialized",
-		"-O0",
-		"-static",
-		"-fplan9-extensions",
-		"-mno-red-zone",
-		"-ffreestanding",
-		"-fno-builtin",
-		"-mcmodel=small"
+	"Include": [
+		"/amd64/include/cflags.json"
 	],
 	"Libs": [
 		"libboot.a",
@@ -27,7 +14,8 @@
 		"-static"
 	],
 	"Post": [
-		"rm *.o *.a"
+		"rm *.o *.a",
+		"../../../../util/data2c ramfs_bootk8cpu_ ../boot/bootk8cpu.elf.out >> ../k10/k8cpu.c"
 	],
 	"Pre": [
 		"[ ! -f bootk8cpu.elf.out ] || rm *.elf.out",

+ 6 - 3
sys/src/9/boot/bootip.c

@@ -13,6 +13,9 @@
 
 #include "boot.h"
 
+// TODO: Fix later
+char* DEFAULT_IP = "10.0.2.2";
+
 static	uint8_t	fsip[IPaddrlen];
 	uint8_t	auip[IPaddrlen];
 static	char	mpoint[32];
@@ -103,7 +106,7 @@ print("ipconfig...");
 	if(!isvalidip(fsip))
 		netenv("fs", fsip);
 	while(!isvalidip(fsip)){
-		buf[0] = 0;
+		strcpy(buf, DEFAULT_IP);
 		outin("filesystem IP address", buf, sizeof(buf));
 		if (parseip(fsip, buf) == -1)
 			fprint(2, "configip: can't parse fs ip %s\n", buf);
@@ -113,7 +116,7 @@ print("ipconfig...");
 	if(!isvalidip(auip))
 		netenv("auth", auip);
 	while(!isvalidip(auip)){
-		buf[0] = 0;
+		strcpy(buf, DEFAULT_IP);
 		outin("authentication server IP address", buf, sizeof(buf));
 		if (parseip(auip, buf) == -1)
 			fprint(2, "configip: can't parse auth ip %s\n", buf);
@@ -142,7 +145,7 @@ connecttcp(void)
 	int fd;
 	char buf[64];
 
-	snprint(buf, sizeof buf, "tcp!%I!564", fsip);
+	snprint(buf, sizeof buf, "tcp!%I!5640", fsip);
 	fd = dial(buf, 0, 0, 0);
 	if (fd < 0)
 		werrstr("dial %s: %r", buf);

+ 346 - 0
sys/src/9/boot/console.c

@@ -0,0 +1,346 @@
+#include <u.h>
+#include <libc.h>
+
+enum {
+	Spec =	0xF800,		/* Unicode private space */
+		PF =	Spec|0x20,	/* num pad function key */
+		View =	Spec|0x00,	/* view (shift window up) */
+		Shift =	Spec|0x60,
+		Break =	Spec|0x61,
+		Ctrl =	Spec|0x62,
+		Alt =	Spec|0x63,
+		Caps =	Spec|0x64,
+		Num =	Spec|0x65,
+		Middle =	Spec|0x66,
+		Altgr =	Spec|0x67,
+		Kmouse =	Spec|0x100,
+	No =	0x00,		/* peter */
+
+	KF =	0xF000,		/* function key (begin Unicode private space) */
+		Home =	KF|13,
+		Up =		KF|14,
+		Pgup =		KF|15,
+		Print =	KF|16,
+		Left =	KF|17,
+		Right =	KF|18,
+		End =	KF|24,
+		Down =	View,
+		Pgdown =	KF|19,
+		Ins =	KF|20,
+		Del =	0x7F,
+		Scroll =	KF|21,
+};
+
+typedef struct Keybscan Keybscan;
+struct Keybscan {
+	int esc1;
+	int esc2;
+	int alt;
+	int altgr;
+	int caps;
+	int ctl;
+	int num;
+	int shift;
+	int collecting;
+	int nk;
+	Rune kc[5];
+	int buttons;
+};
+
+static Keybscan kbscan;
+
+static Rune kbtab[256] =
+{
+[0x00]	No,	'\x1b',	'1',	'2',	'3',	'4',	'5',	'6',
+[0x08]	'7',	'8',	'9',	'0',	'-',	'=',	'\b',	'\t',
+[0x10]	'q',	'w',	'e',	'r',	't',	'y',	'u',	'i',
+[0x18]	'o',	'p',	'[',	']',	'\n',	Ctrl,	'a',	's',
+[0x20]	'd',	'f',	'g',	'h',	'j',	'k',	'l',	';',
+[0x28]	'\'',	'`',	Shift,	'\\',	'z',	'x',	'c',	'v',
+[0x30]	'b',	'n',	'm',	',',	'.',	'/',	Shift,	'*',
+[0x38]	Alt,	' ',	Ctrl,	KF|1,	KF|2,	KF|3,	KF|4,	KF|5,
+[0x40]	KF|6,	KF|7,	KF|8,	KF|9,	KF|10,	Num,	Scroll,	'7',
+[0x48]	'8',	'9',	'-',	'4',	'5',	'6',	'+',	'1',
+[0x50]	'2',	'3',	'0',	'.',	No,	No,	No,	KF|11,
+[0x58]	KF|12,	No,	No,	No,	No,	No,	No,	No,
+[0x60]	No,	No,	No,	No,	No,	No,	No,	No,
+[0x68]	No,	No,	No,	No,	No,	No,	No,	No,
+[0x70]	No,	No,	No,	No,	No,	No,	No,	No,
+[0x78]	No,	View,	No,	Up,	No,	No,	No,	No,
+};
+
+static Rune kbtabshift[256] =
+{
+[0x00]	No,	'\x1b',	'!',	'@',	'#',	'$',	'%',	'^',
+[0x08]	'&',	'*',	'(',	')',	'_',	'+',	'\b',	'\t',
+[0x10]	'Q',	'W',	'E',	'R',	'T',	'Y',	'U',	'I',
+[0x18]	'O',	'P',	'{',	'}',	'\n',	Ctrl,	'A',	'S',
+[0x20]	'D',	'F',	'G',	'H',	'J',	'K',	'L',	':',
+[0x28]	'"',	'~',	Shift,	'|',	'Z',	'X',	'C',	'V',
+[0x30]	'B',	'N',	'M',	'<',	'>',	'?',	Shift,	'*',
+[0x38]	Alt,	' ',	Ctrl,	KF|1,	KF|2,	KF|3,	KF|4,	KF|5,
+[0x40]	KF|6,	KF|7,	KF|8,	KF|9,	KF|10,	Num,	Scroll,	'7',
+[0x48]	'8',	'9',	'-',	'4',	'5',	'6',	'+',	'1',
+[0x50]	'2',	'3',	'0',	'.',	No,	No,	No,	KF|11,
+[0x58]	KF|12,	No,	No,	No,	No,	No,	No,	No,
+[0x60]	No,	No,	No,	No,	No,	No,	No,	No,
+[0x68]	No,	No,	No,	No,	No,	No,	No,	No,
+[0x70]	No,	No,	No,	No,	No,	No,	No,	No,
+[0x78]	No,	Up,	No,	Up,	No,	No,	No,	No,
+};
+
+static Rune kbtabesc1[256] =
+{
+[0x00]	No,	No,	No,	No,	No,	No,	No,	No,
+[0x08]	No,	No,	No,	No,	No,	No,	No,	No,
+[0x10]	No,	No,	No,	No,	No,	No,	No,	No,
+[0x18]	No,	No,	No,	No,	'\n',	Ctrl,	No,	No,
+[0x20]	No,	No,	No,	No,	No,	No,	No,	No,
+[0x28]	No,	No,	Shift,	No,	No,	No,	No,	No,
+[0x30]	No,	No,	No,	No,	No,	'/',	No,	Print,
+[0x38]	Altgr,	No,	No,	No,	No,	No,	No,	No,
+[0x40]	No,	No,	No,	No,	No,	No,	Break,	Home,
+[0x48]	Up,	Pgup,	No,	Left,	No,	Right,	No,	End,
+[0x50]	Down,	Pgdown,	Ins,	Del,	No,	No,	No,	No,
+[0x58]	No,	No,	No,	No,	No,	No,	No,	No,
+[0x60]	No,	No,	No,	No,	No,	No,	No,	No,
+[0x68]	No,	No,	No,	No,	No,	No,	No,	No,
+[0x70]	No,	No,	No,	No,	No,	No,	No,	No,
+[0x78]	No,	Up,	No,	No,	No,	No,	No,	No,
+};
+
+static Rune kbtabaltgr[256] =
+{
+[0x00]	No,	No,	No,	No,	No,	No,	No,	No,
+[0x08]	No,	No,	No,	No,	No,	No,	No,	No,
+[0x10]	No,	No,	No,	No,	No,	No,	No,	No,
+[0x18]	No,	No,	No,	No,	'\n',	Ctrl,	No,	No,
+[0x20]	No,	No,	No,	No,	No,	No,	No,	No,
+[0x28]	No,	No,	Shift,	No,	No,	No,	No,	No,
+[0x30]	No,	No,	No,	No,	No,	'/',	No,	Print,
+[0x38]	Altgr,	No,	No,	No,	No,	No,	No,	No,
+[0x40]	No,	No,	No,	No,	No,	No,	Break,	Home,
+[0x48]	Up,	Pgup,	No,	Left,	No,	Right,	No,	End,
+[0x50]	Down,	Pgdown,	Ins,	Del,	No,	No,	No,	No,
+[0x58]	No,	No,	No,	No,	No,	No,	No,	No,
+[0x60]	No,	No,	No,	No,	No,	No,	No,	No,
+[0x68]	No,	No,	No,	No,	No,	No,	No,	No,
+[0x70]	No,	No,	No,	No,	No,	No,	No,	No,
+[0x78]	No,	Up,	No,	No,	No,	No,	No,	No,
+};
+
+static Rune kbtabctrl[256] =
+{
+[0x00]	No,	'\x1b',	'\x11',	'\x12',	'\x13',	'\x14',	'\x15',	'\x16',
+[0x08]	'\x17',	'\x18',	'\x19',	'\x10',	'\n',	'\x1d',	'\b',	'\t',
+[0x10]	'\x11',	'\x17',	'\x05',	'\x12',	'\x14',	'\x19',	'\x15',	'\t',
+[0x18]	'\x0f',	'\x10',	'\x1b',	'\x1d',	'\n',	Ctrl,	'\x01',	'\x13',
+[0x20]	'\x04',	'\x06',	'\x07',	'\b',	'\n',	'\x0b',	'\x0c',	'\x1b',
+[0x28]	'\x07',	No,	Shift,	'\x1c',	'\x1a',	'\x18',	'\x03',	'\x16',
+[0x30]	'\x02',	'\x0e',	'\n',	'\x0c',	'\x0e',	'\x0f',	Shift,	'\n',
+[0x38]	Alt,	No,	Ctrl,	'\x05',	'\x06',	'\x07',	'\x04',	'\x05',
+[0x40]	'\x06',	'\x07',	'\x0c',	'\n',	'\x0e',	'\x05',	'\x06',	'\x17',
+[0x48]	'\x18',	'\x19',	'\n',	'\x14',	'\x15',	'\x16',	'\x0b',	'\x11',
+[0x50]	'\x12',	'\x13',	'\x10',	'\x0e',	No,	No,	No,	'\x0f',
+[0x58]	'\x0c',	No,	No,	No,	No,	No,	No,	No,
+[0x60]	No,	No,	No,	No,	No,	No,	No,	No,
+[0x68]	No,	No,	No,	No,	No,	No,	No,	No,
+[0x70]	No,	No,	No,	No,	No,	No,	No,	No,
+[0x78]	No,	'\x07',	No,	'\b',	No,	No,	No,	No,
+};
+
+int
+keybscan(uint8_t code, char *out, int len)
+{
+	Rune c;
+	int keyup;
+	int off;
+
+	c = code;
+	off = 0;
+
+	if(len < 16){
+		fprint(2, "keybscan: input buffer too short to be safe\n");
+		return -1;
+	}
+	if(c == 0xe0){
+		kbscan.esc1 = 1;
+		return off;
+	} else if(c == 0xe1){
+		kbscan.esc2 = 2;
+		return off;
+	}
+
+	keyup = c&0x80;
+	c &= 0x7f;
+	if(c > sizeof kbtab){
+		c |= keyup;
+		if(c != 0xFF)	/* these come fairly often: CAPSLOCK U Y */
+			fprint(2, "unknown key %ux\n", c);
+		return off;
+	}
+
+	if(kbscan.esc1){
+		c = kbtabesc1[c];
+		kbscan.esc1 = 0;
+	} else if(kbscan.esc2){
+		kbscan.esc2--;
+		return off;
+	} else if(kbscan.shift)
+		c = kbtabshift[c];
+	else if(kbscan.altgr)
+		c = kbtabaltgr[c];
+	else if(kbscan.ctl)
+		c = kbtabctrl[c];
+	else
+		c = kbtab[c];
+
+	if(kbscan.caps && c<='z' && c>='a')
+		c += 'A' - 'a';
+
+	/*
+	 *  keyup only important for shifts
+	 */
+	if(keyup){
+		switch(c){
+		case Alt:
+			kbscan.alt = 0;
+			break;
+		case Shift:
+			kbscan.shift = 0;
+			/*mouseshifted = 0;*/
+			break;
+		case Ctrl:
+			kbscan.ctl = 0;
+			break;
+		case Altgr:
+			kbscan.altgr = 0;
+			break;
+		case Kmouse|1:
+		case Kmouse|2:
+		case Kmouse|3:
+		case Kmouse|4:
+		case Kmouse|5:
+			kbscan.buttons &= ~(1<<(c-Kmouse-1));
+			/*if(kbdmouse)kbdmouse(kbscan.buttons);*/
+			break;
+		}
+		return off;
+	}
+
+	/*
+	 *  normal character
+	 */
+	if(!(c & (Spec|KF))){
+		off += runetochar(out+off, &c);
+		return off;
+	} else {
+		switch(c){
+		case Caps:
+			kbscan.caps ^= 1;
+			return off;
+		case Num:
+			kbscan.num ^= 1;
+			return off;
+		case Shift:
+			kbscan.shift = 1;
+			/*mouseshifted = 1;*/
+			return off;
+		case Alt:
+			kbscan.alt = 1;
+			/*
+			 * VMware and Qemu use Ctl-Alt as the key combination
+			 * to make the VM give up keyboard and mouse focus.
+			 * This has the unfortunate side effect that when you
+			 * come back into focus, Plan 9 thinks you want to type
+			 * a compose sequence (you just typed alt). 
+			 *
+			 * As a clumsy hack around this, we look for ctl-alt
+			 * and don't treat it as the start of a compose sequence.
+			 */
+			return off;
+		case Ctrl:
+			kbscan.ctl = 1;
+			return off;
+		case Altgr:
+			kbscan.altgr = 1;
+			return off;
+		case Kmouse|1:
+		case Kmouse|2:
+		case Kmouse|3:
+		case Kmouse|4:
+		case Kmouse|5:
+			kbscan.buttons |= 1<<(c-Kmouse-1);
+			/*if(kbdmouse)kbdmouse(kbscan.buttons);*/
+			return off;
+		}
+	}
+
+	off += runetochar(out+off, &c);
+	return off;
+
+}
+
+enum {
+	Black		= 0x00,
+	Blue		= 0x01,
+	Green		= 0x02,
+	Cyan		= 0x03,
+	Red		= 0x04,
+	Magenta		= 0x05,
+	Brown		= 0x06,
+	Grey		= 0x07,
+
+	Bright 		= 0x08,
+	Blinking	= 0x80,
+
+	Attr		= (Black<<4)|Grey,	/* (background<<4)|foreground */
+	Cursor = (Grey<<4)|Black,
+};
+
+enum {
+	Width		= 80*2,
+	Height		= 25,
+};
+
+int
+readline(char* buf, int buflen)
+{
+	int ps2fd;
+	int i, n, off, lastoff, len;
+	char* scan;
+	static uint8_t ibuf[32];
+
+	if((ps2fd = open("#P/ps2keyb", OREAD)) == -1){
+		errstr(buf, sizeof buf);
+		fprint(2, "open #P/ps2keyb: %s\n", buf);
+		return -1;
+	}
+
+	off = 0;
+	for (;;){
+		while((len = read(ps2fd, ibuf, sizeof ibuf)) > 0){
+			lastoff = off;
+			for(i = 0; i < len; i++){
+				if((n = keybscan(ibuf[i], buf+off, buflen - off)) == -1){
+					fprint(2, "keybscan -1\n");
+					return -1;
+				}
+				off += n;
+			}
+			if(buf[off-1] == '\n')
+				goto GotLine;
+			if(off > 0){
+				for(scan = buf + lastoff; scan < buf + off; scan++){
+					write(1, scan, 1);
+					if(*scan == 0x8)
+						off -= 2;
+				}
+			}
+		}
+	}
+GotLine:
+	write(1, "\n", 1);
+	buf[off] = '\0';
+	return off - 1;
+}

+ 18 - 0
sys/src/9/boot/hack.c

@@ -0,0 +1,18 @@
+/*
+ * This file is part of the UCB release of Plan 9. It is subject to the license
+ * terms in the LICENSE file found in the top-level directory of this
+ * distribution and at http://akaros.cs.berkeley.edu/files/Plan9License. No
+ * part of the UCB release of Plan 9, including this file, may be copied,
+ * modified, propagated, or distributed except according to the terms contained
+ * in the LICENSE file.
+ */
+#include <u.h>
+#include <libc.h>
+#include "boot.h"
+char* bootdisk = "disk";
+char* rootdir = "/";
+
+Method method[] = {
+	{ "tcp", configtcp, connecttcp, nil},
+	{nil, nil, nil, nil}
+};

+ 6 - 12
sys/src/9/k10/boot.fs

@@ -1,14 +1,8 @@
 #!/boot/rc -m /boot/rcmain
 # boot script for file servers, including standalone ones
-path=(/boot /bin /amd64/bin /rc/bin .)
-prompt=('harvey@cpu% ' '	')
-echo 'Hello, I am Harvey :-)'
-bind -a /boot /bin
-bind -a '#I' /net
-bind -a '#l0' /net
-bind -a '#p' /proc
-bind -a '#s' /srv
-ipconfig
-/boot/listen1 -t -v tcp!*!1522  /boot/tty /boot/rc -m /boot/rcmain -i &
-/boot/tty -f'#t/eia0' /boot/rc -m/boot/rcmain -i &
-exec /boot/console /boot/tty /boot/rc -m/boot/rcmain -i
+/boot/echo 'Booting'
+#/boot/listen1 -t -v tcp!*!1522  /boot/tty /boot/rc -m /boot/rcmain -i &
+#/boot/tty -f'#t/eia0' /boot/rc -m/boot/rcmain -i &
+/boot/tty -f'#t/eia0' /boot/boot2
+#exec /boot/console /boot/tty /boot/rc -m/boot/rcmain -i
+#exec /boot/console /boot/tty /boot/boot2

+ 1 - 0
sys/src/9/k10/core.json

@@ -48,6 +48,7 @@
 	],
 	"Projects": [
 		"clean.json",
+		"../boot/bootconf.json",
 		"inith.json"
 	],
 	"SourceFiles": [

+ 1 - 1
sys/src/9/k10/k8cpu.json

@@ -73,7 +73,7 @@
 		},
 		"Ramfiles": {
 			"bind": "/amd64/bin/bind",
-			"boot": "boot.fs",
+			"boot": "/sys/src/9/boot/bootk8cpu.elf.out",
 			"cat": "/amd64/bin/cat",
 			"date": "/amd64/bin/date",
 			"echo": "/amd64/bin/echo",

+ 1 - 0
sys/src/9/port/devroot.c

@@ -109,6 +109,7 @@ rootreset(void)
 	addrootdir("env");
 	addrootdir("fd");
 	addrootdir("mnt");
+	addrootdir("n");
 	addrootdir("net");
 	addrootdir("net.alt");
 	addrootdir("proc");

+ 1 - 1
sys/src/cmd/aux/console.c

@@ -474,4 +474,4 @@ main(int argc, char *argv[])
 	}
 
 	exits(nil);
-}
+}

+ 3 - 3
sys/src/cmd/init.c

@@ -181,9 +181,9 @@ rcexec(void)
 {
 	if(cmd)
 		execl("/bin/rc", "rc", "-c", cmd, nil);
-	else if(manual || iscpu)
-		execl("/bin/rc", "rc", nil);
-	else if(strcmp(service, "terminal") == 0)
+	else if(manual || iscpu){
+		execl("/boot/console", "/boot/tty", "/boot/rc", "-m/boot/rcmain", "-i", nil);
+	}else if(strcmp(service, "terminal") == 0)
 		execl("/bin/rc", "rc", "-c", ". /rc/bin/termrc; home=/usr/$user; cd; . lib/profile", nil);
 	else
 		execl("/bin/rc", "rc", nil);