Module Name:    src
Committed By:   thorpej
Date:           Tue Jan  2 16:48:02 UTC 2024

Modified Files:
        src/sys/arch/virt68k/conf: std.virt68k
        src/sys/arch/virt68k/virt68k: autoconf.c

Log Message:
If the loader passed us a RAM disk, use it as the root file system.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/conf/std.virt68k
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/virt68k/virt68k/autoconf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/virt68k/conf/std.virt68k
diff -u src/sys/arch/virt68k/conf/std.virt68k:1.1 src/sys/arch/virt68k/conf/std.virt68k:1.2
--- src/sys/arch/virt68k/conf/std.virt68k:1.1	Tue Jan  2 07:40:59 2024
+++ src/sys/arch/virt68k/conf/std.virt68k	Tue Jan  2 16:48:01 2024
@@ -1,4 +1,4 @@
-#	$NetBSD: std.virt68k,v 1.1 2024/01/02 07:40:59 thorpej Exp $
+#	$NetBSD: std.virt68k,v 1.2 2024/01/02 16:48:01 thorpej Exp $
 #
 # Options/devices that all virt68ks should have
 #
@@ -8,3 +8,8 @@ include		"conf/std"			# MI standard opti
 include		"arch/m68k/conf/std.m68k"	# m68k standard options
 
 options 	EXEC_AOUT	# support for exec'ing a.out
+
+# initrd support
+options 	MEMORY_DISK_HOOKS
+options 	MEMORY_DISK_DYNAMIC
+pseudo-device	md

Index: src/sys/arch/virt68k/virt68k/autoconf.c
diff -u src/sys/arch/virt68k/virt68k/autoconf.c:1.1 src/sys/arch/virt68k/virt68k/autoconf.c:1.2
--- src/sys/arch/virt68k/virt68k/autoconf.c:1.1	Tue Jan  2 07:41:02 2024
+++ src/sys/arch/virt68k/virt68k/autoconf.c	Tue Jan  2 16:48:01 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.1 2024/01/02 07:41:02 thorpej Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.2 2024/01/02 16:48:01 thorpej Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -45,7 +45,9 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.1 2024/01/02 07:41:02 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.2 2024/01/02 16:48:01 thorpej Exp $");
+
+#include "opt_md.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -54,6 +56,11 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v
 #include <sys/reboot.h>
 #include <sys/device.h>
 
+#ifdef MEMORY_DISK_DYNAMIC
+#include <dev/md.h>
+#endif
+
+#include <machine/bootinfo.h>
 #include <machine/intr.h>
 
 #include <virt68k/dev/mainbusvar.h>
@@ -77,7 +84,21 @@ cpu_configure(void)
 void
 cpu_rootconf(void)
 {
-	/* XXX handle RAM disk on kernel command line. */
+#ifdef MEMORY_DISK_DYNAMIC
+	struct bi_record *bi;
+
+	/*
+	 * Look for a RAMDISK bootinfo record.  If we have one,
+	 * hook is up to the memory disk and set it as the root
+	 * file system.
+	 */
+	bi = bootinfo_find(BI_RAMDISK);
+	if (bi != NULL) {
+		struct bi_mem_info *rd = bootinfo_dataptr(bi);
+		md_root_setconf((void *)rd->mem_addr, rd->mem_size);
+	}
+#endif /* MEMORY_DISK_DYNAMIC */
+
 	rootconf();
 }
 

Reply via email to