Commit Graph

1091 Commits

Author SHA1 Message Date
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
Thilo Fromm
1f2706d44e build_sysext: guess image build dir and auto-create it
Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
2023-07-07 14:49:50 +02:00
Thilo Fromm
190fd2c38e build_sysext: bugfixes, QoL changes, help updated
This change improves build_sysext by sourcing a missing lib dependency,
adding a number of comfort / quality-of-life options, and updating the
output of '--help' accordingly.

The OEM sysext finction in build_library/vm_image_util.sh is also
updated to use new command line format.

1. Include missing dependency toolchain_util.sh to fix an error in
   board_options.sh (get_board_arch undefined).
2. Use positional parameters for mandatory arguments.
   build_dir and sysext_name are mandatory and are now positional
   arguments instead of options.
   binary_package is the third positional argument but can be omitted
   if --metapkgs was specified.
3. --squashfs_base is now guessed better and will use the most recent
   build by default.
4. A new boolean flag --ignore_version_mismatch for the more daring
   developer was added. The flag will cause the script to continue if a
   version mismatch between SDK board packages and squashfs base is
   detected.
5. Error messages were improved for when mandatory parameters were not
   provided.
6. The '--help' message was improved and adjusted to the new parameters.

Signed-off-by: Thilo Fromm <thilofromm@microsoft.com>
2023-07-07 11:44:39 +02:00
Krzesimir Nowak
00ac7586a4 *: Remove support for niftycloud OEM 2023-07-05 14:34:17 +02:00
Krzesimir Nowak
ad0360e744 *: Remove support for interoute OEM 2023-07-05 14:33:26 +02:00
Krzesimir Nowak
2c1d89277d *: Drop unused oem sysext files 2023-07-05 08:43:25 +02:00
Krzesimir Nowak
ec723be9d9 *: Drop unused pkgdb stuff 2023-07-05 08:43:25 +02:00
Krzesimir Nowak
16fee4f5b1 build_library/vm_image_util.sh: Switch OEM sysext image building to build_sysext 2023-07-05 08:43:25 +02:00
Krzesimir Nowak
8c2883114a build_library/vm_image_util.sh: Set up a path to sysext base image 2023-07-05 08:40:15 +02:00
Kai Lüke
eb2f3d543d
Merge pull request #920 from krishjainx/sysext-internship
Build_sysext script to enable sysext builds in the OS image build process
2023-07-04 13:37:43 +02:00
krishjainx
6380a43b4f Add script to enable sysext builds in the OS image build process
Included a script to enable generating systemd-sysexts. Successfully
tested sysext generation with a fresh Flatcar image (e.g., Python and
Neofetch system extension). Part of my internship work.

The current OS images we provide are not OK as base for flatcar specific
sysext images: it lacks the package metadata and portage configuration,
in order to keep end user OS image clean. This script retains this
information and allows you to produce systemd-sysexts to extend the
system. This script can be used to build a Flatcar sysext image.
Recommended to run from image build folder.

Signed-off-by: Krish Jain <kjain7@u.rochester.edu>
2023-07-04 13:30:48 +02:00
Jeremi Piotrowski
b2a4a5f0d7 oem_sysext_util: Mount overlay on top of /usr before installing sysext packages
After changes to the inode size, the sysext installation runs out of
space because the installation happens on a mounted production image.
This is problematic because the /usr partition is only 1024MB in size
and gets full. Mount a temporary overlay so that we can use that for
installation, and discard it afterwards.

This also means we no longer need to disable verity and in fact could
live without copying the prod image. I won't make that change since
we're working on a new script to automate building of sysexts using the
overlay approach.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2023-06-23 12:44:11 +00:00
Jeremi Piotrowski
7205c2d742 build_library/disk_util: Switch default ext4 inode size to 256 bytes
Inode sizes smaller than 256:
- don't support extended metadata (nanosecond timestamp resolution)
- cannot handle dates beyond 2038
- are deprecated

Change the default from 128 to 256. There is no way to apply this change on a
mounted filesystem so this change will only apply to new deployments.

Fixes: flatcar/flatcar#1082
Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2023-06-21 13:30:20 +02:00
Kai Lueke
af4daf3516 Upload dev-key-signed OEM sysext update payload
For release tests and updating a machine to a dev build we already have
the dev-key-signed generic update payload but not yet the OEM sysext
update payload.
Generate the dev-key-signed OEM sysext update payload during build and
upload it.
2023-06-14 18:30:48 +02:00
Kai Lueke
f790e3e648 build_library: For now don't use a version for the OEM sysext image
The initial MVP of the OEM sysext usage we release won't have updates
for the sysext image and, therefore, it is not bound to the OS version.
The special name suffix instead of the version hints bootengine at using
it if no matching version is found. The name will also be used at hint
for update-engine to clean it up when versioned sysext images arrive.
2023-06-14 13:00:30 +02:00
Krzesimir Nowak
23df3170ff build_library: Force initial version of OEM sysexts for now
We don't have an update process of the OEM sysexts implemented yet, so
use a fake "initial" version for them and make them independent from
OS version.
2023-06-06 15:10:07 +02:00
Krzesimir Nowak
8b17ca2b02 overlay coreos-base/oem-qemu: Make it a sysext package
It isn't doing much as nothing QEMU-specific was being installed into
the OEM partition.

With that done, we opt into building an OEM sysext image for QEMU
platform.
2023-06-06 15:10:07 +02:00
Krzesimir Nowak
995910cd78 overlay coreos-base/oem-azure: Make it a sysext package
This package will be used for the sysext image, instead of for
installing files into /usr/share/oem. This means that we can drop some
files or move them elsewhere. The systemd service file is not needed,
because it is installed by the app-emulation/wa-linux-agent package
now. This also means that the ignition file as lost its purpose. The
grub.cfg and oem-release must be installed in /usr/share/oem, next to
the sysext raw image file, so handling of these files is moved to the
newly added coreos-base/common-oem-files package. `eject` symlink to
`/usr/bin/true` is installed in the newly added manglefs.sh script.

With this done, we also opt into building an OEM sysext image for
Azure platform.
2023-06-06 15:10:07 +02:00
Krzesimir Nowak
46b98ba0d2 image_to_vm: Require pkgdb tarball and handle sysext building 2023-06-06 13:01:09 +02:00
Krzesimir Nowak
a5ecf0d79f build_library/prod_image_util.sh: Generate a tarball with portage database
Will come in handy when generating OEM sysexts. We can mount the
generic image, put the image database back into the image and emerge
extra packages without the need to drop all DEPENDS and BDEPENDS from
the ebuilds.
2023-06-06 13:01:09 +02:00
Krzesimir Nowak
86d7eb5894 *: Add OEM sysext building utilities 2023-06-06 13:01:09 +02:00
Krzesimir Nowak
5105ed5677 build_library: Move report function to a separate file
I'd like to use them in other places, and I don't need all the other
stuff build_image_util.sh provides.
2023-06-06 13:01:09 +02:00
Krzesimir Nowak
706356c459 build_library/disk_util: Add btrfs UUID randomizing
This is necessary if we want to mount a copy of the production image.
2023-06-06 13:01:09 +02:00
Krzesimir Nowak
33d2af5600 build_library: Adapt to /oem being the new OEM partition mountpoint
This requires us to add another directory to keep when removing a
regenerable state from rootfs. Other changes were straightforward find
and replace.
2023-05-30 15:53:17 +02:00
Krzesimir Nowak
60aded12f5 build_library/catalyst.sh: Fix and extend snapshot handling
- Fix the snapshot name, it is not "portage-${VERSION}", but rather
  "gentoo-${VERSION}".

- After building the snapshot, remove all the similar files from the
  snapshots directory - Catalyst gets easily confused by them and
  bails out.

- Extend the `build_snapshot` function to optionally accept the config
  path and the snapshot name, so SDK's stage1 code can use this
  function instead of duplicating parts of it.
2023-05-25 12:35:29 +02:00
Krzesimir Nowak
120a746c88 build_library/catalyst.sh: Make some variables local 2023-05-24 13:50:50 +02:00
Krzesimir Nowak
27f20f6e26 build_library/build_image_util.sh: Remove temporary /etc backup
The temporary /etc backup created during emerging packages should only
contain empty files that will make sure that the symlinks pointing to
files within the /etc backup won't dangle at any time.
2023-05-11 12:29:48 +02:00
Krzesimir Nowak
bd2bf6acec build_library/check_root: Silence a warning about cgi.py
The python's minor version has now two digits.
2023-05-11 12:29:48 +02:00
Krzesimir Nowak
979d7d0720
Merge pull request #748 from flatcar/krnowak/blocker-fix
update_chroot: Fix some non-fatal error noise
2023-05-03 09:47:53 +02:00
Krzesimir Nowak
076e6940e2 build_library/build_image_util.sh: Split base_image_var.conf into two
We used to create a base_image_var.conf tmpfiles config file that
contained information about directories under /var that weren't
covered by any other tmpfiles config file. Recently some package
update started installing a directory under /var that belonged to a
user/group not found directly in passwd/group file in /etc. This
user/group was defined in passwd/group in /usr/share/baselayout, but
at the early boot, these are not yet checked for user/group
information, so systemd-tmpfiles running inside initrd failed when
trying to create such an entry using the base_image_var.conf tmpfiles
config file.

Split the base_image_var.conf into two files - base_image_var.conf and
base_image_var_late.conf. The former will only contain entries owned
by user/group that are supposed to exist very early in the boot, while
the latter will contain the rest of directories - those will be
created later during the boot.
2023-04-26 15:39:58 +02:00
Krzesimir Nowak
5bc546919f build_library/gen_tmpfiles.py: Add options for allowed users and groups
This will generate tmpfiles config only for directories that are owned
by an allowed user and group if such are passed. Not passing any
allowed users or groups, allows any user or group.
2023-04-26 15:39:58 +02:00
Krzesimir Nowak
1d589ca9d8 build_library/update_chroot_util.sh: Ignore equery's non-zero exit status
The `list` command of `equery` will exit with status 3 if a package is
not found and `--quiet` is in effect. This results in some non-fatal
noise during the SDK build:

INFO    update_chroot: Maybe removing some hard blocks
ERROR   update_chroot: script called: update_chroot '--toolchain_boards=arm64-usr' '--usepkg' '--nousepkgonly' '--getbinpkg'
ERROR   update_chroot: Backtrace:  (most recent call is last)
ERROR   update_chroot:   file update_chroot, line 250, called: remove_hard_blocks 'sudo_e_emerge' 'equery' 'dev-python/setuptools_scm:2'
ERROR   update_chroot:   file update_chroot_util.sh, line 49, called: get_versions_from_equery 'equery' 'dev-python/setuptools_scm'
ERROR   update_chroot:   file update_chroot_util.sh, line 9, called: die_err_trap '"${equery_cmd}" --quiet --no-color list --format='${version} ${fullversion}' "${pkg}"' '3'
ERROR   update_chroot:
ERROR   update_chroot: Command failed:
ERROR   update_chroot:   Command '"${equery_cmd}" --quiet --no-color list --format='${version} ${fullversion}' "${pkg}"' exited with nonzero code: 3
INFO    update_chroot: No hard blockers to remove

Shut the noise up. If package is not found, then there is simply
nothing to do.
2023-04-26 07:49:56 +02:00
Thilo Fromm
401af830d1 scripts, CI, workflows: remove submodule handling (main) 2023-04-13 12:26:36 +02:00
Kai Lueke
54958b813e Drop more tmpfiles rules that cause /etc upcopies
We already drop tmpfile rules that we don't need because we ship the
files through our /etc overlay. However, some rules weren't dropped
because they used tabs and not spaces (/etc/selinux/, /etc/iscsi and
/etc/ssl/*).
Drop rule lines for /etc that use tabs. Also rules modifiers like ! to
only do it during boot or - to allow failure will be removed but those
with + or = will stay as they to explicit recreation.
2023-03-31 11:36:18 +09:00
Kai Lueke
b723d2f15a Ship /etc from /usr through an overlay mount
The existing tmpfile logic took care of folders that the ebuild keepdir
directive wanted to exist on the OS. However, files and symlinks were
not created, causing them to be missing if we didn't explicitly modify
the ebuild files in coreos-overlay to use tmpfiles or patching of
paths to be in /usr. We need a logic to provide /etc files from the
current /usr partition without getting stale. This can be done best
with an overlay mount which requires to keep the original /etc files
under /usr.
Move the final /etc folder of the image build to /usr/share/flatcar/etc
to serve as lower layer in the overlay. Also remove any state from the
rootfs to make sure that we don't rely on it when testing our images
before the release. What we get with an overlay mount is essentially a
similar behavior to a 3-way merge because as long as the user didn't
change the files, the old version is replaced with the new version and
as soon as the user did changes, that file is frozen and wins over the
provided old (in case of a rollback) or new versions from /usr. It does
not work on file lines but on whole file contents, yet that is also
what rpm-ostree does to my knowledge. Also, run tmpfiles once and do
the SELinux labeling to prevent files being created in the upperdir
because they were missing in the lowerdir, or because they had missing
SELinux labels.
2023-02-24 18:41:53 +09:00
Krzesimir Nowak
a0208a706a build_library/dev_container_util.sh: Fix setting up portage
With PORTDIR and PORTDIR_OVERLAY environment variables being gone as
overrides, setting up a profile for the developer container broke. The
overrides were a hack already, as eselect does not seem to have
support for setting a profile based on repos.conf with repo locations
that are valid only after chrooting into the root directory. So
instead of invoking eselect, we set up the symlink ourselves.
2023-02-21 08:43:14 +01:00
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
fa48f70a37 *: Make catalyst and emerge verbose by default
That way we can see a report of what emerge is going to do and the
status of the use flags for the installed packages. The downside is
that we are going to have reports about using deprecated and
unsupported profile in even more places.
2023-02-16 13:57:05 +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
1d132574ac build_library/catalyst.sh: Do not use "which"
There's a bash built-in named command that could be used instead.
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
edc90b4e59 build_library: Add generation of disk space usage
This could replace an ad-hoc calculations we do in package-diff.
2023-02-01 14:43:24 +01:00
Krzesimir Nowak
1c1c0099c7 build_library: Generate content files for initrd too 2023-02-01 14:43:24 +01:00
Krzesimir Nowak
f4829fd860 build_library: Add generation of image contents with different details
Timestamp and user/group information are out, in are device ID and
inode number. That way, the file can be used for accounting size
differences of files/image.
2023-02-01 14:43:24 +01:00
Krzesimir Nowak
9aeab641fd
Merge pull request #633 from flatcar/krnowak/user-patches-setup-fix
*: Fix user-patches setup
2023-01-31 15:41:15 +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
409b47a932 *: Fix user-patches setup
Normally `ln -sf path/to/target at/name` will create a symlink at
`at/name` that points to `path/to/target`. But if `at/name` already
exists and is a directory or a symlink to some other directory, then
this command will create a symlink at `at/name/target` pointing to
`path/to/target`. There is an ambiguity between 1st and 3rd form of
`ln` (please refer to `man ln` for the available invocation forms). It
can be disambiguated by using the `-T` flag to force the 1st form.

In our case, if `/etc/portage/patches` symlink already existed and was
pointing to `<coreos-overlay>/coreos/user-patches`, we ended up with a
useless symlink at `<coreos-overlay>/coreos/user-patches/user-patches`
pointing to `<coreos-overlay>/coreos/user-patches`.
2023-01-31 12:00:22 +01:00
Krzesimir Nowak
0b86840d2e
Merge pull request #626 from flatcar/krnowak/gcc-config
Drop a symlink-fixing hack
2023-01-18 10:16:53 +01:00
Krzesimir Nowak
460218d1e4 build_library/check_root: Print a target of the dangling symlink 2023-01-12 08:37:57 +01:00
Krzesimir Nowak
375ffa6579 common.sh: Drop the unnecessary hack
We have a user patch in coreos-overlay fixing this issue directly in
gcc-config.
2023-01-12 08:37:57 +01:00
Krzesimir Nowak
0374f23660 update_chroot, build_library: Drop repos.conf customization
The "disabled" option was a Flatcar customization in
sys-apps/portage. We are trying to move to vanilla portage, so let's
see if this will work.
2023-01-11 10:45:35 +01:00
Krzesimir Nowak
f63ee98d00 *: Allow applying user patches
When setting up portage configuration, we set up a symlink in
${ROOT}/etc/portage/patches that points to the coreos/user-patches
directory inside the coreos-overlay. That way, we can add our custom
patches to coreos-overlay without the need for moving the packages
from portage-stable to coreos-overlay only to apply an extra patch.
2022-12-14 13:52:48 +01:00
Dongsu Park
0c78420911 build_library: remove GLSA 202105-22 from GLSA_ALLOWLIST
Flatcar has net-fs/samba 4.15.4-r3, greater than 4.13.8, so it is
not necessary to keep GLSA 202105-22 in GLSA_ALLOWLIST.

Allow 202209-12 for now, as update to grub 2.06 is still in progress.
2022-11-24 09:16:43 +01:00
Krzesimir Nowak
97bf185815 common: Extend liblto link fixup function
We need to fix another symlink created by gcc-config, so extend the
function that was doing it for some other links and rename it - it's
not about only liblto any more.
2022-11-09 10:13:24 +01:00
Kai Lueke
91a26e5e1e Use new github org name "flatcar"
The "flatcar-linux" github org was renamed to "flatcar". There are no
github redirections in place and we have to update all links.
2022-09-14 14:33:27 +02:00
Kai Lueke
80e49d190f Use new website flatcar.org
The flatcar-linux.org domain has redirects but it's better to use the
current domain directly.
2022-09-14 14:32:49 +02:00
Kai Lueke
e171ecd69d Fix broken docs link 2022-09-14 14:32:49 +02: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
dc21dda002
Merge pull request #378 from flatcar-linux/slsa-provenance-by-default
Generate SLSA provenance by default
2022-08-15 13:39:13 +02:00
Jeremi Piotrowski
6f1d7976f4
Merge pull request #385 from flatcar-linux/jepio/spdx-sbom
add SPDX SBOM generation using syft
2022-07-27 13:55:00 +02:00
Jeremi Piotrowski
3f39f48389 build_library: install initramfs/torcx SLSA reports into rootfs
Some packages are currently missing from the /usr/share/SLSA directory
compared to flatcar_production_image_packages.txt. For torcx packages,
extract the reports from the torcx bundle when adding it to the rootfs.
For initramfs packages, as a substitute we enumerate build dependencies
of coreos-kernel (image_packages_implicit()). At this time these are
bootengine and intel-microcode.
2022-07-27 13:00:20 +02:00
Jeremi Piotrowski
e20cf95bcb prod_image_util: unpack SLSA report along with gcc when building image
Prod images need libstdc++.so and other libraries produced by
sys-devel/gcc build, but because we don't want all of gcc in the image,
the binpkg is manually unpacked instead of installed with emerge. Make
sure to preserve SLSA metadata when unpacking as well.
2022-07-27 13:00:19 +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
Jeremi Piotrowski
6735a6d5c0
prod_image_util: extract gcc libs to /usr/lib64
This made no difference back when lib was a symlink to lib64, but now that they are separate,
libs belongs in /usr/lib64. This  mostly doesn't show up because ldconfig configures the ld.so cache
to include both locations, but when updating from an older release ld.so.cache is out of date.
Unfortunately ld.so.cache does not get updated until after multipathd, which causes
multipathd to dump core. This may also affect other packages that need access to
libgcc early.

See also: https://github.com/flatcar-linux/Flatcar/issues/809
2022-07-25 17:33:08 +02:00
Jeremi Piotrowski
d3edc97063 build_image: use syft to generate SBOM for prod image
Since v0.51.0 syft supports generating parsing the gentoo package
database. This is a first go at integrating that into our image build
process. This doesn't yet include packages inside torcx packages, or the
kernel, or initramfs-only packages.
2022-07-15 11:52:33 +00:00
Krzesimir Nowak
e65072910d build_library: Try to clean up unused stuff
There is some cruft left after grub hashes generation. After the
contents are zipped into archive, they don't need to be around any
more.

Try to remove the rootfs directory after unmounting the
image. disk_util can recreate it again if there is a need for it.

Remove the build directory used for generating ACI images - it's not
needed after successful installation.
2022-07-14 15:08:12 +02:00
Kai Lueke
ef9b0ff820 ci-automation: Only store compressed images
The new build pipeline compresses images already but uploaded both the
compressed and uncompressed files because the whole build folder gets
uploaded.
Add a new flag "--only_store_compressed" to the image generation which
deletes the uncompressed file after compression is done. Uncompressed
images are still supported if specified in the flag
"image_compression_formats".

Closes https://github.com/flatcar-linux/Flatcar/issues/793
2022-07-05 16:13:22 +02:00
Martin Borgman
1a42fd4a5f Make qemu_template.sh work on MacOS
Make qemu_template.sh work on MacOS

Line 14; The nproc command is only available on systems with GNU coreutils installed. The getconf _NPROCESSORS_ONLN alternative will work on a wider range of UNIX systems.
Line 114; The mktemp syntax used only works on GNU implementation.
Line 159; added hvf (MacOS) and tcg (no acceleration) options as a fallback. By doing this qemu-system-x86_64 will try to use kvm, but when it fails try hvf, and when that fails switch to the tcg accelerator.
2022-06-22 15:18:09 +02:00
Jeremi Piotrowski
2937db11e5
Merge pull request #286 from flatcar-linux/jepio/run-binutils-config
build_library/toolchain_util: set binutils to the latest version
2022-05-10 09:54:58 +02:00
Kai Lueke
6648df57a2 Remove unused image variants
There is no difference anymore between the regular and Pro images.
Remove the definitions and stop building extra images.
2022-05-03 20:30:42 +09: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
Kai Lueke
e2759a3e67 build_library/set_lsb_release: create compatibility symlink
The os-release file was not only accessible through /usr/lib/ but
also through /usr/lib64 because "lib" was just a symlink.
Now that we split them up into two directories, add a compatibility
symlink in case /usr/lib64 was used to access os-release. A check
is added to also work without the split which is useful if the split
is not done for the SDK at the same time.
2022-03-17 11:58:12 +01:00
Kai Lueke
ee46cf104b build_library/check_root: use the new location for kernel modules
The standard location is /usr/lib/modules but on Flatcar "lib" was a
symlink to "lib64". Now this is going to be split up in separate
directories but with compatibility symlinks.
Add the new location to the ignore list.
2022-03-17 11:56:26 +01:00
Kai Lueke
7fafef2084 set_lsb_release: define Flatcar sysext level
Sysext images have a compatibility matching mechanism that searches for
the matching OS version or custom sysext level setting. On Flatcar
there is just the OS version set in /etc/os-release until now which
means that sysext images can't easily be used together with autoupdates
that change the OS version.

Define a sysext level for Flatcar so that users can refer to it instead
of the OS version when they have images that don't rely on a particular
Flatcar version.
Here an example of the now possible metadata:
/etc/extensions/NAME/usr/lib64/extension-release.d/extension-release.NAME
  ID=flatcar
  SYSEXT_LEVEL=1.0
and a symlink /etc/extensions/NAME/usr/lib → /etc/extensions/NAME/usr/lib64
to work around the problem that using lib/ as path destroys Flatcar's
lib → lib64 symlink.
In the future the matching logic hopefully gets more flexible because
now it is just a string comparison. Also, the architecture is not
matched either for now - we should work with upstream to improve this.

Closes: https://github.com/flatcar-linux/Flatcar/issues/643
2022-03-10 18:15:04 +01:00
Gabriel Adrian Samfira
e88f12c69c Rename zstd to zst
Rename sztd to zst and amend the changelog. The zstd binary generates a
compressed file with the .zst extension by default.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-03-08 14:02:37 +00:00
Gabriel Adrian Samfira
71e4f1c660 Remove commented code 2022-03-08 08:07:47 +00:00
Gabriel Adrian Samfira
f126debb37 Allow specifying multiple compression formats
Add the ability to specify a comma separated list of compression formats.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-03-07 12:01:21 +00:00
Gabriel Adrian Samfira
571de4064b Make image compression format configurable
This change adds a new flag called --image_compression_format which
allows us to output the final VM image as one of the supported formats:

bz2 (default), gz, zip or none

if the compression format is "none" or "", the image will not be compressed.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
2022-03-07 12:01:21 +00:00
Sayan Chowdhury
ee7e48cb14
Merge pull request #241 from flatcar-linux/sayan/merge-pro-in-regular
build_library/vm_image_util.sh: Pro image to use non-pro package & use flag
2022-03-02 20:44:03 +05:30
Jeremi Piotrowski
f8efad73bf
Merge pull request #231 from flatcar-linux/jepio/build-image-disable-ebuild-locks
build_library/build_image_util: disable ebuild-locks when merging binary packages.
2022-02-22 13:52:46 +01:00
Jeremi Piotrowski
4cdacf5ae4 build_library/build_image_util: disable ebuild-locks when merging binary packages
Disable ebuild-locks for the emerge command that creates the image.
Ebuild-locks protect unsandboxed ebuild phases from running
concurrently, but also slow things down greatly when a lot of
concurrency would otherwise be possible. The image build phase merges a
big amount of binary packages, and I am not aware of us having any
phases that risk concurrently modifying shared files.

I have been testing this for the last months and have not seen any
failures. The time savings are significant: this cuts image build time
from 20m to 10m for me.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2022-02-22 09:42:42 +00:00
Kai Lüke
ce43f1e001
Merge pull request #227 from flatcar-linux/kai/use-package-users
build_library: move package sysusers to /usr database
2022-02-18 18:16:12 +01:00
Kai Lueke
cc509e77d3 build_library: move package sysusers to /usr database
Package users nowadays get created through systemd-sysuser files.
Gentoo uses the acct-user|groups packages to allocate stable IDs for
these users. Since they get created at runtime, we have the problem
that they end up in /etc/passwd at boot time which would be fine if
they follow the acct-user allocations but it could also be that there
is a package that uses its own sysuser files, leading to dynamic ID
allocation which we can't control and may result in ugly user ID
mismatches that are hard to resolve again. Normally we intend to ship
all system users under /usr/share/baselayout/passwd so that /etc/passwd
is really left to the user's own entries.
Generate the /etc/passwd sysuser entries at image build time and move
these entries over to /usr/share/baselayout/passwd so that all
system users reside in this database. We should still ensure to have
acct-user packages for all system users or at least hardcoded user
IDs, therefore, add a check for that.
2022-02-18 16:57:42 +01:00
Sayan Chowdhury
560122f49d
build_library/vm_image_util.sh: Pro image to use non-pro package & use flag 2022-02-17 19:42:05 +05:30
Dongsu Park
580a5c6852 build_library: update GLSA allowlist
201908-24: polkit 0.120-r2, so not affected
201909-01: perl 5.34.0, so not affected
202003-26: python 3.9.8, so not affected
202005-09: python 3.9.8, so not affected
202006-03: perl 5.34.0, so not affected
202008-01: python 3.9.8, so not affected
202101-18: python 3.9.8, so not affected
202104-04: python 3.9.8, so not affected
202105-34: bash 5.1_p8, so not affected
202107-31: polkit 0.120-r2, so not affected
202107-48: systemd 250.3, so not affected
2022-02-17 10:44:28 +01:00
Dongsu Park
a900d579c4 *: blacklist/whitelist to denylist/allowlist
Replace blacklist with denylist, and whitelist with allowlist.
Use proper vocabulary in all over the code.
2022-02-17 10:44:25 +01:00
Jeremi Piotrowski
07568fb418 build_library: vm_image_util: create fixed-size VHDs for Azure
Azure requires disks to be fixed-size VHD files when uploading to blob storage
in order to create image/gallery objects from them. This is documented here[1].
To prevent mistakes from happening create disks in that format directly so that
any azure compatible tool can upload them, though azcopy is recommend because
it handles their sparseness best.

This has not been an issue for us so far because kola uses code from an older
utility that transparently handled the dynamic-to-fixed-size conversion for VHD
files (azure-vhd-utils). But people working with these things for the first
time fall into this trap.

[1]: https://docs.microsoft.com/en-us/azure/virtual-machines/linux/create-upload-generic#resizing-vhds.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2022-02-01 17:52:09 +00:00
Jeremi Piotrowski
3af02e323c build_library/torcx_manifest.sh: list all component pkgs in sources_on_disk()
source_on_disk() so far relied on the 'sourcePackage' field, which contains the
primary dependency of a torcx packge (app-torcx/docker ->
app-emulation/docker). Now the 'metaPackage' field (app-torcx/docker) is used,
which lets us look at RDEPENDS and figure out all packages that are indirectly
installed when installing a torcx package. torcx_dependencies() does just that,
so move it's definition to torcx_manifest.sh.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2022-01-14 16:00:51 +00:00
Jeremi Piotrowski
499fade8d3 build_torcx_store: store additional 'metaPackage' field in torcx manifest
The torcx_manifest.json file currently has a 'sourcePackage' field which is
extracted from the first runtime dependency of the torcx package ebuild. This
is a convention, and causes sourcePackage to hold 'app-emulation/docker' for
the 'app-torcx/docker' package. This does not carry enough information to be
able to figure out what other packages are part of the torcx package.

Store an additional field, 'metaPackage', in the manifest which contains the
name of the torcx package. With the right ebuild it is then possible to figure
out what other packages are part of a given torcx package. This can then be
used to add that information to the image packages list.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2022-01-14 15:46:08 +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
Kai Lüke
f9b51461ab
Merge pull request #212 from flatcar-linux/kai/set-group-only-in-usr
set_lsb_release: only set update-engine GROUP in /usr, not /etc
2022-01-11 15:01:34 +01:00
Kai Lueke
0c9804a9a4 set_lsb_release: only set update-engine GROUP in /usr, not /etc
The default image group is already encoded in
/usr/share/flatcar/update.conf but it was written to
/etc/flatcar/update.conf as well. This can cause problems when the user
switches channels by forcing an update to a specific release from the
different channel (e.g., through the flatcar-update tool) as it leaves
the file under /etc/flatcar/update.conf out of sync with the new
channel version in /usr/share/flatcar/update.conf.

Since we don't really need to write a specific channel to /etc on new
images as we can rely on the value from /usr, we now leave any possible
overwriting of the value in /etc entirely to the user.
2022-01-11 15:00:43 +01:00
Jeremi Piotrowski
7caafa6cd6 build_library/check_root: ignore dangling '*egg-info' symlink
Since the update of dev-python/certifi, running the command
`./image_to_vm.sh --format gce --board=amd64-usr` fails due to a
dangling symlink. This symlink is located in
/usr/lib64/python3.9/site-packages and is not supposed to be installed
in the first place because of this INSTALL_MASK entry in
coreos-overlay/profiles/coreos/targets/generic/oem-aci/make.defaults:

  INSTALL_MASK="${INSTALL_MASK}
    /usr/*/python3*
  "

There is an open upstream bug that INSTALL_MASK doesn't work correctly on
symlinks (https://bugs.gentoo.org/678462).
The best we can do at this time is to ignore the dangling symlink.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2022-01-11 10:02:53 +00: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
Krzesimir Nowak
96b37b89f8 *: Replace kinvolk github org with flatcar-linux
Stop relying on github redirects, they are a mixed blessing and using
them broke emerge-gitclone inside dev-container in silent way. The
script could not find a desired revision of portage-stable or
coreos-overlay, because it tried to pull from kinvolk instead of
flatcar-linux github org. The redirects seem to hinder fetching a
specific commit, so the script pulled something else (HEAD or main?).
2021-12-21 17:22:48 +01:00
Krzesimir Nowak
89b5505fe6 build_library/catalyst_sdk.sh: Try different way of picking python as default intepreter
Let's see if `eselect python update` would work. It's certainly nicer,
because there would be one place less to change on the next python
update.
2021-12-10 20:06:40 +01:00
Krzesimir Nowak
790fd0fd2c build_library/catalyst_sdk.sh: Select python 3.9 as a default interpreter
At this point nothing pulls python2 anymore, so it became an invalid
target.
2021-12-10 20:06:40 +01:00
Krzesimir Nowak
186f1de4fa update_chroot: Add a way to remove hard blockers
And set it to remove some old version of dev-python/setuptools_scm
package.
2021-12-10 20:06:40 +01:00