Live data from Hacker News

New Linux port for the Nintendo 64

lore.kernel.org

151–160 of 205 posts

Re: New Linux port for the Nintendo 64

#151
post #26

Earlier quoted context omitted.

Could it finally revolutionize porting Linux to new architectures?

I never thought about it but one day AI will port itself to another device. That’s a crazy thought.

This is how you get Skynet.

Re: New Linux port for the Nintendo 64

#153

Earlier quoted context omitted.

Those operating system functions still need to exist and still consume RAM. It doesn't matter whether they run in userspace or kernel space. If you don't need those functions, you can remove them from kernel space in a monolithic kernel. It's possible to build Linux without TCP/IP support and with no on-disk filesystems.

Yes, it is possible to strip out subsystems from the linux kernel, but there are limits. For example: https://weeraman.com/building-a-tiny-linux-kernel-8c07579ae7... They achieved a compressed linux kernel size of just 749 kB which additionally requires at least 12 MB of RAM to boot. This is very impressive, but there a constrained systems with 1 MB or less of memory.

That’s a different argument to the one you opened with. The OP had already made the point that Linux isn’t really practical. But that doesn’t mean that a micro kernel OS would be any better than GNU/Linux. Ultimately you still have the same data stored into RAM (as others have said).

What nobody has (yet) mentioned is that micro kernels typically run slower than monolithic kernels because user space / kernel space memory swapping is expensive compared to running everything in kernel space. This overhead would kill any performance you might get from a system with the hardware specs of an N64. So a monolithic design is absolutely the way to go (in facts that’s how N64 games are actually written —- one monolithic code base with shared memory).

Pragmatically the only way to write software for the N64 is to go bare metal. As the OP said, this Linux port is a fun technical challenge but no OS would be practical (that is unless you’re just using it as a boot loader for other software).

Re: New Linux port for the Nintendo 64

#155
post #150

Earlier quoted context omitted.

If you're building a hardware and have to ship it with an OS, Linux is the obvious choice for most... but the GPL licensing makes it very difficult for a lot others. 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 is the obvious choice for most... but the GPL licensing makes it very difficult for a lot others 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)

That's true.

GPL2 is better for commercialization than GPL3 is. However, BSD, MIT, Apache are much much better than any GPL version, including AGPL.

Re: New Linux port for the Nintendo 64

#156

Earlier quoted context omitted.

Yes, it is possible to strip out subsystems from the linux kernel, but there are limits. For example: https://weeraman.com/building-a-tiny-linux-kernel-8c07579ae7... They achieved a compressed linux kernel size of just 749 kB which additionally requires at least 12 MB of RAM to boot. This is very impressive, but there a constrained systems with 1 MB or less of memory.

That’s a different argument to the one you opened with. The OP had already made the point that Linux isn’t really practical. But that doesn’t mean that a micro kernel OS would be any better than GNU/Linux. Ultimately you still have the same data stored into RAM (as others have said). What nobody has (yet) mentioned is that micro kernels typically run slower than monolithic kernels because user space / kernel space me…

> That’s a different argument to the one you opened with.

"A microkernel would be a good fit for such constrainted environments."

No, that's exactly my argument. My argument is that the linux kernel (even if you strip everything out and create the most tiny linux kernel) is still too big for many constrained environments, e.g. a old router with 512 KiB memory (there are many devices that cannot run linux). However, it is possible to run a small microkernel on such a router, that's my point, nothing more nothing less, that's why I consider using microkernel a good fit.

Then people argued that mircokernels can be as big as a linux kernel and that you can strip the linux kernel down in functionality and I agreed with them, but this does not contradict the point I made.

Re: New Linux port for the Nintendo 64

#157

Earlier quoted context omitted.

That’s a different argument to the one you opened with. The OP had already made the point that Linux isn’t really practical. But that doesn’t mean that a micro kernel OS would be any better than GNU/Linux. Ultimately you still have the same data stored into RAM (as others have said). What nobody has (yet) mentioned is that micro kernels typically run slower than monolithic kernels because user space / kernel space me…

> That’s a different argument to the one you opened with. "A microkernel would be a good fit for such constrainted environments." No, that's exactly my argument. My argument is that the linux kernel (even if you strip everything out and create the most tiny linux kernel) is still too big for many constrained environments, e.g. a old router with 512 KiB memory (there are many devices that cannot run linux). However, i…

> "A microkernel would be a good fit for such constrainted environments."

As the GP said, micro kernels have a performance overhead swapping data between rings. That overhead would bite hard on something running a NEC VR4300 clocked at 93.75 MHz.

A monolithic kernel is the way to go. Just not Linux specifically.

> My argument is that the linux kernel (even if you strip everything out and create the most tiny linux kernel) is still too big for many constrained environments

That was the OP's point. Yours was that a micro kernel would be a better fit. It would not.

> a old router with 512 KiB memory (there are many devices that cannot run linux)

Those devices wouldn't be running code written to programmable chipsets. They wouldn't be running an operating system in the conventional sense. Much like laumars point about how games are written for the N64.

Also nobody is suggesting Linux runs everywhere. We are just pointing out that you massively misunderstand how micro kernels work (and embedded programming too by the sounds of your last post).

By the way, you wouldn't find any routers running a meger 512KB of RAM. That wouldn't be enough for multiple devices connected via IPv4, never mind IPv6 and a wireless AP too. Then you have firewall UI (typically served via HTTP), a DHCP & DNS resolver (both of which are usually served by dnsmasq on consumer devices) and likely other stuff I've forgotten about off hand -- I have some experience building and hacking routers :)

> However, it is possible to run a small microkernel on such a router, that's my point, nothing more nothing less, that's why I consider using microkernel a good fit.

Most consumer routers actually run either Linux or some flavour of BSD. All of which are also monolithic kernel designs. Some enterprise gear will have their own firmware and from what I've seen from some vendors like old Cisco hardware, those have been monoliths too.

I know micro kernel has the word "micro" in it and the design requires loading the bare minimum into the kernel address space of the OS, but you're missing the bigger picture of what a micro kernel actually is and why it is used:

The point of a micro kernel isn't that it consumers less memory. It's that it separates out as much functionality from the kernel as it can and pushes that to user space. The advantages that brings is greater security with things like drivers (not an issue with the N64) and greater crash protection (again, not really an issue with the N64). However that comes with a performance cost, code complexity and any corners you do cut to try to bring those costs down ultimately end up eroding any real world benefits you get from a micro kernel design.

Re: New Linux port for the Nintendo 64

#158

Earlier quoted context omitted.

> That’s a different argument to the one you opened with. "A microkernel would be a good fit for such constrainted environments." No, that's exactly my argument. My argument is that the linux kernel (even if you strip everything out and create the most tiny linux kernel) is still too big for many constrained environments, e.g. a old router with 512 KiB memory (there are many devices that cannot run linux). However, i…

> "A microkernel would be a good fit for such constrainted environments." As the GP said, micro kernels have a performance overhead swapping data between rings. That overhead would bite hard on something running a NEC VR4300 clocked at 93.75 MHz. A monolithic kernel is the way to go. Just not Linux specifically. > My argument is that the linux kernel (even if you strip everything out and create the most tiny linux ke…

> By the way, you wouldn't find any routers running a meger 512KB of RAM.

This is not true in general, although true for modern devices. There are older router models that cannot run linux. A few years back I unsuccessfully tried to flash a very minimal > We are just pointing out that you massively misunderstand how micro kernels work

If someone points out, that linux kernel can be reduced in size and that there are some big microkernels, then I do agree and there is no misunderstanding, as far as I can see. Same holds true for the performance argument.

> As the GP said, micro kernels have a performance overhead swapping data between rings.

I agree that performance will be problematic, but this does not render microkernels useless in general for constrained devices. See for example: https://technik.community/2014/07/micro-kernel-the-best-choi... https://www.scirp.org/html/3-9301550_27477.htm

Re: New Linux port for the Nintendo 64

#159

Earlier quoted context omitted.

> "A microkernel would be a good fit for such constrainted environments." As the GP said, micro kernels have a performance overhead swapping data between rings. That overhead would bite hard on something running a NEC VR4300 clocked at 93.75 MHz. A monolithic kernel is the way to go. Just not Linux specifically. > My argument is that the linux kernel (even if you strip everything out and create the most tiny linux ke…

> By the way, you wouldn't find any routers running a meger 512KB of RAM. This is not true in general, although true for modern devices. There are older router models that cannot run linux. A few years back I unsuccessfully tried to flash a very minimal > We are just pointing out that you massively misunderstand how micro kernels work If someone points out, that linux kernel can be reduced in size and that there are…

> This is not true in general. There are older models that which cannot run linux. A few years back I uncessfully tried to flash a very minimal

How long ago was "a few years ago"? What model number was that? DD-WRT has been ported to the Archer series but if you're talking a ZyNOS based router then you're probably out of luck. Those ZyNOS devices are the real bottom end of the market though. Even the ISP routers here in the UK are generally a step up from those. Particularly these days now that households have an expectation to have kids playing online games, streaming Netflix and such like (even before COVID-19 hit ISPs have been banging on for ages about how their routers allow you to do more concurrently). And with TP-Link, the Archer series are all Linux based or Linux compatible and they start from ~£50. So you'd be really scraping the barrel to find something that wasn't these days.

> I agree that perfromance will be problematic, but this does not render microkernels useless in general for constrained devices.

Any OS designed around kernels, memory safety etc would be useless in general for constrained devices. This isn't an exclusively Linux problem. On such systems the whole design of how software is written and executes is fundamentally different. You don't have an OS that manages processes nor hardware, you write your code for the hardware and the whole thing runs bare metal as only one monolithic blob (or calls out to other discrete devices running their own discrete firmware like a circuit). That's how the N64 works, it's how embedded devices work. It's not how modern routers work.

In 2020 it's hard to think of a time before operating systems but really that is the way how the N64 works. Anything you run on there will eat up a massive chunk of resources if it's expected to stay in memory. So you might as well go with a tiny monolithic kernel and thus shave a few instructions from memory protection and symbol loading (not to mention the marginally smaller binary sizes due to any file system metadata, binary file format overhead and other pre-logic initialisation overhead (such as you get when compiling software rather than writing it in assembly). If you're going to those lengths though laumars point kicks in: you're better off just writing a "bootloader" menu screen rather than a resident OS.

Re: New Linux port for the Nintendo 64

#160

Earlier quoted context omitted.

> "A microkernel would be a good fit for such constrainted environments." As the GP said, micro kernels have a performance overhead swapping data between rings. That overhead would bite hard on something running a NEC VR4300 clocked at 93.75 MHz. A monolithic kernel is the way to go. Just not Linux specifically. > My argument is that the linux kernel (even if you strip everything out and create the most tiny linux ke…

> By the way, you wouldn't find any routers running a meger 512KB of RAM. This is not true in general, although true for modern devices. There are older router models that cannot run linux. A few years back I unsuccessfully tried to flash a very minimal > We are just pointing out that you massively misunderstand how micro kernels work If someone points out, that linux kernel can be reduced in size and that there are…

[deleted]
Post reply on HN