| name | linux-kernel |
| description | Linux kernel configuration, compilation, and customization. Use when building custom kernels, configuring kernel options, enabling/disabling features, or creating minimal kernels for embedded systems. |
Linux Kernel Building
Configure and build Linux kernels for various architectures.
Kernel Source Setup
# Download kernel source
wget https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.6.tar.xz
tar xf linux-6.6.tar.xz
cd linux-6.6
Configuration
# Use default config for architecture
make defconfig
# Interactive menu configuration
make menuconfig
# Minimal config from running kernel
make localmodconfig
# Copy existing config
cp /boot/config-$(uname -r) .config
make olddefconfig
Key Configuration Options
# Enable initramfs support
CONFIG_BLK_DEV_INITRD=y
# Enable devtmpfs for automatic device nodes
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y
# Enable required filesystems
CONFIG_TMPFS=y
CONFIG_PROC_FS=y
CONFIG_SYSFS=y
# Disable unneeded features for minimal kernel
CONFIG_MODULES=n
CONFIG_PRINTK=y
# Embedded initramfs (optional)
CONFIG_INITRAMFS_SOURCE="/path/to/initramfs"
Building
# Build kernel image (x86)
make bzImage -j$(nproc)
# Build kernel image (ARM)
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage -j$(nproc)
# Build device tree blobs
make dtbs
# Build modules
make modules
Output Locations
- x86 kernel:
arch/x86/boot/bzImage - ARM kernel:
arch/arm/boot/zImage - Device trees:
arch/arm/boot/dts/*.dtb - System.map:
System.map
Kernel Boot Parameters
Common kernel command line options:
console=ttyS0,115200 # Serial console
console=tty0 # VGA console
root=/dev/sda1 # Root filesystem device
rootwait # Wait for root device
rw # Mount root read-write
init=/sbin/init # Init process path
rdinit=/init # Initramfs init path
quiet # Suppress boot messages
debug # Enable debug messages
Testing with QEMU
qemu-system-x86_64 \
-kernel arch/x86/boot/bzImage \
-initrd /path/to/initramfs.cpio.gz \
-append "console=ttyS0 rdinit=/init" \
-nographic