31

I have done make menuconfig for a board defconfig and modified few configurations. When I select save, a new .config was created in the Kernel top directory.

I want to create new defconfig for this .config file created.

Can I copy the .config as a new defconfig and copy to arch/arm/configs/?

$ cp .config arch/arm/configs/board_new_defconfig
2

2 Answers 2

58

I think you have to do just one command and use the created file as you want to.

% make savedefconfig 
% cp defconfig arch/arm/configs/my_cool_defconfig

(Pay attention to the filename template that is used for defconfig)

To get all possible targets just run

% make help

As noted by Adam Miller followed by Jeremy, users of Buildroot distribution can use wrappers for that purpose, i.e. (per Buildroot manual, section 8.1):

  • linux-savedefconfig for Linux kernel
  • barebox-savedefconfig for barebox bootloader
  • uboot-savedefconfig for U-Boot bootloader

make savedefconfig minimizes the generated defconfig skipping redundant configs that are implied by others.

13
  • 1
    Ha! I use my_kool_<foo> as a meta variable, myself!
    – Jameson
    Dec 13, 2015 at 8:22
  • 2
    What about linux-savedefconfig? Aren't those discrete defconfigs, one for buildroot and all the accessory packages, one for the linux kernel itself? Dec 17, 2015 at 20:34
  • You can do: make linux-savedefconfig - as per the buildroot manual. I would think that make linux-menuconfig and linux-savedefconfig correspond just as menuconfig and savedefconfig targets do, no? Dec 17, 2015 at 20:41
  • Please note that after this defconfig generated will be sorted but not sorted in alphabetic order
    – ashish
    Nov 3, 2017 at 5:58
  • 1
    "make linux-savedefconfig" is only useful if you are using "buildroot" to build embedded linux, which the OP did not mention. However I added +1 to AdamMiller 's comment because this was just what I was looking for, and other buildroot users may end up here.
    – Jeremy
    Nov 5, 2017 at 23:54
2

For your platform, in a new defconfig file, yes. In fact this is the safest way to create a new defconfig. If you manually remove config entries from an existing config file to create a new one, you are likely to get dependency issues and during build, it might restart the kernel config and give you prompts for selecting individual config options.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.