Subject: Re: Javastation (Krups) boot problems
To: Nate <sma11k3ys@yahoo.com>
From: Martin Husemann <martin@duskware.de>
List: port-sparc
Date: 04/24/2005 23:31:29
--VbJkn9YxBvnuCH5J
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
On Mon, Apr 18, 2005 at 12:02:26AM +0200, Martin Husemann wrote:
> The attached patch fixes it for me - anyone care to comment?
> We could change sys/arch/sparc/stand/* stuff to copy the string contents
> instead, I'm not sure it is worth the effort though.
I looked at it again and fixing the callers instead of promlib turned out to
be not that hard. Here is an alternativ patch, wich also works for me (though
I did not test non-OF machines nor bootparams etc.)
Comments?
Martin
--VbJkn9YxBvnuCH5J
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=patch
Index: stand/boot/boot.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc/stand/boot/boot.c,v
retrieving revision 1.19
diff -c -u -r1.19 boot.c
--- stand/boot/boot.c 8 Apr 2004 07:35:34 -0000 1.19
+++ stand/boot/boot.c 24 Apr 2005 21:26:23 -0000
@@ -235,7 +235,7 @@
main()
{
int error, i;
- char *kernel;
+ char kernel[MAX_PROM_PATH], *k;
u_long marks[MARK_MAX], bootinfo;
struct btinfo_symtab bi_sym;
void *arg;
@@ -258,17 +258,20 @@
/*
* get default kernel.
*/
- prom_bootdevice = prom_getbootpath();
- kernel = prom_getbootfile();
- boothowto = bootoptions(prom_getbootargs());
-
- if (kernel != NULL && *kernel != '\0') {
+ k = prom_getbootfile();
+ if (k != NULL && *k != '\0') {
i = -1; /* not using the kernels */
+ strcpy(kernel, k);
} else {
i = 0;
- kernel = kernels[i];
+ strcpy(kernel, kernels[i]);
}
+ k = prom_getbootpath();
+ if (k && *k)
+ strcpy(prom_bootdevice, k);
+ boothowto = bootoptions(prom_getbootargs());
+
for (;;) {
/*
* ask for a kernel first ..
@@ -280,15 +283,15 @@
if (strcmp(dbuf, "halt") == 0)
_rtt();
if (dbuf[0])
- prom_bootdevice = dbuf;
+ strcpy(prom_bootdevice, dbuf);
printf("boot (press RETURN to try default list): ");
gets(fbuf);
if (fbuf[0])
- kernel = fbuf;
+ strcpy(kernel, fbuf);
else {
boothowto &= ~RB_ASKNAME;
i = 0;
- kernel = kernels[i];
+ strcpy(kernel, kernels[i]);
}
}
@@ -308,7 +311,7 @@
*/
if ((boothowto & RB_ASKNAME) == 0 &&
i != -1 && kernels[++i]) {
- kernel = kernels[i];
+ strcpy(kernel, kernels[i]);
printf(": trying %s...\n", kernel);
} else {
printf("\n");
Index: stand/common/promdev.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc/stand/common/promdev.c,v
retrieving revision 1.15
diff -c -u -r1.15 promdev.c
--- stand/common/promdev.c 30 Jul 2003 15:58:40 -0000 1.15
+++ stand/common/promdev.c 24 Apr 2005 21:26:23 -0000
@@ -91,7 +91,7 @@
{ "obp v2", obp_v2_strategy, null_devopen, obp_close, null_devioctl };
-char *prom_bootdevice;
+char prom_bootdevice[MAX_PROM_PATH];
static int saveecho;
@@ -139,7 +139,7 @@
case PROM_OBP_V2:
case PROM_OBP_V3:
case PROM_OPENFIRM:
- if (prom_bootdevice == NULL) {
+ if (*prom_bootdevice == '\0') {
error = ENXIO;
break;
}
Index: stand/common/promdev.h
===================================================================
RCS file: /cvsroot/src/sys/arch/sparc/stand/common/promdev.h,v
retrieving revision 1.9
diff -c -u -r1.9 promdev.h
--- stand/common/promdev.h 1 Mar 2003 13:01:56 -0000 1.9
+++ stand/common/promdev.h 24 Apr 2005 21:26:23 -0000
@@ -55,7 +55,10 @@
#define DDB_MAGIC2 ( ('D'<<24) | ('D'<<16) | ('B'<<8) | ('2') )
extern time_t getsecs __P((void));
-extern char *prom_bootdevice;
+
+#define MAX_PROM_PATH 128
+
+extern char prom_bootdevice[MAX_PROM_PATH];
extern int cputyp, nbpg, pgofset, pgshift;
extern int debug;
--VbJkn9YxBvnuCH5J--