home | list info | list archive | date index | thread index

[OCLUG-Tech] what exactly does kernel param "retain_initrd" do?

  • Subject: [OCLUG-Tech] what exactly does kernel param "retain_initrd" do?
  • From: "Robert P. J. Day" <rpjday [ at ] crashcourse [ dot ] ca>
  • Date: Tue, 25 Sep 2012 16:01:09 -0400 (EDT)
  poking around in places in the kernel source i haven't been to in a
while so probably the first in a series of nitpicky questions.  the
"retain_initrd" kernel parameter is documented thusly:

  retain_initrd   [RAM] Keep initrd memory after extraction

ok, but does that mean one has *access* to it?  let's look at the
source in init/initramfs.c.  here's the processing of the parameter:

===== start
static int __initdata do_retain_initrd;

static int __init retain_initrd_param(char *str)
{
        if (*str)
                return 0;
        do_retain_initrd = 1;     <--- record the parameter
        return 1;
}
__setup("retain_initrd", retain_initrd_param);
===== end

  and here's the apparent effect it has, just below that in the same
source file:

===== start
static void __init free_initrd(void)
{
#ifdef CONFIG_KEXEC
        unsigned long crashk_start = (unsigned
long)__va(crashk_res.start);
        unsigned long crashk_end   = (unsigned
long)__va(crashk_res.end);
#endif
        if (do_retain_initrd)
                goto skip;

... snip for KEXEC ...

                free_initrd_mem(initrd_start, initrd_end);
skip:
        initrd_start = 0;
        initrd_end = 0;
}
===== end

  so if i read this correctly, if i use the kernel parm of
"retain_initrd", the call to free_initrd_mem() is skipped, but the
variables initrd_start and initrd_end are still cleared, so what
exactly is one supposed to do with the information that the initrd
content is still in memory?

  it's not like it's mounted and visible from userspace, is it?  what
is the value of that parameter?

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================