customize-post-image.adoc 2.0 KB

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