Sunday, January 28, 2024

[SOLVED] How to create a defconfig file from a .config?

Issue

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

Solution

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.



Answered By - 0andriy
Answer Checked By - Katrina (WPSolving Volunteer)