526 points · by MegaDeKay · 5y ago · 195 comments
> Most importantly, because I can.
Good. All I can say is at least it is something different to what I keep seeing on HN. (React, Rust, Kubernetes, JAMstack, JavaScript, etc.)
Probably present this somewhere in a conference (CCC, FOSDEM, etc). Who knows who could be looking at this.
edit: Interesting is a personal taste, and while I have noticed articles on hacker news becoming more repetitive lately, it's probably not fair to put it entirely down to "Founder-type people".
We had a new hire who was huge into HN a while back. Was very hard to rein him in from suggestions of haskell, random frameworks, etc. I've dealt with the "shiny things" mentality many a time, but this was something else. Made the "academic do it right" approach look liberal in terms of risk.
Haskell is cool, but yeah sorry keep that out of my prod stack.
Btw., what are "fb games"?
See https://www.phoronix.com/scan.php?page=news_item&px=Nintendo... for more information.
Wow, four people guessed (or trolled) framebuffer. Interesting.
Are the Linux tests deterministic, and the tests for this change will not run unless something directly affects it? If not, then I’m not a huge fan of these commits, which seem more about vanity.
RFC because I'm not sure if it's useful to have this merged.
So it's for fun; you won't be able to run any existing "normal" Linux emulators and you'd be better off porting stuff to run on bare metal than trying to squeeze it in under Linux on an N64. Cool project, fun, great that it's getting upstreamed... just keep in mind it's not really useful for end users for anything (unlike, say, Wii Linux, where with ~80MB of RAM you can actually get somewhere, though still with many limitations).
OTOH, as other people have mentioned, it makes a good test case for N64 emulators. If they can run this, that's good validation.
But to satisfy your definition needs, I refer to small microkernels.
You want to throw out as many functionality as possible to get your kernel down in size to fit into e.g. 1 MiB of memory.
I am skeptical that this would be the preferred way to port emulators or graphical games. You’re not getting a budget SGI workstation out of this, because the OS kernel itself is only a small part.
The N64 is built around a chip called the Reality Control Processor, or RCP. This contains the RSP, stripped-down MIPS CPU core with a fixed-point SIMD vector unit, and the RDP, a rasterization engine that does simple trilinear texture interpolation and color blending. This is the hard part of programming the N64, and it’s not something that’s addressed by swapping out the OS kernel.
There are… a number of major challenges you will still have to face if you want to make homebrew software for the N64, unless you are okay with just having something on the CPU and writing to the framebuffer.
It will knock down an entry barrier for some people, though, and there's no harm in that at all.
Just trying to temper people’s expectations.
> It will knock down an entry barrier for some people, though, and there's no harm in that at all.
To be honest—I don’t think this is lowering the barrier of entry to N64 development much. Those are the expectations I’m trying to temper here. If you want to develop for N64, you’re going to go through a lot of fuss getting an EverDrive 64 or a similar alternative, setting up an accurate emulator like CEN64 (the popular emulators are not suitable for development), getting toolchains running on your development system, etc.
I think some people have equated “Linux has been ported to system X” as “development for system X is now solved”, when Linux is only a small part of the solution, and for smaller systems (like the N64, which has only 4 MB RAM base), Linux is probably not your kernel of choice anyway.
The Nintendo 64 development scene would definitely benefit from more people pitching in and doing tools development. This is a good time to do it, there are a lot of gaps ready to be filled, and the number of people doing N64 development has increased quite a bit over the past couple years.
On the other hand , this might massively improve the turnaround time on RSP programming (which is something I've actively been trying to learn), since it'll be that much easier to edit and run microcode without having to bake entirely-new ROMs in the process: I'd just need a serial console (or even a framebuffer console on top of whatever the RSP's rendering) and an assembler (or, at the very least, something to turn hexadecimal input into binary data to DMA over - we're only talking 4K each of code and data here, after all).
Certainly a modern GUI a la KDE, Gnome and friends would be well outside of its abilities, but a functional GUI is possible on a shockingly small amount of memory!
The SGI Indy which could be had with an R4000 CPU came with 16MB base
And Windows 95 only required 4MB, so it should be within the realm of possibility,
Berkeley Systems, of course, is known for BSD.
(It won't be running Gtk4 or Qt6 of course.)
https://www.phoronix.com/scan.php?page=news_item&px=Nintendo...
>It's also noted that Linux on the Nintendo 64 is still a big buggy and "constantly flirting with [out of memory]."
If you're running out of ram with just a shell that definitely doesn't leave much left. And there's no storage device, so you can't swap.
https://www.theverge.com/2016/6/22/12008286/sony-ps3-linux-o...
There's a reason a lot of open source in recent years have avoided GPL as a plague and opted for BSD or MIT or Apache licenses.
Linux stayed on GPL2 instead of upgrading to GPL3 precisely to allow others freely using Linux in their commercial devices. In other words: they made the intentional choice of making it legally easy to embed Linux in proprietary hardware products (aka. Tivoization, which GPL2 allows but GPL3 forbids)
"But why... Most importantly, because I can."
https://www.phoronix.com/scan.php?page=news_item&px=Nintendo...
How does a Linux port make it easier to port emulators or console games?
Is this a step towards getting an N64 on a modern (?) stack like qemu+linux?
It helps emulator development by giving you something to work with inside of your emulator that actually has some tooling to let you look around and test out the system from the inside, unlike trying to get a game working. If Linux-N64 can boot, you can expect that a lot of your code is working properly.
There were some games that manually implemented their own virtual memory paging system to map the cartridge ROM to RAM address space.
But, in general a feature that distinguished the N64 from the PS1 was that it had a single, unified block of RAM for all of the hardware to share however you like.
> Differing memory countings are due to the 9th bit only being available to the RCP for tasks such as anti-aliasing or Z-buffering.
afaik there is no way of manually using this ram, its hardwired to fixed function pipeline stages of RCP.
But because of that you might be able to use it for extra sort of like how the Factor 5 GC games would spill out to ARAM.
A lot of work for 4k of RAM though.
It seems that this actually requires using the Expansion Pak as system RAM to even run.
[0] https://github.com/clbr/n64bootloader/tree/master/n64linux
The texture memory would be difficult to use as RAM though since it's not directly addressable.
That's one of the major reasons the N64 has a reputation for being 'blurry'. 4k gives you a max of (with mip maps) one 32x32 16-bit texture at a time.
Everyone here saying 8mb too small, well just add more ram.
https://nintendo.fandom.com/wiki/Nintendo_64_Keyboard
No idea how realistic it'd be to get it working with Linux.
See here: https://www.linux-mips.org/wiki/Linux/MIPS_Porting_Guide
I was bored one evening and ported Linux to run on the Wii's IO/security processor (not the main CPU, that's Wii Linux). It only took a few hours to get the kernel booting to userspace.
Until now however;
La Noire
Outer Wilds
Command and Conquer Remastered
Broken Sword
And so on
What a time to be alive
And Disco Elysium, though that is a bit more RPG-y. (no combat though, but it has stats and "character progression")