Skip to content

Commit

Permalink
Merge pull request #2385 from DaanDeMeyer/focal
Browse files Browse the repository at this point in the history
Various apt based distribution fixes
  • Loading branch information
behrmann authored Feb 13, 2024
2 parents 32d293c + 5f90c9e commit 09c898a
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 11 deletions.
6 changes: 0 additions & 6 deletions mkosi.conf.d/30-debian-ubuntu/mkosi.conf
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,25 @@ Distribution=|ubuntu
Packages=
?exact-name(systemd-ukify)
apt
archlinux-keyring
bash
btrfs-progs
bubblewrap
ca-certificates
coreutils
cpio
curl
dbus-broker
debian-archive-keyring
dnf
dosfstools
e2fsprogs
erofs-utils
iproute2
iputils-ping
libtss2-dev
makepkg
mtools
openssh-client
openssh-server
openssl
ovmf
pacman-package-manager
pesign
python3-cryptography
python3-pefile
Expand All @@ -42,7 +37,6 @@ Packages=
socat
squashfs-tools
strace
swtpm
systemd
systemd-container
systemd-coredump
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# SPDX-License-Identifier: LGPL-2.1-or-later

[Match]
Distribution=ubuntu
Release=|focal
Release=|jammy

[Content]
# "orphan_file" is enabled by default in recent versions of mkfs.ext4 but not supported by the Jammy/Focal kernels
# so we explicitly disable it.
Environment=SYSTEMD_REPART_MKFS_OPTIONS_EXT4="-O ^orphan_file"
9 changes: 9 additions & 0 deletions mkosi.conf.d/30-debian-ubuntu/mkosi.conf.d/20-focal.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# SPDX-License-Identifier: LGPL-2.1-or-later

[Match]
Distribution=ubuntu
Release=focal

[Content]
Packages=
dbus
14 changes: 14 additions & 0 deletions mkosi.conf.d/30-debian-ubuntu/mkosi.conf.d/20-not-focal.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# SPDX-License-Identifier: LGPL-2.1-or-later

[Match]
Distribution=|!ubuntu
Release=|!focal

[Content]
Packages=
archlinux-keyring
dbus-broker
dnf
makepkg
pacman-package-manager
swtpm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[Match]
Release=!jammy
Release=!focal

[Content]
Packages=
Expand Down
17 changes: 13 additions & 4 deletions mkosi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1678,11 +1678,20 @@ def build_kernel_modules_initrd(context: Context, kver: str) -> Path:
sandbox=context.sandbox,
)

# Debian/Ubuntu do not compress their kernel modules, so we compress the initramfs instead. Note that
# this is not ideal since the compressed kernel modules will all be decompressed on boot which
# requires significant memory.

if context.config.distribution.is_apt_distribution():
maybe_compress(context, Compression.zstd, kmods, kmods)
# Ubuntu Focal's kernel does not support zstd-compressed initrds so use xz instead.
if context.config.distribution == Distribution.ubuntu and context.config.release == "focal":
compression = Compression.xz
# Older Debian and Ubuntu releases do not compress their kernel modules, so we compress the initramfs instead.
# Note that this is not ideal since the compressed kernel modules will all be decompressed on boot which
# requires significant memory.
elif context.config.distribution == Distribution.debian and context.config.release in ("sid", "testing"):
compression = Compression.none
else:
compression = Compression.zstd

maybe_compress(context, compression, kmods, kmods)

return kmods

Expand Down
5 changes: 4 additions & 1 deletion mkosi/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,10 @@ def config_parse_compress_level(value: Optional[str], old: Optional[int]) -> Opt

def config_default_compression(namespace: argparse.Namespace) -> Compression:
if namespace.output_format in (OutputFormat.tar, OutputFormat.cpio, OutputFormat.uki, OutputFormat.esp):
if namespace.distribution.is_centos_variant() and int(namespace.release) <= 8:
if (
(namespace.distribution.is_centos_variant() and int(namespace.release) <= 8) or
(namespace.distribution == Distribution.ubuntu and namespace.release == "focal")
):
return Compression.xz
else:
return Compression.zstd
Expand Down

0 comments on commit 09c898a

Please sign in to comment.