← 返回命令列表

Linux command

mkinitcpio 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Example

mkinitcpio

Example

sudo mkinitcpio -P

Example

sudo mkinitcpio -p linux

Example

sudo mkinitcpio -p linux-lts

Example

sudo mkinitcpio -c [path/to/mkinitcpio.conf] -g [path/to/initramfs.img]

Example

sudo mkinitcpio -k [kernel_version] -g [path/to/initramfs.img]

List all available hooks

mkinitcpio -L

Example

mkinitcpio -H [hook_name]

说明

mkinitcpio creates initial ramdisk environments for booting the Linux kernel. The initramfs loads early in the boot process, providing kernel modules and tools needed to mount the real root filesystem. The tool uses hooks to modularly include features like encryption support, LVM, RAID, and filesystem drivers. Presets in /etc/mkinitcpio.d/ define standard image generation parameters for installed kernels.

参数

-g, --generate _filename_
Output CPIO image to specified file
-U, --uki _filename_
Generate unified kernel image for UEFI booting
-k, --kernel _version_
Specify kernel version or path; default is current running kernel
-c, --config _file_
Use custom configuration file; default is /etc/mkinitcpio.conf
-p, --preset _preset_
Build from preset in /etc/mkinitcpio.d/
-P, --allpresets
Process all available presets
-A, --addhooks _hooks_
Add additional hooks (comma-separated)
-S, --skiphooks _hooks_
Skip specified hooks during build
-L, --listhooks
List all available hooks
-H, --hookhelp _hookname_
Display documentation for specified hook
-d, --generatedir _dir_
Set initramfs build location
-t, --builddir _tmpdir_
Use alternate temporary directory for build
-z, --compress _method_
Override compression program (gzip, xz, lz4, zstd)
-s, --save
Retain build directory for debugging
-v, --verbose
Display detailed build information

FAQ

What is the mkinitcpio command used for?

mkinitcpio creates initial ramdisk environments for booting the Linux kernel. The initramfs loads early in the boot process, providing kernel modules and tools needed to mount the real root filesystem. The tool uses hooks to modularly include features like encryption support, LVM, RAID, and filesystem drivers. Presets in /etc/mkinitcpio.d/ define standard image generation parameters for installed kernels.

How do I run a basic mkinitcpio example?

Run `mkinitcpio` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -g, --generate _filename_ do in mkinitcpio?

Output CPIO image to specified file