From: Daan De Meyer Date: Tue, 21 Oct 2025 11:33:10 +0000 (+0200) Subject: Drop support for CDROM= X-Git-Tag: v26~66^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3713c01f7115630774b05e34aedbb20be2a22884;p=thirdparty%2Fmkosi.git Drop support for CDROM= 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. --- diff --git a/mkosi/config.py b/mkosi/config.py index cf42dc328..cec8dcdf1 100644 --- a/mkosi/config.py +++ b/mkosi/config.py @@ -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)} diff --git a/mkosi/qemu.py b/mkosi/qemu.py index 2e9ef759c..86f3db30d 100644 --- a/mkosi/qemu.py +++ b/mkosi/qemu.py @@ -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 += [ diff --git a/mkosi/resources/man/mkosi.1.md b/mkosi/resources/man/mkosi.1.md index 8dfd038b6..4af5d0e59 100644 --- a/mkosi/resources/man/mkosi.1.md +++ b/mkosi/resources/man/mkosi.1.md @@ -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`. diff --git a/mkosi/resources/man/mkosi.news.7.md b/mkosi/resources/man/mkosi.news.7.md index b6848733d..0b77ceee8 100644 --- a/mkosi/resources/man/mkosi.news.7.md +++ b/mkosi/resources/man/mkosi.news.7.md @@ -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 diff --git a/mkosi/vmspawn.py b/mkosi/vmspawn.py index 6a0fd9c07..f84abda84 100644 --- a/mkosi/vmspawn.py +++ b/mkosi/vmspawn.py @@ -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=") diff --git a/tests/test_json.py b/tests/test_json.py index d2d5c8759..e6deffbc2 100644 --- a/tests/test_json.py +++ b/tests/test_json.py @@ -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")],