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

This commit is contained in:
thorpej 2024-01-02 16:48:01 +00:00
parent 13d937d9ba
commit 53af2fcc67
2 changed files with 30 additions and 4 deletions

View File

@ -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 options
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

View File

@ -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 1.1 2024/01/02 07:41:02 thorpej Exp $")
#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();
}