]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Drop support for CDROM=
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 21 Oct 2025 11:33:10 +0000 (13:33 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 21 Oct 2025 19:26:08 +0000 (21:26 +0200)
We want to align on systemd-vmspawn in the future, and it's very
unlikely it'll ever support this option, so let's drop support for
it since it's very niche and not useful except for testing systemd-repart
ISO stuff.

mkosi/config.py
mkosi/qemu.py
mkosi/resources/man/mkosi.1.md
mkosi/resources/man/mkosi.news.7.md
mkosi/vmspawn.py
tests/test_json.py

index cf42dc328a218d810ba014680ac260fe9f24a608..cec8dcdf18f709437a31ace277f9119b46585959 100644 (file)
@@ -2130,7 +2130,6 @@ class Config:
     vsock: ConfigFeature
     vsock_cid: int
     tpm: ConfigFeature
-    cdrom: bool
     removable: bool
     firmware: Firmware
     firmware_variables: Optional[Path]
@@ -4189,17 +4188,6 @@ SETTINGS: list[ConfigSetting[Any]] = [
         compat_names=("QemuSwtpm",),
         scope=SettingScope.main,
     ),
-    ConfigSetting(
-        dest="cdrom",
-        name="CDROM",
-        metavar="BOOLEAN",
-        section="Runtime",
-        parse=config_parse_boolean,
-        help="Attach the image as a CD-ROM to the virtual machine",
-        compat_longs=("--qemu-cdrom",),
-        compat_names=("QemuCdrom",),
-        scope=SettingScope.main,
-    ),
     ConfigSetting(
         dest="removable",
         metavar="BOOLEAN",
@@ -5767,7 +5755,6 @@ def summary(config: Config) -> str:
                               VSock: {config.vsock}
                 VSock Connection ID: {VsockCID.format(config.vsock_cid)}
                                 TPM: {config.tpm}
-                             CD-ROM: {yes_no(config.cdrom)}
                            Firmware: {config.firmware}
                  Firmware Variables: {none_to_none(config.firmware_variables)}
                               Linux: {none_to_none(config.linux)}
index 2e9ef759c1e3863db2f851c4041e493a819a62bc..86f3db30dfdb3a954c3f5cf9a769b6328dd7e587 100644 (file)
@@ -837,10 +837,6 @@ def finalize_kernel_command_line_extra(config: Config) -> list[str]:
     ):
         cmdline += [f"systemd.hostname={config.machine}"]
 
-    if config.cdrom:
-        # CD-ROMs are read-only so tell systemd to boot in volatile mode.
-        cmdline += ["systemd.volatile=yes"]
-
     if config.console != ConsoleMode.gui:
         cmdline += [
             f"systemd.tty.term.console={term}",
@@ -1296,36 +1292,9 @@ def run_qemu(args: Args, config: Config) -> None:
                     "-global", "driver=cfi.pflash01,property=secure,value=on",
                 ]  # fmt: skip
 
-        if config.cdrom and config.output_format in (OutputFormat.disk, OutputFormat.esp):
-            # CD-ROM devices have sector size 2048 so we transform disk images into ones with sector size
-            # 2048.
-            src = (config.output_dir_or_cwd() / config.output_with_compression).resolve()
-            fname = src.parent / f"{src.name}-{uuid.uuid4().hex}"
-            run(
-                [
-                    "systemd-repart",
-                    "--definitions=/",
-                    "--no-pager",
-                    "--pretty=no",
-                    "--offline=yes",
-                    "--empty=create",
-                    "--size=auto",
-                    "--sector-size=2048",
-                    "--copy-from", workdir(src),
-                    workdir(fname),
-                ],  # fmt: skip
-                sandbox=config.sandbox(
-                    options=[
-                        "--bind", fname.parent, workdir(fname.parent),
-                        "--ro-bind", src, workdir(src),
-                    ],
-                ),
-            )  # fmt: skip
-            stack.callback(lambda: fname.unlink())
-        else:
-            fname = stack.enter_context(
-                copy_ephemeral(config, config.output_dir_or_cwd() / config.output_with_compression)
-            )
+        fname = stack.enter_context(
+            copy_ephemeral(config, config.output_dir_or_cwd() / config.output_with_compression)
+        )
 
         apply_runtime_size(config, fname)
 
@@ -1428,9 +1397,7 @@ def run_qemu(args: Args, config: Config) -> None:
             ]
 
             device_type = "virtio-blk-pci"
-            if config.cdrom:
-                device_type = "scsi-cd,device_id=mkosi"
-            elif config.removable:
+            if config.removable:
                 device_type = "scsi-hd,device_id=mkosi,removable=on"
 
             cmdline += [
index 8dfd038b6d78e79e736d8b136e93641646446f17..4af5d0e5913afa708c1131a2c7714bac1d968575 100644 (file)
@@ -1779,10 +1779,6 @@ boolean argument: either `1`, `yes`, or `true` to enable, or `0`, `no`,
 :   Configure whether to use a virtual TPM when booting a virtual machine.
     Takes a boolean value or `auto`. Defaults to `auto`.
 
-`CDROM=`, `--cdrom=`
-:   Configures whether to attach the image as a CD-ROM device when booting a
-    virtual machine. Takes a boolean value. Defaults to `no`.
-
 `Removable=`, `--removable=`
 :   Configures whether to attach the image as a removable device when booting
     a virtual machine. Takes a boolean value. Defaults to `no`.
index b6848733d6475de8a2d9e5e54387086b6967d7a1..0b77ceee873cb83c3e0898df8f3acced837fff7e 100644 (file)
@@ -36,6 +36,7 @@
   positive and negative globs. The new option is FirmwareFiles=.
 - The `RuntimeScratch=` option has been dropped. Use `RuntimeSize=`
   instead to grow the image before booting it.
+- The `CDROM=` option has been dropped.
 
 ## v25
 
index 6a0fd9c0740944e95f4c767fa1204525a4742a7a..f84abda84bd3965cebd2854c355fe26699677870 100644 (file)
@@ -34,9 +34,6 @@ def run_vmspawn(args: Args, config: Config) -> None:
     if config.firmware == Firmware.bios:
         die("systemd-vmspawn cannot boot BIOS firmware images")
 
-    if config.cdrom:
-        die("systemd-vmspawn does not support CD-ROM images")
-
     if config.bind_user:
         die("systemd-vmspawn does not support --bind-user=")
 
index d2d5c8759a9421c894c896c249d4b23e2fb41fb7..e6deffbc208237b5f51acc97095af1ba0d16ecd1 100644 (file)
@@ -129,7 +129,6 @@ def test_config() -> None:
             ],
             "BuildSourcesEphemeral": "yes",
             "BuildSubdirectory": "abc/abc",
-            "CDROM": false,
             "CPUs": 2,
             "CXL": false,
             "CacheDirectory": "/is/this/the/cachedir",
@@ -455,7 +454,6 @@ def test_config() -> None:
         cache_dir=Path("/is/this/the/cachedir"),
         cache_key="qed",
         cacheonly=Cacheonly.always,
-        cdrom=False,
         checksum=False,
         clean_package_metadata=ConfigFeature.auto,
         clean_scripts=[Path("/clean")],