Re: bootloader issue

Izumi Tsutsui <[email protected]>
Newsgroups gmane.os.netbsd.ports.atari
Message-ID <[email protected]>
David Ross wrote:

> The bootloader issue has been identified and Izumi is working on a solution, 
> see below.

 :

> > Okay, I see. /boot.atari in base.tgz is actually a copy of
> > /usr/mdec/milan/boot.atari, not /usr/mdec/std/boot.atari.
> > (they have a different entry address)
> >
> > Maybe we should remove /boot.atari from base.tgz and

This part is done:
http://mail-index.NetBSD.org/source-changes/2009/01/13/msg215358.html
http://mail-index.NetBSD.org/source-changes/2009/01/13/msg215359.html

BTW, I wonder if MILAN (and HADES) kernels have been tested recently...

> > modify sysinst to choose and copy a proper tertiary boot.atari
> > from /usr/mdec dir per running machine types.
> > I'll check how it can be handled in sysinst.

and I've put new test snapshots here:
ftp://ftp.NetBSD.org/pub/NetBSD/arch/atari/snapshot/20090113-4.0_STABLE/
ftp://ftp.NetBSD.org/pub/NetBSD/arch/atari/snapshot/20090113-5.0_BETA/

Note 64 bit time_t changes have been merged into the HEAD,
so I'm afraid it will take a while till it's settled.

sysinst patch is the following (untested at all):

Is there better way to identify running machine types?
(i.e. how to get "machineid" version in a kernel)

---
Index: distrib/utils/sysinst/arch/atari/md.c
===================================================================
RCS file: /cvsroot/src/distrib/utils/sysinst/arch/atari/md.c,v
retrieving revision 1.22
diff -u -r1.22 md.c
--- distrib/utils/sysinst/arch/atari/md.c	7 Oct 2008 09:58:14 -0000	1.22
+++ distrib/utils/sysinst/arch/atari/md.c	13 Jan 2009 16:13:11 -0000
@@ -39,10 +39,11 @@
 /* md.c -- Machine specific code for atari */
 
 #include <stdio.h>
-#include <util.h>
+#include <stdlib.h>
+#include <string.h>
 #include <sys/param.h>
-#include <machine/cpu.h>
 #include <sys/sysctl.h>
+
 #include "defs.h"
 #include "md.h"
 #include "msg_defs.h"
@@ -80,10 +81,35 @@
 int
 md_post_newfs(void)
 {
-	/* boot blocks ... */
+	static const int mib[2] = {CTL_HW, HW_MODEL};
+	size_t len;
+	char *cpu_model;
+	int milan;
+	char bootpath[MAXPATHLEN];
+	int rv;
+
+	/* check machine type via sysctl to select appropriate bootloaders */
+	milan = 0;	/* std is default */
+	sysctl(mib, 2, NULL, &len, NULL, 0);
+	cpu_model = malloc(len);
+	sysctl(mib, 2, cpu_model, &len, NULL, 0);
+	/* XXX model strings should be a common macro to sync with kernel */
+	if (strstr(cpu_model, "Milan") != NULL)
+		milan = 1;
+	free(cpu_model);
+
+	/* copy tertiary boot and install boot blocks */
 	msg_display(MSG_dobootblks, diskdev);
-	return run_program(RUN_DISPLAY, "/usr/mdec/installboot -v /dev/r%sc",
-	    diskdev);
+	snprintf(bootpath, sizeof(bootpath), "/usr/mdec/%s/boot.atari",
+	    milan ? "milan" : "std");
+	rv = cp_to_target(bootpath, "/");
+	if (rv != 0)
+		return rv;
+
+	rv = run_program(RUN_DISPLAY, "/usr/mdec/installboot -v%s /dev/r%sc",
+	    milan ? "m" : "", diskdev);
+
+	return rv;
 }
 
 int

---
Izumi Tsutsui
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.