LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
12
返回列表 发新帖
楼主: yafeng

才知道有个make localmodconfig

[复制链接]
发表于 2009-11-29 10:01:29 | 显示全部楼层
Post by xsam;2050776
强烈关注!希望测试过的兄弟来反馈!


同希望中:thank:thank
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-11-29 11:37:40 | 显示全部楼层
@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'
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-11-29 11:41:26 | 显示全部楼层
From:                   Steven Rostedt <rostedt@goodmis.org>
To:                  linux-kernel@vger.kernel.org
Subject:                  [PATCH 00/15] [GIT PULL] kconfig: localmodconfig for v2.6.32
Date:                  Fri, 11 Sep 2009 15:58:49 -0400
Message-ID:                  <20090911195849.451244684@goodmis.org>
Cc:                  Linus Torvalds <torvalds@linux-foundation.org>, Andrew Morton <akpm@linux-foundation.org>, Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>, Theodore Tso <tytso@mit.edu>, Arnaldo Carvalho de Melo <acme@redhat.com>, zippel@linux-m68k.org, linux-kbuild@vger.kernel.org, Sam Ravnborg <sam@ravnborg.org>, Dick Streefland <dick@streefland.net>, Stephen Rothwell <sfr@canb.auug.org.au>
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. ;-)
回复 支持 反对

使用道具 举报

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

localyesconfig
则是把m改成y,搞成一个不依赖模块的单一内核
  1. This adds the option localyesconfig to make. This is similar to
  2. localmodconfig, but after it removes unnecessary modules it runs
  3.   sed -i s/=m/=y/
  4. on the .config file. It then runs "make silentoldconfig" to fix any
  5. wholes that were created by the conversion of modules to core.
复制代码
回复 支持 反对

使用道具 举报

发表于 2009-11-29 14:19:30 | 显示全部楼层
这么好的东西,昨晚刚弄好个32内核。有时间要试下。
回复 支持 反对

使用道具 举报

发表于 2009-11-29 14:30:35 | 显示全部楼层
看14楼介绍,好像就是根据当前的config.gz来生成配置的,这在arch上如果用官方那PKGBUILD不也用的是一个固定的config...
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-11-29 14:47:22 | 显示全部楼层
Post by huntxu;2050867
看14楼介绍,好像就是根据当前的config.gz来生成配置的,这在arch上如果用官方那PKGBUILD不也用的是一个固定的config...


是的,但是它精简掉了没有了载入的模块。。。。
回复 支持 反对

使用道具 举报

发表于 2009-11-29 22:37:57 | 显示全部楼层
多谢啦,总算明白一些了。
回复 支持 反对

使用道具 举报

发表于 2009-11-30 09:11:48 | 显示全部楼层
在源码的基础上添加模块倒是很简单。其实我之前编译模块发觉最可能出错的地方系统方面的选项,而不是硬件方面的选项。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表