blob: 67a6c0e5270aa13e0e03e6123dd24d1071a93823 [file] [log] [blame] [view]
sbc30e47282016-03-04 01:29:581# Linux sysroot images
2
3The chromium build system for Linux will (by default) use a sysroot image
4rather than building against the libraries installed on the host system.
5This serves several purposes. Firstly, it ensures that binaries will run on all
6supported linux systems independent of the packages installed on the build
7machine. Secondly, it makes the build more hermetic, preventing issues that
8arise for variations among developers' systems.
9
10The sysroot consists of a minimal installation of Debian/stable (or old-stable)
11to ensure maximum compatibility. Pre-built sysroot images are stored in
12Google Cloud Storage and downloaded during `gclient runhooks`
13
14## Installing the sysroot images
15
16Installation of the sysroot is performed by
17`build/linux/sysroot_scripts/install-sysroot.py`.
18
19This script can be run manually but is normally run as part of gclient
20hooks. When run from hooks this script in a no-op on non-linux platforms.
21
22## Rebuilding the sysroot image
23
24The pre-built sysroot images occasionally needs to be rebuilt. For example,
qyearsleyc0dc6f42016-12-02 22:13:3925when security updates to Debian are released, or when a new package is needed by
thomasanderson99d60d82016-12-15 23:35:1826the chromium build. If you just want to update the sysroots without adding any
27new packages, skip to `Using build_and_upload.py`.
28
29### Adding new packages
30
31To add a new package, edit the `sysroot-creator-*.sh` scripts and modify the
32`DEBIAN_PACKAGES` list, then run the update step (`UpdatePackageListsAll`). The
Tom Anderson015a8b82017-11-14 23:48:5033steps below will use `sysroot-creator-stretch.sh` as an example.
thomasanderson99d60d82016-12-15 23:35:1834
35### Updating existing package list
36
37To update packages to the latest versions run:
38
Tom Anderson015a8b82017-11-14 23:48:5039 $ ./sysroot-creator-stretch.sh UpdatePackageListsAll
thomasanderson99d60d82016-12-15 23:35:1840
41This command will update the package lists that are stored alongside the script.
42If no packages have changed then this script will have no effect.
sbc30e47282016-03-04 01:29:5843
44### Rebuilding
45
46To rebuild the images (without any changes) run the following commands:
47
48 $ cd build/linux/sysroot_scripts
Tom Anderson015a8b82017-11-14 23:48:5049 $ ./sysroot-creator-stretch.sh BuildSysrootAll
sbc30e47282016-03-04 01:29:5850
51The above command will rebuild the sysroot for all architectures. To build
52just one architecture use `BuildSysroot<arch>`. Run the script with no
53arguments for a list of possible architectures. For example:
54
Tom Anderson015a8b82017-11-14 23:48:5055 $ ./sysroot-creator-stretch.sh BuildSysrootAmd64
sbc30e47282016-03-04 01:29:5856
57This command on its own should be a no-op and produce an image identical to
58the one on Google Cloud Storage.
59
sbc30e47282016-03-04 01:29:5860### Uploading new images
61
62To upload images to Google Cloud Storage run the following command:
63
Tom Anderson015a8b82017-11-14 23:48:5064 $ ./sysroot-creator-stretch.sh UploadSysrootAll <SHA1>
sbc30e47282016-03-04 01:29:5865
66Here you should use the SHA1 of the git revision at which the images were
67created.
68
69Uploading new images to Google Clound Storage requires write permission on the
70`chrome-linux-sysroot` bucket.
71
72### Rolling the sysroot version used by chromium
73
thomasanderson99d60d82016-12-15 23:35:1874Once new images have been uploaded, the `sysroots.json` file needs to be updated
75to reference the new versions. This process is manual and involves updating the
76`Revision` and `Sha1Sum` values in the file.
77
78### Using `build-and-upload.py`
79
80The `build_and_upload.py` script automates the above four steps. It is
81recommended to use this just before you're ready to submit your CL, after you've
82already tested one of the updated sysroots on your local configuration. Build
83or upload failures will not produce detailed output, but will list the script
84and arguments that caused the failure. To debug this, you must run the failing
85command manually. This script requires Google Cloud Storage write permission on
86the `chrome-linux-sysroot` bucket.