xref: /OK3568_Linux_fs/buildroot/docs/manual/customize-post-image.txt (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1// -*- mode:doc; -*-
2// vim: set syntax=asciidoc:
3
4=== Customization _after_ the images have been created
5
6While post-build scripts (xref:rootfs-custom[]) are run _before_
7building the filesystem image, kernel and bootloader, *post-image
8scripts* can be used to perform some specific actions _after_ all images
9have been created.
10
11Post-image scripts can for example be used to automatically extract your
12root filesystem tarball in a location exported by your NFS server, or
13to create a special firmware image that bundles your root filesystem and
14kernel image, or any other custom action required for your project.
15
16To enable this feature, specify a space-separated list of post-image
17scripts in config option +BR2_ROOTFS_POST_IMAGE_SCRIPT+ (in the +System
18configuration+ menu). If you specify a relative path, it will be
19relative to the root of the Buildroot tree.
20
21Just like post-build scripts, post-image scripts are run with the main
22Buildroot tree as current working directory. The path to the +images+
23output directory is passed as the first argument to each script. If the
24config option +BR2_ROOTFS_POST_SCRIPT_ARGS+ is not empty, these
25arguments will be passed to the script too. All the scripts will be
26passed the exact same set of arguments, it is not possible to pass
27different sets of arguments to each script.
28
29Again just like for the post-build scripts, the scripts have access to
30the environment variables +BR2_CONFIG+, +HOST_DIR+, +STAGING_DIR+,
31+TARGET_DIR+, +BUILD_DIR+, +BINARIES_DIR+, +CONFIG_DIR+ and
32+BASE_DIR+.
33
34The post-image scripts will be executed as the user that executes
35Buildroot, which should normally _not_ be the root user. Therefore, any
36action requiring root permissions in one of these scripts will require
37special handling (usage of fakeroot or sudo), which is left to the
38script developer.
39