sbc | 30e4728 | 2016-03-04 01:29:58 | [diff] [blame] | 1 | # Linux sysroot images |
| 2 | |
| 3 | The chromium build system for Linux will (by default) use a sysroot image |
| 4 | rather than building against the libraries installed on the host system. |
| 5 | This serves several purposes. Firstly, it ensures that binaries will run on all |
| 6 | supported linux systems independent of the packages installed on the build |
| 7 | machine. Secondly, it makes the build more hermetic, preventing issues that |
| 8 | arise for variations among developers' systems. |
| 9 | |
| 10 | The sysroot consists of a minimal installation of Debian/stable (or old-stable) |
| 11 | to ensure maximum compatibility. Pre-built sysroot images are stored in |
| 12 | Google Cloud Storage and downloaded during `gclient runhooks` |
| 13 | |
| 14 | ## Installing the sysroot images |
| 15 | |
| 16 | Installation of the sysroot is performed by |
| 17 | `build/linux/sysroot_scripts/install-sysroot.py`. |
| 18 | |
| 19 | This script can be run manually but is normally run as part of gclient |
| 20 | hooks. When run from hooks this script in a no-op on non-linux platforms. |
| 21 | |
| 22 | ## Rebuilding the sysroot image |
| 23 | |
| 24 | The pre-built sysroot images occasionally needs to be rebuilt. For example, |
qyearsley | c0dc6f4 | 2016-12-02 22:13:39 | [diff] [blame] | 25 | when security updates to Debian are released, or when a new package is needed by |
thomasanderson | 99d60d8 | 2016-12-15 23:35:18 | [diff] [blame] | 26 | the chromium build. If you just want to update the sysroots without adding any |
| 27 | new packages, skip to `Using build_and_upload.py`. |
| 28 | |
| 29 | ### Adding new packages |
| 30 | |
| 31 | To add a new package, edit the `sysroot-creator-*.sh` scripts and modify the |
Tom Anderson | 0cfed476 | 2018-10-09 19:46:36 | [diff] [blame^] | 32 | `DEBIAN_PACKAGES` list. |
sbc | 30e4728 | 2016-03-04 01:29:58 | [diff] [blame] | 33 | |
| 34 | ### Rebuilding |
| 35 | |
| 36 | To rebuild the images (without any changes) run the following commands: |
| 37 | |
| 38 | $ cd build/linux/sysroot_scripts |
Tom Anderson | 015a8b8 | 2017-11-14 23:48:50 | [diff] [blame] | 39 | $ ./sysroot-creator-stretch.sh BuildSysrootAll |
sbc | 30e4728 | 2016-03-04 01:29:58 | [diff] [blame] | 40 | |
| 41 | The above command will rebuild the sysroot for all architectures. To build |
| 42 | just one architecture use `BuildSysroot<arch>`. Run the script with no |
| 43 | arguments for a list of possible architectures. For example: |
| 44 | |
Tom Anderson | 015a8b8 | 2017-11-14 23:48:50 | [diff] [blame] | 45 | $ ./sysroot-creator-stretch.sh BuildSysrootAmd64 |
sbc | 30e4728 | 2016-03-04 01:29:58 | [diff] [blame] | 46 | |
| 47 | This command on its own should be a no-op and produce an image identical to |
| 48 | the one on Google Cloud Storage. |
| 49 | |
sbc | 30e4728 | 2016-03-04 01:29:58 | [diff] [blame] | 50 | ### Uploading new images |
| 51 | |
| 52 | To upload images to Google Cloud Storage run the following command: |
| 53 | |
Tom Anderson | 0cfed476 | 2018-10-09 19:46:36 | [diff] [blame^] | 54 | $ ./sysroot-creator-stretch.sh UploadSysrootAll |
sbc | 30e4728 | 2016-03-04 01:29:58 | [diff] [blame] | 55 | |
| 56 | Here you should use the SHA1 of the git revision at which the images were |
| 57 | created. |
| 58 | |
| 59 | Uploading new images to Google Clound Storage requires write permission on the |
| 60 | `chrome-linux-sysroot` bucket. |
| 61 | |
| 62 | ### Rolling the sysroot version used by chromium |
| 63 | |
thomasanderson | 99d60d8 | 2016-12-15 23:35:18 | [diff] [blame] | 64 | Once new images have been uploaded, the `sysroots.json` file needs to be updated |
| 65 | to reference the new versions. This process is manual and involves updating the |
| 66 | `Revision` and `Sha1Sum` values in the file. |
| 67 | |
| 68 | ### Using `build-and-upload.py` |
| 69 | |
| 70 | The `build_and_upload.py` script automates the above four steps. It is |
| 71 | recommended to use this just before you're ready to submit your CL, after you've |
| 72 | already tested one of the updated sysroots on your local configuration. Build |
| 73 | or upload failures will not produce detailed output, but will list the script |
| 74 | and arguments that caused the failure. To debug this, you must run the failing |
| 75 | command manually. This script requires Google Cloud Storage write permission on |
| 76 | the `chrome-linux-sysroot` bucket. |