Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
is there a way to create a .config file from existing 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
nimar
n00b
n00b


Joined: 06 Dec 2007
Posts: 34
Location: Brooklyn

PostPosted: Sat Apr 27, 2013 4:25 pm    Post subject: is there a way to create a .config file from existing kernel Reply with quote

I accidentally deleted the .conifg file from /usr/src/linux uisng rm. Ah well, my bad.
any way to recreate .config from exisiting bzImage or running kernel in /boot?
can't remeber all the settings and trying not to reinvent MY wheel.
Regards
-N
Back to top
View user's profile Send private message
Logicien
l33t
l33t


Joined: 16 Sep 2005
Posts: 738
Location: Montréal

PostPosted: Sat Apr 27, 2013 4:57 pm    Post subject: Reply with quote

Check in the /proc directory if you have a file named config.gz . It is the configuration file of the running kernel compressed with Gzip.

Some options, CONFIG_IKCONFIG and CONFIG_IKCONFIG_PROC , need to be activated in the running kernel to be able to retreive the file. You can use a script in the Linux kernel source tree, to recreate a kernel configuration from it's image when the CONFIG_IKCONFIG option have been activated:
Code:
CONFIG_IKCONFIG:

This option enables the complete Linux kernel ".config" file
contents to be saved in the kernel. It provides
of which kernel options are used in a running kernel or in an on-disk kernel.
This information can be extracted from the kernel
image file with the script scripts/extract-ikconfig and used as
input to rebuild the current kernel or to build another kernel.
It can also be extracted from a running kernel by reading
/proc/config.gz if enabled (below).

Symbol: IKCONFIG [=y]
Type  : tristate
Prompt: Kernel .config support
   Defined at init/Kconfig:681
         Location:
         -> General setup

_________________
Paul


Last edited by Logicien on Sat Apr 27, 2013 5:09 pm; edited 1 time in total
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 6250
Location: Goose Creek SC

PostPosted: Sat Apr 27, 2013 4:58 pm    Post subject: Reply with quote

if you enabled
Code:
<*> Kernel .config support
[*]   Enable access to .config through /proc/config.gz
/proc/config.gz will exist and can be used as you wish by
Code:
zcat /proc/config.gz > /usr/src/linux/.config

_________________
Defund the FCC.
Back to top
View user's profile Send private message
Ant P.
Advocate
Advocate


Joined: 18 Apr 2009
Posts: 2204
Location: UK

PostPosted: Sat Apr 27, 2013 5:16 pm    Post subject: Reply with quote

If all else fails, you can run `make localyesconfig` in the kernel tree and it'll reselect all your currently in-use drivers.
Back to top
View user's profile Send private message
nimar
n00b
n00b


Joined: 06 Dec 2007
Posts: 34
Location: Brooklyn

PostPosted: Sat Apr 27, 2013 5:30 pm    Post subject: Reply with quote

Thank you! I will give the suggestions a try and get back!
Back to top
View user's profile Send private message
nimar
n00b
n00b


Joined: 06 Dec 2007
Posts: 34
Location: Brooklyn

PostPosted: Sat Apr 27, 2013 5:44 pm    Post subject: Reply with quote

Quote:
Check in the /proc directory if you have a file named config.gz


Not there. Then tried
Quote:
'make localyesconfig'
and got:

Code:

linux # make localyesconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/zconf.lex.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
In file included from scripts/kconfig/zconf.tab.c:2503:0:
scripts/kconfig/menu.c: In function 'get_symbol_str':
scripts/kconfig/menu.c:561:18: warning: 'jump' may be used uninitialized in this function [-Wuninitialized]
scripts/kconfig/menu.c:515:19: note: 'jump' was declared here
  HOSTLD  scripts/kconfig/conf
No config file found at scripts/kconfig/streamline_config.pl line 123.
make[1]: *** [localyesconfig] Error 2
make: *** [localyesconfig] Error 2


Darn! serves me right. :(

anything else?

I hate to reinvent the wheel, but it looks like I'll have to do a better job of keeping my exsting wheels round...
Back to top
View user's profile Send private message
Ant P.
Advocate
Advocate


Joined: 18 Apr 2009
Posts: 2204
Location: UK

PostPosted: Sat Apr 27, 2013 5:50 pm    Post subject: Reply with quote

You might need to run a normal make defconfig first.
Back to top
View user's profile Send private message
DONAHUE
Watchman
Watchman


Joined: 09 Dec 2006
Posts: 6250
Location: Goose Creek SC

PostPosted: Sat Apr 27, 2013 5:54 pm    Post subject: Reply with quote

http://www.kernel-seeds.org/
_________________
Defund the FCC.
Back to top
View user's profile Send private message
nimar
n00b
n00b


Joined: 06 Dec 2007
Posts: 34
Location: Brooklyn

PostPosted: Sat Apr 27, 2013 6:34 pm    Post subject: Reply with quote

While I hate it to pieces, looks like I'll have to run 'make defconfig' and move on.

Thank you all for the suggestions. I guess one of the things I WILL add is


Quote:

<*> Kernel .config support
[*] Enable access to .config through /proc/config.gz


regards

-N
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 31342
Location: 56N 3W

PostPosted: Sat Apr 27, 2013 7:43 pm    Post subject: Reply with quote

nimar,

Do you have any old kernel .config files you can use for a starting point ?
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
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