]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Remove --qemu-boot option
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 10 Jan 2023 14:33:45 +0000 (15:33 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 11 Jan 2023 14:18:23 +0000 (15:18 +0100)
Given that we're standardizing more and more on UEFI and unified
kernel images, let's drop support for qemu direct linux boot, to
drop yet another seldomly exercised codepath.

.github/workflows/ci.yml
NEWS.md
mkosi.md
mkosi/__init__.py
mkosi/backend.py
tests/test_config_parser.py

index dd132bb06dc3da5718cbba13714ba6962f12998a..06cccc8349858c10230004c2af5cf356a57d48e4 100644 (file)
@@ -206,16 +206,8 @@ jobs:
 
     - name: Boot ${{ matrix.distro }}/${{ matrix.format }} UEFI
       if: matrix.format == 'disk'
-      run: sudo timeout -k 30 10m python3 -m mkosi --qemu-boot=uefi qemu
+      run: sudo timeout -k 30 10m python3 -m mkosi qemu
 
     - name: Check ${{ matrix.distro }}/${{ matrix.format }} UEFI
       if: matrix.format == 'disk' || matrix.format == 'directory'
       run: sudo python3 -m mkosi shell bash -c "[[ -e /testok ]] || { cat /failed-services; exit 1; }"
-
-    - name: Boot ${{ matrix.distro }}/${{ matrix.format}} QEMU Linux Boot
-      if: matrix.format == 'disk'
-      run: sudo timeout -k 30 10m python3 -m mkosi --qemu-boot=linux qemu
-
-    - name: Check ${{ matrix.distro }}/${{ matrix.format }} QEMU Linux Boot
-      if: matrix.format == 'disk' || matrix.format == 'directory'
-      run: sudo python3 -m mkosi shell bash -c "[[ -e /testok ]] || { cat /failed-services; exit 1; }"
diff --git a/NEWS.md b/NEWS.md
index fe656d89c1294547017151dad6dc85e6c82927b2..753c708c5dc0af0c788489cba83b731d118196b6 100644 (file)
--- a/NEWS.md
+++ b/NEWS.md
@@ -28,6 +28,7 @@
 
     We also remove the WithoutUnifiedKernelImages= switch as building unified
     kernel images is trivial and fast these days.
+- Support for --qemu-boot was dropped
 
 ## v14
 
index 8370571876ef93546952bf69a1e53d106e3de4c9..195b34101527052f0cf9cbbf2137e15fb40ccddc 100644 (file)
--- a/mkosi.md
+++ b/mkosi.md
@@ -984,12 +984,6 @@ a machine ID.
   scope unit for the containers. This option should be used when mkosi is
   run by a service unit.
 
-`QemuBoot=`, `--qemu-boot=`
-
-: When used with the `qemu` verb, this option specifies how qemu should
-  boot the image. Can be set to either `uefi` to do a UEFI boot or `linux`
-  to do a qemu direct linux boot.
-
 `Netdev=`, `--netdev`
 
 : When used with the boot or qemu verbs, this option creates a virtual
index 0e8a5d8bb571f49245346e14477a9e551d020975..3ec1d008acf5b549a6e9cfaeab3b5a62179c4f21 100644 (file)
@@ -1086,8 +1086,6 @@ def install_unified_kernel(state: MkosiState, label: Optional[str], root_hash: O
                 option = "mount.usr" if usr_only else "root"
                 boot_options = f"{boot_options} {option}=LABEL={label}"
 
-            state.staging.joinpath(state.config.output_split_cmdline).write_text(boot_options)
-
             cmd: List[PathString] = [
                 "ukify",
                 "--cmdline", boot_options,
@@ -1116,6 +1114,9 @@ def install_unified_kernel(state: MkosiState, label: Optional[str], root_hash: O
 
             run(cmd)
 
+            if not state.staging.joinpath(state.staging / state.config.output_split_kernel.name).exists():
+                copy_file(boot_binary, state.staging / state.config.output_split_kernel.name)
+
 
 def secure_boot_sign(state: MkosiState, directory: Path, replace: bool = False) -> None:
     if state.do_run_build_script:
@@ -1150,49 +1151,6 @@ def secure_boot_sign(state: MkosiState, directory: Path, replace: bool = False)
                 os.rename(f"{f}.signed", f)
 
 
-def extract_unified_kernel(state: MkosiState) -> None:
-    if state.do_run_build_script or state.for_cache or not state.config.bootable:
-        return
-
-    kernel = None
-
-    for path, _, filenames in os.walk(state.root / "boot/EFI/Linux"):
-        for i in filenames:
-            if not i.endswith(".efi") and not i.endswith(".EFI"):
-                continue
-
-            if kernel is not None:
-                raise ValueError(
-                    f"Multiple kernels found, don't know which one to extract. ({kernel} vs. {path}/{i})"
-                )
-
-            kernel = os.path.join(path, i)
-
-    if kernel is None:
-        return
-
-    copy_file(kernel, state.staging / state.config.output_split_kernel.name)
-
-
-def extract_kernel_image_initrd(state: MkosiState) -> None:
-    if state.do_run_build_script or state.for_cache or not state.config.bootable:
-        return
-
-    kimgabs = None
-    initrd = None
-
-    for kver, kimg in gen_kernel_images(state):
-        kimgabs = state.root / kimg
-        initrd = initrd_path(state, kver)
-
-    if kimgabs is None:
-        return
-    assert initrd is not None
-
-    copy_file(kimgabs, state.staging / state.config.output_split_kernel_image.name)
-    copy_file(initrd, state.staging / state.config.output_split_initrd.name)
-
-
 def compress_output(config: MkosiConfig, src: Path) -> None:
     compress = should_compress_output(config)
 
@@ -2293,13 +2251,6 @@ def create_parser() -> ArgumentParserMkosi:
         action=BooleanAction,
         help="If specified, underlying systemd-nspawn containers use the resources of the current unit.",
     )
-    group.add_argument(
-        "--qemu-boot",
-        help="Configure which qemu boot protocol to use",
-        choices=["uefi", "linux", None],
-        metavar="PROTOCOL",
-        default="uefi",
-    )
     group.add_argument(
         "--network-veth",     # Compatibility option
         dest="netdev",
@@ -2633,9 +2584,6 @@ def unlink_output(config: MkosiConfig) -> None:
                     if p.name.startswith(config.output_split_kernel.name):
                         unlink_try_hard(p)
             unlink_try_hard(config.output_split_kernel)
-            unlink_try_hard(config.output_split_kernel_image)
-            unlink_try_hard(config.output_split_initrd)
-            unlink_try_hard(config.output_split_cmdline)
 
             if config.nspawn_settings is not None:
                 unlink_try_hard(config.output_nspawn_settings)
@@ -3644,9 +3592,6 @@ def build_image(state: MkosiState, *, manifest: Optional[Manifest] = None) -> No
 
     invoke_repart(state, split=True)
 
-    extract_unified_kernel(state)
-    extract_kernel_image_initrd(state)
-
     make_tar(state)
     make_cpio(state)
     make_directory(state)
@@ -4108,7 +4053,7 @@ def run_qemu(config: MkosiConfig) -> None:
     accel = "kvm" if config.qemu_kvm else "tcg"
 
     firmware, fw_supports_sb = find_qemu_firmware(config)
-    smm = "on" if fw_supports_sb and config.qemu_boot == "uefi" else "off"
+    smm = "on" if fw_supports_sb else "off"
 
     if config.architecture == "aarch64":
         machine = f"type=virt,accel={accel}"
@@ -4154,21 +4099,13 @@ def run_qemu(config: MkosiConfig) -> None:
             # after it is created.
             cmdline += ["-nic", f"tap,script=no,downscript=no,ifname={ifname},model=virtio-net-pci"]
 
-    if config.qemu_boot == "uefi":
-        cmdline += ["-drive", f"if=pflash,format=raw,readonly=on,file={firmware}"]
-
-    if config.qemu_boot == "linux":
-        cmdline += [
-            "-kernel", config.output_split_kernel_image,
-            "-initrd", config.output_split_initrd,
-            "-append", config.output_split_cmdline.read_text().strip(),
-        ]
+    cmdline += ["-drive", f"if=pflash,format=raw,readonly=on,file={firmware}"]
 
     for k, v in config.credentials.items():
         cmdline += ["-smbios", f"type=11,value=io.systemd.credential:{k}={v}"]
 
     with contextlib.ExitStack() as stack:
-        if config.qemu_boot == "uefi" and fw_supports_sb:
+        if fw_supports_sb:
             ovmf_vars = stack.enter_context(copy_file_temporary(src=find_ovmf_vars(config), dir=tmp_dir()))
             cmdline += [
                 "-global",
index a3679fbb362b44be865c65a7a6a02b5fa7344a0f..5475219f8f2ffad715f047768a3aea3be3d32e30 100644 (file)
@@ -429,7 +429,6 @@ class MkosiConfig:
     qemu_mem: str
     qemu_kvm: bool
     qemu_args: Sequence[str]
-    qemu_boot: str
 
     # systemd-nspawn specific options
     nspawn_keep_unit: bool
@@ -443,18 +442,6 @@ class MkosiConfig:
     def output_split_kernel(self) -> Path:
         return build_auxiliary_output_path(self, ".efi")
 
-    @property
-    def output_split_kernel_image(self) -> Path:
-        return build_auxiliary_output_path(self, ".vmlinuz")
-
-    @property
-    def output_split_initrd(self) -> Path:
-        return build_auxiliary_output_path(self, ".initrd")
-
-    @property
-    def output_split_cmdline(self) -> Path:
-        return build_auxiliary_output_path(self, ".cmdline")
-
     @property
     def output_nspawn_settings(self) -> Path:
         return build_auxiliary_output_path(self, ".nspawn")
@@ -487,9 +474,6 @@ class MkosiConfig:
         return (
             self.output,
             self.output_split_kernel,
-            self.output_split_kernel_image,
-            self.output_split_initrd,
-            self.output_split_cmdline,
             self.output_nspawn_settings,
             self.output_checksum,
             self.output_signature,
index e32f1440fe72f34e1c19a6822502f74675bd00c7..0c1d3d801ff1f95127b72ec08dd609013eff5b95 100644 (file)
@@ -133,7 +133,6 @@ class MkosiConfig:
             "qemu_kvm": mkosi.qemu_check_kvm_support(),
             "qemu_args": [],
             "nspawn_keep_unit": False,
-            "qemu_boot": "uefi",
             "netdev": False,
             "ephemeral": False,
             "cache_initrd": False,