* [Buildroot] [PATCH] add pre-build script @ 2013-02-13 13:54 Joe Halpin 2013-02-13 22:24 ` Arnout Vandecappelle 0 siblings, 1 reply; 11+ messages in thread From: Joe Halpin @ 2013-02-13 13:54 UTC (permalink / raw) To: buildroot This is a patch to add a pre-build script, which runs before the build starts. This lets us setup symlinks and such before the build starts, which makes things easier and cleaner for us. Maybe it will for other people too. This was made from the 20.12.11 release. I searched for a patch like this but didn't find one. Apologies if I'm being redundant. Joe ---- Joe Halpin | Software Engineer | Luminator LTG | 972-516-3083 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130213/3b296ae1/attachment.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: buildroot-prebuild.patch Type: application/octet-stream Size: 1608 bytes Desc: buildroot-prebuild.patch URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130213/3b296ae1/attachment.obj> ^ permalink raw reply [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH] add pre-build script 2013-02-13 13:54 [Buildroot] [PATCH] add pre-build script Joe Halpin @ 2013-02-13 22:24 ` Arnout Vandecappelle 2013-02-14 1:04 ` Spenser Gilliland ` (2 more replies) 0 siblings, 3 replies; 11+ messages in thread From: Arnout Vandecappelle @ 2013-02-13 22:24 UTC (permalink / raw) To: buildroot On 13/02/13 14:54, Joe Halpin wrote: > This is a patch to add a pre-build script, which runs before the build > starts. This lets us setup symlinks and such before the build starts, > which makes things easier and cleaner for us. Maybe it will for other > people too. This was made from the 20.12.11 release. Could you clarify a bit more what the use case is? Then we can consider if there are maybe better ways to achieve it. Also, a properly formatted patch has a commit message which is formatted as follows: a single summary line of max. 80 characters, an empty line, one or more paragraphs explaining why the patch is necessary, your Signed-off-by line, a line containing three dashes, the patch changelog (if you resubmit it). Look at other patches on the list for examples. And you should send the patch with git send-email or similar, so that whitespace is retained and we can comment in-line. Regarding the patch itself: why do you pass $(TARGET_DIR) as an argument? Since the 'dirs' step comes after the 'prepare' step, $(TARGET_DIR) doesn't exist yet... Regards, Arnout -- Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F ^ permalink raw reply [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH] add pre-build script 2013-02-13 22:24 ` Arnout Vandecappelle @ 2013-02-14 1:04 ` Spenser Gilliland 2013-02-14 7:56 ` Thomas Petazzoni [not found] ` <05255DE50A102443A25D42F2CCAC151FA58C27@LUMEXCH.luminatorusa.com> 2013-02-14 15:08 ` [Buildroot] [PATCH] add pre-build scrip. Patch V2 Joe Halpin 2 siblings, 1 reply; 11+ messages in thread From: Spenser Gilliland @ 2013-02-14 1:04 UTC (permalink / raw) To: buildroot On Feb 13, 2013 4:28 PM, "Arnout Vandecappelle" <arnout@mind.be> wrote: > > On 13/02/13 14:54, Joe Halpin wrote: >> >> This is a patch to add a pre-build script, which runs before the build >> starts. This lets us setup symlinks and such before the build starts, >> which makes things easier and cleaner for us. Maybe it will for other >> people too. This was made from the 20.12.11 release. > > > Could you clarify a bit more what the use case is? Then we can consider if there are maybe better ways to achieve it. > > > Also, a properly formatted patch has a commit message which is formatted as follows: a single summary line of max. 80 characters, an empty line, one or more paragraphs explaining why the patch is necessary, your Signed-off-by line, a line containing three dashes, the patch changelog (if you resubmit it). Look at other patches on the list for examples. And you should send the patch with git send-email or similar, so that whitespace is retained and we can comment in-line. > > > Regarding the patch itself: why do you pass $(TARGET_DIR) as an argument? Since the 'dirs' step comes after the 'prepare' step, $(TARGET_DIR) doesn't exist yet... > > > Regards, > Arnout > > > -- > Arnout Vandecappelle arnout at mind be > Senior Embedded Software Architect +32-16-286500 > Essensium/Mind http://www.mind.be > G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven > LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle > GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F > _______________________________________________ > buildroot mailing list > buildroot at busybox.net > http://lists.busybox.net/mailman/listinfo/buildroot I have a use case for this. In Microblaze builds, it would be nice to generate optimal cflags from the dts/mhs for use in all software. This could be accomplished by a pre script. Spenser -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20130213/a2cd0333/attachment-0001.html> ^ permalink raw reply [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH] add pre-build script 2013-02-14 1:04 ` Spenser Gilliland @ 2013-02-14 7:56 ` Thomas Petazzoni 2013-02-14 16:28 ` Spenser Gilliland 0 siblings, 1 reply; 11+ messages in thread From: Thomas Petazzoni @ 2013-02-14 7:56 UTC (permalink / raw) To: buildroot Dear Spenser Gilliland, On Wed, 13 Feb 2013 19:04:30 -0600, Spenser Gilliland wrote: > I have a use case for this. In Microblaze builds, it would be nice to > generate optimal cflags from the dts/mhs for use in all software. > This could be accomplished by a pre script. Do you have the example of pre-build script that does this? Changing the CFLAGS requires changing some internal Buildroot make variables, so I'm not sure how you're doing this from a pre-build script. Best regards, Thomas -- Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com ^ permalink raw reply [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH] add pre-build script 2013-02-14 7:56 ` Thomas Petazzoni @ 2013-02-14 16:28 ` Spenser Gilliland 2013-02-14 17:04 ` Thomas Petazzoni 0 siblings, 1 reply; 11+ messages in thread From: Spenser Gilliland @ 2013-02-14 16:28 UTC (permalink / raw) To: buildroot On Thu, Feb 14, 2013 at 1:56 AM, Thomas Petazzoni <thomas.petazzoni@free-electrons.com> wrote: > Dear Spenser Gilliland, > > On Wed, 13 Feb 2013 19:04:30 -0600, Spenser Gilliland wrote: > >> I have a use case for this. In Microblaze builds, it would be nice to >> generate optimal cflags from the dts/mhs for use in all software. >> This could be accomplished by a pre script. > > Do you have the example of pre-build script that does this? Changing > the CFLAGS requires changing some internal Buildroot make variables, so > I'm not sure how you're doing this from a pre-build script. > > Best regards, > > Thomas > -- > Thomas Petazzoni, Free Electrons > Kernel, drivers, real-time and embedded Linux > development, consulting, training and support. > http://free-electrons.com I'm not doing this with the specific implementation posted. I'm just saying it would be a nice feature to have. Many device trees specify processor/arch features and optimized cflags can be constructed from this data. I currently do this outside of buildroot and just provide BR2_TARGET_OPTIMIZATION on the make command line from the buildscripts for the hardware. It would be nice to have buildroot completely self contained and not require the software developers to download the additional hardware files. Spenser -- Spenser Gilliland Computer Engineer Doctoral Candidate ^ permalink raw reply [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH] add pre-build script 2013-02-14 16:28 ` Spenser Gilliland @ 2013-02-14 17:04 ` Thomas Petazzoni 2013-02-14 22:10 ` Arnout Vandecappelle 0 siblings, 1 reply; 11+ messages in thread From: Thomas Petazzoni @ 2013-02-14 17:04 UTC (permalink / raw) To: buildroot Dear Spenser Gilliland, On Thu, 14 Feb 2013 10:28:24 -0600, Spenser Gilliland wrote: > I'm not doing this with the specific implementation posted. I'm just > saying it would be a nice feature to have. Many device trees specify > processor/arch features and optimized cflags can be constructed from > this data. > > I currently do this outside of buildroot and just provide > BR2_TARGET_OPTIMIZATION on the make command line from the buildscripts > for the hardware. > > It would be nice to have buildroot completely self contained and not > require the software developers to download the additional hardware > files. Indeed, but the pre-build script approach you posted would not allow to customize the CFLAGS. The CFLAGS are part of Buildroot .config file, which is loaded at the time you run "make". So when your pre-build script gets executed by Buildroot, make has already loaded the value of BR2_TARGET_OPTIMIZATION. You would have to make a specific script that returns custom CFLAGS, and add some code in Buildroot that does: CUSTOM_CFLAGS = $(shell ./your/custom/script) Thomas -- Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com ^ permalink raw reply [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH] add pre-build script 2013-02-14 17:04 ` Thomas Petazzoni @ 2013-02-14 22:10 ` Arnout Vandecappelle 2013-02-15 5:09 ` Thomas Petazzoni 0 siblings, 1 reply; 11+ messages in thread From: Arnout Vandecappelle @ 2013-02-14 22:10 UTC (permalink / raw) To: buildroot On 14/02/13 18:04, Thomas Petazzoni wrote: > Dear Spenser Gilliland, > > On Thu, 14 Feb 2013 10:28:24 -0600, Spenser Gilliland wrote: > >> I'm not doing this with the specific implementation posted. I'm just >> saying it would be a nice feature to have. Many device trees specify >> processor/arch features and optimized cflags can be constructed from >> this data. >> >> I currently do this outside of buildroot and just provide >> BR2_TARGET_OPTIMIZATION on the make command line from the buildscripts >> for the hardware. >> >> It would be nice to have buildroot completely self contained and not >> require the software developers to download the additional hardware >> files. > > Indeed, but the pre-build script approach you posted would not allow to > customize the CFLAGS. Spenser didn't post it... > The CFLAGS are part of Buildroot .config file, > which is loaded at the time you run "make". Ah, right, major shortcoming if the pre-build script can't update the .config... > So when your pre-build > script gets executed by Buildroot, make has already loaded the value of > BR2_TARGET_OPTIMIZATION. > > You would have to make a specific script that returns custom CFLAGS, > and add some code in Buildroot that does: > > CUSTOM_CFLAGS = $(shell ./your/custom/script) This is a good place to do := instead of =, otherwise the script gets re-run for every build step... Regards, Arnout -- Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F ^ permalink raw reply [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH] add pre-build script 2013-02-14 22:10 ` Arnout Vandecappelle @ 2013-02-15 5:09 ` Thomas Petazzoni 2013-02-15 20:50 ` Spenser Gilliland 0 siblings, 1 reply; 11+ messages in thread From: Thomas Petazzoni @ 2013-02-15 5:09 UTC (permalink / raw) To: buildroot Dear Arnout Vandecappelle, On Thu, 14 Feb 2013 23:10:04 +0100, Arnout Vandecappelle wrote: > > Indeed, but the pre-build script approach you posted would not allow to > > customize the CFLAGS. > > Spenser didn't post it... Ah, I got confused with the patch from "Joe Halpin" <jhalpin@luminatorusa.com> in the same thread. Isn't this the same thing? I'm not sure how Joe's patch is related to Spenser's discussion. But surely, the patch from Joe Halpin does allow to alter the configuration. Best regards, Thomas -- Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com ^ permalink raw reply [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH] add pre-build script 2013-02-15 5:09 ` Thomas Petazzoni @ 2013-02-15 20:50 ` Spenser Gilliland 0 siblings, 0 replies; 11+ messages in thread From: Spenser Gilliland @ 2013-02-15 20:50 UTC (permalink / raw) To: buildroot I'm just describing a use case for the concept of a pre-build script. I want to make sure that you know that this feature is valuable in more than just Joe's use case. Thanks, Spenser On Thu, Feb 14, 2013 at 11:09 PM, Thomas Petazzoni <thomas.petazzoni@free-electrons.com> wrote: > Dear Arnout Vandecappelle, > > On Thu, 14 Feb 2013 23:10:04 +0100, Arnout Vandecappelle wrote: > >> > Indeed, but the pre-build script approach you posted would not allow to >> > customize the CFLAGS. >> >> Spenser didn't post it... > > Ah, I got confused with the patch from "Joe Halpin" > <jhalpin@luminatorusa.com> in the same thread. Isn't this the same > thing? I'm not sure how Joe's patch is related to Spenser's discussion. > > But surely, the patch from Joe Halpin does allow to alter the > configuration. > > Best regards, > > Thomas > -- > Thomas Petazzoni, Free Electrons > Kernel, drivers, real-time and embedded Linux > development, consulting, training and support. > http://free-electrons.com > _______________________________________________ > buildroot mailing list > buildroot at busybox.net > http://lists.busybox.net/mailman/listinfo/buildroot -- Spenser Gilliland Computer Engineer Doctoral Candidate ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <05255DE50A102443A25D42F2CCAC151FA58C27@LUMEXCH.luminatorusa.com>]
[parent not found: <511CF47A.7050004@mind.be>]
* [Buildroot] [PATCH] add pre-build script. Patch v2 [not found] ` <511CF47A.7050004@mind.be> @ 2013-02-14 14:29 ` Joe Halpin 0 siblings, 0 replies; 11+ messages in thread From: Joe Halpin @ 2013-02-14 14:29 UTC (permalink / raw) To: buildroot No, just hit thee wrong button, sorry. I've copied the list here thanks Joe -----Original Message----- From: Arnout Vandecappelle [mailto:arnout at mind.be] Sent: Thursday, February 14, 2013 8:28 AM To: Joe Halpin Subject: Re: [Buildroot] [PATCH] add pre-build script. Patch v2 You didn't reply to the list, was that intentional? Regards, Arnout On 14/02/13 15:24, Joe Halpin wrote: > In our environment we have a standardized directory for downloaded > source tarballs. The location of the build tree for each developer can > vary on each of their machines. For example, one developer might put his > development tree under his home directory, another under /opt or some > other base. > So one use case would be to figure out the full path to the tarball > directory before the build, and create a symlink in place of the dl > directory which points to the central location. > We have been using the menuconfig option to define the source download > directory (Build options-> Download dir), but (since we can't predict > the absolute path to the download directory) this requires us to keep > all buildroot directories at the same level from the project base, and > use a relative path. That becomes inconvenient when we tag release > candidates, because we'd like to have a version directory added to the > path to the tagged directory. For example, the path to trunk might be > > /opt/dev/<project>/trunk/module1 (module2 ...) > > But the path to a tag would have to be at the same level, so we wind up > with > > /opt/dev/<project>/tags/module1-v1 > module1-v2 > module2-v1 > module2-v2 > > etc, when what we'd like to have is > > /opt/dev/<project>/tags/version-1.0/module1 (module 2 ...) > /opt/dev/<project>/tags/version-1.1/module1 (module 2 ...) > > and so forth. This isn't at the same level as the trunk though, so the > path to the source tarballs has to be absolute. > I probably could have explained that better, if it's not clear I'll try > again. > Sorry about the patch, this is my first time submitting one. I'll redo > it with the changes you asked for. > One question though about the TARGET_DIR. My script doesn't care about > it so I missed that. What would you suggest I use instead? I was > thinking about using the current directory (./), which at that point I > believe would be the base buildroot directory. > > Also, sorry about top-posting, I'm condemned to use Outlook here, which > doesn't quote things properly. > Thanks > Joe > > -----Original Message----- > From: Arnout Vandecappelle [mailto:arnout at mind.be] > Sent: Wednesday, February 13, 2013 4:24 PM > To: Joe Halpin > Cc: buildroot at busybox.net > Subject: Re: [Buildroot] [PATCH] add pre-build script > > On 13/02/13 14:54, Joe Halpin wrote: >> This is a patch to add a pre-build script, which runs before the build >> starts. This lets us setup symlinks and such before the build starts, >> which makes things easier and cleaner for us. Maybe it will for other >> people too. This was made from the 20.12.11 release. > > Could you clarify a bit more what the use case is? Then we can > consider > if there are maybe better ways to achieve it. > > > Also, a properly formatted patch has a commit message which is > formatted as follows: a single summary line of max. 80 characters, an > empty line, one or more paragraphs explaining why the patch is > necessary, > your Signed-off-by line, a line containing three dashes, the patch > changelog (if you resubmit it). Look at other patches on the list for > examples. And you should send the patch with git send-email or similar, > so that whitespace is retained and we can comment in-line. > > > Regarding the patch itself: why do you pass $(TARGET_DIR) as an > argument? Since the 'dirs' step comes after the 'prepare' step, > $(TARGET_DIR) doesn't exist yet... > > > Regards, > Arnout > > -- Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F ^ permalink raw reply [flat|nested] 11+ messages in thread
* [Buildroot] [PATCH] add pre-build scrip. Patch V2 2013-02-13 22:24 ` Arnout Vandecappelle 2013-02-14 1:04 ` Spenser Gilliland [not found] ` <05255DE50A102443A25D42F2CCAC151FA58C27@LUMEXCH.luminatorusa.com> @ 2013-02-14 15:08 ` Joe Halpin 2 siblings, 0 replies; 11+ messages in thread From: Joe Halpin @ 2013-02-14 15:08 UTC (permalink / raw) To: buildroot Here's a resend of the patch, I think I got it right this time. Arnout, please ignore my last reply about CONFIG_DIR, I was thinking about my own world and missed what you were trying to tell me. I'm passing CONFIG_DIR in the patch now, which is probably the best place to start from. Add a pre-build script that can be used to setup directories, scripts etc. This allows scripts which may change .config. CONFIG_DIR is passed as the target directory for this reason. Signed-off-by Joe Halpin jhelpin at luminatorusa.com --- Correction to the original patch diff --git a/Makefile b/Makefile index 3f967b2..29d3bd6 100644 --- a/Makefile +++ b/Makefile @@ -393,6 +393,12 @@ $(BUILD_DIR)/buildroot-config/auto.conf: $(BUILDROOT_CONFI\ G) $(MAKE) $(EXTRAMAKEARGS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTCXX="$(HOSTCXX\ _NOCCACHE)" silentoldconfig prepare: $(BUILD_DIR)/buildroot-config/auto.conf +ifneq ($(BR2_ROOTFS_PRE_BUILD_SCRIPT),"") + @$(call MESSAGE,"Executing pre-build script\(s\)") + @$(foreach s, $(call qstrip,$(BR2_ROOTFS_PRE_BUILD_SCRIPT)), \ + $(s) $(CONFIG_DIR)$(sep)) +endif + toolchain: prepare dirs dependencies $(BASE_TARGETS) diff --git a/system/Config.in b/system/Config.in index 1e4fff3..df9e5ce 100644 --- a/system/Config.in +++ b/system/Config.in @@ -260,6 +260,19 @@ config BR2_ROOTFS_OVERLAY They are copied as-is into the rootfs, excluding files ending with ~ and .git, .svn and .hg directories. +config BR2_ROOTFS_PRE_BUILD_SCRIPT + string "Custom scripts to run before starting the build" + default "" + help + Specify a space-separated list of scripts to be run before the build + has started. + + This gives users the oportunity to do board-specific preparation. + + These scripts are called with $(CONFIG_DIR) as first and + only argument. Make sure the exit code of those scripts are 0, + otherwise make will stop after calling them. + config BR2_ROOTFS_POST_BUILD_SCRIPT string "Custom scripts to run before creating filesystem images" default "" -----Original Message----- From: Arnout Vandecappelle [mailto:arnout at mind.be] Sent: Wednesday, February 13, 2013 4:24 PM To: Joe Halpin Cc: buildroot at busybox.net Subject: Re: [Buildroot] [PATCH] add pre-build script On 13/02/13 14:54, Joe Halpin wrote: > This is a patch to add a pre-build script, which runs before the build > starts. This lets us setup symlinks and such before the build starts, > which makes things easier and cleaner for us. Maybe it will for other > people too. This was made from the 20.12.11 release. Could you clarify a bit more what the use case is? Then we can consider if there are maybe better ways to achieve it. Also, a properly formatted patch has a commit message which is formatted as follows: a single summary line of max. 80 characters, an empty line, one or more paragraphs explaining why the patch is necessary, your Signed-off-by line, a line containing three dashes, the patch changelog (if you resubmit it). Look at other patches on the list for examples. And you should send the patch with git send-email or similar, so that whitespace is retained and we can comment in-line. Regarding the patch itself: why do you pass $(TARGET_DIR) as an argument? Since the 'dirs' step comes after the 'prepare' step, $(TARGET_DIR) doesn't exist yet... Regards, Arnout -- Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F ^ permalink raw reply related [flat|nested] 11+ messages in thread
end of thread, other threads:[~2013-02-15 20:50 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-13 13:54 [Buildroot] [PATCH] add pre-build script Joe Halpin
2013-02-13 22:24 ` Arnout Vandecappelle
2013-02-14 1:04 ` Spenser Gilliland
2013-02-14 7:56 ` Thomas Petazzoni
2013-02-14 16:28 ` Spenser Gilliland
2013-02-14 17:04 ` Thomas Petazzoni
2013-02-14 22:10 ` Arnout Vandecappelle
2013-02-15 5:09 ` Thomas Petazzoni
2013-02-15 20:50 ` Spenser Gilliland
[not found] ` <05255DE50A102443A25D42F2CCAC151FA58C27@LUMEXCH.luminatorusa.com>
[not found] ` <511CF47A.7050004@mind.be>
2013-02-14 14:29 ` [Buildroot] [PATCH] add pre-build script. Patch v2 Joe Halpin
2013-02-14 15:08 ` [Buildroot] [PATCH] add pre-build scrip. Patch V2 Joe Halpin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox