it assumes you've already got all of the nessery pacages to compile and run this shit, and you've extracted linux 5.15.156 and busybox 1.34.1 to their relevent directorys and have the linux .config i've attached as well.
I too rolled my own initrd to play around, but its much more complicated, since its doing bitlocker style disk encryption and storing the key on TPM. It's not even that hard to roll your own /init + udev, but systemd shit is definitely trying to make things hard for everyone if you're trying to keep it small to uclibc and maybe lvm2 + ssh while handling more complicated procedures like trying to look for a specific drive by serial or configure a specific ethernet card by MAC address for fallback iscsi boot. There's also s6 init if you're too lazy to write a real init daemon to handle all the startup dependencies inside your initrd.
"defconfig" is probably fine for a toy system, but expect all the drivers and usual features to be missing. You definitely would want to enable the EFI stuff, since some modern boards don't even do compatibility mode anymore.
i don't care if you think my code is shit (i know it is and i don't care) so criteic it all you want.
It's missing the mandatory /dev/console, so userspace command line programs might not even print until started after the devtmpfs mount. Pull it in from your real /dev/console, or mknod your own for the cpio command.
echo '/bin/sh' >> init
echo 'echo "Welcome to KFLinux"' >> init
The other way around. So you see the text before the prompt shows up, not after you exit the prompt.
You'll also likely find that keyboard sequences like CTRL-C don't work, so you could try something like:
exec /bin/cttyhack /bin/sh
This gives you a shell with PID 1 and functioning keyboard controls, so you can do exec /sbin/init if you want to pass control to another Linux system.
Do not exit the shell however, the kernel will assume something went very wrong if PID 1 ever exits, just call "exec poweroff" to shut down.