You are not logged in.

#1 2015-07-08 19:30:04

khouli
Member
Registered: 2014-12-14
Posts: 70

Where does control start up in the initramfs? How is it special?

I want to know what's going on once the initramfs is loaded. How can I observe and inspect what the initramfs-linux.img disk image does during boot?

The basic steps of the GRUB logic aren't too hard to follow but once it loads the kernel and chooses a root it's just an opaque logic wall to me. Where does it pick up? And what causes it to eventually change the root volume?

Is there a way to boot into it and start a shell rather than continuing as usual and mounting the final root volume?

Offline

#2 2015-07-08 20:06:27

Head_on_a_Stick
Member
From: London
Registered: 2014-02-20
Posts: 7,732
Website

Re: Where does control start up in the initramfs? How is it special?

Offline

#3 2015-07-08 20:21:09

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,534
Website

Re: Where does control start up in the initramfs? How is it special?

khouli wrote:

How can I observe and inspect what the initramfs-linux.img disk image does during boot?

You can see what is in it with `cpio -t </boot/initramfs-linux.img` it's just a compressed (usually) root partition archive.

Where does it pick up? And what causes it to eventually change the root volume?

It picks up where the boot loader leaves off ... kind of.  "it" is not a thing, as noted above, it's just a minimal root file system.  This file system should include a /bin/init.

Is there a way to boot into it and start a shell rather than continuing as usual and mounting the final root volume?

Kernel parameters `break=premount` or just list a bad/absent real root in your bootloader.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#4 2015-07-08 21:47:48

frostschutz
Member
Registered: 2013-11-15
Posts: 1,419

Re: Where does control start up in the initramfs? How is it special?

The kernel extracts the initramfs and executes /init and everything else spins off from there. Usually /init is a shell script and the shell (and other command line tools) are provided by an all-in-one binary (busybox).

This might also give you some ideas): https://wiki.gentoo.org/wiki/Custom_Initramfs

Generated initramfs usually have a more complicated structure as they have to deal with all sorts of situations.

Offline

Board footer

Powered by FluxBB