Le 18/11/2021 à 03:07, onefang a écrit : > Um, initramfs already uses busybox. Or it can, it's an option in
> initramfs-tools.
Initramfs can use what you want to provide what is bundled by Debian
in binutils and util-linux, + a shell. Busybox provides you with all
that, and much more, ready-made. Aboriginal was a distro in which all of
these applications was actually provided by busybox - I didn't look
recently.
The initramfs typically contains a script named /sbin/init, which is
the default application launched by the kernel when it has finished
booting. If the initramfs is based on busybox, then this script is
interpreted by one of the shells provided by busybox (or it could be
busybox's init), and all the userspace applications are also provided by
busybox.
YOU DON'T NEED AN INITRAMFS TO DO THAT. THIS INIT SEQUENCE CAN BE
DONE OUT OF A DISK PARTITION IF THE KERNEL IS ABLE TO MOUNT IT. The
advantage of such a set up is that you can modify your script from
another OS mounting this partition.
The application to launch by the kernel is given as an argument to
the kernel when invoked by the bootloader (grub, uboot). In case of a
bootloader firmware which lacks the possibility to provide arguments to
the kernel, it is possible to define the default init when configuring
the kernel. Just to experiment with busybox, give to the kernel the
argument init="/bin/busybox ash" . After boot, you get the prompt;
first invoke 'busybox install'; export
PATH='/bin:/sbin:/usr/bin:/usr/sbin' (depending how you have prepared
your boot partition and configured your busybox) and then 'mount -t proc
proc /proc', and experiment... By default, the kernel will invoke
/sbin/init. If you are running out of a partition and not initramfs, you
need to invoke 'busybox install' only once and this can be done in
advance by chrooting into the partition. There are many possibities ...
up to your imagination.