Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Add support for using a raw file-system image as me...
details: https://anonhg.NetBSD.org/src/rev/af9483ab1c27
branches: trunk
changeset: 789660:af9483ab1c27
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Fri Aug 30 16:42:17 2013 +0000
description:
Add support for using a raw file-system image as memory disk root with
the x86 bootloader.
diffstat:
sys/arch/i386/stand/boot/boot2.c | 3 ++-
sys/arch/i386/stand/lib/bootmod.h | 3 ++-
sys/arch/i386/stand/lib/exec.c | 11 ++++++++++-
sys/arch/i386/stand/lib/libi386.h | 3 ++-
sys/arch/x86/include/bootinfo.h | 3 ++-
sys/arch/x86/x86/x86_machdep.c | 18 ++++++++++++++++--
6 files changed, 34 insertions(+), 7 deletions(-)
diffs (146 lines):
diff -r 2405c9fbcd64 -r af9483ab1c27 sys/arch/i386/stand/boot/boot2.c
--- a/sys/arch/i386/stand/boot/boot2.c Fri Aug 30 16:24:06 2013 +0000
+++ b/sys/arch/i386/stand/boot/boot2.c Fri Aug 30 16:42:17 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: boot2.c,v 1.59 2013/07/28 08:50:09 he Exp $ */
+/* $NetBSD: boot2.c,v 1.60 2013/08/30 16:42:17 jmcneill Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -143,6 +143,7 @@
{ "vesa", command_vesa },
{ "splash", splash_add },
{ "rndseed", rnd_add },
+ { "fs", fs_add },
{ "userconf", userconf_add },
{ NULL, NULL },
};
diff -r 2405c9fbcd64 -r af9483ab1c27 sys/arch/i386/stand/lib/bootmod.h
--- a/sys/arch/i386/stand/lib/bootmod.h Fri Aug 30 16:24:06 2013 +0000
+++ b/sys/arch/i386/stand/lib/bootmod.h Fri Aug 30 16:42:17 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bootmod.h,v 1.5 2011/11/28 07:56:54 tls Exp $ */
+/* $NetBSD: bootmod.h,v 1.6 2013/08/30 16:42:17 jmcneill Exp $ */
/*-
* Copyright (c) 2008 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -36,6 +36,7 @@
#define BM_TYPE_KMOD 0x00
#define BM_TYPE_IMAGE 0x01
#define BM_TYPE_RND 0x02
+#define BM_TYPE_FS 0x03
struct boot_module *bm_next;
} boot_module_t;
diff -r 2405c9fbcd64 -r af9483ab1c27 sys/arch/i386/stand/lib/exec.c
--- a/sys/arch/i386/stand/lib/exec.c Fri Aug 30 16:24:06 2013 +0000
+++ b/sys/arch/i386/stand/lib/exec.c Fri Aug 30 16:42:17 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: exec.c,v 1.50 2012/05/21 21:34:16 dsl Exp $ */
+/* $NetBSD: exec.c,v 1.51 2013/08/30 16:42:17 jmcneill Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -177,6 +177,12 @@
return module_add_common(name, BM_TYPE_RND);
}
+void
+fs_add(char *name)
+{
+ return module_add_common(name, BM_TYPE_FS);
+}
+
static void
module_add_common(char *name, uint8_t type)
{
@@ -591,6 +597,9 @@
case BM_TYPE_IMAGE:
bi->type = BI_MODULE_IMAGE;
break;
+ case BM_TYPE_FS:
+ bi->type = BI_MODULE_FS;
+ break;
case BM_TYPE_RND:
default:
/* safest -- rnd checks the sha1 */
diff -r 2405c9fbcd64 -r af9483ab1c27 sys/arch/i386/stand/lib/libi386.h
--- a/sys/arch/i386/stand/lib/libi386.h Fri Aug 30 16:24:06 2013 +0000
+++ b/sys/arch/i386/stand/lib/libi386.h Fri Aug 30 16:42:17 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: libi386.h,v 1.38 2011/11/28 07:56:54 tls Exp $ */
+/* $NetBSD: libi386.h,v 1.39 2013/08/30 16:42:17 jmcneill Exp $ */
/*
* Copyright (c) 1996
@@ -139,6 +139,7 @@
void module_add(char *);
void splash_add(char *);
void rnd_add(char *);
+void fs_add(char *);
void userconf_add(char *);
struct btinfo_framebuffer;
diff -r 2405c9fbcd64 -r af9483ab1c27 sys/arch/x86/include/bootinfo.h
--- a/sys/arch/x86/include/bootinfo.h Fri Aug 30 16:24:06 2013 +0000
+++ b/sys/arch/x86/include/bootinfo.h Fri Aug 30 16:42:17 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bootinfo.h,v 1.20 2013/05/16 19:06:45 christos Exp $ */
+/* $NetBSD: bootinfo.h,v 1.23 2013/08/30 16:42:17 jmcneill Exp $ */
/*
* Copyright (c) 1997
@@ -176,6 +176,7 @@
#define BI_MODULE_ELF 0x01
#define BI_MODULE_IMAGE 0x02
#define BI_MODULE_RND 0x03
+#define BI_MODULE_FS 0x04
struct btinfo_modulelist {
struct btinfo_common common;
diff -r 2405c9fbcd64 -r af9483ab1c27 sys/arch/x86/x86/x86_machdep.c
--- a/sys/arch/x86/x86/x86_machdep.c Fri Aug 30 16:24:06 2013 +0000
+++ b/sys/arch/x86/x86/x86_machdep.c Fri Aug 30 16:42:17 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: x86_machdep.c,v 1.58 2013/04/12 16:59:40 christos Exp $ */
+/* $NetBSD: x86_machdep.c,v 1.59 2013/08/30 16:42:17 jmcneill Exp $ */
/*-
* Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi,
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.58 2013/04/12 16:59:40 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.59 2013/08/30 16:42:17 jmcneill Exp $");
#include "opt_modular.h"
#include "opt_physmem.h"
@@ -73,6 +73,11 @@
#include <dev/acpi/acpivar.h>
#endif
+#include "opt_md.h"
+#ifdef MEMORY_DISK_HOOKS
+#include <dev/md.h>
+#endif
+
void (*x86_cpu_idle)(void);
static bool x86_cpu_idle_ipi;
static char x86_cpu_idle_text[16];
@@ -182,6 +187,15 @@
(void *)((uintptr_t)bi->base + KERNBASE),
bi->len);
break;
+ case BI_MODULE_FS:
+ aprint_debug("File-system image path=%s len=%d pa=%x\n",
+ bi->path, bi->len, bi->base);
+ KASSERT(trunc_page(bi->base) == bi->base);
+#ifdef MEMORY_DISK_HOOKS
+ md_root_setconf((void *)((uintptr_t)bi->base + KERNBASE),
+ bi->len);
+#endif
+ break;
default:
aprint_debug("Skipping non-ELF module\n");
break;
Home |
Main Index |
Thread Index |
Old Index