Hi, I'm new to the forum, trying to learn Swift by doing a small CLI application that helps running Linux VMs on Apples Virtualization Framework. I've posted this question almost verbatim from the forums on swift.org, and was kindly directed here.
My intention is to create VMs with ISO files, but enable output only via serial console, without a virtual graphics card. I know this might not be feasible, but it was the idea I had and I wanted to see if it is doable. So far I have managed to boot an Alpine Linux via kernel and ramdisk and the VZLinuxBootLoader. One crucial step is to provide VZLinuxBootLoader.commandLine to tell the kernel to activate output on the virtual console port, like console=hvc0. But booting an ISO with VZLinuxBootLoader is not possible if I'm not mistaken and the other option is VZEFIBootLoader, which doesn't support kernel parameters.
Now, I'd like to try and mix both boot loaders by subclassing VZLinuxBootLoader and implementing all that is required to boot an ISO file. But if I look at the implementation these two classes are relatively sparse:
@available(macOS 11.0, *)
open class VZLinuxBootLoader : VZBootLoader {
public init(kernelURL: URL)
open var kernelURL: URL
open var commandLine: String
open var initialRamdiskURL: URL?
}
and
@available(macOS 13.0, *)
open class VZEFIBootLoader : VZBootLoader {
public init()
open var variableStore: VZEFIVariableStore?
}
I've cut out comments to keep it brief.
I expected to find some implementation details for what makes these classes distinct from each other (as they both inherit VZBootLoader), hoping to be able to copy/paste a few methods here and there and try my luck passing some kernel args into the ISOs kernel.
Is something similar possible? Am I in the right spot? I'd really appreciate some feedback and maybe some pointers to the right direction. Maybe someone can also give me some details or links to documentation why the two classes contain practically no implementation code?
Thanks in advance, and have a great day.