summaryrefslogtreecommitdiff
path: root/sys/dev/md_root.c
diff options
context:
space:
mode:
authoruebayasi <uebayasi@NetBSD.org>2015-08-30 05:24:03 +0000
committeruebayasi <uebayasi@NetBSD.org>2015-08-30 05:24:03 +0000
commitd11ed543bb4a838cab8ba211ddcf200df4fed274 (patch)
treebc1416d6e894d405b20f603d7e00ca5a79e67765 /sys/dev/md_root.c
parentbb9bbabbaa07f048ca4208a907b651edc4cc0c79 (diff)
Put back MEMORY_DISK_IMAGE logic, but use generated opt_memory_root_image.h
and don't polute Makefile.kern.inc.
Diffstat (limited to 'sys/dev/md_root.c')
-rw-r--r--sys/dev/md_root.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/sys/dev/md_root.c b/sys/dev/md_root.c
index 59a408a8a0b..6017360a504 100644
--- a/sys/dev/md_root.c
+++ b/sys/dev/md_root.c
@@ -1,4 +1,4 @@
-/* $NetBSD: md_root.c,v 1.18 2015/08/29 15:51:53 uebayasi Exp $ */
+/* $NetBSD: md_root.c,v 1.19 2015/08/30 05:24:03 uebayasi Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -30,9 +30,10 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: md_root.c,v 1.18 2015/08/29 15:51:53 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: md_root.c,v 1.19 2015/08/30 05:24:03 uebayasi Exp $");
#include "opt_md.h"
+#include "opt_memory_disk_image.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -41,10 +42,23 @@ __KERNEL_RCSID(0, "$NetBSD: md_root.c,v 1.18 2015/08/29 15:51:53 uebayasi Exp $"
#include <dev/md.h>
#ifdef MEMORY_DISK_DYNAMIC
+#ifdef makeoptions_MEMORY_DISK_IMAGE
+#error MEMORY_DISK_DYNAMIC is not compatible with MEMORY_DISK_IMAGE
+#endif
size_t md_root_size;
char *md_root_image;
#else /* MEMORY_DISK_DYNAMIC */
+#ifdef makeoptions_MEMORY_DISK_IMAGE
+#ifdef MEMORY_DISK_ROOT_SIZE
+#error MEMORY_DISK_ROOT_SIZE is not compatible with MEMORY_DISK_IMAGE
+#endif
+char md_root_image[] = {
+#include "md_root_image.h"
+};
+uint32_t md_root_size = sizeof(md_root_image) & ~(DEV_BSIZE - 1);
+
+#else /* makeoptions_MEMORY_DISK_IMAGE */
#ifndef MEMORY_DISK_ROOT_SIZE
#define MEMORY_DISK_ROOT_SIZE 512
@@ -57,6 +71,7 @@ char *md_root_image;
*/
uint32_t md_root_size = ROOTBYTES;
char md_root_image[ROOTBYTES] = "|This is the root ramdisk!\n";
+#endif /* makeoptions_MEMORY_DISK_IMAGE */
#endif /* MEMORY_DISK_DYNAMIC */
#ifndef MEMORY_DISK_RBFLAGS