3 title: Customizing Your Build
5 https://raw.githubusercontent.com/automotive-grade-linux/docs-sources/master/docs/getting-started/image-workflow-cust-build.md
8 <!-- WARNING: This file is generated by fetch_docs.js using /home/boron/Documents/AGL/docs-webtemplate/site/_data/tocs/getting_started/master/image-development-workflow-getting-started-book.yml -->
10 # 4. Customizing Your Build
12 Because the build process is based on BitBake and the Yocto Project,
13 build customizations are driven through configuration files used during
16 Lots of configuration files exist that define a build.
17 However, the primary one that acts as a global configuration mechanism is the
18 `local.conf` file, which is found in the Build Directory in a folder named "conf".
20 Before you start your build process, you should open up the `local.conf` file
21 and look through it to be sure the general configurations are correct.
22 The file is well commented so you should be able to understand what the
23 various variables accomplish.
25 To view and customize the `local.conf` file, use any text editor:
28 $ vi $AGL_TOP/build/conf/local.conf
31 As mentioned in the "[Initializing Your Build Environment](./image-workflow-initialize-build-environment.html#initializing-your-build-environment.html)" section,
32 the `local.conf` file gets augmented with AGL configuration fragments based on
33 how you execute the `aglsetup.sh` script.
34 You can see those fragments at the end the configuration file.
36 Even though your build should work fine after running the `aglsetup.sh` script,
37 you might consider editing your `local.conf` file to use one or more of the
38 following configurations.
40 ## Capturing Build History
42 You can enable build history to help maintain the quality of your build output.
43 You can use it to highlight unexpected and possibly unwanted changes in the build output.
44 Basically, with build history enabled, you get a record of information about the contents
45 of each package and image.
46 That information is committed to a local Git repository where you can examine it.
48 To enable build history, make sure the following two lines are in your
52 INHERIT += "buildhistory"
53 BUILDHISTORY_COMMIT = "1"
57 "[Maintaining Build Output Quality](https://www.yoctoproject.org/docs/2.4.4/ref-manual/ref-manual.html#maintaining-build-output-quality)"
58 section in the Yocto Project Reference Manual for a complete discussion on
61 ## Deleting Temporary Workspace
63 During a build, the build system uses a lot of disk space to store temporary files.
64 You can ease the burden on your system and speed up the build by configuring the build
65 to remove temporary workspace.
67 You need to inherit the `rm_work` class by using this statement in the `local.conf` file:
73 You can read about the class in the
74 "[rm_work.bbclass](https://www.yoctoproject.org/docs/2.4.4/ref-manual/ref-manual.html#ref-classes-rm-work)"
75 section of the Yocto Project Reference Manual for more information.
77 ## Pointing at Shared State Cache Locations
79 The build system creates everything from scratch unless BitBake can determine that parts do not need to be rebuilt. Fundamentally, building from scratch is attractive as it means all parts are built fresh and there is no possibility of stale data causing problems.
80 When developers hit problems, they typically default back to building from scratch so they know the state
81 of things from the start.
83 The build process uses Shared State Cache (sstate) to speed up subsequent builds.
84 This cache retains artifacts that can be re-used once it is determined that they
85 would not be different as compared to a re-built module.
87 For the AGL build, you can specify the location for sstate files by including the
88 following in the `local.conf` file:
91 SSTATE_DIR = "${HOME}/workspace_agl/sstate-cache"
94 also, in the `local.conf` file, you can specify additional directories in which the build
95 system can look for shared state information.
96 Use the following form in your file to list out the directories you want the build
97 process to look at for sstate information:
102 file://.* http://someserver.tld/share/sstate/PATH;downloadfilename=PATH \n \
103 file://.* file:///some/local/dir/sstate/PATH"
106 If you want to know more about the Yocto Project sstate mechanism, see the
107 "[Shared State Cache](https://www.yoctoproject.org/docs/2.4.4/ref-manual/ref-manual.html#shared-state-cache)"
108 section in the Yocto Project Reference Manual.
110 ## Preserving the Download Directory
112 During the initial build, the system downloads many different source code tarballs
113 from various upstream projects.
114 Downloading these files can take a while, particularly if your network
116 The process downloads files into a
117 "[download directory](https://www.yoctoproject.org/docs/2.4.4/ref-manual/ref-manual.html#var-DL_DIR)".
118 The `DL_DIR` variable defines the download directory.
119 For subsequent builds, you can preserve this directory to speed up the download
122 The default download directory is in a folder named "downloads".
123 For the AGL build you can set the download directory by adding the following to your
127 DL_DIR = "${HOME}/workspace_agl/downloads"
130 ## Using a Shared State (sstate) Mirror
132 The underlying Yocto Project build system uses Shared State Mirrors to cache
133 artifacts from previous builds.
134 You can significantly speed up builds and guard against fetcher failures by
136 To use mirrors, add this line to your `local.conf` file in the Build directory:
139 SSTATE_MIRRORS_append = " file://.* https://download.automotivelinux.org/sstate-mirror/master/${DEFAULTTUNE}/PATH \n "
142 You can learn more about shared state and how it is used in the
143 "[Shared State Cache](https://yoctoproject.org/docs/2.4.4/ref-manual/ref-manual.html#shared-state-cache)"
144 section of the Yocto Project Reference Manual.