+ -
当前位置:首页 → 问答吧 → 才知道有个make localmodconfig

才知道有个make localmodconfig

时间:2009-11-27

来源:互联网

谁研究过这个内核配置选项?自动按照硬件配置编译内核么?
大体试了试,确实精简了不少,并且挺智能,比如:我只有ext4文件系统,它就只选了ext4,我是AMD的780G主板,它连Radeon KMS都给我选上了,网卡啥的选的也都正确,虽然貌似稍微选上了一些“垃圾”选项?

[root@HomeServer ~]# cd /lib/modules/
[root@HomeServer modules]# du --max-depth=1 -h
94M ./2.6.31-ARCH
15M ./2.6.32-rc8-rc

内核模块由100M左右减到了10几M

作者: yafeng   发布时间: 2009-11-27

有这么好的,还真不知道,值得学习一下。

作者: alpha.gu   发布时间: 2009-11-27

是不是刚出来不久?

作者: ch_fb   发布时间: 2009-11-27

嗯,回去试试。

作者: Havanna   发布时间: 2009-11-27

好像还有一个make localyesconfig 把现在使用的模块编译到内核里面去。Gentoo板块有说过。

作者: unicon   发布时间: 2009-11-28

这么好?马上虚拟机里来一次

作者: jobinson99   发布时间: 2009-11-28

哇,是不是哦。。。有机会试试看,精简多了,编译速度也快了

作者: jarryson   发布时间: 2009-11-28

听起来不错,继续关注,要真好用,偶就去gentoo在折腾折腾

作者: 独钓寒江雪   发布时间: 2009-11-28

哪个内核版本有?是不是ARCH才有?我看GIT的内核说明没有这个啊

作者: digwtx   发布时间: 2009-11-28

强烈关注!希望测试过的兄弟来反馈!

作者: xsam   发布时间: 2009-11-29

引用:
作者: xsam
强烈关注!希望测试过的兄弟来反馈!
同希望中

作者: 独钓寒江雪   发布时间: 2009-11-29

@echo ' gconfig - Update current config utilising a GTK based front-end'
@echo ' oldconfig - Update current config utilising a provided .config as base'
@echo ' localmodconfig - Update current config disabling modules not loaded'
@echo ' localyesconfig - Update current config converting local mods to core'
@echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps'
@echo ' randconfig - New config with random answer to all options'
@echo ' defconfig - New config with default answer to all options'

作者: yafeng   发布时间: 2009-11-29

From: Steven Rostedt <[email protected]>
To: [email protected]
Subject: [PATCH 00/15] [GIT PULL] kconfig: localmodconfig for v2.6.32
Date: Fri, 11 Sep 2009 15:58:49 -0400
Message-ID: <[email protected]>
Cc: Linus Torvalds <[email protected]>, Andrew Morton <[email protected]>, Ingo Molnar <[email protected]>, Thomas Gleixner <[email protected]>, Theodore Tso <[email protected]>, Arnaldo Carvalho de Melo <[email protected]>, [email protected], [email protected], Sam Ravnborg <[email protected]>, Dick Streefland <[email protected]>, Stephen Rothwell <[email protected]>
Archive-link: Article, Thread

Linus,

This is the patch set that creates localmodconfig and localyesconfig.
This will facilitate testers by removing the thousand modules that
distributions enable with only the ones that they have loaded.

Yes it may miss usb devices that you don't have plugged in, but it will
save a lot of time in compiling by only compiling the code that you
have loaded.

The usage is quite simple. Just download the latest kernel.org kernel
(with this changeset in), cd to that directory and then do:

make localmodconfig

It will search for a .config locally first, then will look for
/proc/config.gz, then it will search the /boot directory for configs
matching the local kernel (uname -r). If it still does not find one
It search for configurations in the local binarys (vmlinux, /lib/modules..,
kernel/configs.ko, etc).

Once it finds a config to use, it will then read all the Kconfigs
and Makefiles to find out what config compiles what module. Then lsmod
is used to see what modules are loaded, and it will keep enabled all
the configs (including dependencies) that those modules require to
build. It disables all modules not needed.

Note, it only disables it does not enable, because a lot of modules
can be enabled by more than one config, and I don't want to guess.
I could someday enable easy configs (1 to 1 matches of config to module).

It also does nothing with built in code (=y). It does not enable or
disable them.

I've been using this code (various versions of) since 2005, and
so have others. When I get a new box, the first thing I do is
boot up the distribution kernel, download kernel.org kernel, and run
this script to get the modules needed to boot the kernel.

** CONFLICTS **

linux-next has proven that there is a conflict between these patches
and Sam Ravnborg's tree. I've tried to get in contact with Sam, but
he seems to be out. I don't want to hold up this push on that account.
But if you want, I could wait to fix the conflicts, or you can pull
this and he can fix it on his end. I'm fine with it. I just think
that this tool is important enough to get into mainline, especially
early in the merge window since it will help others test it. ;-)

作者: yafeng   发布时间: 2009-11-29

@echo ' localmodconfig
@echo ' localyesconfig
这两个貌似都是2.6.32的新选项,其中从上贴可以看出,这个是通过当前内核配置选项:
代码:
It will search for a .config locally first, then will look for
/proc/config.gz, then it will search the /boot directory for configs
matching the local kernel (uname -r). If it still does not find one
It search for configurations in the local binarys (vmlinux, /lib/modules..,
kernel/configs.ko, etc).
然后调用lsmod来分析当前的系统加载了哪些模块,把没有加载的模块都去掉

localyesconfig
则是把m改成y,搞成一个不依赖模块的单一内核
代码:
This adds the option localyesconfig to make. This is similar to
localmodconfig, but after it removes unnecessary modules it runs

 sed -i s/=m/=y/

on the .config file. It then runs "make silentoldconfig" to fix any
wholes that were created by the conversion of modules to core.

作者: yafeng   发布时间: 2009-11-29

这么好的东西,昨晚刚弄好个32内核。有时间要试下。

作者: contrl   发布时间: 2009-11-29

看14楼介绍,好像就是根据当前的config.gz来生成配置的,这在arch上如果用官方那PKGBUILD不也用的是一个固定的config...

作者: huntxu   发布时间: 2009-11-29

引用:
作者: huntxu
看14楼介绍,好像就是根据当前的config.gz来生成配置的,这在arch上如果用官方那PKGBUILD不也用的是一个固定的config...
是的,但是它精简掉了没有了载入的模块。。。。

作者: yafeng   发布时间: 2009-11-29

多谢啦,总算明白一些了。

作者: 独钓寒江雪   发布时间: 2009-11-30

在源码的基础上添加模块倒是很简单。其实我之前编译模块发觉最可能出错的地方系统方面的选项,而不是硬件方面的选项。

作者: xsam   发布时间: 2009-11-30

热门下载

更多