Subject: Re: RaQ1 / Stock NetBSD Recovery ISO
To: None <jjhartley@gmail.com>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: port-cobalt
Date: 08/05/2007 01:17:20
jjhartley@gmail.com wrote:

> I've noticed that I'm
> not seeing any of the "We serve it, you surf it" POST messages.

Maybe you have to turn on firmware console first?
http://www.NetBSD.org/ports/cobalt/faq.html#buttons

> More
> importantly, how can I boot into single-user mode?  Am I missing
> something here?

If you can get "Cobalt:" prompt after the "We serve it.." banner
by typing any key, you can specify it by "single" strings on
the prompt as the following:
---
 :

13.Ethernet Test...........................PASS
16.RTC Test................................PASS

Cobalt: bfd /boot/vmlinux.gz single	<-- type here
Decompressing done
Executing bootloader kernel...
Decompressing - done.

>> NetBSD/cobalt 4.99.26 Bootloader, Revision 0.2 [@0x80f00000]
>> (tsutsui@mirage, Sun Aug  5 00:46:02 JST 2007)
>> Memory:              262144 k
>> PROM boot string:    root=/dev/hda1 ro single 
Boot [wd0a:netbsd]: 
Loading: wd0a:netbsd
3118416+214512 [162960+157897]=0x37c490
Starting at 0x80001000

 :

root on wd0a dumps on wd0b
root file system type: ffs
Enter pathname of shell or RETURN for /bin/sh: 
We recommend creating a non-root account and using su(1) for root access.
No entry for terminal type "dumb";
using dumb terminal settings.
# 
---

But there is no way to specify it on the native bootloader prompt.

I've written a quick diff to support it (attached),
but we have to change both a kernel and a bootloader
and I'm not sure it's acceptable to commit.

> Starting dhclient.
> Internet Systems Consortium DHCP Client V3.0.3
> Copyright 2004-2005 Internet Systems Consortium.
> All rights reserved.
> For info, please visit http://www.isc.org/products/DHCP
> 
> No bpf devices.   Please read the README section for your operating system.

Hmm, something wrong in restorecd scripts?
(/dev/bpf is not created? script creates (obsolete) /dev/bpf0?)
---
Izumi Tsutsui


Index: cobalt/machdep.c
===================================================================
RCS file: /cvsroot/src/sys/arch/cobalt/cobalt/machdep.c,v
retrieving revision 1.84
diff -u -r1.84 machdep.c
--- cobalt/machdep.c	3 Jul 2007 10:31:57 -0000	1.84
+++ cobalt/machdep.c	4 Aug 2007 16:01:01 -0000
@@ -172,6 +172,7 @@
 	char *ssym = 0;
 	struct btinfo_symtab *bi_syms;
 #endif
+	struct btinfo_howto *bi_howto;
 
 	/*
 	 * Clear the BSS segment (if needed).
@@ -235,6 +236,10 @@
 	}
 #endif
 
+	bi_howto = lookup_bootinfo(BTINFO_HOWTO);
+	if (bi_howto != NULL)
+		boothowto = bi_howto->bi_howto;
+
 	cobalt_id = read_board_id();
 	if (cobalt_id >= COBALT_MODELS || cobalt_model[cobalt_id] == NULL)
 		sprintf(cpu_model, "Cobalt unknown model (board ID %u)",
Index: include/bootinfo.h
===================================================================
RCS file: /cvsroot/src/sys/arch/cobalt/include/bootinfo.h,v
retrieving revision 1.4
diff -u -r1.4 bootinfo.h
--- include/bootinfo.h	15 Apr 2006 11:33:33 -0000	1.4
+++ include/bootinfo.h	4 Aug 2007 16:01:01 -0000
@@ -41,6 +41,7 @@
 #define BTINFO_BOOTPATH 2
 #define BTINFO_SYMTAB	3
 #define BTINFO_FLAGS	4
+#define BTINFO_HOWTO	5
 
 struct btinfo_magic {
 	struct btinfo_common common;
@@ -67,6 +68,12 @@
 	uint32_t bi_flags;
 };
 
+struct btinfo_howto {
+	struct btinfo_common common;
+
+	uint32_t bi_howto;
+};
+
 #ifdef _KERNEL
 void	*lookup_bootinfo __P((int));
 #endif
Index: stand/boot/boot.c
===================================================================
RCS file: /cvsroot/src/sys/arch/cobalt/stand/boot/boot.c,v
retrieving revision 1.6
diff -u -r1.6 boot.c
--- stand/boot/boot.c	3 Aug 2007 13:15:56 -0000	1.6
+++ stand/boot/boot.c	4 Aug 2007 16:01:01 -0000
@@ -109,7 +109,7 @@
 static char *bootstring;
 
 static int patch_bootstring	(char *bootspec);
-static int get_bsdbootname(char **, char **);
+static int get_bsdbootname(char **, char **, int *);
 static int parse_bootname(char *, int, char **, char **);
 static int prominit		(unsigned int memsize);
 static int print_banner		(unsigned int memsize);
@@ -191,7 +191,7 @@
  * Extract NetBSD boot specification
  */
 static int
-get_bsdbootname(char **dev, char **kname)
+get_bsdbootname(char **dev, char **kname, int *howtop)
 {
 	int len, error;
 	char *bootstr_dev, *bootstr_kname;
@@ -237,10 +237,7 @@
 			break;
 		if (c == '-') {
 			while ((c = *++ptr) && c != ' ')
-				;
-#if notyet
-			BOOT_FLAG(c, boothowto);
-#endif
+				BOOT_FLAG(c, *howtop);
 		} else {
 			spec = ptr;
 			while ((c = *++ptr) && c != ' ')
@@ -342,10 +339,12 @@
 	struct btinfo_flags bi_flags;
 	struct btinfo_symtab bi_syms;
 	struct btinfo_bootpath bi_bpath;
+	struct btinfo_howto bi_howto;
 
-	int addr, speed;
+	int addr, speed, howto;
 
 	/* Initialize boot info early */
+	howto = 0x0;
 	bi_flags.bi_flags = 0x0;
 	bi_addr = bi_init();
 
@@ -356,7 +355,7 @@
 	print_banner(memsize);
 
 	memset(marks, 0, sizeof marks);
-	get_bsdbootname(&dev, &kernel);
+	get_bsdbootname(&dev, &kernel, &howto);
 
 	if (kernel != NULL) {
 		DPRINTF(("kernel: %s\n", kernel));
@@ -377,7 +376,10 @@
 		strcat(bootpath, ":");
 		strcat(bootpath, kernel);
 
-		printf("Loading: %s\n", bootpath);
+		printf("Loading: %s", bootpath);
+		if (howto)
+			printf(" (howto 0x%x)", howto);
+		printf("\n");
 		patch_bootstring(bootpath);
 		win = (loadfile(bootpath, marks, LOAD_ALL) != -1);
 	}
@@ -394,6 +396,9 @@
 
 		bi_add(&bi_flags, BTINFO_FLAGS, sizeof(bi_flags));
 
+		bi_howto.bi_howto = howto;
+		bi_add(&bi_howto, BTINFO_HOWTO, sizeof(bi_howto));
+
 		entry = (void *)marks[MARK_ENTRY];
 
 		DPRINTF(("Bootinfo @ 0x%x\n", bi_addr));
Index: stand/boot/version
===================================================================
RCS file: /cvsroot/src/sys/arch/cobalt/stand/boot/version,v
retrieving revision 1.2
diff -u -r1.2 version
--- stand/boot/version	25 Jul 2007 14:11:06 -0000	1.2
+++ stand/boot/version	4 Aug 2007 16:01:01 -0000
@@ -6,3 +6,4 @@
 
 0.1:	Initial revision, only booting from the harddrive is supported
 0.2:	Flush all cache data in start.S
+0.3:	Parse boothowto flags and pass it via bootinfo