* [Buildroot] [PATCH v2] Add option to copy config file to rootfs
@ 2014-07-31 15:26 Nathaniel Roach
2014-07-31 17:16 ` Yann E. MORIN
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Nathaniel Roach @ 2014-07-31 15:26 UTC (permalink / raw)
To: buildroot
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.
---
Changes v1 to v2
- Corrected wording of config helper message (Thomas De Schampheleire)
- Moved order in menu to reflect actual order of the operation
---
Makefile | 4 ++++
system/Config.in | 11 +++++++++++
2 files changed, 15 insertions(+)
diff --git a/Makefile b/Makefile
index 022beea..cc49291 100644
--- a/Makefile
+++ b/Makefile
@@ -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))
diff --git a/system/Config.in b/system/Config.in
index e7e146a..a1ff23f 100644
--- a/system/Config.in
+++ b/system/Config.in
@@ -339,6 +339,17 @@ config BR2_ROOTFS_OVERLAY
They are copied as-is into the rootfs, excluding files ending with
~ and .git, .svn and .hg directories.
+config BR2_CONFIG_COPY
+ bool "Copy buildroot .config file to rootfs"
+ help
+ Copies the buildroot .config file 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_POST_BUILD_SCRIPT
string "Custom scripts to run before creating filesystem images"
default ""
--
2.0.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* [Buildroot] [PATCH v2] Add option to copy config file to rootfs 2014-07-31 15:26 [Buildroot] [PATCH v2] Add option to copy config file to rootfs Nathaniel Roach @ 2014-07-31 17:16 ` Yann E. MORIN 2014-07-31 17:55 ` Thomas De Schampheleire 2014-07-31 17:19 ` Matthew Weber 2014-07-31 21:50 ` Thomas Petazzoni 2 siblings, 1 reply; 9+ messages in thread From: Yann E. MORIN @ 2014-07-31 17:16 UTC (permalink / raw) To: buildroot Nathaniel, All, On 2014-07-31 23:26 +0800, Nathaniel Roach spake thusly: > 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. I wonder what would be the use-case for this? I think the case where one would want this file in the generated filesystem is a corner case, and that it would be better served with a post-build script. Regards, Yann E. MORIN. > --- > Changes v1 to v2 > - Corrected wording of config helper message (Thomas De Schampheleire) > - Moved order in menu to reflect actual order of the operation > --- > Makefile | 4 ++++ > system/Config.in | 11 +++++++++++ > 2 files changed, 15 insertions(+) > > diff --git a/Makefile b/Makefile > index 022beea..cc49291 100644 > --- a/Makefile > +++ b/Makefile > @@ -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)) > diff --git a/system/Config.in b/system/Config.in > index e7e146a..a1ff23f 100644 > --- a/system/Config.in > +++ b/system/Config.in > @@ -339,6 +339,17 @@ config BR2_ROOTFS_OVERLAY > They are copied as-is into the rootfs, excluding files ending with > ~ and .git, .svn and .hg directories. > > +config BR2_CONFIG_COPY > + bool "Copy buildroot .config file to rootfs" > + help > + Copies the buildroot .config file 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_POST_BUILD_SCRIPT > string "Custom scripts to run before creating filesystem images" > default "" > -- > 2.0.1 > > _______________________________________________ > buildroot mailing list > buildroot at busybox.net > http://lists.busybox.net/mailman/listinfo/buildroot -- .-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Buildroot] [PATCH v2] Add option to copy config file to rootfs 2014-07-31 17:16 ` Yann E. MORIN @ 2014-07-31 17:55 ` Thomas De Schampheleire 2014-07-31 18:17 ` Thomas Petazzoni 0 siblings, 1 reply; 9+ messages in thread From: Thomas De Schampheleire @ 2014-07-31 17:55 UTC (permalink / raw) To: buildroot "Yann E. MORIN" <yann.morin.1998@free.fr> schreef: >Nathaniel, All, > >On 2014-07-31 23:26 +0800, Nathaniel Roach spake thusly: >> 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. > >I wonder what would be the use-case for this? What is the use case in crosstool-NG to save the configuration and log alongside the toolchain? Or what about the /proc/config.gz feature of the Linux kernel? It allows people that receive the generated images to easily inspect and reproduce the configuration. One doesn't even need to think about legal counter- arguments here: even within the same company it can be useful to be able to inspect the configuration of a running system... > >I think the case where one would want this file in the generated >filesystem is a corner case, and that it would be better served with >a post-build script. I think this is a feature that deserves to be in Buildroot directly. Just like rootfs-overlay used to be something that people had to do manually from their post build script, but later became a supported feature because many people found it useful, or the feature to set the root password, this is something that is generally useful by many users, even those that don't fully know how to use the post build script to it's full ability, or did not yet realize the usefulness of the saving of the configuration. Best regards, Thomas ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Buildroot] [PATCH v2] Add option to copy config file to rootfs 2014-07-31 17:55 ` Thomas De Schampheleire @ 2014-07-31 18:17 ` Thomas Petazzoni 2014-07-31 18:40 ` Thomas De Schampheleire 0 siblings, 1 reply; 9+ messages in thread From: Thomas Petazzoni @ 2014-07-31 18:17 UTC (permalink / raw) To: buildroot Dear Thomas De Schampheleire, On Thu, 31 Jul 2014 19:55:21 +0200, Thomas De Schampheleire wrote: > >I think the case where one would want this file in the generated > >filesystem is a corner case, and that it would be better served with > >a post-build script. > > I think this is a feature that deserves to be in Buildroot > directly. Just like rootfs-overlay used to be > something that people had to do manually from their > post build script, but later became a supported > feature because many people found it useful, or the > feature to set the root password, this is something that is > generally useful by many users, even those that don't fully know how > to use the post build script to it's full ability, or did not yet > realize the usefulness of the saving of the configuration. I don't really have a strong opinion on whether we should have this feature or not, but what bothers me is adding yet another global config option just for a small thing like that. If we were to include the .config file in the rootfs, could we do it unconditionally? Or would the .config file size be problematic? Thomas -- Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Buildroot] [PATCH v2] Add option to copy config file to rootfs 2014-07-31 18:17 ` Thomas Petazzoni @ 2014-07-31 18:40 ` Thomas De Schampheleire 2014-07-31 21:37 ` Yann E. MORIN 0 siblings, 1 reply; 9+ messages in thread From: Thomas De Schampheleire @ 2014-07-31 18:40 UTC (permalink / raw) To: buildroot Thomas Petazzoni <thomas.petazzoni@free-electrons.com> schreef: >Dear Thomas De Schampheleire, > >On Thu, 31 Jul 2014 19:55:21 +0200, Thomas De Schampheleire wrote: > >> >I think the case where one would want this file in the generated >> >filesystem is a corner case, and that it would be better served with >> >a post-build script. >> >> I think this is a feature that deserves to be in Buildroot >> directly. Just like rootfs-overlay used to be >> something that people had to do manually from their >> post build script, but later became a supported >> feature because many people found it useful, or the >> feature to set the root password, this is something that is >> generally useful by many users, even those that don't fully know how >> to use the post build script to it's full ability, or did not yet >> realize the usefulness of the saving of the configuration. > >I don't really have a strong opinion on whether we should have this >feature or not, but what bothers me is adding yet another global config >option just for a small thing like that. > >If we were to include the .config file in the rootfs, could we do it >unconditionally? Or would the .config file size be problematic? Not do much the size, but as specified in the help text the potential root password will be readable too. So if you get a hand on the rootfs image, you can determine the password very easily, which is probably not acceptable by all. Best regards, Thomas ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Buildroot] [PATCH v2] Add option to copy config file to rootfs 2014-07-31 18:40 ` Thomas De Schampheleire @ 2014-07-31 21:37 ` Yann E. MORIN 2014-08-01 4:45 ` Thomas De Schampheleire 0 siblings, 1 reply; 9+ messages in thread From: Yann E. MORIN @ 2014-07-31 21:37 UTC (permalink / raw) To: buildroot Thomas?, All, On 2014-07-31 20:40 +0200, Thomas De Schampheleire spake thusly: > Thomas Petazzoni <thomas.petazzoni@free-electrons.com> schreef: > >Dear Thomas De Schampheleire, > > > >On Thu, 31 Jul 2014 19:55:21 +0200, Thomas De Schampheleire wrote: > > > >> >I think the case where one would want this file in the generated > >> >filesystem is a corner case, and that it would be better served with > >> >a post-build script. > >> > >> I think this is a feature that deserves to be in Buildroot > >> directly. Just like rootfs-overlay used to be > >> something that people had to do manually from their > >> post build script, but later became a supported > >> feature because many people found it useful, or the > >> feature to set the root password, this is something that is > >> generally useful by many users, even those that don't fully know how > >> to use the post build script to it's full ability, or did not yet > >> realize the usefulness of the saving of the configuration. <sarcastic> Great! Let's include in Buildroot all the cruft that a post-build script can do. </sarcastic> Sorry for the rant, really, but we introduced post-build scripts for a reason: so that users can further customise their rootfs with whatever they want to put/remove/tweak in there, without polluting Buildroot with border-line behaviours. And the root password, since you're speaking about it, is part of the behaviour of the target system. The .config is just sitting there, and serves no purpose in the running of the target system. (crosstool-NG: everyone can make mistakes in their infancy! ;-) ) > >I don't really have a strong opinion on whether we should have this > >feature or not, but what bothers me is adding yet another global config > >option just for a small thing like that. > > > >If we were to include the .config file in the rootfs, could we do it > >unconditionally? Or would the .config file size be problematic? > > Not do much the size, but as specified in the help text > the potential root password will be readable too. So if > you get a hand on the rootfs image, you can > determine the password very easily, which is > probably not acceptable by all. That, plus the fact the .config will also contain info from the packages in br2-external, too, which might be a bit sensitive, and a definitive no-no for production images. And I still believe this is more of a convenience option for internal use, or for development reasons. Production images will most probably never ever have this file in them (no more would they have /proc/config.gz either.) So: 1. _I_ still _think_ this should be handled in a post-build script; 2. if we were to ever have this, this should *not* be unconditional; 3. it should default to 'n'; 4. I will never ack this. :-p Regards, Yann E. MORIN. -- .-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Buildroot] [PATCH v2] Add option to copy config file to rootfs 2014-07-31 21:37 ` Yann E. MORIN @ 2014-08-01 4:45 ` Thomas De Schampheleire 0 siblings, 0 replies; 9+ messages in thread From: Thomas De Schampheleire @ 2014-08-01 4:45 UTC (permalink / raw) To: buildroot "Yann E. MORIN" <yann.morin.1998@free.fr> schreef: >Thomas?, All, > >On 2014-07-31 20:40 +0200, Thomas De Schampheleire spake thusly: >> Thomas Petazzoni <thomas.petazzoni@free-electrons.com> schreef: >> >Dear Thomas De Schampheleire, >> > >> >On Thu, 31 Jul 2014 19:55:21 +0200, Thomas De Schampheleire wrote: >> > >> >> >I think the case where one would want this file in the generated >> >> >filesystem is a corner case, and that it would be better served with >> >> >a post-build script. >> >> >> >> I think this is a feature that deserves to be in Buildroot >> >> directly. Just like rootfs-overlay used to be >> >> something that people had to do manually from their >> >> post build script, but later became a supported >> >> feature because many people found it useful, or the >> >> feature to set the root password, this is something that is >> >> generally useful by many users, even those that don't fully know how >> >> to use the post build script to it's full ability, or did not yet >> >> realize the usefulness of the saving of the configuration. > ><sarcastic> >Great! Let's include in Buildroot all the cruft that a post-build script >can do. ></sarcastic> > >Sorry for the rant, really, but we introduced post-build scripts for a >reason: so that users can further customise their rootfs with whatever >they want to put/remove/tweak in there, without polluting Buildroot with >border-line behaviours. > >And the root password, since you're speaking about it, is part of the >behaviour of the target system. The .config is just sitting there, and >serves no purpose in the running of the target system. > >(crosstool-NG: everyone can make mistakes in their infancy! ;-) ) > >> >I don't really have a strong opinion on whether we should have this >> >feature or not, but what bothers me is adding yet another global config >> >option just for a small thing like that. >> > >> >If we were to include the .config file in the rootfs, could we do it >> >unconditionally? Or would the .config file size be problematic? >> >> Not do much the size, but as specified in the help text >> the potential root password will be readable too. So if >> you get a hand on the rootfs image, you can >> determine the password very easily, which is >> probably not acceptable by all. > >That, plus the fact the .config will also contain info from the packages >in br2-external, too, which might be a bit sensitive, and a definitive >no-no for production images. > >And I still believe this is more of a convenience option for internal >use, or for development reasons. Production images will most probably >never ever have this file in them (no more would they have >/proc/config.gz either.) > >So: > 1. _I_ still _think_ this should be handled in a post-build script; > 2. if we were to ever have this, this should *not* be unconditional; > 3. it should default to 'n'; > 4. I will never ack this. :-p /me backs down... :-) ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Buildroot] [PATCH v2] Add option to copy config file to rootfs 2014-07-31 15:26 [Buildroot] [PATCH v2] Add option to copy config file to rootfs Nathaniel Roach 2014-07-31 17:16 ` Yann E. MORIN @ 2014-07-31 17:19 ` Matthew Weber 2014-07-31 21:50 ` Thomas Petazzoni 2 siblings, 0 replies; 9+ messages in thread From: Matthew Weber @ 2014-07-31 17:19 UTC (permalink / raw) To: buildroot Hi Nathaniel, On Thu, Jul 31, 2014 at 10:26 AM, Nathaniel Roach <nroach44@gmail.com> wrote: > 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. > > --- > Changes v1 to v2 > - Corrected wording of config helper message (Thomas De Schampheleire) > - Moved order in menu to reflect actual order of the operation > --- > Makefile | 4 ++++ > system/Config.in | 11 +++++++++++ > 2 files changed, 15 insertions(+) > > diff --git a/Makefile b/Makefile > index 022beea..cc49291 100644 > --- a/Makefile > +++ b/Makefile > @@ -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 Before you do the copy, would it be worth doing a savedefconfig (or like) activity to cleanup the .config file? Then the file on target would be much easier to read if you manually had to view it. Thanks! -- Matthew L Weber / Sr Software Engineer / Platform Software matthew.weber at rockwellcollins.com www.rockwellcollins.com ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Buildroot] [PATCH v2] Add option to copy config file to rootfs 2014-07-31 15:26 [Buildroot] [PATCH v2] Add option to copy config file to rootfs Nathaniel Roach 2014-07-31 17:16 ` Yann E. MORIN 2014-07-31 17:19 ` Matthew Weber @ 2014-07-31 21:50 ` Thomas Petazzoni 2 siblings, 0 replies; 9+ messages in thread From: Thomas Petazzoni @ 2014-07-31 21:50 UTC (permalink / raw) To: buildroot Dear Nathaniel Roach, On Thu, 31 Jul 2014 23:26:38 +0800, Nathaniel Roach wrote: > 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. > > --- > Changes v1 to v2 > - Corrected wording of config helper message (Thomas De Schampheleire) > - Moved order in menu to reflect actual order of the operation > --- > Makefile | 4 ++++ > system/Config.in | 11 +++++++++++ > 2 files changed, 15 insertions(+) Thanks for the proposal, but apparently there's no really a consensus around it and there's a very simple way to do the same using a post-build script, so I've marked the patch as Rejected in patchwork. Best regards, Thomas -- Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-08-01 4:45 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-07-31 15:26 [Buildroot] [PATCH v2] Add option to copy config file to rootfs Nathaniel Roach 2014-07-31 17:16 ` Yann E. MORIN 2014-07-31 17:55 ` Thomas De Schampheleire 2014-07-31 18:17 ` Thomas Petazzoni 2014-07-31 18:40 ` Thomas De Schampheleire 2014-07-31 21:37 ` Yann E. MORIN 2014-08-01 4:45 ` Thomas De Schampheleire 2014-07-31 17:19 ` Matthew Weber 2014-07-31 21:50 ` Thomas Petazzoni
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.