xref: /OK3568_Linux_fs/buildroot/docs/manual/debugging-buildroot.txt (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun// -*- mode:doc; -*-
2*4882a593Smuzhiyun// vim: set syntax=asciidoc:
3*4882a593Smuzhiyun
4*4882a593Smuzhiyun[[debugging-buildroot]]
5*4882a593Smuzhiyun
6*4882a593Smuzhiyun== Debugging Buildroot
7*4882a593Smuzhiyun
8*4882a593SmuzhiyunIt is possible to instrument the steps +Buildroot+ does when building
9*4882a593Smuzhiyunpackages. Define the variable +BR2_INSTRUMENTATION_SCRIPTS+ to contain
10*4882a593Smuzhiyunthe path of one or more scripts (or other executables), in a
11*4882a593Smuzhiyunspace-separated list, you want called before and after each step. The
12*4882a593Smuzhiyunscripts are called in sequence, with three parameters:
13*4882a593Smuzhiyun
14*4882a593Smuzhiyun  - +start+ or +end+ to denote the start (resp. the end) of a step;
15*4882a593Smuzhiyun  - the name of the step about to be started, or which just ended;
16*4882a593Smuzhiyun  - the name of the package.
17*4882a593Smuzhiyun
18*4882a593SmuzhiyunFor example :
19*4882a593Smuzhiyun
20*4882a593Smuzhiyun----
21*4882a593Smuzhiyunmake BR2_INSTRUMENTATION_SCRIPTS="/path/to/my/script1 /path/to/my/script2"
22*4882a593Smuzhiyun----
23*4882a593Smuzhiyun
24*4882a593SmuzhiyunThe list of steps is:
25*4882a593Smuzhiyun
26*4882a593Smuzhiyun  - +extract+
27*4882a593Smuzhiyun  - +patch+
28*4882a593Smuzhiyun  - +configure+
29*4882a593Smuzhiyun  - +build+
30*4882a593Smuzhiyun  - +install-host+, when a host-package is installed in +$(HOST_DIR)+
31*4882a593Smuzhiyun  - +install-target+, when a target-package is installed in +$(TARGET_DIR)+
32*4882a593Smuzhiyun  - +install-staging+, when a target-package is installed in +$(STAGING_DIR)+
33*4882a593Smuzhiyun  - +install-image+, when a target-package installs files in +$(BINARIES_DIR)+
34*4882a593Smuzhiyun
35*4882a593SmuzhiyunThe script has access to the following variables:
36*4882a593Smuzhiyun
37*4882a593Smuzhiyun  - +BR2_CONFIG+: the path to the Buildroot .config file
38*4882a593Smuzhiyun  - +HOST_DIR+, +STAGING_DIR+, +TARGET_DIR+: see
39*4882a593Smuzhiyun    xref:generic-package-reference[]
40*4882a593Smuzhiyun  - +BUILD_DIR+: the directory where packages are extracted and built
41*4882a593Smuzhiyun  - +BINARIES_DIR+: the place where all binary files (aka images) are
42*4882a593Smuzhiyun    stored
43*4882a593Smuzhiyun  - +BASE_DIR+: the base output directory
44