stl | 8 Aug 2012 11:01
Picon

need some clarifications concerning rootf mounting

Hello all,
I need some explanations concerning the ways to mount rootf during boot.

I have read some documents (notably the very useful How to use initramfs by Rob Landley)
and dug into the source code, but some doubts remain.

If I well understood, there is 2 differents procedures to mount the rootfs:
- using the old way: init ramdisk
- using the initramfs support (which appears to be really more efficient)

The fonction "populate_rootfs()" seems to be a crucial point of the procedure:
it calls a first time "unpack_to_roofs()" with __initramfs_start and __initramfs_size
as arguments, and if initrd_start is not NULL, calls one more time "unpack_to_rootfs()"
with initrd_start and (initrd_end-initrd_start) as arguments.

What's really happening during the first unpack_to_rootfs() ?
Does the kernel unpack the iniramfs.cpio (created either by supplying a valid cpio one
or a config file through CONFIG_INITRAMFS_SOURCE) from __initramfs_start (defined in vmlinux.lds.S)?

If I aim to use initramfs support, should I do something with initrd_start/end and CONFIG_BLK_DEV_RAM stuffs?

Thanks in advance for your help and clarifications.

Regards

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies <at> kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
stl | 14 Aug 2012 12:15
Picon

Re: need some clarifications concerning rootf mounting

I have dug a little more, and if I well understand, the initramfs_data.cpio.gz should be
expanded from __initramfs_start (defined in vmlinux.lds.S)

But when and how is it done?
And by who?
Architecture specific code? bootloader, or setup_arch() memory initialisation function?
Or the kernel itself and automatically during kernel build? Or during boot?

In my case, the initramfs_data.cpio.gz is not present at __initramfs_start.
When the kernel tries to find the compression magic number ("decompress_method() function),
it complains and panic with the following message:

kernel panic: junk in compressed archive

(I precise that I am porting Linux-2.6.37 to a new architecture)

Thanks in advance for your help and advices.

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies <at> kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Rahul Bedarkar | 14 Aug 2012 12:44
Picon
Gravatar

Re: need some clarifications concerning rootf mounting

On Tue, Aug 14, 2012 at 3:45 PM, stl <st.lambert02 <at> gmail.com> wrote:
> I have dug a little more, and if I well understand, the
> initramfs_data.cpio.gz should be
> expanded from __initramfs_start (defined in vmlinux.lds.S)
>
> But when and how is it done?
> And by who?
> Architecture specific code? bootloader, or setup_arch() memory
> initialisation function?
> Or the kernel itself and automatically during kernel build? Or during boot?
>
> In my case, the initramfs_data.cpio.gz is not present at __initramfs_start.
> When the kernel tries to find the compression magic number
> ("decompress_method() function),
> it complains and panic with the following message:
>
> kernel panic: junk in compressed archive

It is essential to have rootfs otherwise you will not able to compete
kernel boot process.
If you try to compile kernel without rootfs, it will give you error.
In your case, kernel found that initramfs_data.cpio.gz does not
contain anything. you might have did touch to initramfs_data.cpio.gz
to ignore error ?

Thanks,
Rahul B.
>
> (I precise that I am porting Linux-2.6.37 to a new architecture)
>
> Thanks in advance for your help and advices.
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies <at> kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
stl | 16 Aug 2012 11:31
Picon

Re: need some clarifications concerning rootf mounting

Thanks for your answer.

Ok, here is what I have exactly done:

- compiled with my uClibc cross-compiler a simple hello world program.
- written a basic config file in linux-2.6.37/usr, creating a dev/console, a /init from /usr/hello and some other dirs.
- edited the .config file with CONFIG_INITRAMFS_SOURCE = ......./usr/config_file and selected CONFIG_INITRAMFS_COMPRESSION_GZIP=y
- built the kernel
- launched vmlinux and received the "kernel panic: junk in compressed archive" error message

In the source code, initrd_start ans initrd_end appears.
if i want to use initramfs support (and not initrd support), should I do something special in "setup_arch()" in order to initialize these symbols?

thakns in advance

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies <at> kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Rahul Bedarkar | 20 Aug 2012 10:02
Picon
Gravatar

Re: need some clarifications concerning rootf mounting

You haven't build your root file system. I believe we give path to
root file system in CONFIG_INITRAMFS_SOURCE.
There are different ways to build root file system, like buildroot.
http://buildroot.uclibc.org/

-Rahul B.

On Thu, Aug 16, 2012 at 3:01 PM, stl <st.lambert02 <at> gmail.com> wrote:
> Thanks for your answer.
>
> Ok, here is what I have exactly done:
>
> - compiled with my uClibc cross-compiler a simple hello world program.
> - written a basic config file in linux-2.6.37/usr, creating a dev/console, a
> /init from /usr/hello and some other dirs.
> - edited the .config file with CONFIG_INITRAMFS_SOURCE =
> ......./usr/config_file and selected CONFIG_INITRAMFS_COMPRESSION_GZIP=y
> - built the kernel
> - launched vmlinux and received the "kernel panic: junk in compressed
> archive" error message
>
> In the source code, initrd_start ans initrd_end appears.
> if i want to use initramfs support (and not initrd support), should I do
> something special in "setup_arch()" in order to initialize these symbols?
>
> thakns in advance

Gmane