1 |
On Tue, Aug 20, 2013 at 2:44 AM, Helmut Jarausch |
2 |
<jarausch@××××××××××××××××.de> wrote: |
3 |
> On 08/19/2013 04:55:29 PM, Mike Gilbert wrote: |
4 |
>> |
5 |
>> On Mon, Aug 19, 2013 at 5:58 AM, Helmut Jarausch |
6 |
>> <jarausch@××××××××××××××××.de> wrote: |
7 |
>> > Hi, |
8 |
>> > |
9 |
>> > what binaries and libraries have to be put into an initramfs for a |
10 |
>> > system |
11 |
>> > booting with init=/usr/lib/systemd/systemd ? |
12 |
>> > (I am building the initramsfs myself) |
13 |
>> > |
14 |
>> |
15 |
>> You need to get your root filesystem and /usr mounted. Just keep that |
16 |
>> goal in mind and start adding files to support it. |
17 |
>> |
18 |
>> There doesn't need to be anything systemd-specific. |
19 |
>> |
20 |
> |
21 |
> I am not sure about "timing". |
22 |
> |
23 |
> Initially the kernel has only the "mini" /usr partition contained within the |
24 |
> initramfs. |
25 |
> Then it switches to "real root" and only then it tries to mount the "real" |
26 |
> /usr partition. |
27 |
> Does this all happen before the kernel hands control over to the init |
28 |
> process (i.e. systemd) ? |
29 |
> |
30 |
|
31 |
Here's the essence of what you need to accomplish (skip step 2 if you |
32 |
don't have a separate /usr filesystem): |
33 |
|
34 |
1. Mount the "real" root filesystem, which we will call /realroot. |
35 |
2. Mount the /usr filesystem at /realroot/usr. |
36 |
3. Pivot /realroot onto / and exec /usr/lib/systemd/systemd. |
37 |
|
38 |
Step 3 is generally accomplished by a line like this: |
39 |
|
40 |
exec switch_root /realroot /usr/bin/systemd/systemd "$@" |
41 |
|
42 |
If you want to be able to switch inits at boot time, you will need to |
43 |
parse the kernel command line from /proc/cmdline. |