MKINITRAMFS(8) | System Manager's Manual | MKINITRAMFS(8) |
mkinitramfs
—
create an initial ramdisk environment
mkinitramfs |
[-fhv ] [-D
helperfile] [-H
hooksdir] [-I
initfile] [-c
conffile] [-k
kernelversion] [-m
modulesdir] [-o
initramfs] |
The mkinitramfs
utility creates an initial
ramdisk environment for booting the Linux kernel. The initial ramdisk is in
essence a very small environment (early userspace) which loads various
kernel modules and sets up necessary things before handing over control to
init. This makes it possible to have, for example, encrypted root file
systems and root file systems on a software RAID array.
mkinitramfs
can be extended with custom hooks.
The options are as follows:
-D
helperfile,
--helper
=helperfile-H
hooksdir,
--hooks
=hooksdirmkinitramfs
uses
/usr/share/mkinitramfs/hooks and
/etc/mkinitramfs/hooks.-I
initfile,
--init
=initfile-c
conffile,
--config
=conffile-f
,
--force
-k
kernelversion,
--kernel
=kernelversion-m
modulesdir,
--modules
=modulesdirThis option has no effect if monolith or hostonly were enabled in configuration file.
-o
initramfs,
--output
=initramfskernelversion
"
directory, created in TMPDIR
or (if unavailable)
in /tmp directory.-v
,
--version
-h
,
--help
mkinitramfs
uses the
TMPDIR
environment variable. If set, it uses
subdirectories in the given directory to create its temporary working
directories. Else it uses /tmp as default value for
that purpose. The given directory should be on a filesystem which allows the
execution of files stored there, i.e. should not be mounted with the
noexec
mount option.
Create an initramfs for current running kernel:
mkinitramfs -o /tmp/initramfs-`uname -r`.img
Create an initramfs for specific kernel:
mkinitramfs -o /tmp/initramfs-5.4.224.img -k 5.4.224
Debug initramfs creation (check out written logfile):
sh -x `which mkinitramfs` -o /tmp/initramfs-`uname -r` 2>/tmp/log
If you have modular kernel and you use busybox' modprobe to handle modules, you must note that busybox' modprobe doesn't have ability to install soft dependencies of modules (i.e. modules.softdep). You must install them yourself using hooks. See mkinitramfs.hooks(7) how to do it.
mkinitramfs.config(5), mkinitramfs.cmdline(7), mkinitramfs.hooks(7)
Kernel subsystem documentation: Ramfs, rootfs and initramfs.
The Linux kernel user's and administrator's guide: Using the initial RAM disk (initrd).
The original implementation was done by illiliti <illiliti@protonmail.com> as “tinyramfs” tool.
This implementation was re-worked for Zeppe-Lin by Alexandr Savca <alexandr.savca89@gmail.com>.
May 22, 2023 | Zeppe-Lin |