kumquat-buildroot/docs/manual/customize-post-image.adoc
Heiko Thiery b7cc572208 Add BR2_ROOTFS_{PRE_BUILD|POST_{BUILD|FAKEROOT|IMAGE}}_SCRIPT_ARGS
Currently, one may only specify one list of arguments that are passed to
several scripts (BR2_ROOTFS_PRE_BUILD_SCRIPT, BR2_ROOTFS_POST_BUILD_SCRIPT,
BR2_ROOTFS_POST_FAKEROOT_SCRIPT and BR2_ROOTFS_POST_IMAGE_SCRIPT_ARGS).

So one has to be careful that the arguments for these scripts do noti
collide.

To allow specifiying dedicated arguments to each type of scripts, new
config options are introduced. For backward compatibility the value of
BR2_ROOTFS_POST_SCRIPT_ARGS is still passed to the scripts. But now one
can add specific arguments from the new config option.

Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com>
[yann.morin.1998@free.fr:
  - mention common args in help texts
  - slight coding style beautification
  - slight rewording in commit log
]
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2024-03-28 21:47:04 +01:00

44 lines
2.0 KiB
Plaintext

// -*- mode:doc; -*-
// vim: set syntax=asciidoc:
=== Customization _after_ the images have been created
While post-build scripts (xref:rootfs-custom[]) are run _before_
building the filesystem image, kernel and bootloader, *post-image
scripts* can be used to perform some specific actions _after_ all images
have been created.
Post-image scripts can for example be used to automatically extract your
root filesystem tarball in a location exported by your NFS server, or
to create a special firmware image that bundles your root filesystem and
kernel image, or any other custom action required for your project.
To enable this feature, specify a space-separated list of post-image
scripts in config option +BR2_ROOTFS_POST_IMAGE_SCRIPT+ (in the +System
configuration+ menu). If you specify a relative path, it will be
relative to the root of the Buildroot tree.
Just like post-build scripts, post-image scripts are run with the main
Buildroot tree as current working directory. The path to the +images+
output directory is passed as the first argument to each script. If the
config option +BR2_ROOTFS_POST_SCRIPT_ARGS+ is not empty, these
arguments will be passed to the script too. All the scripts will be
passed the exact same set of arguments, it is not possible to pass
different sets of arguments to each script.
Note that the arguments from +BR2_ROOTFS_POST_SCRIPT_ARGS+ will also be
passed to post-build and post-fakeroot scripts. If you want to use
arguments that are only used for the post-image scripts you can use
+BR2_ROOTFS_POST_IMAGE_SCRIPT_ARGS+.
Again just like for the post-build scripts, the scripts have access to
the environment variables +BR2_CONFIG+, +HOST_DIR+, +STAGING_DIR+,
+TARGET_DIR+, +BUILD_DIR+, +BINARIES_DIR+, +CONFIG_DIR+ and
+BASE_DIR+.
The post-image scripts will be executed as the user that executes
Buildroot, which should normally _not_ be the root user. Therefore, any
action requiring root permissions in one of these scripts will require
special handling (usage of fakeroot or sudo), which is left to the
script developer.