Bug 8771 - make savedefconfig modifies sources
Summary: make savedefconfig modifies sources
Status: RESOLVED WORKSFORME
Alias: None
Product: buildroot
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-07 18:43 UTC by Geoff Levand
Modified: 2016-03-07 20:23 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Geoff Levand 2016-03-07 18:43:49 UTC
When building out of the source tree 'make savedefconfig' will modify the sources in some situations.  This is problematic when the sources are on read-only media.  It should write to the file defconfig in the build directory.

  mkdir /tmp/out
  make O=/tmp/out qemu_aarch64_virt_defconfig
  cd /tmp/out
  make savedefconfig
  
In this case qemu_aarch64_virt_defconfig in the sources gets modified.
Comment 1 Thomas Petazzoni 2016-03-07 20:23:01 UTC
This is the expected behavior. I personally don't like it (since it deviates from how the Linux kernel handles defconfig, and also because it's look weird), but that's the way it's supposed to work in Buildroot.

Basically, the defconfig is stored to the file pointed by BR2_DEFCONFIG. By default, this option is set to $(CONFIG_DIR)/defconfig, which would do what you want, i.e save the defconfig next to the .config file.

However, when you run "make <foobar>_defconfig", we set BR2_DEFCONFIG to "configs/<foobar>_defconfig". The original intent is to make things "transparent": if you start from a defconfig, the assumption is that you want changes made to this configuration to be saved back to the same defconfig.

You can override this at any time by changing BR2_DEFCONFIG in menuconfig/xconfig/nconfig, or simply on the command line by passing BR2_DEFCONFIG="/some/place".

As I said, I personally don't really like this behavior, and I got confused several times. The fact that the source tree is modified is indeed another drawback of this behavior. However, I didn't find this to be too problematic to really argue against the contributors who wanted this feature.