Port-atari archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

intallation ramdisk problem on NetBSD/atari



Has anyone recently tried installation using a kernel booted from TOS
and sysinst.fs ramdisk image loaded from floppy?

NetBSD/atari has used "ramdisk image auto-loaded from floppy on open,"
but nowadays md(4) is dynamically configured on open
so we no longer can specify md[012] for a root device by default
because they are not configured at mountroot().

The attached patch is a dirty hack for atari's traditional installation
(until it will get ustarfs based bootable floppies?),
but is there any better workaround for forthcoming 6.0 release?

Thanks,


Index: atari/autoconf.c
===================================================================
RCS file: /cvsroot/src/sys/arch/atari/atari/autoconf.c,v
retrieving revision 1.61
diff -u -p -r1.61 autoconf.c
--- atari/autoconf.c    5 Jun 2011 17:09:18 -0000       1.61
+++ atari/autoconf.c    28 Jun 2012 15:55:05 -0000
@@ -33,6 +33,8 @@
 #include <sys/cdefs.h>
 __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.61 2011/06/05 17:09:18 matt Exp $");
 
+#include "opt_md.h"
+
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/reboot.h>
@@ -41,10 +43,17 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v
 #include <sys/device.h>
 #include <sys/disklabel.h>
 #include <sys/disk.h>
+#include <sys/malloc.h>
 #include <machine/disklabel.h>
 #include <machine/cpu.h>
 #include <atari/atari/device.h>
 
+#if defined(MEMORY_DISK_HOOKS)
+#include <dev/md.h>
+#endif
+
+#include "ioconf.h"
+
 static void findroot(void);
 int mbmatch(device_t, cfdata_t, void *);
 void mbattach(device_t, device_t, void *);
@@ -75,6 +84,51 @@ cpu_rootconf(void)
 {
 
        findroot();
+#if defined(MEMORY_DISK_HOOKS)
+       /*
+        * XXX
+        * quick hacks for atari's traditional "auto-load from floppy on open"
+        * install md(4) ramdisk.
+        * See sys/arch/atari/dev/md_root.c for details.
+        */
+#define RAMD_NDEV      3       /* XXX */
+
+       if ((boothowto & RB_ASKNAME) != 0) {
+               int md_major, i;
+               dev_t md_dev;
+               cfdata_t cf;
+               struct md_softc *sc;
+
+               md_major = devsw_name2blk("md", NULL, 0);
+               if (md_major >= 0) {
+                       for (i = 0; i < RAMD_NDEV; i++) {
+                               md_dev = MAKEDISKDEV(md_major, i, RAW_PART);
+                               cf = malloc(sizeof(*cf), M_DEVBUF,
+                                   M_ZERO|M_WAITOK);
+                               if (cf == NULL)
+                                       break;  /* XXX */
+                               cf->cf_name = md_cd.cd_name;
+                               cf->cf_atname = md_cd.cd_name;
+                               cf->cf_unit = i;
+                               cf->cf_fstate = FSTATE_STAR;
+                               /* XXX mutex */
+                               sc = device_private(config_attach_pseudo(cf));
+                               if (sc == NULL)
+                                       break;  /* XXX */
+                       }
+                       /*
+                        * XXX
+                        * If booted_device is not recognized,
+                        * assume we are booting from TOS and make ffs default
+                        * because sometimes md ramdisk image is
+                        * mis-recognized as msdosfs and
+                        * it causes unexpected panic.
+                        */
+                       if (booted_device == NULL)
+                               rootfstype = "ffs";
+               }
+       }
+#endif
        setroot(booted_device, booted_partition);
 }
 
---
Izumi Tsutsui


Home | Main Index | Thread Index | Old Index