Build A Minimal Linux Kernel

本文详细介绍了如何通过去除不必要的内核模块和特性,构建一个尽可能小的Linux内核,以减少无盘服务器的启动时间。通过对比最小配置文件与正常配置文件,并在QEMU中进行测试,最终成功构建了一个2.7MB的精简内核,显著提高了无盘服务器的启动效率。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Build-A-Minimal-Linux-Kernel

Leave out the unnecessary kernel module and features to make a minimal kernel as possible as one can

Reason for thus a project

When I am to set up a diskless linux server on my local network, I notice that the linux kernel in general distrubtion is about 4.7M. When the PXE download the kernel for the diskless enveriment, the tftpd speed is only thundreds Kbyte/s, so I immediately realize that if I can build a more minimal kernel, the bootup time of the diskless server maybe decrease a lot. I search which features are not necessory for boot a linux on a network filesystem(NFS), and I get many useful instructions. However, it fails to bootup when I finish the compiling. Unfortunately, I could get no sense which configuration casue the problem. The bootup procedure can give little or even no information.

To do

I write a shell batch with these steps: 1. compare the minimal configuration file(with which, the corresponding kernel cannot bootup) and the normal config file(just from a distrubtion). 2.separate both the two configuration file with same sections, replace each fraction of the normal config file with the 'fatal' one. 3.comiple and test the kernel in QEMU, if it success to boot, try to replace more following that in step2. '-curses' '-std:mon' are some usefull option when testing the kernel with QEMU.

Results

My final successful diskless linux kernel is 2.7M.

For others, some one make up a 744KB kernel. (http://linuxman.blog.ccidnet.com/blog-htm-do-showone-uid-60710-type-blog-itemid-293122.html)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值