16

I have a couple of old Game Boy Advance SP systems around somewhere, and I was wondering if it's possible to get an old version of Linux running on one. I'm just doing it for fun, and thought that it might be cool to do if it is possible.

JAL
  • 9,502
  • 14
  • 57
  • 120
Jordan M. Baron
  • 992
  • 8
  • 16
  • 2
    The obvious follow-up question is if you can run CP/M on the Z80 of the GBA, or rather, if anyone has actually done this ... – dirkt Jul 27 '16 at 15:06
  • I'd see if someone has ported NetBSD to the device. Even if it hasn't, NetBSD on a Raspberry Pi running the GBA emulator would be very doable. (Even though this isn't specifically what you wanted.) –  Jul 27 '16 at 17:20
  • Related: almost posted this as an answer before realizing it was an April Fools joke: http://www.nothink.org/misc/OpenBSD-gameboy.html – JAL Aug 01 '16 at 16:52

3 Answers3

15

Not Linux, but I know you can run UNIX 5 with a tool called gbaunix. You can read about the process in Amit Singh's paper on kernelthread and you can browse through the source on my unofficial fork on GitHub.

You will need a a copy of the RK05 disk image to use gbaunix. If you don't want to recompile the binary, you can cat the disk image with the precompiled binary provided in the paper.

$ cat unixv5.tmp disks/unixv5.dsk > unixv5.gba
JAL
  • 9,502
  • 14
  • 57
  • 120
11

Linux itself will not run on the GBA SP. The reason for this is that the CPUs (one ARM7TDMI and one Z80) do not have a way to protect and manage memory. The component to do that is the MMU, which needs to be present on all computers that can run Linux.

But a variant called µCLinux (short for microcontroller Linux) has some things stripped out and could theoretically run on the Game Boy Advance SP. But I do not know if 288 KB is enough memory for this ...

user3840170
  • 23,072
  • 4
  • 91
  • 150
Omar and Lorraine
  • 38,883
  • 14
  • 134
  • 274
  • 2
    Microcontrollers usually have a lot less. – wizzwizz4 Jul 27 '16 at 16:48
  • 2
    Do any of those microcontrollers run uCLinux and do something useful? – Omar and Lorraine Jul 27 '16 at 16:55
  • One or the other, but rarely both. Most run a compiled BASIC variant, and those that run -n*x kernals have much less memory available. Unless they're doing trivial tasks where cutting developer hours is worth it, code is custom-built. Apparently, ~4Mb is required though, so that information isn't too useful. – wizzwizz4 Jul 27 '16 at 17:08
  • I found an attempt to port uClinux to GBA from 2004, see my new answer. – JAL Nov 03 '16 at 16:19
  • 1
    You can certainly run Linux on a system without an MMU. There's a reason why DSLinux is a thing, despite the fact that its ARM9 also lacks an MMU. So right now, both your first and second paragraphs contradict each other. – forest Sep 15 '18 at 02:15
  • @forest is that a recent development then? My impression is MMU is a requirement for Linux proper. – Omar and Lorraine Sep 15 '18 at 11:42
  • @Wilson Not really. uClinux has been around for a very long time, and it does not require an MMU. The memory is less efficient and, of course, individual processes have access to all memory, but it certainly can run without an MMU. – forest Sep 16 '18 at 00:17
  • @forest so read my answer again: It is distinguishing between uClinux and the "proper" one. uCLinux is a port of the mainstream kernel, which makes it a separate development from Linux. Right? – Omar and Lorraine Sep 16 '18 at 06:20
  • @Wilson It used to be a fork of Linux, but it's built into the kernel now (or at least, the mainline kernel is able to run without an MMU if so configured). – forest Sep 16 '18 at 11:47
6

Thanks to this Slashdot article, I also found a guide from 2004 with instructions on how to port Microcontroller Linux (uClinux) to the GBA. The main site is long dead, but I found a mirror via the WayBack Machine.

The uClinux cvs repo is long dead, but if you can find the September 9th, 2003 snapshot (uClinux-dist-20030909.tar.gz), you should be able to apply the uclgba patch:

$ tar xzf uClinux-dist-20030909.tar.gz
$ cd uClinux-dist
$ patch -p1 < uclgba_2004-03-14.patch
JAL
  • 9,502
  • 14
  • 57
  • 120