| 1 | abuild |
| 2 | ====== |
| 3 | |
| 4 | This utility is a great tool to check whether your coreboot tree |
| 5 | compiles for one or all targets. It compiles the 'default' build for a |
| 6 | mainboard. This is roughly equivalent to removing the .config file, |
| 7 | running `make menuconfig`, selecting the manufacturer and mainboard, |
| 8 | then saving the config without making any other changes. |
| 9 | |
| 10 | It is run on all patches submitted via gerrit as part of the process. |
| 11 | Before submitting a patch, it is a very good idea to run abuild first |
| 12 | to make sure your patch compiles cleanly for all. |
| 13 | |
| 14 | Note that abuild is a tool to do a simple build test, and binaries it |
| 15 | produces may well not boot if flashed to a system. |
| 16 | |
| 17 | ## Basic usage |
| 18 | |
| 19 | abuild needs to be run from the coreboot directory. If you cd into the |
| 20 | coreboot/util/abuild directory and try to run it from there, it will |
| 21 | not run correctly. |
| 22 | |
| 23 | If you invoke abuild with no parameters, it will build all boards |
| 24 | automatically. |
| 25 | |
| 26 | You can also specify a single board to build with the -t option. For |
| 27 | example, to build the Lenovo X230 target, run: |
| 28 | |
| 29 | ```bash |
| 30 | $ util/abuild/abuild -t lenovo/x230 |
| 31 | ``` |
| 32 | |
| 33 | ## Where builds and logs are stored |
| 34 | |
| 35 | The resulting images and logs are stored in directory coreboot-builds/ |
| 36 | under your current directory. This can be overridden with --outdir: |
| 37 | |
| 38 | ```bash |
| 39 | $ util/abuild/abuild --outdir /mnt/portable/coreboot-builds |
| 40 | ``` |
| 41 | |
| 42 | This is useful if you want to divert the build to an external hard |
| 43 | drive, e.g. to keep the solid-state drive holding the coreboot tree |
| 44 | young. |
| 45 | |
| 46 | (We will still refer to this directory as "coreboot-builds" below.) |
| 47 | |
| 48 | After running the X230 build above, the build log will be in |
| 49 | coreboot-builds/LENOVO_X230/make.log. |
| 50 | |
| 51 | For an overview of what passed and what failed, look at |
| 52 | coreboot-builds/passing_boards and coreboot-builds/failing_boards. |
| 53 | **These logs are overwritten with each abuild run.** Save them elsewhere |
| 54 | if you feel a need to reference the results later. |
| 55 | |
| 56 | ## Payloads |
| 57 | |
| 58 | You can also specify a payload directory with -p: |
| 59 | |
| 60 | ```bash |
| 61 | mkdir payloads |
| 62 | cp /somewhere/filo.elf payloads |
| 63 | ``` |
| 64 | |
| 65 | Then add a file payloads/payload.sh which prints the name of the |
| 66 | payload to use (and takes the mainboard as a parameter) such as: |
| 67 | |
| 68 | ```bash |
| 69 | echo "`dirname $0`/build/filo.elf" |
| 70 | ``` |
| 71 | |
| 72 | Then you can build an image with payload by specifying: |
| 73 | |
| 74 | ```bash |
| 75 | util/abuild/abuild -t lenovo/x230 -p ./payloads |
| 76 | ``` |
| 77 | |
| 78 | You can also tell abuild not to use a payload: |
| 79 | |
| 80 | ```bash |
| 81 | util/abuild/abuild -t lenovo/x230 -p none |
| 82 | ``` |
| 83 | |
| 84 | ## Build non-default configurations |
| 85 | |
| 86 | Sometimes you do need to build test a custom, non-default configuration. |
| 87 | This can be accomplished by placing a config file in configs/. |
| 88 | |
| 89 | First, clean your slate with `make distclean` or `rm .config`. |
| 90 | |
| 91 | Then run `make menuconfig`, select the manufacturer and mainboard, and |
| 92 | configure the options you need to test building for. |
| 93 | |
| 94 | Then save a minimal config file omitting options that did not change |
| 95 | from default: |
| 96 | |
| 97 | ```bash |
| 98 | make savedefconfig |
| 99 | ``` |
| 100 | |
| 101 | This file is saved as `defconfig` and can be edited further. |
| 102 | |
| 103 | Now this file can be saved in configs/ which will form the basis of a |
| 104 | custom configuration included in an abuild. However, it needs to be |
| 105 | named in a specific way for abuild to pick it up: |
| 106 | |
| 107 | ``` |
| 108 | config.<board>_<suffix> |
| 109 | ``` |
| 110 | |
| 111 | <board> is effectively the BOARD\_xxx Kconfig option without "BOARD\_". |
| 112 | <suffix> is a free form description of the configuration being built. |
| 113 | |
| 114 | For example, a config for ASUS P8Z77-M PRO that tests building with MRC |
| 115 | raminit code (as opposed to the default native raminit) would be named |
| 116 | `config.asus_p8z77_m_pro_mrc_bin` and contains: |
| 117 | |
| 118 | ``` |
| 119 | CONFIG_VENDOR_ASUS=y |
| 120 | CONFIG_BOARD_ASUS_P8Z77_M_PRO=y |
| 121 | # CONFIG_USE_NATIVE_RAMINIT is not set |
| 122 | CONFIG_CPU_MICROCODE_CBFS_NONE=y |
| 123 | # CONFIG_BOOTBLOCK_CONSOLE is not set |
| 124 | # CONFIG_POSTCAR_CONSOLE is not set |
| 125 | ``` |
| 126 | |
| 127 | For what we are trying to do, not setting USE_NATIVE_RAMINIT is the |
| 128 | important part. The other three optional changes are meant to speed |
| 129 | things up. All these options can be selected during `make menuconfig`. |
| 130 | |
| 131 | Path to MRC binary blob remains default and thus not included here. |
| 132 | |
| 133 | Custom configurations can also be put in a file and applied to an entire |
| 134 | abuild run using -K. Assume for example you are not interested in |
| 135 | the postcar stage at all and just want it to shut up, you can create |
| 136 | a file named `myconfig` with this line: |
| 137 | |
| 138 | ``` |
| 139 | # CONFIG_POSTCAR_CONSOLE is not set |
| 140 | ``` |
| 141 | |
| 142 | and run `abuild -K myconfig` to build everything with a silent postcar |
| 143 | stage. |
| 144 | |
| 145 | ## Selectively build certain targets only (also config file naming caveats) |
| 146 | |
| 147 | The P8Z77-M PRO example above would fail for P8Z77-M, because the |
| 148 | config file name is ambiguous. `abuild` would pick up this config when |
| 149 | building for P8Z77-M, but fails when it sees that this config isn't |
| 150 | meant for P8Z77-M (but for P8Z77-M PRO). To avoid this error, you have |
| 151 | to skip this config using --skip_set: |
| 152 | |
| 153 | ```bash |
| 154 | util/abuild/abuild --skip_set BOARD_ASUS_P8Z77_M_PRO |
| 155 | ``` |
| 156 | |
| 157 | To complete the test, run abuild again specifically for this board |
| 158 | variant (see next section). |
| 159 | |
| 160 | You can skip building other targets based on other Kconfigs. To skip |
| 161 | building targets without a Kconfig set, use --skip_unset: |
| 162 | |
| 163 | ```bash |
| 164 | util/abuild/abuild --skip_unset USE_NATIVE_RAMINIT |
| 165 | ``` |
| 166 | This example skips building configs not using (Sandy/Ivy Bridge) native |
| 167 | RAM init. |
| 168 | |
| 169 | ## Additional Examples |
| 170 | |
| 171 | Many boards have multiple variants. You can build for a specific |
| 172 | variant of a board: |
| 173 | |
| 174 | ```bash |
| 175 | util/abuild/abuild -t asus/p8x7x-series -b p8z77-m_pro -p none |
| 176 | ``` |
| 177 | |
| 178 | Many of the boards need files from the 'blobs' repository, which will |
| 179 | be initialized by the -B option. If the blobs repo has already been |
| 180 | initialized in your local tree, it won't hurt to add the -B. |
| 181 | |
| 182 | ```bash |
| 183 | util/abuild/abuild -B -t lenovo/x230 -p none |
| 184 | ``` |
| 185 | |
| 186 | Adding ccache to your system and telling abuild to use it with the -y |
| 187 | option will speed things up a bit: |
| 188 | |
| 189 | ```bash |
| 190 | util/abuild/abuild -B -y -t lenovo/x230 -p none |
| 191 | ``` |
| 192 | |
| 193 | Telling abuild to use multiple cores with the -c option helps speed |
| 194 | things up as well: |
| 195 | |
| 196 | ```bash |
| 197 | util/abuild/abuild -B -y -c 8 -t lenovo/x230 -p none |
| 198 | ``` |
| 199 | |
| 200 | Of course, the real power of abuild is in testing multiple boards. |
| 201 | |
| 202 | ```bash |
| 203 | util/abuild/abuild -B -y -c 8 -p none |
| 204 | ``` |
| 205 | |
| 206 | ## Full options list |
| 207 | |
| 208 | ```text |
| 209 | coreboot autobuild v0.11.01 (Feb 3, 2023) |
| 210 | [...] |
| 211 | Usage: util/abuild/abuild [options] |
| 212 | util/abuild/abuild [-V|--version] |
| 213 | util/abuild/abuild [-h|--help] |
| 214 | |
| 215 | Options: |
| 216 | [-a|--all] Build previously succeeded ports as well |
| 217 | [-A|--any-toolchain] Use any toolchain |
| 218 | [-b|--board-variant <name>] Build specific board variant under the |
| 219 | given target. |
| 220 | [-B|--blobs] Allow using binary files |
| 221 | [--checksum <path/basefile>] Store checksums at path/basefile |
| 222 | [-c|--cpus <numcpus>] Build on <numcpus> at the same time |
| 223 | [-C|--config] Configure-only mode |
| 224 | [-d|--dir <dir>] Directory containing config files |
| 225 | [-e|--exitcode] Exit with a non-zero errorlevel on failure |
| 226 | [-J|--junit] Write JUnit formatted xml log file |
| 227 | [-K|--kconfig <name>] Prepend file to generated Kconfig |
| 228 | [-l|--loglevel <num>] Set loglevel |
| 229 | [-L|--clang] Use clang on supported arch |
| 230 | [-n|--name] Set build name - also sets xmlfile if not |
| 231 | already set |
| 232 | [-o|--outdir <path>] Store build results in path |
| 233 | (defaults to coreboot-builds) |
| 234 | [-p|--payloads <dir>] Use payloads in <dir> to build images |
| 235 | [-P|--prefix <name>] File name prefix in CBFS |
| 236 | [-q|--quiet] Print fewer messages |
| 237 | [-r|--remove] Remove output dir after build |
| 238 | [-R|--root <path>] Absolute path to coreboot sources |
| 239 | (defaults to /usr/src/coreboot) |
| 240 | [--scan-build] Use clang's static analyzer |
| 241 | [--skip_set <value>] Skip building boards with this Kconfig set |
| 242 | [--skip_unset <value>] Skip building boards with this Kconfig not set |
| 243 | [--timeless] Generate timeless builds |
| 244 | [-t|--target <vendor/board>] Attempt to build target vendor/board only |
| 245 | [-T|--test] Submit image(s) to automated test system |
| 246 | [-u|--update] Update existing image |
| 247 | [-v|--verbose] Print more messages |
| 248 | [-x|--chromeos] Build with CHROMEOS enabled |
| 249 | Skip boards without ChromeOS support |
| 250 | [-X|--xmlfile <name>] Set JUnit XML log file filename |
| 251 | (defaults to /usr/src/coreboot/abuild.xml) |
| 252 | [-y|--ccache] Use ccache |
| 253 | [-z|--clean] Remove build results when finished |
| 254 | [-Z|--clean-somewhat] Remove build but keep coreboot.rom + config |
| 255 | |
| 256 | [-V|--version] Print version number and exit |
| 257 | [-h|--help] Print this help and exit |
| 258 | |
| 259 | [-s|--silent] obsolete |
| 260 | ``` |