On Tue, Aug 20, 2013 at 2: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) ? >
Here's the essence of what you need to accomplish (skip step 2 if you don't have a separate /usr filesystem): 1. Mount the "real" root filesystem, which we will call /realroot. 2. Mount the /usr filesystem at /realroot/usr. 3. Pivot /realroot onto / and exec /usr/lib/systemd/systemd. Step 3 is generally accomplished by a line like this: exec switch_root /realroot /usr/bin/systemd/systemd "$@" If you want to be able to switch inits at boot time, you will need to parse the kernel command line from /proc/cmdline.