* How to load initramfs only on-demand?
@ 2016-03-12 8:29 Woody Wu
2016-03-13 4:36 ` Greg KH
0 siblings, 1 reply; 4+ messages in thread
From: Woody Wu @ 2016-03-12 8:29 UTC (permalink / raw)
To: kernelnewbies
Hi,
I will be using initramfs to do some special task on my system, such as,
format a nand flash and burn in the real root file system. But these tasks
will be rarely needed and I dont want to pay for loading an
initramfs-embedded kernel image every time, since it takes time loading
bigger mage from flash by boot loader. So I hope thing could be somewhat
looks like that, if user press a key in the boot loader stage, the
boot loader could load an initramfs cpio.gz from a special nand partition
into a fixed memory location. Then via a kernel parameter, the memory
address of the initramfs could be recognized by the kernel, and only at
this time the kernel goes the initramfs booting stage, otherwise kernel
will do the normal booting and mounting the real root file system.
My question is, is there such a kernel parameter to do the job? Probably
there is a non-parameter solution like passing the initramfs address in a
register when a boot loader transfer control to the kernel, but this is not
an option to me since my boot loader (u-boot) does not support doing
this. Thanks.
BR,
-wood
--
Life is the only flaw in an otherwise perfect nonexistence
-- Schopenhauer
woody
public key at http://subkeys.pgp.net:11371 (narkewoody at gmail.com)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160312/98e7abb3/attachment.html
^ permalink raw reply [flat|nested] 4+ messages in thread* How to load initramfs only on-demand?
2016-03-12 8:29 How to load initramfs only on-demand? Woody Wu
@ 2016-03-13 4:36 ` Greg KH
2016-03-13 5:37 ` Woody Wu
0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2016-03-13 4:36 UTC (permalink / raw)
To: kernelnewbies
On Sat, Mar 12, 2016 at 04:29:08PM +0800, Woody Wu wrote:
> My question is, is there such a kernel parameter to do the job? Probably there
> is a non-parameter solution like passing?the initramfs address in a register
> when a boot loader transfer control to the kernel, but this is not an option to
> me since my boot loader (u-boot) does not support doing this.?Thanks.
You have the source to your bootloader, I suggest you fix that up to
support this if you want it, not much the kernel can do on it's own
here, sorry.
good luck!
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* How to load initramfs only on-demand?
2016-03-13 4:36 ` Greg KH
@ 2016-03-13 5:37 ` Woody Wu
2016-03-14 12:30 ` Woody Wu
0 siblings, 1 reply; 4+ messages in thread
From: Woody Wu @ 2016-03-13 5:37 UTC (permalink / raw)
To: kernelnewbies
On Sunday, March 13, 2016, Greg KH <greg@kroah.com> wrote:
> On Sat, Mar 12, 2016 at 04:29:08PM +0800, Woody Wu wrote:
> > My question is, is there such a kernel parameter to do the job? Probably
> there
> > is a non-parameter solution like passing the initramfs address in a
> register
> > when a boot loader transfer control to the kernel, but this is not an
> option to
> > me since my boot loader (u-boot) does not support doing this. Thanks.
>
> You have the source to your bootloader, I suggest you fix that up to
> support this if you want it, not much the kernel can do on it's own
> here, sorry.
>
>
But the kernel document says,
External initramfs images:
--------------------------
If the kernel has initrd support enabled, an external cpio.gz archive can
also
be passed into a 2.6 kernel in place of an initrd. In this case, the kernel
will autodetect the type (initramfs, not initrd) and extract the external
cpio
archive into rootfs before trying to run /init.
This has the memory efficiency advantages of initramfs (no ramdisk block
device) but the separate packaging of initrd (which is nice if you have
non-GPL code you'd like to run from initramfs, without conflating it with
the GPL licensed Linux kernel binary).
It can also be used to supplement the kernel's built-in initramfs image.
The
files in the external archive will overwrite any conflicting files in
the built-in initramfs archive. Some distributors also prefer to customize
a single kernel image with task-specific initramfs images, without
recompiling.
So I am thinking, can I from my bootloader load a cpio.gz into ram and
start kernel with a command line "initrd=0x30000000"? Wii this work? And,
in this case should I also pass kernel with someilike "roo=/dev/ram"?
Thanks.
-woody
--
Life is the only flaw in an otherwise perfect nonexistence
-- Schopenhauer
woody
public key at http://subkeys.pgp.net:11371 (narkewoody at gmail.com)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160313/cd9a0c64/attachment.html
^ permalink raw reply [flat|nested] 4+ messages in thread* How to load initramfs only on-demand?
2016-03-13 5:37 ` Woody Wu
@ 2016-03-14 12:30 ` Woody Wu
0 siblings, 0 replies; 4+ messages in thread
From: Woody Wu @ 2016-03-14 12:30 UTC (permalink / raw)
To: kernelnewbies
m
On Sunday, March 13, 2016, Woody Wu <narkewoody@gmail.com> wrote:
>
>
> On Sunday, March 13, 2016, Greg KH <greg@kroah.com
> <javascript:_e(%7B%7D,'cvml','greg@kroah.com');>> wrote:
>
>> On Sat, Mar 12, 2016 at 04:29:08PM +0800, Woody Wu wrote:
>> > My question is, is there such a kernel parameter to do the job?
>> Probably there
>> > is a non-parameter solution like passing the initramfs address in a
>> register
>> > when a boot loader transfer control to the kernel, but this is not an
>> option to
>> > me since my boot loader (u-boot) does not support doing this. Thanks.
>>
>> You have the source to your bootloader, I suggest you fix that up to
>> support this if you want it, not much the kernel can do on it's own
>> here, sorry.
>>
>>
> But the kernel document says,
>
> External initramfs images:
> --------------------------
>
> If the kernel has initrd support enabled, an external cpio.gz archive can
> also
> be passed into a 2.6 kernel in place of an initrd. In this case, the
> kernel
> will autodetect the type (initramfs, not initrd) and extract the external
> cpio
> archive into rootfs before trying to run /init.
>
> This has the memory efficiency advantages of initramfs (no ramdisk block
> device) but the separate packaging of initrd (which is nice if you have
> non-GPL code you'd like to run from initramfs, without conflating it with
> the GPL licensed Linux kernel binary).
>
> It can also be used to supplement the kernel's built-in initramfs image.
> The
> files in the external archive will overwrite any conflicting files in
> the built-in initramfs archive. Some distributors also prefer to customize
> a single kernel image with task-specific initramfs images, without
> recompiling.
>
> So I am thinking, can I from my bootloader load a cpio.gz into ram and
> start kernel with a command line "initrd=0x30000000"? Wii this work? And,
> in this case should I also pass kernel with someilike "roo=/dev/ram"?
> Thanks.
>
> -woody
>
>
> I found the initrd=address works! No root= need to be passed. Only let
u-boot load a cpio.uboot image into physical memory and set the correct
kernel command line, my problem solved. :-)
--
Life is the only flaw in an otherwise perfect nonexistence
-- Schopenhauer
woody
public key at http://subkeys.pgp.net:11371 (narkewoody at gmail.com)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160314/337aa673/attachment.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-03-14 12:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-12 8:29 How to load initramfs only on-demand? Woody Wu
2016-03-13 4:36 ` Greg KH
2016-03-13 5:37 ` Woody Wu
2016-03-14 12:30 ` Woody Wu
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).