You are not logged in.

#1 2009-02-10 14:05:11

simion314
Member
Registered: 2008-07-29
Posts: 34

[Solved]Creating a .config

Hi , i am reading the book "Linux kernel in a Nutshell"  http://oreilly.com/catalog/9780596100797/
and i am at chaper 7 where you must create a .config optimized for your hardware. After i get a list
with all the modules my computer needs i have to find in the .config the line that configures that driver
but the method to find that line is not working:
first i cd in my linux source

$ cd ~/linux/src/linux-2.6.28-ARCH/

then i search for a module

$ find -type f -name Makefile |  grep e1000

I get no output. I opened the Makefile and is not containing the modules config in it.
Maybe the kernel structure changed or i am doing something wrong?

I also tried this script http://lkml.org/lkml/2008/9/18/203 ,after changing the /sbin/lsmod to /bin/lsmod
but it sais that it can't find the configuration for the modules.

Found an intresting thread but ui do not know how to get the script  from Chris Li, maybe someone can find it.

Last edited by simion314 (2009-02-11 04:27:45)

Offline

#2 2009-02-10 14:23:10

defrysk
Member
From: Barrie, Ontario
Registered: 2008-12-15
Posts: 42
Website

Re: [Solved]Creating a .config

cd /usr/src/linux-2.6.28-ARCH/
cat .config | grep E1000
CONFIG_E1000=m
CONFIG_E1000E=m

Offline

#3 2009-02-10 14:51:12

simion314
Member
Registered: 2008-07-29
Posts: 34

Re: [Solved]Creating a .config

defrysk wrote:

cd /usr/src/linux-2.6.28-ARCH/
cat .config | grep E1000
CONFIG_E1000=m
CONFIG_E1000E=m

This method will not work in all cases and you will have modules that you can't find the CONFIG_. The best method is using the kernel MAKEfile and it's tools,, i just found this(but i am unable to find how to get the scripts) http://kerneltrap.org/index.php?q=maila … 124/thread

Thx for the response.

Offline

#4 2009-02-10 16:02:10

big_gie
Member
Registered: 2005-01-19
Posts: 637

Re: [Solved]Creating a .config

simion314 wrote:

i just found this(but i am unable to find how to get the scripts) http://kerneltrap.org/index.php?q=maila … 124/thread

Really interesting! I tried a year ago to write a bash script doing something similar. Basically it compared the loaded modules reported by lsmod to all ".ko" files built. Modules not loaded were reported and could be manually disabled...

Offline

#5 2009-02-10 16:07:09

big_gie
Member
Registered: 2005-01-19
Posts: 637

Re: [Solved]Creating a .config

I could not find the python script either.
I just found back my stupid script. Here it is:

#!/bin/bash

# Save loaded module
lsmod |sort | awk '{ print $1 }' > /tmp/driver_loaded.txt

# Find compiled modules
find /lib/modules/`uname -r`/ -name *.ko | xargs -r -i basename "{}" | sed -e "s/.ko//g" | sort > /tmp/driver_compiled.txt

# Compare the two list, and print the CONFIG_* associated
diff /tmp/driver_compiled.txt /tmp/driver_loaded.txt | grep "<" | awk '{ print $2 }' | sort --unique | xargs -i zgrep -i {} /proc/config.gz | grep -v "# "

Offline

#6 2009-02-10 18:55:57

mole
Member
Registered: 2007-02-17
Posts: 21

Re: [Solved]Creating a .config

simion314, did you download a kernel archive and extract it before running the find command? It should find two files:

./drivers/net/e1000e/Makefile
./drivers/net/e1000/Makefile

Or is your ~/linux/src/linux-2.6.28-ARCH/ just a link to /usr/src/linux-2.6.28-ARCH/ ? The Arch kernel package does not contain these files.

Offline

#7 2009-02-10 19:36:29

simion314
Member
Registered: 2008-07-29
Posts: 34

Re: [Solved]Creating a .config

mole wrote:

simion314, did you download a kernel archive and extract it before running the find command? It should find two files:

./drivers/net/e1000e/Makefile
./drivers/net/e1000/Makefile

Or is your ~/linux/src/linux-2.6.28-ARCH/ just a link to /usr/src/linux-2.6.28-ARCH/ ? The Arch kernel package does not contain these files.

Yes i copied the source from /usr/src, so i need to download a vanila kernel?Or is a kernel26-source package in arch?

Offline

#8 2009-02-10 20:01:52

mole
Member
Registered: 2007-02-17
Posts: 21

Re: [Solved]Creating a .config

You need a vanilla kernel.

Offline

Board footer

Powered by FluxBB