On Tue, Aug 20, 2013 at 1:44 AM, Helmut Jarausch
<jarau...@igpm.rwth-aachen.de> wrote:
> On 08/19/2013 04:55:29 PM, Mike Gilbert wrote:
>>
>> On Mon, Aug 19, 2013 at 5:58 AM, Helmut Jarausch
>> <jarau...@igpm.rwth-aachen.de> wrote:
>> > Hi,
>> >
>> > what binaries and libraries have to be put into an initramfs for a
>> > system
>> > booting with init=/usr/lib/systemd/systemd ?
>> > (I am building the initramsfs myself)
>> >
>>
>> You need to get your root filesystem and /usr mounted. Just keep that
>> goal in mind and start adding files to support it.
>>
>> There doesn't need to be anything systemd-specific.
>>
>
> I am not sure about "timing".
>
> Initially the kernel has only the "mini" /usr partition contained within the
> initramfs.
> Then it switches to "real root" and only then it tries to mount the "real"
> /usr partition.
> Does this all happen before the kernel hands control over to the init
> process (i.e. systemd) ?

No, the kernel has a mini filesystem (doesn't matter which directory
structure has inside), and it executes the init script (or binary
program) in the root of the initramfs. This init program/script is the
responsible for mounting the real root and other partitions, and
handling control over to systemd (or OpenRC, or whatever).

Dracut is able to create an initramfs (with the systemd Dracut module)
that executes systemd inside the initramfs, which mounts /usr,
switches to the real root, and gives control to the "real" systemd
instance. At shutdown, the reverse happens: the "real" systemd
surrenders control to the initramfs systemd, it umounts everything,
and finish the shutdow process.

If you generate an initramfs with Dracut using the systemd module, the
init inside the initramfs is a link to /usr/lib/systemd/systemd.

Unless you want to learn the ins and outs of using an initramfs (and
having a lot of fun and failed boots in the process), I highly
recommend using Dracut. It does everything for you.

Regards.
-- 
Canek Peláez Valdés
Posgrado en Ciencia e Ingeniería de la Computación
Universidad Nacional Autónoma de México

Reply via email to