在编译Linux内核时,我编译的驱动程序和模块的数量肯定会影响生成的二进制文件的大小。但是,当内核加载到内存中时,它也会影响内核的大小吗?
我的意思是,当我编译硬件不需要的驱动程序时,内核会忽略它们吗,或者它们也被加载到RAM中呢?
TL;DR :
我编译内核A,只包含我需要的驱动程序;
包含我需要的驱动程序的内核B+我不需要的额外驱动程序。
内核B将比内核A?占用更多内存
发布于 2013-08-02 08:16:05
.ko文件)可以根据需要分别加载。除非加载它们,否则它们不会消耗任何主内存。- Loading a kernel module is done using [`modprobe`](http://linux.die.net/man/8/modprobe) and [`insmod`](http://linux.die.net/man/8/insmod) commands, after the Linux kernel is loaded and running.
- When loading a Linux kernel _module_ using `modprobe`, any other modules _it_ depends upon are [automatically loaded first](http://www.tldp.org/HOWTO/Module-HOWTO/x197.html#INTELLIGENT).
- When the kernel modules are loaded, they need to be mapped into a contiguous block of virtual memory. This is achieved by introducing an [additional constraint on the memory map using `vmalloc`](http://www.tldp.org/HOWTO/html_single/Module-HOWTO/#MEMALLOC).
https://stackoverflow.com/questions/17998548
复制相似问题