Source-Changes-HG archive

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

[src/trunk]: src/sys Put back MEMORY_DISK_IMAGE logic, but use generated opt_...



details:   https://anonhg.NetBSD.org/src/rev/3ddb42096cd2
branches:  trunk
changeset: 810425:3ddb42096cd2
user:      uebayasi <uebayasi%NetBSD.org@localhost>
date:      Sun Aug 30 05:24:03 2015 +0000

description:
Put back MEMORY_DISK_IMAGE logic, but use generated opt_memory_root_image.h
and don't polute Makefile.kern.inc.

diffstat:

 sys/conf/Makefile.kern.inc |   3 ++-
 sys/conf/files             |   3 ++-
 sys/conf/mdroot.mk         |   8 ++++++++
 sys/dev/md_root.c          |  19 +++++++++++++++++--
 4 files changed, 29 insertions(+), 4 deletions(-)

diffs (99 lines):

diff -r e0d812fc8ee7 -r 3ddb42096cd2 sys/conf/Makefile.kern.inc
--- a/sys/conf/Makefile.kern.inc        Sun Aug 30 05:23:17 2015 +0000
+++ b/sys/conf/Makefile.kern.inc        Sun Aug 30 05:24:03 2015 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.kern.inc,v 1.212 2015/08/30 05:12:00 uebayasi Exp $
+#      $NetBSD: Makefile.kern.inc,v 1.213 2015/08/30 05:24:04 uebayasi Exp $
 #
 # This file contains common `MI' targets and definitions and it is included
 # at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}.
@@ -484,6 +484,7 @@
 .endif
 .endif
 
+.include "${S}/conf/mdroot.mk"
 .include "${S}/conf/lint.mk"
 .include "${S}/conf/cscope.mk"
 .include "${S}/conf/gdbinit.mk"
diff -r e0d812fc8ee7 -r 3ddb42096cd2 sys/conf/files
--- a/sys/conf/files    Sun Aug 30 05:23:17 2015 +0000
+++ b/sys/conf/files    Sun Aug 30 05:24:03 2015 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files,v 1.1141 2015/08/30 05:12:00 uebayasi Exp $
+#      $NetBSD: files,v 1.1142 2015/08/30 05:24:04 uebayasi Exp $
 #      @(#)files.newconf       7.5 (Berkeley) 5/10/93
 
 version        20150832
@@ -290,6 +290,7 @@
                                MEMORY_DISK_DYNAMIC
 defparam opt_md.h              MEMORY_DISK_SERVER=1 MEMORY_DISK_ROOT_SIZE
                                MEMORY_DISK_RBFLAGS
+defparam opt_memory_disk_image makeoptions_MEMORY_DISK_IMAGE
 
 defflag opt_tftproot.h         TFTPROOT TFTPROOT_DEBUG
 
diff -r e0d812fc8ee7 -r 3ddb42096cd2 sys/conf/mdroot.mk
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/conf/mdroot.mk        Sun Aug 30 05:24:03 2015 +0000
@@ -0,0 +1,8 @@
+# $NetBSD: mdroot.mk,v 1.1 2015/08/30 05:24:04 uebayasi Exp $
+
+.if defined(MEMORY_DISK_IMAGE)
+md_root_image.h: ${MEMORY_DISK_IMAGE}
+       ${_MKTARGET_CREATE}
+       ${TOOL_HEXDUMP} -v -e '"\t" 8/1 "0x%02x, " "\n"' ${.ALLSRC} > ${.TARGET}
+md_root.o: md_root_image.h
+.endif
diff -r e0d812fc8ee7 -r 3ddb42096cd2 sys/dev/md_root.c
--- a/sys/dev/md_root.c Sun Aug 30 05:23:17 2015 +0000
+++ b/sys/dev/md_root.c Sun Aug 30 05:24:03 2015 +0000
@@ -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 @@
 #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 @@
  */
 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



Home | Main Index | Thread Index | Old Index