Skip to contentSkip to conversation

Add option to copy config file to rootfs

PATCH Superseded Nathaniel Roach 2 participants 2 messages Jul 31, 2014 Kbuild

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 Add option to copy config file to rootfs

BR2_CONFIG_COPY copies the config file to /etc/buildroot.config as 0600 during target-finalize after overlay copy, but before post-build script install.

---
 Makefile         |  4 ++++
 system/Config.in | 11 +++++++++++
 2 files changed, 15 insertions(+)
Makefile +4 -0
index 022beea..cc49291 100644
@@ -614,6 +614,10 @@ endif
 			--chmod=Du+w --exclude .empty --exclude '*~' \
 			$(d)/ $(TARGET_DIR)$(sep))
 
+ifeq ($(BR2_CONFIG_COPY),y)
+	$(INSTALL) -m 0600 .config $(TARGET_DIR)/etc/buildroot.config
+endif
+
 	@$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_BUILD_SCRIPT)), \
 		$(call MESSAGE,"Executing post-build script $(s)"); \
 		$(EXTRA_ENV) $(s) $(TARGET_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
system/Config.in +11 -0
index e7e146a..94fb744 100644
@@ -328,6 +328,17 @@ config BR2_ROOTFS_USERS_TABLES
 
 	  See manual for details on the usage and syntax of these files.
 
+config BR2_CONFIG_COPY
+	bool "Copy buildroot .config file to rootfs"
+	help
+	  Copies the .config file used to build the rootfs into the
+	  rootfs. This may be useful for debugging.
+
+	  It will be put in /etc/buildroot.config with a mode of 0600
+
+	  However, be wary that it will contain the root password
+	  (if set) and other possibly sensitive data.
+
 config BR2_ROOTFS_OVERLAY
 	string "Root filesystem overlay directories"
 	default ""
Signature · 1 line
2.0.1
#1 lore raw

PATCH 2/2 Add option to copy config file to rootfs

Hi Nathaniel,

Quoted 5 lines · Nathaniel Roach

BR2_CONFIG_COPY copies the config file to /etc/buildroot.config as 0600 during target-finalize after overlay copy, but before post-build script install.

Your subject says 2/2 but I only see 1 patch?

Quoted 25 lines
---
 Makefile         |  4 ++++
 system/Config.in | 11 +++++++++++
 2 files changed, 15 insertions(+)
Makefile +4 -0
index 022beea..cc49291 100644
@@ -614,6 +614,10 @@ endif
                        --chmod=Du+w --exclude .empty --exclude '*~' \
                        $(d)/ $(TARGET_DIR)$(sep))
 
+ifeq ($(BR2_CONFIG_COPY),y)
+       $(INSTALL) -m 0600 .config $(TARGET_DIR)/etc/buildroot.config
+endif
+
        @$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_BUILD_SCRIPT)), \
                $(call MESSAGE,"Executing post-build script $(s)"); \
                $(EXTRA_ENV) $(s) $(TARGET_DIR) $(call qstrip,$(BR2_ROOTFS_POST_SCRIPT_ARGS))$(sep))
system/Config.in +0 -0
index e7e146a..94fb744 100644

system/Config.in config BR2_ROOTFS_USERS_TABLES · line 334

Quoted 7 lines
system/Config.in +4 -0
@@ -328,6 +328,17 @@ config BR2_ROOTFS_USERS_TABLES
 
          See manual for details on the usage and syntax of these files.
 
+config BR2_CONFIG_COPY
+       bool "Copy buildroot .config file to rootfs"
+       help
+         Copies the .config file used to build the rootfs into the

'to build the rootfs' is not fully accurate as it was also used to build the kernel, bootloader and what not.
So maybe 'to build the system' or simply 'Copies the buildroot .config file into ...'

system/Config.in config BR2_ROOTFS_USERS_TABLES · line 344

Quoted 10 lines
system/Config.in +7 -0
+         rootfs. This may be useful for debugging.
+
+         It will be put in /etc/buildroot.config with a mode of 0600
+
+         However, be wary that it will contain the root password
+         (if set) and other possibly sensitive data.
+
 config BR2_ROOTFS_OVERLAY
        string "Root filesystem overlay directories"
        default ""

Best regards,
Thomas