]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Drop boot counting support
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 18 Feb 2025 09:44:11 +0000 (10:44 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 18 Feb 2025 10:32:03 +0000 (11:32 +0100)
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.

mkosi/__init__.py
mkosi/config.py
mkosi/resources/man/mkosi.1.md
tests/test_config.py

index 0d6bd545d15738975b1e892cce0e3080af17e7b6..d01baf64402ae9f8b768ced2caadc7e7ab68ba3e 100644 (file)
@@ -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,
     )
 
 
index 15c523b3ccab75d7943b0596164b76ea23c55a92..1b9901ed4f9c15f66a2af93700b04880f9195159 100644 (file)
@@ -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",
     ),
index 35dc2ed80da83581ee14f8257b43e4975917e546..ff726c5364d087becdde822baac87280115f2421 100644 (file)
@@ -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
index d0ac5075462cad6f897b83faaddcbbc4db64465b..bb28843f390b8747b64c8e412b63e3a884bbbe96 100644 (file)
@@ -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: