From: Milton Miller <miltonm@bga.com>
To: <fastboot@lists.osdl.org>, <klibc@zytor.com>, <linuxppc-dev@ozlabs.org>
Subject: [PATCH] export retained initrd in debugfs
Date: Wed, 11 Apr 2007 03:31:07 -0500 (CDT) [thread overview]
Message-ID: <boot-4-misc-01.miltonm@bga.com> (raw)
In-Reply-To: <boot-4-00.miltonm@bga.com>
Export initrd in debugfs when retained.
As a side effect, initrd_start and initrd_end are not cleared when the
initrd is retained.
After this patch, one can then copy the initrd space from debugfs and
pass it to kexec as the initrd, or do something else with it (maybe it
was an initrd not an initramfs).
Signed-off-by: Milton Miller <miltonm@bga.com>
---
This is a lot more reliable than extracting it via dd from /dev/mem.
Currently debugfs doesn't have a getattr even for blobs, so one has
to cp elsewhere before using kexec from kexec-tools.
Index: kernel/init/initramfs.c
===================================================================
--- kernel.orig/init/initramfs.c 2007-03-28 00:12:15.000000000 -0500
+++ kernel/init/initramfs.c 2007-03-28 00:35:56.000000000 -0500
@@ -6,6 +6,7 @@
#include <linux/delay.h>
#include <linux/string.h>
#include <linux/syscalls.h>
+#include <linux/debugfs.h>
static __initdata char *message;
static void __init error(char *x)
@@ -519,7 +520,7 @@ static void __init free_initrd(void)
unsigned long crashk_end = (unsigned long)__va(crashk_res.end);
#endif
if (do_retain_initrd)
- goto skip;
+ return;
#ifdef CONFIG_KEXEC
/*
@@ -588,3 +589,29 @@ static int __init populate_rootfs(void)
return 0;
}
rootfs_initcall(populate_rootfs);
+
+#ifdef CONFIG_BLK_DEV_INITRD
+static struct debugfs_blob_wrapper initrd_blob;
+
+static int __init export_initrd(void)
+{
+ struct dentry *d;
+ initrd_blob.data = (char *)initrd_start;
+ initrd_blob.size = initrd_end - initrd_start;
+
+ if (!do_retain_initrd)
+ return 0;
+
+ if (!initrd_start)
+ return 0;
+
+ d = debugfs_create_blob("initrd", S_IFREG, NULL, &initrd_blob);
+
+ if (!d)
+ return 1;
+
+ return 0;
+}
+
+__initcall(export_initrd);
+#endif
next prev parent reply other threads:[~2007-04-11 8:31 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-11 8:28 [PATCH 0/3+2+8] powerpc zImage kexec Milton Miller
2007-04-11 8:29 ` [PATCH HACK kexec-tools-testing] malloc corruption hack Milton Miller
2007-04-11 8:30 ` [PATCH kexec-tools] ppc64: correct @ha relocation Milton Miller
2007-04-12 3:24 ` Simon Horman
2007-04-12 3:57 ` [Fastboot] " Simon Horman
2007-04-12 8:17 ` Mohan Kumar M
2007-04-13 1:35 ` Simon Horman
2007-04-11 8:30 ` [PATCH kexec-tools] ppc64: use kernels slave loop for purgatory Milton Miller
2007-04-13 1:34 ` Simon Horman
2007-04-11 8:31 ` Milton Miller [this message]
2007-04-12 6:17 ` [PATCH] export retained initrd in debugfs Michael Neuling
2007-04-11 8:32 ` [PATCH] kexec: send slaves to new kernel earlier Milton Miller
2007-04-11 8:32 ` [PATCH 1/8] boot: more verbose gunzip error message Milton Miller
2007-04-12 7:46 ` David Gibson
2007-04-11 8:32 ` [PATCH 2/8] bootwrapper: smp support code Milton Miller
2007-04-11 8:32 ` [PATCH 3/8] bootwrapper: occuppied memory ranges Milton Miller
2007-04-11 8:33 ` [PATCH 4/8] bootwrapper: help for 64 bit cpus Milton Miller
2007-04-12 7:43 ` Segher Boessenkool
2007-04-12 8:49 ` Benjamin Herrenschmidt
2007-04-11 8:33 ` [PATCH 5/8] bootwrapper: Add kexec callable zImage wrapper Milton Miller
2007-04-11 8:33 ` [PATCH 6/8] bootwrapper: convert flatdevtree to version 16 Milton Miller
2007-04-11 16:30 ` Scott Wood
2007-04-12 16:56 ` Milton Miller
2007-04-11 8:34 ` [PATCH 7/8] bootwrapper: rtas support Milton Miller
2007-04-11 8:34 ` [PATCH 8/8] bootwrapper: example sreset marshalling Milton Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=boot-4-misc-01.miltonm@bga.com \
--to=miltonm@bga.com \
--cc=fastboot@lists.osdl.org \
--cc=klibc@zytor.com \
--cc=linuxppc-dev@ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).