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.
I have an idea as to how you might make progress
Sadly, that didn’t pan out. I was hoping that the format of the VZEFIVariableStore
file was in some standard format, so you could set a boot argument there, but:
-
That hope was misguided. That format of that file is something Apple specific and not documented as API.
-
Even if that were the case, there’s no guarantee that Linux will be able to boot arguments from there [1].
At this point I’m out of ideas )-:
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
[1] To be clear, I know nothing about how Linux picks up its boot arguments, I was just hoping based on my experience with macOS on Intel.