From: Michael A Cassaniti Date: Thu, 28 Jul 2022 07:40:55 +0000 (+1000) Subject: Added boot counting to unified kernels if /etc/kernel/tries exists X-Git-Tag: v14~89 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6719b8408739f58e28f5a7babf5cb8dfece20ee2;p=thirdparty%2Fmkosi.git Added boot counting to unified kernels if /etc/kernel/tries exists See https://systemd.io/AUTOMATIC_BOOT_ASSESSMENT/ for details on boot counting --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index d6fa184b8..7596d2be6 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -4060,12 +4060,17 @@ def install_unified_kernel( image_id = f"mkosi-{args.distribution}" partlabel = None + # See https://systemd.io/AUTOMATIC_BOOT_ASSESSMENT/#boot-counting + boot_count = "" + if root.joinpath("etc/kernel/tries").exists(): + boot_count = f'+{root.joinpath("etc/kernel/tries").read_text().strip()}' + if args.image_version: - boot_binary = root / prefix / f"EFI/Linux/{image_id}_{args.image_version}.efi" + boot_binary = root / prefix / f"EFI/Linux/{image_id}_{args.image_version}{boot_count}.efi" elif root_hash: - boot_binary = root / prefix / f"EFI/Linux/{image_id}-{kver}-{root_hash}.efi" + boot_binary = root / prefix / f"EFI/Linux/{image_id}-{kver}-{root_hash}{boot_count}.efi" else: - boot_binary = root / prefix / f"EFI/Linux/{image_id}-{kver}.efi" + boot_binary = root / prefix / f"EFI/Linux/{image_id}-{kver}{boot_count}.efi" if root.joinpath("etc/kernel/cmdline").exists(): boot_options = root.joinpath("etc/kernel/cmdline").read_text().strip()