首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >编译模块的数量是否影响RAM中linux内核的大小?

问编译模块的数量是否影响RAM中linux内核的大小?
EN

Stack Overflow用户
提问于 2013-08-01 15:39:14
回答 1查看 224关注 0票数 0

在编译Linux内核时,我编译的驱动程序和模块的数量肯定会影响生成的二进制文件的大小。但是,当内核加载到内存中时,它也会影响内核的大小吗?

我的意思是,当我编译硬件不需要的驱动程序时,内核会忽略它们吗,或者它们也被加载到RAM中呢?

TL;DR :

我编译内核A,只包含我需要的驱动程序;

包含我需要的驱动程序的内核B+我不需要的额外驱动程序。

内核B将比内核A?占用更多内存

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-08-02 08:16:05

  1. 任何作为Linux内核映像一部分构建的驱动程序都会在引导期间加载到主内存中,并且不管是否使用它,都将继续消耗主内存。
  2. 作为独立模块构建的驱动程序(即.ko文件)可以根据需要分别加载。除非加载它们,否则它们不会消耗任何主内存。
代码语言:javascript
复制
- 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). 

​

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17998548

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档