From eadf555fd44244d0ae2e847ff07b6cfd301e6add Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Thu, 18 Apr 2024 13:26:44 +0200 Subject: [PATCH 1/6] mkosi: Update to latest --- .github/workflows/mkosi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/mkosi.yml b/.github/workflows/mkosi.yml index 2cffc3cf826..56f62e67ea7 100644 --- a/.github/workflows/mkosi.yml +++ b/.github/workflows/mkosi.yml @@ -74,7 +74,7 @@ jobs: steps: - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 - - uses: systemd/mkosi@a845d4108ac87ca443bd1ad78ab53520bffd2eda + - uses: systemd/mkosi@236784dbb597321eedab50cef06cc49f92c57293 # Freeing up disk space with rm -rf can take multiple minutes. Since we don't need the extra free space # immediately, we remove the files in the background. However, we first move them to a different location From 6911a9ea7fc03fe909e667cac1c435d3252c750a Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Thu, 18 Apr 2024 13:27:05 +0200 Subject: [PATCH 2/6] mkosi: Drop systemd-repart from package lists This is just a Provides for systemd-udev. --- mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.conf b/mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.conf index cc9f3e9d11c..23704276ffd 100644 --- a/mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.conf +++ b/mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.conf @@ -9,7 +9,6 @@ VolatilePackages= systemd systemd-udev systemd-container - systemd-repart systemd-resolved systemd-networkd systemd-boot From d2c0acaf707ded59e7b22809d6dd4fe25dfdeb21 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Thu, 18 Apr 2024 13:27:43 +0200 Subject: [PATCH 3/6] mkosi: Install more packages Let's install everything we can to get more coverage and make sure all build outputs are available in mkosi containers or VMs. --- .../mkosi.conf.d/10-centos-fedora/mkosi.conf | 17 +++++++------- .../mkosi.conf.d/10-debian-ubuntu/mkosi.conf | 23 +++++++++++++------ .../mkosi.conf.d/10-opensuse/mkosi.conf | 7 ++++-- 3 files changed, 30 insertions(+), 17 deletions(-) diff --git a/mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.conf b/mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.conf index 23704276ffd..4344b51fa03 100644 --- a/mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.conf +++ b/mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.conf @@ -7,17 +7,18 @@ Distribution=|fedora [Content] VolatilePackages= systemd - systemd-udev - systemd-container - systemd-resolved - systemd-networkd systemd-boot - systemd-tests - systemd-ukify - systemd-pam - systemd-oomd-defaults + systemd-container + systemd-devel systemd-journal-remote + systemd-networkd systemd-networkd-defaults + systemd-oomd-defaults + systemd-pam + systemd-resolved + systemd-tests + systemd-udev + systemd-ukify Packages= bpftool diff --git a/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.conf b/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.conf index 7ece67705a9..7144d73f104 100644 --- a/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.conf +++ b/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.conf @@ -6,19 +6,28 @@ Distribution=|ubuntu [Content] VolatilePackages= + libnss-myhostname + libnss-mymachines + libnss-resolve + libnss-systemd + libpam-systemd + libsystemd-dev + libudev-dev systemd - systemd-userdbd + systemd-boot + systemd-boot-efi + systemd-container + systemd-coredump + systemd-dev + systemd-homed + systemd-journal-remote systemd-oomd + systemd-resolved systemd-sysv systemd-tests systemd-timesyncd - systemd-resolved - systemd-homed - systemd-coredump - systemd-journal-remote - systemd-container - systemd-boot systemd-ukify + systemd-userdbd udev Packages= diff --git a/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.conf b/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.conf index 24d69ccc277..dbc6f945af8 100644 --- a/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.conf +++ b/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.conf @@ -9,15 +9,18 @@ InitrdInclude=initrd/ [Content] VolatilePackages= systemd - udev - systemd-experimental systemd-boot systemd-container + systemd-devel + systemd-doc + systemd-experimental systemd-homed + systemd-lang systemd-network systemd-portable systemd-sysvcompat systemd-testsuite + udev # We install gawk, gzip, grep, xz, sed, rsync and docbook-xsl-stylesheets here explicitly so that the busybox # versions don't get installed instead. From 15bf8bfb69e549fe46e652366fc9e7fab0e02562 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Thu, 18 Apr 2024 14:00:30 +0200 Subject: [PATCH 4/6] mkosi: Undefine FORTIFY_SOURCE before setting it again Otherwise we get warnings from gcc. --- mkosi.images/system/mkosi.conf.d/10-arch/mkosi.build.chroot | 2 +- .../system/mkosi.conf.d/10-centos-fedora/mkosi.build.chroot | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.build.chroot b/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.build.chroot index 8eebd62b047..13d4ebeb188 100755 --- a/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.build.chroot +++ b/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.build.chroot @@ -25,7 +25,7 @@ mount --mkdir --rbind "$PWD/pkg/$ID" "pkg/$ID/src/" # on the makepkg command line so we append to /etc/makepkg.conf instead. The rootfs is overlaid with a # writable tmpfs during the build script so these changes don't end up in the image itself. tee --append /etc/makepkg.conf >/dev/null < Date: Thu, 18 Apr 2024 13:28:17 +0200 Subject: [PATCH 5/6] mkosi: Setup --ffile-prefix-map= for opensuse as well This doesn't actually work because the opensuse spec doesn't allow adding extra build flags, but I'm working on fixing that, so let's already set things up for later. --- .../10-opensuse/mkosi.build.chroot | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.build.chroot b/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.build.chroot index fe89611e36e..6261be19903 100755 --- a/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.build.chroot +++ b/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.build.chroot @@ -29,6 +29,20 @@ tee --append /usr/lib/rpm/suse/macros <<'EOF' %{nil} EOF +VERSION="$(cat meson.version)" +RELEASE="$(date "+%Y%m%d%H%M%S" --date "@$TS")" + +DIST="$(rpm --eval %dist)" +ARCH="$(rpm --eval %_arch)" +SRCDEST="/usr/src/debug/systemd-$VERSION-${RELEASE}${DIST}.$ARCH" + +# TODO: Enable this when the opensuse spec stops unconditionally setting FORTIFY_SOURCE=2. +# EXTRA_CFLAGS="-O0 -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=0" +EXTRA_CFLAGS="" +if ((WITH_DEBUG)); then + EXTRA_CFLAGS="$EXTRA_CFLAGS -ffile-prefix-map=../src=$SRCDEST" +fi + build() { IFS= # TODO: Replace meson_build and meson_install overrides with "--undefine __meson_verbose" once @@ -49,15 +63,17 @@ build() { $( ((WITH_DEBUG)) || echo --define) \ $( ((WITH_DEBUG)) || echo "debug_package %{nil}") \ --define "vendor openSUSE" \ - --define "version_override $(cat meson.version)" \ - --define "release_override $(date "+%Y%m%d%H%M%S" --date "@$TS")" \ + --define "version_override $VERSION" \ + --define "release_override $RELEASE" \ --define "__check_files sh -c '$(rpm --eval %__check_files) | tee /tmp/unpackaged-files'" \ + --define "build_cflags $(rpm --eval %build_cflags) $EXTRA_CFLAGS" \ --define "meson_build %{shrink:%{__meson} compile -C %{_vpath_builddir} -j %{_smp_build_ncpus} %{nil}}" \ --define "meson_install %{shrink:DESTDIR=%{buildroot} %{__meson} install -C %{_vpath_builddir} --no-rebuild --quiet %{nil}}" \ --define "meson_extra_configure_options -D mode=developer -D b_sanitize=${SANITIZERS:-none}" \ --define "__os_install_post /usr/lib/rpm/brp-suse %{nil}" \ --define "__elf_exclude_path ^/usr/lib/systemd/tests/unit-tests/.*$" \ --define "__script_requires %{nil}" \ + --define "_find_debuginfo_dwz_opts %{nil}" \ --noclean \ "$@" \ "pkg/$ID/systemd.spec" From a432014b0142b610b31e1737133a616741bc7cb1 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Thu, 18 Apr 2024 13:29:12 +0200 Subject: [PATCH 6/6] mkosi: Install debug packages when WITH_DEBUG=1 is enabled When we're building debuginfo packages, the original binaries and libraries are stripped so make sure we install the debuginfo packages to make sure debugging in the container/VM still works. --- .../10-arch/mkosi.conf.d/10-debug.conf | 7 +++++ .../mkosi.conf.d/10-debug.conf | 17 ++++++++++++ .../mkosi.conf.d/10-debug.conf | 27 +++++++++++++++++++ .../10-opensuse/mkosi.conf.d/10-debug.conf | 22 +++++++++++++++ 4 files changed, 73 insertions(+) create mode 100644 mkosi.images/system/mkosi.conf.d/10-arch/mkosi.conf.d/10-debug.conf create mode 100644 mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.conf.d/10-debug.conf create mode 100644 mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.conf.d/10-debug.conf create mode 100644 mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.conf.d/10-debug.conf diff --git a/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.conf.d/10-debug.conf b/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.conf.d/10-debug.conf new file mode 100644 index 00000000000..4a6d2e925ce --- /dev/null +++ b/mkosi.images/system/mkosi.conf.d/10-arch/mkosi.conf.d/10-debug.conf @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +[Match] +Environment=WITH_DEBUG=1 + +[Content] +VolatilePackages=systemd-debug diff --git a/mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.conf.d/10-debug.conf b/mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.conf.d/10-debug.conf new file mode 100644 index 00000000000..0c3707b20bf --- /dev/null +++ b/mkosi.images/system/mkosi.conf.d/10-centos-fedora/mkosi.conf.d/10-debug.conf @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +[Match] +Environment=WITH_DEBUG=1 + +[Content] +VolatilePackages= + systemd-container-debuginfo + systemd-debuginfo + systemd-debugsource + systemd-journal-remote-debuginfo + systemd-libs-debuginfo + systemd-networkd-debuginfo + systemd-pam-debuginfo + systemd-resolved-debuginfo + systemd-tests-debuginfo + systemd-udev-debuginfo diff --git a/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.conf.d/10-debug.conf b/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.conf.d/10-debug.conf new file mode 100644 index 00000000000..b53b3dcffec --- /dev/null +++ b/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.conf.d/10-debug.conf @@ -0,0 +1,27 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +[Match] +Environment=WITH_DEBUG=1 + +[Content] +VolatilePackages= + libnss-myhostname-dbgsym + libnss-mymachines-dbgsym + libnss-resolve-dbgsym + libnss-systemd-dbgsym + libpam-systemd-dbgsym + libsystemd-shared-dbgsym + libsystemd0-dbgsym + libudev1-dbgsym + systemd-boot-dbgsym + systemd-container-dbgsym + systemd-coredump-dbgsym + systemd-dbgsym + systemd-homed-dbgsym + systemd-journal-remote-dbgsym + systemd-oomd-dbgsym + systemd-resolved-dbgsym + systemd-tests-dbgsym + systemd-timesyncd-dbgsym + systemd-userdbd-dbgsym + udev-dbgsym diff --git a/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.conf.d/10-debug.conf b/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.conf.d/10-debug.conf new file mode 100644 index 00000000000..2262eae77e9 --- /dev/null +++ b/mkosi.images/system/mkosi.conf.d/10-opensuse/mkosi.conf.d/10-debug.conf @@ -0,0 +1,22 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later + +[Match] +Environment=WITH_DEBUG=1 + +[Content] +VolatilePackages= + libsystemd0-debuginfo + libudev1-debuginfo + systemd-boot-debuginfo + systemd-container-debuginfo + systemd-coredump-debuginfo + systemd-debuginfo + systemd-debugsource + systemd-experimental-debuginfo + systemd-homed-debuginfo + systemd-journal-remote-debuginfo + systemd-network-debuginfo + systemd-portable-debuginfo + systemd-sysvcompat-debuginfo + systemd-testsuite-debuginfo + udev-debuginfo