From cbac3256144cd8ab7de23f96b86fd4bb3ce0bb0b Mon Sep 17 00:00:00 2001 From: Kenta Kubo <601636+kkebo@users.noreply.github.com> Date: Thu, 5 Feb 2026 04:38:55 +0900 Subject: [PATCH] config(qemu): add experimental Raspberry Pi support --- Configuration/QEMUConstant.swift | 38 +++++++++++++ .../UTMQemuConfiguration+Arguments.swift | 56 ++++++++++--------- Configuration/UTMQemuConfiguration.swift | 3 + .../UTMQemuConfigurationNetwork.swift | 2 + Configuration/UTMQemuConfigurationQEMU.swift | 2 +- Configuration/UTMQemuConfigurationSound.swift | 2 + Platform/Shared/VMConfigDisplayView.swift | 11 +++- Platform/Shared/VMConfigInputView.swift | 5 +- Platform/Shared/VMConfigQEMUView.swift | 3 +- Platform/Shared/VMConfigSystemView.swift | 4 ++ Platform/Shared/VMWizardHardwareView.swift | 7 +++ Platform/Shared/VMWizardOSOtherView.swift | 1 + Platform/ar.lproj/Localizable.strings | 4 ++ Platform/de.lproj/Localizable.strings | 4 ++ Platform/es-419.lproj/Localizable.strings | 4 ++ Platform/fi.lproj/Localizable.strings | 4 ++ Platform/fr.lproj/Localizable.strings | 1 + Platform/iOS/VMSessionState.swift | 4 ++ Platform/iOS/VMSettingsView.swift | 6 +- Platform/iOS/VMToolbarDisplayMenuView.swift | 6 ++ Platform/it.lproj/Localizable.strings | 4 ++ Platform/ja.lproj/Localizable.strings | 1 + Platform/ko.lproj/Localizable.strings | 1 + Platform/macOS/VMQEMUSettingsView.swift | 10 +++- Platform/pl.lproj/Localizable.strings | 1 + Platform/ru.lproj/Localizable.strings | 4 ++ Platform/zh-HK.lproj/Localizable.strings | 4 ++ Platform/zh-Hans.lproj/Localizable.strings | 4 ++ Platform/zh-Hant.lproj/Localizable.strings | 4 ++ 29 files changed, 165 insertions(+), 35 deletions(-) diff --git a/Configuration/QEMUConstant.swift b/Configuration/QEMUConstant.swift index 97d73ae8b..448b300dd 100644 --- a/Configuration/QEMUConstant.swift +++ b/Configuration/QEMUConstant.swift @@ -478,9 +478,24 @@ extension QEMUTarget { } } + var hasUsbSharingSupport: Bool { + switch self.rawValue { + case let x where x.hasPrefix("raspi"): return false + default: return true + } + } + var hasAgentSupport: Bool { switch self.rawValue { case "isapc": return false + case let x where x.hasPrefix("raspi"): return false + default: return true + } + } + + var hasUefiSupport: Bool { + switch self.rawValue { + case let x where x.hasPrefix("raspi"): return false default: return true } } @@ -491,6 +506,29 @@ extension QEMUTarget { default: return true } } + + var hasHypervisorSupport: Bool { + switch self.rawValue { + case let x where x.hasPrefix("raspi"): return false + default: return true + } + } + + var hasBuiltinFramebuffer: Bool { + switch self.rawValue { + case let x where x.hasPrefix("raspi"): return true + default: return false + } + } + + var fixedMemorySize: Int? { + switch self.rawValue { + case "raspi0", "raspi1ap", "raspi3ap": return 512 + case "raspi2b", "raspi3b": return 1024 + case "raspi4b": return 2048 + default: return nil + } + } } #if WITH_QEMU_TCI diff --git a/Configuration/UTMQemuConfiguration+Arguments.swift b/Configuration/UTMQemuConfiguration+Arguments.swift index a42c51a7d..f16fbed58 100644 --- a/Configuration/UTMQemuConfiguration+Arguments.swift +++ b/Configuration/UTMQemuConfiguration+Arguments.swift @@ -264,6 +264,8 @@ import Virtualization // for getting network interfaces "vgamem_mb=\(vgaRamSize)" } f() + } else if system.target.hasBuiltinFramebuffer { + // Use the board's built-in framebuffer (no arguments) } else { for display in displays { if !shouldSkipDisplay(display) { @@ -951,36 +953,38 @@ import Virtualization // for getting network interfaces f("usb-kbd,bus=usb-bus.0") } #if WITH_USB - let maxDevices = input.maximumUsbShare - let buses = (maxDevices + 2) / 3 - if input.usbBusSupport == .usb3_0 { - var controller = "qemu-xhci" - if isPcCompatible { - controller = "nec-usb-xhci" - } - for i in 0..