小编fro*_*utz的帖子

编译内核时如何减小 initrd 的大小?

当我编译自己的内核时,基本上我所做的如下:

  1. 我从 www.kernel.org 下载源代码并解压。

  2. 我将之前的内容复制.config到源代码中,并make menuconfig根据内核的新策略查看新选项并修改配置。

  3. 然后,我编译它: make -j 4

  4. 最后,我安装它:su -c 'make modules_install && make install'.

  5. 经过几次测试,我删除了旧内核(从/boot/lib/modules)并使用新内核完全运行(这最后一步救了我好几次!这是一个专业提示!)。

问题是,/boot/initrd.img-4.x.x与我的发行版中的那些相比,我总是得到一个巨大的。这里以我当前/boot/目录的内容为例:

# ls -alFh
total 243M
drwxr-xr-x  5 root root 4.0K Mar 16 21:26 ./
drwxr-xr-x 25 root root 4.0K Feb 25 09:28 ../
-rw-r--r--  1 root root 2.9M Mar  9 07:39 System.map-4.4.0-1-amd64
-rw-r--r--  1 root root 3.1M Mar 11 22:30 System.map-4.4.5
-rw-r--r--  1 root root …
Run Code Online (Sandbox Code Playgroud)

compiling linux-kernel

23
推荐指数
3
解决办法
1万
查看次数

为什么对 initramfs 使用 cpio?

我正在按照Gentoo wiki制作我自己的 initramfs 。而不是熟悉的tarand gzip,页面告诉我使用cpioand gzip维基百科cpio2.6 内核的 initramfs 使用了它,但没有解释原因。

这只是一个约定还是cpio对 initramfs 更好?我还可以使用tarandgzip吗?

compression initramfs cpio

13
推荐指数
2
解决办法
4908
查看次数

标签 统计

compiling ×1

compression ×1

cpio ×1

initramfs ×1

linux-kernel ×1