Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
how to generate .config file from a running kernel?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
shallpion
Guru
Guru


Joined: 29 Sep 2008
Posts: 331

PostPosted: Sat Dec 05, 2009 10:13 am    Post subject: how to generate .config file from a running kernel? Reply with quote

A dump question.. assume I am running a machine but I don't have the .config file from which the kernel has been compiled. Is there any way I can generate that file from the running kernel? Thanks.
Back to top
View user's profile Send private message
sebv
Tux's lil' helper
Tux's lil' helper


Joined: 14 Jan 2005
Posts: 78
Location: Savoie (France)

PostPosted: Sat Dec 05, 2009 10:24 am    Post subject: Reply with quote

If your kernel was compiled with

Code:
CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y


you can get the config file of this kernel with

Code:
zcat /proc/config.gz


Under Gentoo you also have http://www.gentoo.org/doc/fr/genkernel.xml, but it didn't made exactly the same kernel as the one is running.
_________________
-La théorie, c'est quand on sait tout et que rien ne fonctionne. La pratique, c'est quand tout fonctionne et que personne ne sait pourquoi.
-Définissez-moi d'abord ce que vous entendez par Dieu et je vous dirai si j'y crois.
[Einstein]
Back to top
View user's profile Send private message
ronmon
Veteran
Veteran


Joined: 15 Apr 2002
Posts: 1043
Location: Key West, FL

PostPosted: Sat Dec 05, 2009 10:28 am    Post subject: Reply with quote

First, check for the file "/proc/config.gz". If that isn't there, look in any kernel source tree for the extract-ikconfig script.

/usr/src/linux/scripts/extract-ikconfig

That will pull the config from a bzImage.
_________________
Ask Questions the Smart Way - by ESR
Back to top
View user's profile Send private message
shallpion
Guru
Guru


Joined: 29 Sep 2008
Posts: 331

PostPosted: Sat Dec 05, 2009 11:37 am    Post subject: Reply with quote

That is very helpful. Thank you guys :)
Back to top
View user's profile Send private message
Cripplys
n00b
n00b


Joined: 04 May 2011
Posts: 9

PostPosted: Sun Jan 20, 2013 12:20 am    Post subject: Reply with quote

Hi guys,
i tried extract-ikconfig on bzImage, but it didn't work. Script ended with this error : extract-ikconfig: Cannot find kernel config.
Could you please help me with this? I've lost previous kernel config by unmerging gentoo-sources - it was accident. :cry:
Back to top
View user's profile Send private message
VoidMage
Watchman
Watchman


Joined: 14 Oct 2006
Posts: 6196

PostPosted: Sun Jan 20, 2013 1:38 am    Post subject: Reply with quote

While I haven't used extract-ikconfig, I strongly suspect it works only on kernels built with CONFIG_IKCONFIG.

Also, unless I'm missing something, a simple unmerge shouldn't have removed the old config - not unless you've removed the old kernel directory too.
Back to top
View user's profile Send private message
Cripplys
n00b
n00b


Joined: 04 May 2011
Posts: 9

PostPosted: Wed Jan 23, 2013 12:10 pm    Post subject: Reply with quote

Well, I run "emerge --depclean" and it deleted the directory too. So now I'm trying the find a solution that helps me get back config from bzImage. But as i said, extract-ikconfig doesn't work...I think there must be some solution, but i don't know it. :(
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum