← 返回命令列表

Linux command

genkernel 命令

安全

权限或系统影响较大,执行前请核对目标。

常用示例

Example

sudo genkernel all

Example

sudo genkernel [bzImage|initramfs|kernel|ramdisk]

Example

sudo genkernel --menuconfig all

Example

sudo genkernel --kernname=[custom_name] all

Example

sudo genkernel --kerneldir=[path/to/directory] all

说明

genkernel is a Gentoo Linux utility that automates the kernel compilation and installation process. It builds a generic kernel with broad hardware support, similar to kernels found in binary distributions. The tool handles configuring, compiling, and installing the kernel along with generating an initramfs (initial ramdisk) required for booting. It can automatically detect hardware and enable appropriate kernel modules. genkernel reads configuration from /etc/genkernel.conf and supports various filesystem, encryption, and boot features through command-line options.

参数

all
Build kernel, modules, and initramfs.
bzImage
Build only the compressed kernel image.
initramfs
Build only the initial ramdisk.
kernel
Build only the kernel and modules.
ramdisk
Build only the ramdisk.
--menuconfig
Run menuconfig before compilation.
--nconfig
Run nconfig (ncurses-based) before compilation.
--kernname _NAME_
Tag the kernel and initramfs with _NAME_.
--kerneldir _DIR_
Use kernel source from _DIR_ instead of /usr/src/linux.
--makeopts _OPTS_
Pass options to make (e.g., -j4).
--no-clean
Skip `make clean` before compilation.
--no-mrproper
Skip `make mrproper` before compilation, preserving the existing kernel config.
--lvm
Add LVM support to initramfs.
--luks
Add LUKS encryption support to initramfs.

FAQ

What is the genkernel command used for?

genkernel is a Gentoo Linux utility that automates the kernel compilation and installation process. It builds a generic kernel with broad hardware support, similar to kernels found in binary distributions. The tool handles configuring, compiling, and installing the kernel along with generating an initramfs (initial ramdisk) required for booting. It can automatically detect hardware and enable appropriate kernel modules. genkernel reads configuration from /etc/genkernel.conf and supports various filesystem, encryption, and boot features through command-line options.

How do I run a basic genkernel example?

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

What does all do in genkernel?

Build kernel, modules, and initramfs.