Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Stefan Fröberg" <stefan.froberg@petroprogram.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/5] Add a post-image script mechanism
Date: Wed, 16 Jan 2013 21:22:41 +0200	[thread overview]
Message-ID: <50F6FE01.2080205@petroprogram.com> (raw)
In-Reply-To: <1358363393-29977-2-git-send-email-thomas.petazzoni@free-electrons.com>

16.1.2013 21:09, Thomas Petazzoni kirjoitti:
> Just like we have a post-build script mechanism that gets executed
> after the build of all packages but before the creation of the
> filesystem images, let's introduce a post-image script mechanism, that
> gets executed once all filesystem images have been generated.
>
> This can for example be used to call a tool building a firmware image
> from different images generated by Buildroot, or automatically extract
> the tarball root filesystem image into some location exported by NFS,
> or any other custom action.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
>  Makefile         |    9 +++++++++
>  system/Config.in |   18 ++++++++++++++++++
>  2 files changed, 27 insertions(+)
>
> diff --git a/Makefile b/Makefile
> index 6f8ed0e..88b5a85 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -353,6 +353,8 @@ endif
>  
>  include fs/common.mk
>  
> +TARGETS+=target-post-image
> +
>  TARGETS_CLEAN:=$(patsubst %,%-clean,$(TARGETS))
>  TARGETS_SOURCE:=$(patsubst %,%-source,$(TARGETS) $(BASE_TARGETS))
>  TARGETS_DIRCLEAN:=$(patsubst %,%-dirclean,$(TARGETS))
> @@ -548,6 +550,13 @@ target-generatelocales: host-localedef
>  	done
>  endif
>  
> +target-post-image:
> +ifneq ($(BR2_ROOTFS_POST_IMAGE_SCRIPT),)
> +	@$(call MESSAGE,"Executing post-image script\(s\)")
> +	@$(foreach s, $(call qstrip,$(BR2_ROOTFS_POST_IMAGE_SCRIPT)), \
> +		$(s) $(BINARIES_DIR)$(sep))
> +endif
> +
>  toolchain-eclipse-register:
>  	./support/scripts/eclipse-register-toolchain `readlink -f $(O)` $(notdir $(TARGET_CROSS)) $(BR2_ARCH)
>  
> diff --git a/system/Config.in b/system/Config.in
> index 69863c4..1ffe8a0 100644
> --- a/system/Config.in
> +++ b/system/Config.in
> @@ -265,4 +265,22 @@ config BR2_ROOTFS_POST_BUILD_SCRIPT
>  	  only argument. Make sure the exit code of those scripts are 0,
>  	  otherwise make will stop after calling them.
>  
> +config BR2_ROOTFS_POST_IMAGE_SCRIPT
> +	string "Custom script to run after creating filesystem images"
> +	default ""
> +	help
> +	  Specify a space-separated list of scripts to be run after
> +	  the build has finished and after Buildroot has packed the
> +	  files into selected filesystem images.
> +
> +	  This can for example be used to call a tool building a
> +	  firmware image from different images generated by Buildroot,
> +	  or automatically extract the tarball root filesystem image
> +	  into some location exported by NFS, or any other custom
> +	  action.
> +
> +	  These scripts are called with the images directory name as
> +	  first and only argument. The script is executed from the
> +	  main Buildroot source directory as the current directory.
> +
>  endmenu

Nice.  I know exactly what Im going to use this mechanism for.

Packing target binaries with UPX (http://upx.sourceforge.net/) at the
end of image creation.

Every byte counts :-)

Regards
Stefan

  reply	other threads:[~2013-01-16 19:22 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-16 19:09 [Buildroot] Post-image script feature and other related fixes Thomas Petazzoni
2013-01-16 19:09 ` [Buildroot] [PATCH 1/5] Add a post-image script mechanism Thomas Petazzoni
2013-01-16 19:22   ` Stefan Fröberg [this message]
2013-01-16 20:03   ` Yann E. MORIN
2013-01-16 21:41     ` Thomas Petazzoni
2013-01-16 22:06       ` Yann E. MORIN
2013-01-17  8:14         ` Jeremy Rosen
2013-01-25 18:48   ` Yann E. MORIN
2013-01-29 16:27   ` Luca Ceresoli
2013-01-16 19:09 ` [Buildroot] [PATCH 2/5] docs/manual: mention the new post-image mechanism Thomas Petazzoni
2013-01-16 20:06   ` Yann E. MORIN
2013-01-16 21:42     ` Thomas Petazzoni
2013-01-25 18:50   ` Yann E. MORIN
2013-01-29 16:27   ` Luca Ceresoli
2013-01-16 19:09 ` [Buildroot] [PATCH 3/5] package/customize: remove Thomas Petazzoni
2013-01-19 12:51   ` Arnout Vandecappelle
2013-01-25 18:35   ` Yann E. MORIN
2013-01-29 16:27   ` Luca Ceresoli
2013-01-16 19:09 ` [Buildroot] [PATCH 4/5] docs/manual: no longer mention the package/customize thing Thomas Petazzoni
2013-01-16 20:10   ` Yann E. MORIN
2013-01-25 18:32   ` Yann E. MORIN
2013-01-29 16:27   ` Luca Ceresoli
2013-01-16 19:09 ` [Buildroot] [PATCH 5/5] docs/manual: slightly reword the solutions to customize rootfs Thomas Petazzoni
2013-01-25 18:31   ` Yann E. MORIN
2013-01-29 16:27   ` Luca Ceresoli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50F6FE01.2080205@petroprogram.com \
    --to=stefan.froberg@petroprogram.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox