Commit Graph

75 Commits

Author SHA1 Message Date
James Le Cuirot
50d7dd1a84
Drop all references to a toolchain-specific binpkg host
This evidently hasn't been used in a very long time, if ever, and it's
just adding confusion.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
2025-04-22 17:59:38 +01:00
Krzesimir Nowak
b1220b6e4e build_library/toolchain_util: Fix setting a profile
Setting a profile in a newly created sysroot when building native
toolchains broke after an eselect update. Apparently eselect gets the
path to the coreos-overlay repository and then prefixes it with
ROOT. Since ROOT was set to /build/<arch>-usr, the resulting patch was
wrong. Fix this by telling eselect where to find our make.profile
symlink in new sysroot by setting PORTAGE_CONFIGROOT to
/build/<arch>-usr and where to find our profiles by setting ROOT (and
SYSROOT, because it must match ROOT) to /.
2025-03-21 14:16:01 +01:00
James Le Cuirot
a76d1b3f1b
Drop all instances of ineffective --root-deps=rdeps option
This option became ineffective with EAPI 7 and all trace of older EAPIs
has now gone.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
2024-11-12 22:08:21 +00:00
James Le Cuirot
8e5b5af225
dev-lang/rust: Drop our custom package in favour of upstream Gentoo's
It is not clear why this was forked originally. One reason was to avoid
the sys-apps/lsb-release dependency, but it probably wasn't just that.
It seems likely that the upstream package did not support cross targets
at the time. Now it does.

It appears that LTO was previously enabled by us following Gentoo rather
than through an explicit decision. They now disable it by default, so we
do likewise. It previously used "fat" LTO, which makes Rust especially
slow to build and reportedly made rustc slower than with "thin" LTO!
There seems little benefit in using thin LTO given that we rebuild Rust
almost as much as the packages that use it, plus we don't enable LTO
anywhere else.

We still avoid rustdoc to keep the size down using INSTALL_MASK. This
isn't as good as not building it in the first place, but this alone
isn't worth keeping a fork.

Cross targets are now handled via the admittedly experimental
RUST_CROSS_TARGETS support. This has been in place for a while, and I
think it is fairly widely used now. If it does disappear, it would
almost certainly be for something even better.

This also updates Rust from 1.80.0 to 1.80.1.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
2024-08-15 16:54:11 +01:00
James Le Cuirot
6d4692b159
sys-devel/sysroot-wrappers: Drop as Gentoo's gcc will handle sysroot
It will patch gcc to respect ESYSROOT when cross-compiling, effectively
adding the --sysroot flag without the use of flags or wrappers. This
hasn't been merged into Gentoo yet, but it has been given the nod. When
it does get merged, it was only be for newer gcc versions than we're
currently using, so we'll need this user patch in the meantime
regardless.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
2024-08-08 16:40:50 +01:00
James Le Cuirot
1d7d53fad9
Upgrade to Catalyst 4
Catalyst 4 has totally changed the way repositories are handled. It only
works when the name of the directory containing the repository matches
the configured name of that repository. This was not the case for us,
with the coreos repository residing in the coreos-overlay directory. We
wanted to move and rename our repositories anyway, but this is a big
change, so we'll do separately. For now, this just renames coreos to
coreos-overlay.

Catalyst 4 also ingests the main repository snapshot as a squashfs
rather than a tarball. It features a utility to generate such a
snapshot, but it doesn't fit Flatcar well, particularly because it
expects each ebuild repository to reside at the top level of its own git
repository. It was very easy to call tar2sqfs manually though.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
2024-07-15 14:27:59 +01:00
Krzesimir Nowak
ab43658d60 overlay: Fix references to moved packages 2024-01-16 12:55:15 +01:00
Krish Jain
fadf4c2ebc Check the url in get_sdk_binhost before echoing
When running the build_packages script, one can encounter an error such as
'Error fetching binhost package info from.' This pertains to SDK packages (not
board packages). Since we have transitioned to the SDK container, the SDK
packages are no longer published independently from the container image.
2023-07-17 15:03:18 +05:30
Krzesimir Nowak
a76292c7d5 *: Drop the use of deprecated PORTDIR and PORTDIR_OVERLAY env vars
These were mostly replaced by relevant config in repos.conf directory.
2023-02-20 17:10:26 +01:00
Krzesimir Nowak
520b92ad7e *: Expand short emerge flags and use bash arrays
Emerge flags are cryptic in general, but short flags even more so, so
expand them. While at it, I noticed some places where bash arrays
could be used, so convert those places too.
2023-02-16 13:57:05 +01:00
Krzesimir Nowak
2161efba6f build_library/toolchain_util.sh: Install matching versions of toolchain packages
When adding a mask or accept keywords entry for some version of a
toolchain package (gcc, libc, gdb, binutils or kernel headers), it
can't be done by just doing it, for example, for sys-devel/gcc. Both
cross-{x86_64,aarch64}-cros-linux-gnu/gcc needs to be
masked/keyworded, otherwise crossdev will pick up the latest stable
version for cross-{x86_64,aarch64}-cros-linux-gnu/gcc and this choice
is not affected by masks or accept keywords of sys-devel/gcc.

This situation does not happen all that often, but when it happens,
it's usually hard to remember to handle also the cross toolchain
packages. Forgetting to do so leads to weird issues. So instead of
telling crossdev to use the latest stable versions of cross toolchain
packages, we will tell it to use specific versions that match the
version of plain packages.
2023-02-06 11:57:40 +01:00
Krzesimir Nowak
57f849239f build_library/toolchain_util: Set up symlink for user patches
This was a place I missed where /etc/portage is set up. Because of it,
user patches for sys-devel/gcc were not picked up.

Also stop using deprecated PORTDIR and PORTDIR_OVERLAY getters. We
still set those variables, but we will drop them eventually.
2023-01-31 12:19:50 +01:00
Krzesimir Nowak
3f242c05eb build_library/toolchain_util: Drop workaround for building stable gdb
This is fixed in crossdev now.
2022-08-22 15:19:54 +02:00
Jeremi Piotrowski
7c87bb611f enable GENERATE_SLSA_PROVENANCE for board ROOT
This needs to be done in setup_board for ROOT=/build/$BOARD, but also in
toolchain_util because basic toolchains packages are built through
catalyst.
2022-07-27 12:59:49 +02:00
Jeremi Piotrowski
a66bded4ce install_cross_libs: fix toolchain dependency installation
`./setup_board --nousepkg --nogetbinpkg` currently fails with a
circular dependency due to pulling in the whole systemd-cryptsetup-udev
dependency chain. This is due to several issue:

* `emerge --root=$ROOT --emptytree` considers ROOT=/ to also be empty,
  so it pulls in all host packages. This must've not always been the case.
  So we need to pipe the dependency package list through `egrep $ROOT`
  to filter only those that would get installed into the desired ROOT
* if SYSROOT=/ and not SYSROOT=ROOT, then virtual/os-headers is missing
  from $ROOT package list
* the final filter expression tries to previously looked like this:
  (=sys-devel/gcc|sys-devel/binutils-0.9) which also matches
  sys-devel/gcc-config and sys-devel/binutils-config, which are
  necessary dependencies. Rework the match expression to not filter
  those out.
2022-07-27 12:59:49 +02:00
jenkins
4c71bf789c build_library/toolchain_util: set binutils to the latest version
This was already being done for gcc but not for binutils. Binutils is
also slotted and when we run the sdk (stage3/stage4) job in the CI, the
seed sdk already contains crossdev packages that we may want to update.
2022-04-21 07:48:18 +00:00
Thilo Fromm
719689992c SDK container: enable binpkg cache for nightly builds
Signed-off-by: Thilo Fromm <thilo@kinvolk.io>
2022-01-12 15:44:30 +01:00
Thilo Fromm
a6ddcda88e ci-automation: Apply suggestions from PR review
Co-authored-by: Krzesimir Nowak <knowak@microsoft.com>
2022-01-10 11:41:03 +01:00
flatcar-ci
7d76cfedf7 ci-automation + setup_board: publish and use binpkgs
This change adds a job for publishing binary packages to the build cache
server to the ci automation.

Also, setup_board is updated to use the buildcache package cache if a
nightly build version is detected.

Signed-off-by: flatcar-ci <infra+ci@flatcar-linux.org>
2022-01-07 17:16:44 +01:00
Jeremi Piotrowski
6ce5d3165f
build_library/toolchain_util: check CBUILD+CHOST for rust warning
For consistency with code further down in the file: aarch64 cross compilation only applies when CBUILD is x86,
for native aarch64 builds rust is guaranteed to have aarch64 rustlibs.
2021-07-28 16:47:13 +02:00
Jeremi Piotrowski
4ba3218d6a boostrap_sdk: only build aarch64 cross-rust on x86 hosts
The rust ebuild has some magic to detect cross-toolchains present on the
system and enable building additional cross targets. The code to trigger
the rebuild of rust is part of install_cross_rust, and checks whether
the cross directories exist in the rust installation. If they don't,
then rust is removed and rebuilt to allow for the auto-detection to
happen.

Right now there are two issues with the code. Firstly, the path that is
checked is wrong, which leads to rust always being removed and rebuilt.
The path checked is /usr/lib/rust-*/rustlib but /usr/lib/rustlib is
where the files are installed.

The second issue is that it checks for aarch64 dirs when CHOST is
aarch64-cros-linux-gnu. However, on an aarch64 host the aarch64 dirs
will already exist from building the sdk itself. The rust ebuild is not
ready to handle aarch64 hosts yet and blows up. The correct behavior is
to combine the check for CHOST with a check for the right CBUILD.

On an aarch64 host we should presumably check for the x86 CHOST and rust
dirs, but that can be added later, because it needs more work.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2021-07-19 15:11:12 +00:00
Jeremi Piotrowski
e4f57bea82 bootstrap_sdk: fix issues around lib->lib64 symlink
The arm64 profiles don't specify SYMLINK_LIB=yes, which makes sense
since arm64 systems don't support multilib in the way that we are used
to from x86. What this means is that build artifacts are installed into
separate lib and lib64 directories. The root overlay installed in stage4
needs to check for SYMLINK_LIB before trying to create a symlink,
otherwise it fails to be applied because it collides with the directory
in the rootfs.

This uncovered a second minor issues - the rust toolchain bootstrap
scripts checked for /usr/lib64/rust*, but the ebuild installs to
/usr/lib/rust.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2021-07-19 15:11:09 +00:00
Dongsu Park
829cec45e8 jenkins: do not configure ccache variables
Setting the invalid CCACHE_ variables resulted in strange failure
in projects depending on meson, newer version like 0.55.3. For example
systemd build fails like the following errors:

```
 * ACCESS DENIED:  utimes:       /mnt/host/source/ccache
 * ACCESS DENIED:  utimes:       /mnt/host/source/ccache

F: utimes
S: deny
P: /mnt/host/source/ccache
A: /mnt/host/source/ccache
R: /mnt/host/source/ccache
C: ccache cc /build/amd64-usr/var/tmp/portage/sys-apps/systemd-246/work/systemd-246-abi_x86_64.amd64/meson-private/sanitycheckc.c -o /build/amd64-usr/var/tmp/portage/sys-apps/systemd-246/work/systemd-246-abi_x86_64.amd64/meson-private/sanitycheckc.exe -O1 -pipe -pipe -D_FILE_OFFSET_BITS=64
```

We should not set up ccache at all, as it has been already disabled in
coreos-overlay repo.
2020-10-26 15:38:57 +01:00
Kai Lüke
cfdb7b0ab7
build_library/toolchain_util.sh: Remove old download code for Rust
The SDK now includes a Rust version with the aarch64 cross-compilation
libraries and the toolchain job doesn't build it anymore. Yet it was
still recompiled because the path had changed.
Remove the adjustment of the download URL and any automatic building
of Rust. Just issue a warning so that any problem can be spotted easily.
This change does not affect the SDK bootstrapping (full or just stage4)
but affects ./build_packages and the toolchains job. For the toolchains
job the crossdev setup is missing anyway and rebuilding wouldn't help
but only downloading, yet since in stage4 there are no binary package
URLs at all, it's best to remove this step and if it is needed later,
the warning will help.
2020-07-31 22:54:53 +02:00
Marga Manterola
e04156a0f1
bootstrap_sdk: build and upload SDK toolchain pkgs
Before, we were relying on the toolchains job to build and upload
packages that were part of the SDK. With this change, all packages that
should be part of the SDK are built and uploaded by the SDK job. The
toolchains job only builds toolchain packages specific for the release.

This change includes several adjustments done to both the SDK and the
toolchains jobs to make this work:
 * Make the SDK job build all cross toolchains, including Rust
 * Stop building Rust in the toolchains job and use the one in the SDK
   instead.
 * In toolchain_util.sh: detect when the symlink folder for crossdev
   packages is missing and run crossdev to create it during
   update_chroot setup.
 * Make it possible to build the SDK starting from stage 4 instead of
   stage 1, to make the SDK building faster for PR branches / nightlies
   (full build should still be done for releases / weeklies).
2020-06-29 15:18:55 +05:30
Dongsu Park
b13976285e build_library: deal with both virtual/rust and dev-lang/rust
Toolchain utils have installed only `dev-lang/rust`. It could result
in version mismatch between `virtual/rust` and `dev-lang/rust`, because
`dev-lang/rust` does not automatically pull in `virtual/rust`.

So install `virtual/rust` instead of `dev-lang/rust`.
2020-06-10 20:30:22 +02:00
Kai Lüke
06c4894f71
SDK: Take environment variable to specify SDK location
The dev build SDKs are not in $FLATCAR_DEV_BUILDS/sdk but published under
$FLATCAR_DEV_BUILDS/developer/sdk.
Add an environment variable to specify where the SDK is to be found
but default to $FLATCAR_DEV_BUILDS/sdk if it is not specified.
From Jenkins this variable is exported as DOWNLOAD_ROOT_SDK.
2020-05-14 16:03:15 +02:00
Kai Lüke
74f04c59f7
Reuse correct binary packages for a Flatcar version
Two Flatcar versions were used in /etc/portage/make.conf both in the SDK
and in the boards.
Use only a single version by default to get the expected results and not
something else when using binary packages.

The Rust crossdev package was never uploaded to /sdk/ and always
had to be compiled again.
Upload it in a separate toolchain-arm64 directory because /Packages in /crossdev/
doesn't refer to the Rust package and its use flags.
2020-05-11 15:45:21 +02:00
Flatcar Buildbot
8ac3182bc3 2345.0.1 2019-12-05 09:01:56 +01:00
Flatcar Buildbot
c7bbb2b1e2 2345.0.0 2019-12-04 14:59:11 +01:00
Flatcar Buildbot
1dad511f69 2317.0.1 2019-11-07 19:40:01 +01:00
David Michael
9b863fa7ae Revert "build_library: Add temporary workaround for binutils update"
This reverts commit faf07f1b8f.
2019-08-08 15:53:06 +00:00
David Michael
faf07f1b8f build_library: Add temporary workaround for binutils update
Revert this after the new binutils is built into the SDK.
2019-08-03 16:24:27 +00:00
David Michael
7b7c78b592 build_library: Drop old workarounds for toolchain binpkgs 2019-01-24 23:25:51 +00:00
David Michael
729575c22e update_chroot: Allow upgrading glibc and binutils 2018-10-12 17:58:09 +00:00
David Michael
afff45366a build_toolchains: Update sysroot settings for newer portage
Since EAPI=7 was supported, portage can no longer use different
ROOT and SYSROOT values.  This adjusts the paths so that the first
phase builds cross-toolchains under /usr/${CHOST}, then the native
toolchains are built under /build/${BOARD} (as was being done
previously).  Now that the cross-toolchain development files can't
be used when building the native toolchain, the headers and libs
are stupidly copied into the board root to be used used and then
overwritten by the board packages as they are built.  Since this is
all done in a chroot, these changes shouldn't affect the SDK host.
2018-08-29 21:40:21 +00:00
David Michael
ecc6d6bd3e build_toolchains: Stop building arm64 toolchains 2018-08-29 18:04:55 +00:00
David Michael
d2f2e11225 update_chroot: Allow upgrading glibc 2018-04-06 18:30:38 -04:00
David Michael
ac8402c1aa update_chroot: Allow upgrading binutils and GCC
Normally toolchains packages are prevented from upgrading.  This
drops that restriction and explicitly removes old versions so that
conflicting tool profiles are not accidentally used.

This reverts commit 20975049b3.
2018-01-04 14:27:47 -05:00
David Michael
20975049b3 Revert "update_chroot: Avoid a portage crash while upgrading binutils"
The binutils update prevents Linux from uncompressing during boot,
so this is being put off until it's fixed.

This reverts commit 5e659964d0.
2017-10-19 08:43:41 -07:00
David Michael
5e659964d0 update_chroot: Avoid a portage crash while upgrading binutils
This omits the toolchain packages' version-pinning flag for the
binutils package while it is being upgraded.  It also removes older
versions installed in parallel that cause unwanted rebuilds.

When stable has the upgraded version, this can be reverted.
2017-09-29 14:10:58 -07:00
David Michael
3d68362d02 toolchain: always run gcc-config 2017-02-16 17:54:06 -08:00
Michael Marineau
95d0bdaf72 *: Fix PIPESTATUS checks for bash 4.3
The one-liner `[[ -z ${PIPESTATUS[*]#0} ]]` no longer works because the
expansion still includes spaces even if all the values are zero. Somehow
that didn't matter in bash 4.2 but it does mater in 4.3 to be consistent
with the general behavior of variables in [[ tests.
2016-01-25 18:25:53 -08:00
Michael Marineau
b0c14f99b1 kernel_menuconfig: new script to simplify kernel config changes 2015-11-10 18:06:49 -08:00
Michael Marineau
dc88c752e9 Merge pull request #392 from glevand/for-merge
Add basic support for arm64
2015-04-08 13:42:29 -07:00
Geoff Levand
ec53361620 toolchain_util: Add arm64-usr support
Adds CROSS_PROFILES, BOARD_CHOSTS, and BOARD_PROFILES definitions to support a
generic arm64-usr board.

get_portage_arch() is updated to convert aarch64 correctly.

Signed-off-by: Geoff Levand <geoff@infradead.org>
2015-04-08 13:30:38 -07:00
Michael Marineau
6e6a0a4967 toolchain_util: include repos.conf in bootstrap build environments
This is required for the eventual removal of `$PORTDIR` and
`$PORTDIR_OVERLAY` and ensures toolchain rebuilds/updates with
`./build_packages --nousepkg` don't erroniously try to use ebuilds from
`/usr/portage` inside of the SDK.

In order to fix up the build_toolchains script the crossdev overlay
needs to be setup properly, previously only setup_board did it.

Overall silences a lot of warnings and fixes an issue with crossdev:

    /usr/bin/emerge-wrapper: line 48: /eclass/toolchain-funcs.eclass: No such file or directory
    /usr/bin/emerge-wrapper: line 49: tc-arch: command not found
2015-04-01 16:30:37 -07:00
Geoff Levand
ea6cf50b8d toolchain_util.sh: Fix _configure_sysroot CBUILD
The portage CBUILD and HOSTCC variables need to be set to the SDK host to get
a proper cross build when building target binaries.

Change _configure_sysroot to use the CBUILD environment variable to set the
CBUILD and HOSTCC variables of ${ROOT}/etc/portage/make.conf.  Also, fix up all
calls to _configure_sysroot to set the CBUILD environment variable.

Fixes setup_board failure when the host and target architectures differ.

Signed-off-by: Geoff Levand <geoff@infradead.org>

[marineam: fixed a copy/paste error]
2015-04-01 15:54:43 -07:00
Michael Marineau
d0da252d49 toolchain_util: fix parsing emerge --pretend output
Fix parsing the following output:

    [ebuild  N    ] dev-libs/gmp-5.1.3-r1 to /usr/x86_64-cros-linux-gnu/
    [ebuild     UD] sys-libs/timezone-data-2013d [2014i-r1] to /usr/x86_64-cros-linux-gnu/

The previous regex did not account for upgrades and got confused by the
`[2014i-r1]` listing and goobbled up too much of the string. I am not
sure *why* portage is reporting an upgrade when --emptytree is also used
but there it is. Match all not-] characters instead.
2015-01-28 16:37:52 -08:00
Michael Marineau
1de8eb3b11 toolchain: always switch to latest GCC version
Normally Gentoo expects moving between major GCC releases to be a manual
step. In our case we want this to always be automatic, otherwise the GCC
version won't be switched at all.
2014-08-26 16:31:46 -07:00