Package: cmkinitramfs
Tools to generate an initramfs from a configuration file.Documentation is available athttps://cmkinitramfs.readthedocs.io/.AboutThis project provides three main executables:cmkinit,cmkcpiodirandcmkcpiolist.cmkinitbuilds an init script from a configuration file.cmkcpiodirandcmkcpiolistbuild an initramfs,
including the init script, from the same configuration file.cmkcpiodirbuilds the initramfs into a directory on a filesystem,
and generates the CPIO archive from it.cmkcpiolistbuilds a CPIO list, using the same format as Linux kernel’sgen_init_cpioutility, and generates the CPIO archive usinggen_init_cpio. Seethe corresponding Linux kernel documentationfor more information.InstallationCompatibilityPython version: this library is compatible withPython ≥ 3.7.Python implementation: this library is compatible withCPythonandPyPy.DependenciesPython dependencies:bin (mkcpiodir and mkcpiolist) dependencies:pyelftoolsDocumentation:sphinxsphinx_rtd_themeTests:QA:flake8mypytoxOther dependencies:initramfs (mkcpiodir and mkcpiolist) dependencies:loadkeys(kbd)busyboxmodinfo(kmod, busybox)mkcpiodir dependencies:find(findutils, busybox)cpio(cpio, busybox)mkcpiolist dependencies:gen_init_cpio(linux kernel, linux-misc-apps)InstallInstall from pypi:$pipinstallcmkinitramfsInstall from source with setup.py:$gitclonehttps://github.com/teapot9/cmkinitramfs.git$cdcmkinitramfs$python3setup.pyinstallInstall from source with pip:$gitclonehttps://github.com/teapot9/cmkinitramfs.git$cdcmkinitramfs$pip3install.ConfigurationThe configuration file is in aniniformat.Each section defines a data source, the section name is the data identifier.Some options expects a data source as input, there are several data identifier
formats:DATA=data-name: data defined in the section with the same name.data-name: same asDATA=data-name.PATH=/path/foo/bar: data at the path/path/foo/bar, this can
be a directory, a file, or a block device./absolute/path: same asPATH=/absolute/path.UUID=1234-5678: filesystem with UUID1234-5678.LABEL=foo: filesystem with labelfoo.PARTUUID=1234-5678: partition with UUID1234-5678.PARTLABEL=foo: partition with labelfoo.DEFAULT sectionThis section has default values for other sections, as well as
global configuration.root(mandatory): Data identifier for the data to use as new root.mountpoints(optional): Comma separated list of data identifier
to load in addition of rootfs.keymap(optional): Boolean value defining if a keymap should be
loaded. If set tono, allkeymap-*configurations will be ignored.
Defaults tono.keymap-src(optional): Path of the keymap file to use. If not
specified butkeymapisyes, the converted keymap should already
exists atkeymap-path.keymap-path(optional): Path where the binary keymap will be
generated (generated fromkeymap-src).
Defaults to/tmp/keymap.bmap.keymap-dest(optional): Path of the keymap file within the initramfs.
Defaults to/root/keymap.bmap.init-path(optional): Path where the init script will be generated
(generated fromcmkinitramfs.init.mkinit()).
Defaults to/tmp/init.sh.files(optional): Additional files to include in the initramfs.
Each item is separated by a newline. Format:source:destination(e.g.files =/root/foo:/root/barcopy the filefooin the initramfs
renaming itbar). If no destination is given, the file will be copied
to the same path assourcein the initramfs.sourcecan be an
absolute or relative path,destinationmust be an absolute path
within the initramfs.execs(optional): Additional executables to include in the initramfs.
Same format asfiles, except thatsourcewill also be searched
in directories from thePATHenvironment variable.libs(optional): Additional libraries to include in the initramfs.
Same format asfiles, except thatsourcewill also be searched
in directories from/etc/ld.so.confand theLD_LIBRARY_PATHenvironment variable.busybox(optional): Additional executables to include in the initramfs.
Each item is separated by a newline. Format:exec:
name of the command (basename).
If busybox provides the command, they will not be added. Otherwise,
the executable is searched inPATH.cmkcpiodir-default-opts(optional): Options to append to thecmkcpiodircommand line.cmkcpiolist-default-opts(optional): Options to append to thecmkcpiolistcommand line.modules(optional): Kernel modules to load in the initramfs.
One module per line, each line with the module name followed by the
module parameters (e.g.mymodule foo=bar).scripts(optional): User scripts to run at a given breakpoint.
One user script per line with the formatbreakpoint:script.
The scriptscriptwill be run at the breakpointbreakpoint.
A list of available breakpoints is available incmkinitramfs.init.Breakpoint.
These scripts will be run wether the breakpoint is enabled or not.
Example:init: ls /dev: runls /devafter initialization.LUKS data sectionsLUKS device to open.type = luks(mandatory).need(optional): Hard dependencies: comma separated
list of data identifiers. Those dependencies are required to loadanduse the data.load-need(optional): Load dependencies: comma
separated list of data identifiers. Those dependencies are only required
to load the data, they can be unloaded when the data has been successfully
loaded. (e.g. A LUKS key, an archive to decompress.)source(mandatory): Data identifier of the data to unlock.name(mandatory): Name to use for the luks device, this will be
used by cryptsetup.key(optional): Data identifier for the LUKS key.header(optional): Data identifier for the LUKS header.discard(optional): Enable discards. Boolean value (yes/no).LVM data sectionsLVM logical volume to load.type = lvm(mandatory).need(optional): Hard dependencies: comma separated
list of data identifiers. Those dependencies are required to loadanduse the data.load-need(optional): Load dependencies: comma
separated list of data identifiers. Those dependencies are only required
to load the data, they can be unloaded when the data has been successfully
loaded. (e.g. A LUKS key, an archive to decompress.)vg-name(mandatory): Volume group name.lv-name(mandatory): Logical volume name.Mount data sectionsFilesystem to mount.type = mount(mandatory).need(optional): Hard dependencies: comma separated
list of data identifiers. Those dependencies are required to loadanduse the data.load-need(optional): Load dependencies: comma
separated list of data identifiers. Those dependencies are only required
to load the data, they can be unloaded when the data has been successfully
loaded. (e.g. A LUKS key, an archive to decompress.)source(optional): Data identifier for the filesystem to mount.
If not set, it will set the source to “none” (e.g. for TMPFS).mountpoint(mandatory): Path where the filesystem will be mounted.filesystem(mandatory): Which filesystem to use, option passed
tomount-tfilesystem.options(optional): Mount options, defaults toro. Note for ZFS:
if themountpointproperty is not set tolegacy, thezfsutiloption is required.MD data sectionsMD RAID data to load.type = md(mandatory).need(optional): Hard dependencies: comma separated
list of data identifiers. Those dependencies are required to loadanduse the data.load-need(optional): Load dependencies: comma
separated list of data identifiers. Those dependencies are only required
to load the data, they can be unloaded when the data has been successfully
loaded. (e.g. A LUKS key, an archive to decompress.)name(mandatory): Name of the MD RAID, this will be used by mdadm.source(mandatory): New line separated data identifiers of the
sources to use. Multiple block devices can be specified, or the
UUID of the MD RAID.Clone data sectionsClone a source to a destination.type = clone(mandatory).need(optional): Hard dependencies: comma separated
list of data identifiers. Those dependencies are required to loadanduse the data.load-need(optional): Load dependencies: comma
separated list of data identifiers. Those dependencies are only required
to load the data, they can be unloaded when the data has been successfully
loaded. (e.g. A LUKS key, an archive to decompress.)source(mandatory): Data identifier for the source of the clone.destination(mandatory): Data identifier of the destination
of the clone.ZFS pool sectionsImport a ZFS pool.type = zfspool(mandatory).need(optional): Hard dependencies: comma separated
list of data identifiers. Those dependencies are required to loadanduse the data.load-need(optional): Load dependencies: comma
separated list of data identifiers. Those dependencies are only required
to load the data, they can be unloaded when the data has been successfully
loaded. (e.g. A LUKS key, an archive to decompress.)pool(mandatory): Pool name.cache(optional): Data identifier of the ZFS cache file (must be present
in the initramfs).ZFS crypt sectionsUnlock an encrypted ZFS dataset.type = zfscrypt(mandatory).need(optional): Hard dependencies: comma separated
list of data identifiers. Those dependencies are required to loadanduse the data.load-need(optional): Load dependencies: comma
separated list of data identifiers. Those dependencies are only required
to load the data, they can be unloaded when the data has been successfully
loaded. (e.g. A LUKS key, an archive to decompress.)pool(optional): Data identifier of the parent pool (defaults to same
as pool name).dataset(mandatory): Name of the dataset to unlock.key(optional): Data identifier of a keyfile to use.UsageKernel command-line parametersThe init script will check the kernel cmdline for known parameters.debug: Same asrd.debug.init=<pathto init>: Set the init process to run after the initramfs.quiet: Same asrd.quiet.rd.break=<breakpoint>: Drop into a shell at a given point.
Seecmkinitramfs.init.Breakpoint.rd.debug: Show debugging informations.rd.panic: On fatal error: cause a kernel panic rather than droping
into a shell.rd.quiet: Reduce log shown on console.For more details, seecmkinitramfs.init.do_cmdline.cmkinit$cmkinit--helpusage: cmkinit [-h] [--version]

Build an init script

optional arguments:
  -h, --help  show this help message and exit
  --version   show program's version number and exitRunningcmkinitwill generate an init script and output it to stdout.
No options are available, everything is defined in the configuration file.
TheCMKINITCFGenvironment variable may be defined to use a custom
configuration file.cmkcpiodir$cmkcpiodir--helpusage: cmkcpiodir [-h] [--version] [--debug] [--verbose] [--quiet]
                  [--output OUTPUT] [--binroot BINROOT] [--kernel KERNEL]
                  [--only-build-archive | --only-build-directory] [--keep]
                  [--clean] [--build-dir BUILD_DIR]

Build an initramfs using a directory.

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  --debug, -d           debugging mode: non-root, implies -k
  --verbose, -v         be verbose
  --quiet, -q           be quiet (can be repeated)
  --output OUTPUT, -o OUTPUT
                        set the output of the CPIO archive
  --binroot BINROOT, -r BINROOT
                        set the root directory for binaries (executables and
                        libraries)
  --kernel KERNEL, -K KERNEL
                        set the target kernel version of the initramfs,
                        defaults to the running kernel
  --only-build-archive, -c
                        only build the CPIO archive from an existing initramfs
                        directory
  --only-build-directory, -D
                        only build the initramfs directory, implies -k
  --keep, -k            keep the created initramfs directory
  --clean, -C           overwrite temporary directory if it exists, use
                        carefully
  --build-dir BUILD_DIR, -b BUILD_DIR
                        set the location of the initramfs directoryRunningcmkcpiodirwill generate the initramfs in a directory, then
it will create the CPIO archive from this directory.cmkcpiodirrequires root privileges when run in non-debug mode,
see thedo_nodesoptions ofcmkinitramfs.initramfs.Initramfs.build_to_directory().cmkcpiolist$cmkcpiolist--helpusage: cmkcpiolist [-h] [--version] [--debug] [--verbose] [--quiet]
                   [--output OUTPUT] [--binroot BINROOT] [--kernel KERNEL]
                   [--only-build-archive | --only-build-list] [--keep]
                   [--cpio-list CPIO_LIST]

Build an initramfs using a CPIO list

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  --debug, -d           debugging mode: non-root, implies -k
  --verbose, -v         be verbose
  --quiet, -q           be quiet (can be repeated)
  --output OUTPUT, -o OUTPUT
                        set the output of the CPIO archive
  --binroot BINROOT, -r BINROOT
                        set the root directory for binaries (executables and
                        libraries)
  --kernel KERNEL, -K KERNEL
                        set the target kernel version of the initramfs,
                        defaults to the running kernel
  --only-build-archive, -c
                        only build the CPIO archive from an existing CPIO list
  --only-build-list, -L
                        only build the CPIO list, implies -k
  --keep, -k            keep the created CPIO list
  --cpio-list CPIO_LIST, -l CPIO_LIST
                        set the location of the CPIO listRunningcmkcpiolistwill generate an initramfs CPIO list in a file,
then it will create the CPIO archive from this list withgen_init_cpio.cmkcpiolistdoes not require root privileges.findlib$findlib--helpusage: findlib [-h] [--verbose] [--quiet] [--version]
               [--compatible COMPATIBLE] [--root ROOT] [--null] [--glob]
               LIB [LIB ...]

Find a library on the system

positional arguments:
  LIB                   library to search

optional arguments:
  -h, --help            show this help message and exit
  --verbose, -v         be verbose
  --quiet, -q           be quiet (can be repeated)
  --version             show program's version number and exit
  --compatible COMPATIBLE, -c COMPATIBLE
                        set a binary the library must be compatible with
  --root ROOT, -r ROOT  set the root directory to search for the library
  --null, -0            paths will be delemited by null characters instead of
                        newlines
  --glob, -g            library names are glob patternsfindlibwill search the absolute path of a library on the system.
It will search in directories from/etc/ld.so.conf,LD_LIBRARY_PATH,
and default library paths (seecmkinitramfs.bin.find_lib()andcmkinitramfs.bin.find_lib_iter()).ExamplesCommand-line interface$cmkcpiodirCreates init script in/tmp/init.sh.If enabled, builds binary keymap in/tmp/keymap.bmap.Builds initramfs in/tmp/initramfs(disable this step with--only-build-archive).Builds CPIO archive from/tmp/initramfsto/usr/src/initramfs.cpio(disable this step with--only-build-directory).Cleanup/tmp/initramfsdirectory (disable with--keep).$cmkcpiolistCreates init script in/tmp/init.sh.If enabled, builds binary keymap in/tmp/keymap.bmap.Builds CPIO list in/tmp/initramfs.list(disable this step with--only-build-archive).Builds CPIO archive from/tmp/initramfs.listto/usr/src/initramfs.cpio(disable this step with--only-build-list).$findlib'libgcc_s.so.1'/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/libgcc_s.so.1Searches thelibgcc_s.so.1library on the system and prints it
to stdout.$findlib-g'libgcc_s.*'/usr/lib/gcc/x86_64-pc-linux-gnu/10.2.0/libgcc_s.so.1
/lib64/libgcc_s.so.1
/lib64/libgcc_s.so.1Search any library matchinglibgcc_s.*on the system and prints them
to stdout.