From: Daan De Meyer Date: Tue, 18 Feb 2025 09:44:11 +0000 (+0100) Subject: Drop boot counting support X-Git-Tag: v26~373 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b5e418d52ec0817f7c986e4771573aae9178c77b;p=thirdparty%2Fmkosi.git Drop boot counting support Setting up boot counting for the initial UKI in an image does not make sense as there's nothing to fall back to. The existing interface where we pick up the number of tries from a file in /etc inside the image was also rather bad so let's get rid of the boot counting specifier. --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index 0d6bd545d..d01baf644 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -2036,13 +2036,12 @@ def install_type1( f.write("fi\n") -def expand_kernel_specifiers(text: str, kver: str, token: str, roothash: str, boot_count: str) -> str: +def expand_kernel_specifiers(text: str, kver: str, token: str, roothash: str) -> str: specifiers = { "&": "&", "e": token, "k": kver, "h": roothash, - "c": boot_count, } return expand_delayed_specifiers(specifiers, text) @@ -2063,19 +2062,11 @@ def finalize_bootloader_entry_format( if not context.config.unified_kernel_image_format: bootloader_entry_format += "-&h" - boot_count = "" - if (context.root / "etc/kernel/tries").exists(): - boot_count = (context.root / "etc/kernel/tries").read_text().strip() - - if not context.config.unified_kernel_image_format: - bootloader_entry_format += "+&c" - return expand_kernel_specifiers( bootloader_entry_format, kver=kver, token=token, roothash=roothash_value, - boot_count=boot_count, ) diff --git a/mkosi/config.py b/mkosi/config.py index 15c523b3c..1b9901ed4 100644 --- a/mkosi/config.py +++ b/mkosi/config.py @@ -2921,8 +2921,8 @@ SETTINGS: list[ConfigSetting[Any]] = [ "requires a filename with no path components." ), # The default value is set in `__init__.py` in `install_uki`. - # `None` is used to determine if the roothash and boot count format - # should be appended to the filename if they are found. + # `None` is used to determine if the roothash should be appended + # to the filename if they are found. # default= help="Specify the format used for the UKI filename", ), diff --git a/mkosi/resources/man/mkosi.1.md b/mkosi/resources/man/mkosi.1.md index 35dc2ed80..ff726c536 100644 --- a/mkosi/resources/man/mkosi.1.md +++ b/mkosi/resources/man/mkosi.1.md @@ -987,7 +987,6 @@ boolean argument: either `1`, `yes`, or `true` to enable, or `0`, `no`, | `&e` | Entry Token | | `&k` | Kernel version | | `&h` | `roothash=` or `usrhash=` value of kernel argument | - | `&c` | Number of tries used for boot attempt counting | `UnifiedKernelImageProfiles=`, `--uki-profile=` : Build additional UKI profiles. Takes a comma-separated list of paths diff --git a/tests/test_config.py b/tests/test_config.py index d0ac50754..bb28843f3 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -1211,7 +1211,6 @@ def test_kernel_specifiers(tmp_path: Path) -> None: kver = "13.0.8-5.10.0-1057-oem" # taken from reporter of #1638 token = "MySystemImage" roothash = "67e893261799236dcf20529115ba9fae4fd7c2269e1e658d42269503e5760d38" - boot_count = "3" def test_expand_kernel_specifiers(text: str) -> str: return expand_kernel_specifiers( @@ -1219,19 +1218,15 @@ def test_kernel_specifiers(tmp_path: Path) -> None: kver=kver, token=token, roothash=roothash, - boot_count=boot_count, ) assert test_expand_kernel_specifiers("&&") == "&" assert test_expand_kernel_specifiers("&k") == kver assert test_expand_kernel_specifiers("&e") == token assert test_expand_kernel_specifiers("&h") == roothash - assert test_expand_kernel_specifiers("&c") == boot_count assert test_expand_kernel_specifiers("Image_1.0.3") == "Image_1.0.3" - assert ( - test_expand_kernel_specifiers("Image~&c+&h-&k-&e") == f"Image~{boot_count}+{roothash}-{kver}-{token}" - ) + assert test_expand_kernel_specifiers("Image+&h-&k-&e") == f"Image+{roothash}-{kver}-{token}" def test_output_id_version(tmp_path: Path) -> None: