Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Apple Fan 2008

macrumors 68000
Original poster
May 17, 2021
1,595
3,886
Florida, USA 🇺🇸
I’ve been wondering how plausible it would be to port Darwin or even just XNU over to RISC-V. I already downloaded the XNU source code and have been poking around a little, but I would likely need to really get into RISC-V assembly to make a working build. (Which I will do as soon as I get a RISC-V SBC to play around with, which I plan to soon)

XNU has already been officially supported on two CISC platforms (68k on NeXTStep machines and x86 for OpenStep, Rhapsody, and OS X/macOS) and two RISC platforms (PowerPC and ARM). So porting it to a third RISC platform should be possible in theory.

If you’re wondering why, I want this, the answer is just because the idea of Darwin on RISC-V just sounds really cool to me, even when Linux, another UNIX based system, is right there.

If I continue with this idea should I go for a recent version (Apple Silicon era) or older version (back when Apple had complete binaries of Darwin up for download)?

(If this post feels out of place on this forum, I apologize, I wasn’t 100% sure where to post this)
 
I think it would be a decent chunk of work to get anything together that you can actually run software with. But possible, probably.

You'll definitely need to replace some hand crafted assembly but hopefully the majority of the work lies in early boot and making available some set of "intrinsics" to the C code that'll then just compile and work, but it's hard to say without having tried.

If you want to actually get a useful Darwin system out the other end and not just a kernel that boots without a userspace, I would base it off of PureDarwin or another project in a similar spirit
 
  • Like
Reactions: Basic75
I think it would be a decent chunk of work to get anything together that you can actually run software with. But possible, probably.

You'll definitely need to replace some hand crafted assembly but hopefully the majority of the work lies in early boot and making available some set of "intrinsics" to the C code that'll then just compile and work, but it's hard to say without having tried.

If you want to actually get a useful Darwin system out the other end and not just a kernel that boots without a userspace, I would base it off of PureDarwin or another project in a similar spirit
Not sure if something like PureDarwin or OpenDarwin would work since both are based on old versions of Darwin with old dependencies that didn’t have RISC-V versions at the time.
 
Not sure if something like PureDarwin or OpenDarwin would work since both are based on old versions of Darwin with old dependencies that didn’t have RISC-V versions at the time.
It's hard to say without starting out but I do think it'd be easier to fork from that and figure it out along the way than start from latest pure XNU and work from that
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.