add pre-build script
PATCH 1/1 add pre-build script
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>
PATCH 1/1 add pre-build script
Quoted 4 lines · Joe Halpin
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
Signature · 6 lines
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
PATCH 1/1 add pre-build script
Quoted 10 lines · Arnout Vandecappelle
Quoted 5 lines · Joe Halpin
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.
Quoted 3 lines
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.
Quoted 3 lines
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...
Quoted 13 lines
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
Quoted 4 lines
_______________________________________________
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>
PATCH 1/1 add pre-build script
Dear Spenser Gilliland,
Quoted 3 lines · Spenser Gilliland
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
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH 1/1 add pre-build script
Quoted 12 lines · Thomas Petazzoni
Dear Spenser Gilliland,
Quoted 3 lines · Spenser Gilliland
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.
Quoted 8 lines
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
Signature · 3 lines
Spenser Gilliland Computer Engineer Doctoral Candidate
PATCH 1/1 add pre-build script
Dear Spenser Gilliland,
Quoted 5 lines · Spenser Gilliland
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.
Quoted 7 lines
I currently do this outside of buildroot and just provide
BR2_TARGET_OPTIMIZATIONon 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
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH 1/1 add pre-build script
Quoted 13 lines · Thomas Petazzoni
Dear Spenser Gilliland,
Quoted 9 lines · Spenser Gilliland
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_OPTIMIZATIONon the make command line from the buildscripts for the hardware.
Quoted 6 lines
Quoted 3 lines
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...
Quoted 2 lines
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...
Quoted 8 lines
So when your pre-build
script gets executed by Buildroot, make has already loaded the value ofBR2_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
Signature · 6 lines
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
PATCH 1/1 add pre-build script
Dear Arnout Vandecappelle,
Quoted 4 lines · Arnout Vandecappelle
Quoted 2 lines
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" <[email protected]> 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
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
PATCH 1/1 add pre-build script
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
Quoted 28 lines · Thomas Petazzoni
Dear Arnout Vandecappelle,
Quoted 4 lines · Arnout Vandecappelle
Quoted 2 lines
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" <[email protected]> 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
Signature · 3 lines
Spenser Gilliland Computer Engineer Doctoral Candidate
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 add pre-build script. Patch v2
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
Quoted 3 lines · Joe Halpin
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
Quoted 13 lines
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
Quoted 3 lines
/opt/dev/<project>/trunk/module1 (module2 ...)
But the path to a tag would have to be at the same level, so we wind
up
Quoted 7 lines
with
/opt/dev/<project>/tags/module1-v1
module1-v2 module2-v1 module2-v2
Quoted 8 lines
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
Quoted 9 lines
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 theTARGET_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
Quoted 4 lines
doesn't quote things properly.
Thanks
Joe
Quoted 9 lines
-----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 scriptQuoted 1 line · Joe Halpin
This is a patch to add a pre-build script, which runs before the
build
Quoted 9 lines
Quoted 3 lines
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.
Quoted 7 lines
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,
Quoted 12 lines
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
Signature · 6 lines
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
PATCH 1/1 add pre-build scrip. Patch V2
In reply to Arnout VandecappelleHere'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
Makefile +0 -0
@@ -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)
system/Config.in +0 -0
@@ -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
Quoted 4 lines · Joe Halpin
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
Signature · 6 lines
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