← 返回命令列表

Linux command

mkinitfs 命令

文本

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

常用示例

Example

mkinitfs

Example

mkinitfs -c [path/to/config]

Compress

mkinitfs -C [gzip|xz|zstd|lz4|none]

List files

mkinitfs -l

Example

mkinitfs -L

Example

mkinitfs [kernel_version]

Example

mkinitfs -o [path/to/initramfs.img]

说明

mkinitfs collects files from the root filesystem and creates a compressed initramfs for Alpine Linux. The initramfs provides early userspace tools needed to mount the real root filesystem during boot. Features control which modules, binaries, and configuration files are included. Common features include base system tools, filesystem support, encryption (cryptsetup), LVM, and network booting (dhcp, nfs).

参数

-b _basedir_
Use specified directory instead of root filesystem
-c _configfile_
Use alternative configuration file; default is /etc/mkinitfs/mkinitfs.conf
-C _algorithm_
Compression method: gzip (default), xz, zstd, lz4, or none
-f _fstab_
Specify alternate fstab file
-F _features_
Enable specified features
-i _initfile_
Use custom init script
-k
Keep temporary files after completion
-K
Include host APK keys in initramfs
-l
Dry run; list files that would be included
-L
Show all available features
-n
Exclude kernel modules and firmware
-o _outfile_
Specify output file path
-P _featuresdir_
Add custom features directory to search path
-q
Quiet mode; suppress output messages
-t _tmpdir_
Set temporary directory location

FAQ

What is the mkinitfs command used for?

mkinitfs collects files from the root filesystem and creates a compressed initramfs for Alpine Linux. The initramfs provides early userspace tools needed to mount the real root filesystem during boot. Features control which modules, binaries, and configuration files are included. Common features include base system tools, filesystem support, encryption (cryptsetup), LVM, and network booting (dhcp, nfs).

How do I run a basic mkinitfs example?

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

What does -b _basedir_ do in mkinitfs?

Use specified directory instead of root filesystem