User:Goverp/Genlist

This article contains Article description::a shell script to generate gen_init_cpio input from a configuration file, for use when generating initramfs files or configurations for the linux kernel.

The idea is to create the configuration file to specify the programs used in your /init and list the resources (files, devices etc) that it uses. The script locates the program files, and the libraries on which they depend, and generates the necessary gen_init_cpio instructions to build the appropriate directory tree and files and so forth.

The script works by generating a list of all resources and their dependencies (i.e. libraries, files, and the directories in their paths), and then expands the results into the gen_init_cpio input.

It's been updated (28 Mar 2021) to improve parsing of the ldd output, and remove the ill-considered function to read /etc/fstab. You can still include i/etc/fstab as a file (to allow fsck -A) but you'd probably want your own mount points under say /mnt/root.

Usage is to run: and then do whatever is appropriate to your kernel/bootloader configuration.