BMOW title
Floppy Emu banner

More Thoughts on Homebrew CPU Linux

The other day I wrote about designing a new homebrew CPU, and getting Linux running on it. After looking deeper into the idea, it’s just not realistic to port Linux to a CPU that I built myself, even a low-end version like ucLinux. At a minimum the CPU would need 16-bit registers (or is it 32-bit?) and hardware support for supervisor and user modes. To get usable performance (typical Linux command line programs running at interactive speeds) it would probably also need a larger number of registers, things like hardware multiply and divide instructions, and at least a small amount of cache. None of that’s impossible, but it would add lots of additional chips and interconnects, and it’s probably out of range of what I can expect to build from a handful of discrete logic chips. My BMOW1 CPU was nowhere near that capable, yet was definitely pushing the upper limits of what I have the time and desire to build by hand.

I could design my CPU in VHDL or a hardware description language, and program it into an FPGA, similar to what I did with my Tiny CPU. That holds much less interest for me, though. There are already lots of FPGA-based CPU soft cores, including ones from the FPGA vendors themselves, and it’s a path that just doesn’t excite me very much.

What about a simpler OS? ELKS is a minimal Linux-derivative originally designed for 8086 computers and should have very modest requirements. It looks nearly abandoned, though, and would probably be difficult to find information and support to help get it going. There’s also Minix, which should run on very low-end systems. It seems better supported than ELKS, but there’s still not much info available about it, and the latest Minix 3.0 appears aimed towards higher-end CPUs. FreeRTOS looks very lightweight and could probably run on a very simple CPU. But from what I can tell it’s not really an operating system at all, it’s just a thread scheduling library. There are no included applications nor even a command shell.

When it comes down to it, I just don’t want to spend the time and energy it would take to create a CPU capable of running any of these. Maybe someday, but not now.

That still leaves me with a couple of related projects that would be interesting to pursue. The first is constructing a single board computer using an old commercially-available CPU, and getting Linux running on that. A great example is this homebrew 68000 system built on a breadboard and running ucLinux. That could be a fun project – complicated, but not overwhelming. I even have a couple of DIP 68000 CPUs in a box somewhere that I could use. Perhaps this could even further the goals of my long-dormant Plus Too project. Or maybe try using a simple ARM CPU, or even an ARM-based microcontroller with some extra external memory. This would be an interesting hardware exercise as well as a deep dive into Linux internals and Linux porting.

The second path is extending an existing C compiler (likely gcc or llvm) to support a homebrew CPU, either one of my existing CPU designs or a new one. The BMOW1 CPU is maybe almost capable enough to handle simple C programs. A few additional registers and instructions, and I think it would be there. It would be predominantly a software project related to how compilers work. This interests me too, though less so. I see the creation of a cross-compiler more as a means to supporting a CPU project, rather than as a fun project in itself.

So many ideas, so little time!

Read 5 comments and join the conversation 

5 Comments so far

  1. kbob - October 27th, 2014 3:56 pm

    This is the scary/fun stage of a project, where anything is possible, and nothing is decided. I went through a similar process this summer. I started out thinking I was going to build a Lisp machine on an FPGA. That mutated into a Smalltalk CPU, and then somehow it turned into a virtual analog synthesizer running on OS X. (No, really, it was a perfectly logical progression!) Now I am working on the synthesizer.

    The choice of what to work on is always very personal, so I can’t even guess what you’re interested in, what you’d find challenging, or what you think is too easy. But if you’re interested in doing something with OS plus hardware, take a look at these projects for ideas.

    Synthesis OS. A radically real-time OS with JIT-compiled I/O channels. Originally for 68030, you could port it or write something similar for just about any CPU that has interrupts.

    L4. A secure microkernel. Linux has been ported to L4. Needs supervisor mode and memory protection.

    NetBSD. Another mainstream Unix, has already been ported to lots of obscure hardware.

    Anyway, good luck, and I look forward to reading about whatever you decide to create.

  2. Tom - October 28th, 2014 6:15 pm

    If you don’t mind running really slowly, you could write an emulator for a simple instruction set, like RISC-V, on a homebrew CPU and run a linux image on that. People have done that with javascript ( Steve Wozniak did something similar on the original Apple, as I recall. You would get tools like llvm and gcc for free.

  3. Leon - October 31st, 2014 11:01 pm

    If you want to port an OS to your very simple 8 bits BMOW (or equivalent) home-made CPU, I think you should consider using a very simple OS. Without multitasking, without TCP/IP network, etc…
    For example, CP/M, that was first designed for 8080 CPU or equivalents.
    I believe that you can have a lot of fun with just a very simple OS. But it depends on what you want to do.

    Leon – french hobbyist.

  4. Mike Spivey - March 22nd, 2015 1:19 pm

    I’m glad you mentioned Minix. I believe you can still find Minix 2 on the Web for download, and there was a 68k version that ran on the Amiga. Getting Linux going is an impressive and inspiring achievement, but in your place I would look at Minix and hope to get substantially more bang for each MHz and KB.


  5. Freddy ferrer - September 19th, 2017 3:57 am

    Hola buenos días .quiero decirle que lo admiró mucho y soy fanático de sus proyectos de electrónica ,actualmente soy un principiante y me llama mucho la atención el fascinante mundo de la electrónica. pero le escribo para que me guie en un proyecto que tengo en mente el cual se trata de hacer funcionar una pantalla LCD de un blackberry 9800 quisiera que me explicara como funciona eso que señales deben tener o que señales usa para lograr funcionar la pantalla LCD

Leave a reply. For customer support issues, please use the Customer Support link instead of writing comments.