linux 内核裁剪之 kernel

说明

需要编译

1
2
3
内核
设备树
其它驱动程序

准备

1
https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.10.191.tar.xz

用法

默认配置

1
make vexpress_defconfig
1
make menuconfig
1
2
3
4
5
# 不想要在 rootfs 里面手动 mknod,需要开这个
Device Drivers --->
Generic Driver Options --->
[*] Maintain a devtmpfs filesystem to mount at /dev
[*] Automount devtmpfs at /dev, after the kernel mounted the rootfs

编译

1
make -j$(nproc)

测试

查看 tty

1
cat .config | grep -i tty
1
CONFIG_CMDLINE="console=ttyAMA0"

运行

1
2
3
4
5
6
7
qemu-system-arm \
-M vexpress-a9 \
-m 512M \
-kernel ~/downloads/linux-5.10.191/output/arch/arm/boot/zImage \
-dtb ~/downloads/linux-5.10.191/output/arch/arm/boot/dts/vexpress-v2p-ca9.dtb \
-nographic \
-append "console=ttyAMA0"