#!/usr/bin/perl
# ko2config.pl - convert *.ko to CONFIG
# set your kernel and source path here
chomp($path = "/lib/modules/".`uname -r`);
$k_path = "linux-source-2.6.24";
# get modules list from system
my @list = `find $path/kernel | grep ko`;
for (@list) {
# obtain file name
chomp($a = (split/\//, $_)[-1]);
print "$a = ";
# find CONFIG_* via Makefile
$a =~ s/\.ko$/.o/;
$lconfig = `grep '+= $a' -R $k_path`;
$config = "CONFIG_$1" if $lconfig =~ /CONFIG_(.*)[)] \+=/;
print $config, "\n";}
剛剛看到 LKML 上一篇 Script to build-in used modules, based on streamline_config.pl 在做類似的事情.
The aim of this is to provide a semi-automatic method to produce a custom kernel that has everything needed for your hardware built in, so you don't need an initrd.非常有趣. 只能說 Linux kernel 的 Makefile 博大精深, 沒有這麼簡單阿. XD
沒有留言:
張貼留言