The title says it all: I need the .config
file that was used for compiling a kernel, but all I have is the defconfig file. I've seen instructions on how to produce the latter from the former, but not the other way around. Is it possible?
Asked
Active
Viewed 3,025 times
1
-
1http://superuser.com/questions/287371/obtain-kernel-config-from-currently-running-linux-system – Mali Jan 19 '17 at 16:46
-
`make ARCH=
whatever_defconfig`. Be sure that you have proper kernel sources. *whatever_defconfig* should be located under *arch/ – 0andriy Jan 19 '17 at 20:56/configs/whatever_defconfig*. (There are some exceptions, for example, x86_64 defconfigs are in *arch/x86/configs* folder) -
@0andriy: Wouldn't that command simply build the kernel? That's not really what I'm looking for... – Jon Smark Jan 24 '17 at 14:25
2 Answers
1
If you know the base config against which your defconfig file was generated, you can merge against it. Kernel version doesn't have to be exactly the same - new options will stay on default.
Assuming the base which your defconfig
file was generated against was x86_64_defconfig (most likely) and you just have copied it into the linux source tree:
$ make mrproper
$ scripts/kconfig/merge_config.sh defconfig
If there are no errors, the .config file is now ready and you can run make
to build the kernel.
For further help run $ scripts/kconfig/merge_config.sh -h
or peek into the script.
-2
You can't.
defconfig files are basic and minimalist config for one target architecture, and are just a starting point used to define a real .config.
You can instead retrieve .config used by other ways : look here on super-user
-
-
@0andriy, yes I've built lot of kernels, have you understand the question ? Jon don't want to build a kernel from defconfig, he wants to retrieve the .config used to build current running kernel from defconfig. That's not possible .... – Mali Jan 19 '17 at 21:52
-
Yes, I do, and could hardly imagine the case where you have binary only kernel with manually altered configuration without that configuration provided. Perhaps some paranoid gentoo server node? – 0andriy Jan 19 '17 at 23:11
-
I would upvote the answer in case you elaborate in which cases one can recover, and in which can't. – 0andriy Jan 20 '17 at 08:40
-
Unfortunately, the answer on Superuser for alternative methods of getting the .config file does not help me, since the kernel does not export a `/proc/config.gz` nor there is a config file on `/boot`. – Jon Smark Jan 24 '17 at 14:24