dslm4515 / Musl-LFS

Linux From Scratch using Musl as Libc
GNU General Public License v3.0
170 stars 21 forks source link

Initramfs bugs #77

Closed Strahinja closed 2 years ago

Strahinja commented 2 years ago

Currently Musl-LFS has the init script at /sbin/init within initramfs instead of /init, which in my testing causes kernel panic:

https://github.com/dslm4515/Musl-LFS/blob/d953d31dbc626021831f0ef5385809d5baa162d4/doc/3-Chroot/097-Initramfs#L41

Also, ldd /usr/sbin/udevadm shows that one of the dependencies is libkmod.so.2, which isn't copied to the initramfs, also producing a kernel panic:

https://github.com/dslm4515/Musl-LFS/blob/d953d31dbc626021831f0ef5385809d5baa162d4/doc/3-Chroot/097-Initramfs#L44

Further, none of the s6-* tools like s6-mkdir, s6-mount etc (which are copied instead of the "regular" ones like mkdir, mount, etc) are actually used by the init script:

https://github.com/dslm4515/Musl-LFS/blob/d953d31dbc626021831f0ef5385809d5baa162d4/files/initramfs-init#L47v

Finally, init script uses printf utility, which isn't copied to the initramfs.

dslm4515 commented 2 years ago

I am in the middle of developing a new method to generate an initramfs, using statically built s6-portable-utils... hence the missing dependancies.

I can not seem to find good guides or example for writing an init script for it.

Strahinja commented 2 years ago

Since I am currently using Artix Linux, I am mostly familiar with its initramfs, which is generated using the same tool as in Arch Linux, mkinitcpio. You can perhaps use its init as a reference for specific details. For example, it uses statically-linked busybox to avoid potential dependency issues and simplify initramfs generation.

dslm4515 commented 2 years ago

Yes, I was looking into busybox to simplify the initramfs creation.

Biggest hurdle for me is init script. I will review your link.

I've seen dracut... but seems easy to use but hard to setup...

dslm4515 commented 2 years ago

Added missing library and modified init script to use s6-portable-utils binaries.

commit f70607c7583fb2cceef746803c8bfb83f0695091 commit eb647866a11fb81c419bf7cba06324f05b4dd833

It's a temporary fix. I will likely import the busybox build from BMLFS.

Strahinja commented 2 years ago

Thanks, I believe this issue can be closed now.