Re: Any interest in building the Linux kernel from a MacOS host?

From: Hector Martin
Date: Mon Sep 26 2022 - 08:49:00 EST


On 26/09/2022 18.06, Martin Povišer wrote:
> FWIW my current workflow includes building the kernel under macOS, so
> there’s some interest from me, but that will pass once the porting
> project progresses enough. So far I get by with some local duct tape.
>
>> On 26. 9. 2022, at 10:09, Sven Peter <sven@xxxxxxxxxxxxx> wrote:
>>
>> On Mon, Sep 26, 2022, at 09:51, Nick Desaulniers wrote:
>
> (...)
>
>>> If this might seem helpful
>>> to anyone's workflow, I wouldn't mind pursuing this (with some
>>> cleanup, sending a more formal patch set). Maybe this helps us
>>> bootstrap or get Linux up and running sooner on these machines?
>>
>> I've been either using a Linux VM or just a bare metal system running
>> on these machine for quite a while now to build kernels. This would've
>> been useful when I originally started though and VMs weren't working very
>> well yet so maybe it's still worth pursuing.
>
> I really wanted to do it in a VM as a saner path, but I didn't find
> a satisfactory way to share the working source tree between the macOS
> host and Linux guest (which wouldn't slow down the build).
>
> Martin

Just for context: Most of our (Asahi) developers' workflow involves
loading kernels over USB from another machine. That other machine can be
any OS, but if it's another M1/2 running macOS you get the additional
perk of USB-PD tooling to remote-force-reboot the target machine as well
as get a real physical serial port. The same tooling could be ported to
Linux-on-M1/2 relatively easily, but nobody has done that yet (probably
because these days we have a hypervisor that gives you a superset of
that functionality anyway, over standard USB, so it's not that necessary).

I personally use an x86 host and a hardware contraption to provide the
same hard reboot/UART functionality (for the rare case when the
hypervisor borks, to avoid having to hold down power buttons).

So there are certainly some people who'd benefit from using a macOS
machine as a build host, either for the special USB-PD functionality or
because they just like macOS as a development environment. It sounds
like getting it to work isn't that hard, so perhaps it's worth upstreaming?

- Hector