Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [Feature Request] script to run after build completion
@ 2011-06-08 20:40 Alper Yıldırım
  2011-06-08 22:30 ` Steve Calfee
  2011-06-09 11:21 ` Bjørn Forsman
  0 siblings, 2 replies; 10+ messages in thread
From: Alper Yıldırım @ 2011-06-08 20:40 UTC (permalink / raw)
  To: buildroot

Hello,

A feature i want to see in buildroot is to have a post build script to
run after image creation process, in other words just before "make"
returns to console. This way i can put my post build commands inside
this script. It will definitely ease my buildroot usage.

Some examples to put in this script are:

- Printing some king of a "build completed" message,
- Printing build time,
- Nfs directory creation from rootfs.tar file,
- Copying necessary images to some other locations,
- Playing some sound when build is completed.

Also, it will be nice to pass a build failed/completed parameter to
this script, so different actions could be taken, (i.e. different
sounds could be played)

What do you think about this Thomas?

Cheers
Alper

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [Feature Request] script to run after build completion
  2011-06-08 20:40 [Buildroot] [Feature Request] script to run after build completion Alper Yıldırım
@ 2011-06-08 22:30 ` Steve Calfee
  2011-06-09 11:23   ` Bjørn Forsman
  2011-06-09 11:21 ` Bjørn Forsman
  1 sibling, 1 reply; 10+ messages in thread
From: Steve Calfee @ 2011-06-08 22:30 UTC (permalink / raw)
  To: buildroot

On 06/08/11 13:40, Alper Y?ld?r?m wrote:
> Hello,
> 
> A feature i want to see in buildroot is to have a post build script to
> run after image creation process, in other words just before "make"
> returns to console. This way i can put my post build commands inside
> this script. It will definitely ease my buildroot usage.
> 

Hi Alper,

Yes a post build script is useful. enter your script path in menuconfig
target_filesystem_options -->

It becomes in your .config something like:
BR2_ROOTFS_POST_BUILD_SCRIPT=
"$(TOPDIR)/target/device/beagleboard/patchrootfs.sh"

Regards, Steve

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [Feature Request] script to run after build completion
  2011-06-08 20:40 [Buildroot] [Feature Request] script to run after build completion Alper Yıldırım
  2011-06-08 22:30 ` Steve Calfee
@ 2011-06-09 11:21 ` Bjørn Forsman
  2011-06-09 19:35   ` Alper Yıldırım
  1 sibling, 1 reply; 10+ messages in thread
From: Bjørn Forsman @ 2011-06-09 11:21 UTC (permalink / raw)
  To: buildroot

2011/6/8 Alper Y?ld?r?m <yildirimalper@gmail.com>:
> Hello,
>
> A feature i want to see in buildroot is to have a post build script to
> run after image creation process, in other words just before "make"
> returns to console. This way i can put my post build commands inside
> this script. It will definitely ease my buildroot usage.
>
> Some examples to put in this script are:
>
> - Printing some king of a "build completed" message,
> - Printing build time,
> - Nfs directory creation from rootfs.tar file,
> - Copying necessary images to some other locations,
> - Playing some sound when build is completed.
>
> Also, it will be nice to pass a build failed/completed parameter to
> this script, so different actions could be taken, (i.e. different
> sounds could be played)

I do this on the command line:

make && echo Buildroot success || echo Buildroot error

You can easily extend this by creating a small script, e.g. build.sh:

----8<----
#!/bin/sh

handle_success()
{
  echo Buildroot built successfully
  # ...
}

handle_failure()
{
  echo Buildroot failed
  # ...
}

make && handle_success || handle_failure
----8<----

Best regards,
Bj?rn Forsman

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [Feature Request] script to run after build completion
  2011-06-08 22:30 ` Steve Calfee
@ 2011-06-09 11:23   ` Bjørn Forsman
  2011-06-09 15:55     ` Steve Calfee
  0 siblings, 1 reply; 10+ messages in thread
From: Bjørn Forsman @ 2011-06-09 11:23 UTC (permalink / raw)
  To: buildroot

2011/6/9 Steve Calfee <stevecalfee@gmail.com>:
> On 06/08/11 13:40, Alper Y?ld?r?m wrote:
>> Hello,
>>
>> A feature i want to see in buildroot is to have a post build script to
>> run after image creation process, in other words just before "make"
>> returns to console. This way i can put my post build commands inside
>> this script. It will definitely ease my buildroot usage.
>>
>
> Hi Alper,
>
> Yes a post build script is useful. enter your script path in menuconfig
> target_filesystem_options -->
>
> It becomes in your .config something like:
> BR2_ROOTFS_POST_BUILD_SCRIPT=
> "$(TOPDIR)/target/device/beagleboard/patchrootfs.sh"

BR2_ROOTFS_POST_BUILD_SCRIPT is run before image creation, not after
(so you can change the rootfs before it is packaged). So I don't think
it is the right solution.

Best regards,
Bj?rn Forsman

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [Feature Request] script to run after build completion
  2011-06-09 11:23   ` Bjørn Forsman
@ 2011-06-09 15:55     ` Steve Calfee
  0 siblings, 0 replies; 10+ messages in thread
From: Steve Calfee @ 2011-06-09 15:55 UTC (permalink / raw)
  To: buildroot

2011/6/9 Bj?rn Forsman <bjorn.forsman@gmail.com>:
>
> BR2_ROOTFS_POST_BUILD_SCRIPT is run before image creation, not after
> (so you can change the rootfs before it is packaged). So I don't think
> it is the right solution.
>
> Best regards,
> Bj?rn Forsman
>

OK, I see. When I build and want to extract to nfs etc, I put my
buildroot make inside a shell script, if it returns success I then do
the unpacking and copying (uImage).

Steve

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [Feature Request] script to run after build completion
  2011-06-09 11:21 ` Bjørn Forsman
@ 2011-06-09 19:35   ` Alper Yıldırım
  0 siblings, 0 replies; 10+ messages in thread
From: Alper Yıldırım @ 2011-06-09 19:35 UTC (permalink / raw)
  To: buildroot

Thanks for the tip Bjorn.
I can use this method until such a feature is implemented.

2011/6/9 Bj?rn Forsman <bjorn.forsman@gmail.com>:
> 2011/6/8 Alper Y?ld?r?m <yildirimalper@gmail.com>:
>> Hello,
>>
>> A feature i want to see in buildroot is to have a post build script to
>> run after image creation process, in other words just before "make"
>> returns to console. This way i can put my post build commands inside
>> this script. It will definitely ease my buildroot usage.
>>
>> Some examples to put in this script are:
>>
>> - Printing some king of a "build completed" message,
>> - Printing build time,
>> - Nfs directory creation from rootfs.tar file,
>> - Copying necessary images to some other locations,
>> - Playing some sound when build is completed.
>>
>> Also, it will be nice to pass a build failed/completed parameter to
>> this script, so different actions could be taken, (i.e. different
>> sounds could be played)
>
> I do this on the command line:
>
> make && echo Buildroot success || echo Buildroot error
>
> You can easily extend this by creating a small script, e.g. build.sh:
>
> ----8<----
> #!/bin/sh
>
> handle_success()
> {
> ?echo Buildroot built successfully
> ?# ...
> }
>
> handle_failure()
> {
> ?echo Buildroot failed
> ?# ...
> }
>
> make && handle_success || handle_failure
> ----8<----
>
> Best regards,
> Bj?rn Forsman
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [Feature Request] script to run after build completion
@ 2013-01-16 17:07 Stephan Hoffmann
  2013-01-19 10:54 ` Arnout Vandecappelle
  0 siblings, 1 reply; 10+ messages in thread
From: Stephan Hoffmann @ 2013-01-16 17:07 UTC (permalink / raw)
  To: buildroot

Hello all,

I am picking up a feature request from 2011, because I am currently in a
situation where I could use the proposed feature.

Alper Y?ld?r?m wrote on 8 Jun 2011 22:40
> Hello,
>
> A feature i want to see in buildroot is to have a post build script to
> run after image creation process, in other words just before "make"
> returns to console. This way i can put my post build commands inside
> this script. It will definitely ease my buildroot usage.
>
> Some examples to put in this script are:
>
> - Printing some king of a "build completed" message,
> - Printing build time,
> - Nfs directory creation from rootfs.tar file,
> - Copying necessary images to some other locations,
- any other kind of project/board specific post processing
> - Playing some sound when build is completed.
>
> Also, it will be nice to pass a build failed/completed parameter to
> this script, so different actions could be taken, (i.e. different
> sounds could be played)
I would rather think of a hook that only gets called after successful
image completion.
>
> What do you think about this Thomas?
>
> Cheers
> Alper

I tried to implement such a hook, but did not find the right place.
Could anybody give me a hint?

Kind regards

Stephan

-- 
reLinux     -    Stephan Hoffmann
Am Schmidtgrund 124    50765 K?ln
Tel. +49.221.95595-19    Fax: -64
www.reLinux.de     sho at reLinux.de

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [Feature Request] script to run after build completion
  2013-01-16 17:07 Stephan Hoffmann
@ 2013-01-19 10:54 ` Arnout Vandecappelle
  2013-01-21  5:27   ` Jérôme Pouiller
  0 siblings, 1 reply; 10+ messages in thread
From: Arnout Vandecappelle @ 2013-01-19 10:54 UTC (permalink / raw)
  To: buildroot

On 16/01/13 18:07, Stephan Hoffmann wrote:
> Hello all,
>
> I am picking up a feature request from 2011, because I am currently in a
> situation where I could use the proposed feature.
>
> Alper Y?ld?r?m wrote on 8 Jun 2011 22:40
>> Hello,
>>
>> A feature i want to see in buildroot is to have a post build script to
>> run after image creation process, in other words just before "make"
>> returns to console. This way i can put my post build commands inside
>> this script. It will definitely ease my buildroot usage.
>>
>> Some examples to put in this script are:
>>
>> - Printing some king of a "build completed" message,
>> - Printing build time,
>> - Nfs directory creation from rootfs.tar file,
>> - Copying necessary images to some other locations,
> - any other kind of project/board specific post processing
>> - Playing some sound when build is completed.
>>
>> Also, it will be nice to pass a build failed/completed parameter to
>> this script, so different actions could be taken, (i.e. different
>> sounds could be played)
> I would rather think of a hook that only gets called after successful
> image completion.

  I think this very much falls into the category of featuritis.

  In many situations, you'll want a script around 'make' to automate 
things beyond what buildroot does. As long as this script only does 
things _before_ and _after_ the 'make' invocation, there is no need for a 
change in buildroot infrastructure. And these top-level scripts are so 
different from project to project that it doesn't make sense to include 
them in buildroot either.

  For example, here's a script that will automatically take a defconfig 
and copy the images to the target:

#! /bin/sh
# Wrapper around make

# We allow running from a foreign directory
topdir="$(dirname $0)"
[ "$topdir" = . ] && output="output/" || outdir="O=$PWD"
MAKE="make -C $topdir $outdir"

if [ ! -e .config ]; then
   $MAKE project_defconfig
fi

echo $MAKE "$@"
$MAKE "$@" || exit $?

imgfiles="${output}images/bzImage ${output}images/rootfs.cpio.bz2"

# Terminate if image files were not generated
for f in $imgfiles; do
    [ -r "$f" ] || exit 1
done

if [ "$TARGET_IP" ]; then
   scp $imgfiles root@$TARGET_IP:/mnt/boot
   ssh root@$TARGET_IP /sbin/reboot
fi


  There is really no need to change buildroot to support this kind of thing.

  Regards,
  Arnout


[snip]

-- 
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] 10+ messages in thread

* [Buildroot] [Feature Request] script to run after build completion
  2013-01-19 10:54 ` Arnout Vandecappelle
@ 2013-01-21  5:27   ` Jérôme Pouiller
  2013-01-24  6:26     ` Arnout Vandecappelle
  0 siblings, 1 reply; 10+ messages in thread
From: Jérôme Pouiller @ 2013-01-21  5:27 UTC (permalink / raw)
  To: buildroot

Hello Arnout,

On Saturday 19 January 2013 11:54:37 Arnout Vandecappelle wrote:
> On 16/01/13 18:07, Stephan Hoffmann wrote:
> > Hello all,
> > 
> > I am picking up a feature request from 2011, because I am currently in a
> > situation where I could use the proposed feature.
> > 
> > Alper Y?ld?r?m wrote on 8 Jun 2011 22:40
> > 
> >> Hello,
> >> 
> >> A feature i want to see in buildroot is to have a post build script to
> >> run after image creation process, in other words just before "make"
> >> returns to console. This way i can put my post build commands inside
> >> this script. It will definitely ease my buildroot usage.
[...]
> > 
> > I would rather think of a hook that only gets called after successful
> > image completion.
> 
>   I think this very much falls into the category of featuritis.
> 
>   In many situations, you'll want a script around 'make' to automate
> things beyond what buildroot does. As long as this script only does
> things _before_ and _after_ the 'make' invocation, there is no need for a
> change in buildroot infrastructure. And these top-level scripts are so
> different from project to project that it doesn't make sense to include
> them in buildroot either.
Stephan does not suggest to include these scripts in Buildroot, but just add 
needed framework.

>   For example, here's a script that will automatically take a defconfig
> and copy the images to the target:
> 
> #! /bin/sh
> # Wrapper around make
> 
> # We allow running from a foreign directory
> topdir="$(dirname $0)"
> [ "$topdir" = . ] && output="output/" || outdir="O=$PWD"
> MAKE="make -C $topdir $outdir"
> 
> if [ ! -e .config ]; then
>    $MAKE project_defconfig
> fi
> 
> echo $MAKE "$@"
> $MAKE "$@" || exit $?
> 
> imgfiles="${output}images/bzImage ${output}images/rootfs.cpio.bz2"
> 
> # Terminate if image files were not generated
> for f in $imgfiles; do
>     [ -r "$f" ] || exit 1
> done
> 
> if [ "$TARGET_IP" ]; then
>    scp $imgfiles root@$TARGET_IP:/mnt/boot
>    ssh root@$TARGET_IP /sbin/reboot
> fi
> 
> 
>   There is really no need to change buildroot to support this kind of thing.
This script is not trivial in comparison to post-build.sh. Buildroot should 
deliver a template of it... 

In add, user can continue to run make without running this script (especially 
since this script does not appear in output/ directory). 

IMHO, external script is not right answer and feature asked by Stephan make 
sense.

-- 
J?r?me Pouiller

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Buildroot] [Feature Request] script to run after build completion
  2013-01-21  5:27   ` Jérôme Pouiller
@ 2013-01-24  6:26     ` Arnout Vandecappelle
  0 siblings, 0 replies; 10+ messages in thread
From: Arnout Vandecappelle @ 2013-01-24  6:26 UTC (permalink / raw)
  To: buildroot

On 01/21/13 06:27, J?r?me Pouiller wrote:
> Hello Arnout,
>
> On Saturday 19 January 2013 11:54:37 Arnout Vandecappelle wrote:
[snip]
>>    For example, here's a script that will automatically take a defconfig
>> and copy the images to the target:
>>
>> #! /bin/sh
>> # Wrapper around make
>>
>> # We allow running from a foreign directory
>> topdir="$(dirname $0)"
>> [ "$topdir" = . ]&&  output="output/" || outdir="O=$PWD"
>> MAKE="make -C $topdir $outdir"
>>
>> if [ ! -e .config ]; then
>>     $MAKE project_defconfig
>> fi
>>
>> echo $MAKE "$@"
>> $MAKE "$@" || exit $?
>>
>> imgfiles="${output}images/bzImage ${output}images/rootfs.cpio.bz2"
>>
>> # Terminate if image files were not generated
>> for f in $imgfiles; do
>>      [ -r "$f" ] || exit 1
>> done
>>
>> if [ "$TARGET_IP" ]; then
>>     scp $imgfiles root@$TARGET_IP:/mnt/boot
>>     ssh root@$TARGET_IP /sbin/reboot
>> fi
>>
>>
>>    There is really no need to change buildroot to support this kind of thing.
 >
> This script is not trivial in comparison to post-build.sh. Buildroot should
> deliver a template of it...

  Eh? First of all, the proposed change would not be enough to support a 
script like the above, because the first part (automatically setting O= 
and automatically running a defconfig) is missing. So the only thing that 
could be done by the post-build script is everything starting from the 
line "imgfiles=..." That leaves just two lines of script that become 
redundant with the post-build infrastructure:

echo $MAKE "$@"
$MAKE "$@" || exit $?



> In add, user can continue to run make without running this script (especially
> since this script does not appear in output/ directory).

  If you tell the user to use that script to do the build, he won't even 
know about 'make'.

> IMHO, external script is not right answer and feature asked by Stephan make
> sense.

  It does make sense. I just think that other, much more useful things 
have been rejected in the past (e.g. the rsync filesystem, the split 
Config.in that allows extra packages to be added)


  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] 10+ messages in thread

end of thread, other threads:[~2013-01-24  6:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-08 20:40 [Buildroot] [Feature Request] script to run after build completion Alper Yıldırım
2011-06-08 22:30 ` Steve Calfee
2011-06-09 11:23   ` Bjørn Forsman
2011-06-09 15:55     ` Steve Calfee
2011-06-09 11:21 ` Bjørn Forsman
2011-06-09 19:35   ` Alper Yıldırım
  -- strict thread matches above, loose matches on Subject: below --
2013-01-16 17:07 Stephan Hoffmann
2013-01-19 10:54 ` Arnout Vandecappelle
2013-01-21  5:27   ` Jérôme Pouiller
2013-01-24  6:26     ` Arnout Vandecappelle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox