News for hackers. Stuff that matters.
Re:We ran a Unix-like OS Xv6 on our home-built CPU with a ho... by boricj on Saturday June 28, 2025 @09:57AM (#44404734)
That reminds me of a three week, three person group project I had back when I was in university. There were a couple of topics we could pick from, including writing a very simple operating system from scratch. I asked the professors if we could instead port MINIX3 to the Raspberry Pi (given that it already had an ARM port to the BeagleBoard) and they accepted.

What was supposed to be a reasonably straightforward project proved to be a huge challenge as we encountered numerous unforeseen technical difficulties. One particularly harrowing one was that the Raspberry Pi 3 booted into hypervisor mode instead of supervisor mode and QEMU's Raspberry Pi emulation accuracy was so abysmal back then to be borderline useless for osdev. I recall it took me an entire week of low-level hardware debugging just to figure that one out.

By the end, we pulled through and delivered a working port with UART, GPIO and framebuffer drivers that could run on the Raspberry Pi 2 and 3. We run our presentation with the port on real hardware, using a shell script that displayed bitmaps from the ramdisk and monitored GPIO pins to move slides forwards or backwards (I used a knife to short-circuit the pins as needed). It was by far the coolest presentation of all the groups just on originality alone and I think I still have the image of that SD card somewhere.

Re:We ran a Unix-like OS Xv6 on our home-built CPU with a ho... by rustybolt on Saturday June 28, 2025 @12:23PM (#44405897)
Nice.

> I asked the professors if we could instead port MINIX3 to the Raspberry Pi

I think they were expecting you to fail.

> QEMU's Raspberry Pi emulation accuracy was so abysmal

When I did some hobby OS dev my strategy was to make it work on QEMU and then pray it would work on real hardware as well, which worked OK...

How did you handle the debugging the raspberry pi on real hardware?

Re:We ran a Unix-like OS Xv6 on our home-built CPU with a ho... by boricj on Saturday June 28, 2025 @01:40PM (#44406591)
> I think they were expecting you to fail.

Maybe, but I already had a reputation of being the dark wizard back then. If anything, the other students in my group went along with this because they knew I could overcome any problem... regardless of the cost on my sanity.

> How did you handle the debugging the raspberry pi on real hardware?

Painfully through serial output. I didn't have access to a JTAG probe at the time (I'm not even sure the Raspberry Pi could be debugged that way) and documentation was exceedingly poor.

After that experience, I refuse to debug anything hardware-related without at the very least a GDB stub.

Re:We ran a Unix-like OS Xv6 on our home-built CPU with a ho... by userbinator on Saturday June 28, 2025 @05:35PM (#44408365)
and documentation was exceedingly poor.

This is Broadcom we're talking about, where that's par for the course. Personally I'd choose a SoC from AllWinner or Rockchip or even Mediatek over them.

Re:We ran a Unix-like OS Xv6 on our home-built CPU with a ho... by duskwuff on Saturday June 28, 2025 @11:10PM (#44410064)
> I didn't have access to a JTAG probe at the time (I'm not even sure the Raspberry Pi could be debugged that way)

The BCM2835-based ones can - I don't know about the modern ones - but you have to change the configuration on a couple of GPIOs to make it show up. (Which makes it difficult to debug early startup, unfortunately.)

Re:We ran a Unix-like OS Xv6 on our home-built CPU with a ho... by accrual on Saturday June 28, 2025 @04:01PM (#44407703)
> I used a knife to short-circuit the pins as needed

Reminds me of shorting the two power-on pins on an ATX motherboard to start it without a switch installed. Obviously, your setup was far cooler. Nice work.

Re:We ran a Unix-like OS Xv6 on our home-built CPU with a ho... by ForOldHack on Sunday June 29, 2025 @02:25AM (#44410740)
That lasted a few months for me, until I found a box of the front panel connectors, and I taped together a power/reset and speaker connector. ( I made two, one to use, and one as a spare... ) after not being used for 6 months, It got tossed... of course, only to be needed a few years later for fixing a intermittent motherboard.
Re:We ran a Unix-like OS Xv6 on our home-built CPU with a ho... by fithisux on Sunday June 29, 2025 @05:11AM (#44411489)
I don't understand why Minix3 is not developed any more. I thought with Risc-V it would see a renewed interest.
Re:We ran a Unix-like OS Xv6 on our home-built CPU with a ho... by boricj on Sunday June 29, 2025 @08:22AM (#44412520)
I've ranted previously on that topic [1] [2] [3], but as a former contributor MINIX3 in my opinion is a technological dead-end that ran out of steam.

[1] https://news.ycombinator.com/item?id=41673634

[2] https://news.ycombinator.com/item?id=40762110

[3] https://news.ycombinator.com/item?id=34916261

Re:We ran a Unix-like OS Xv6 on our home-built CPU with a ho... by dleslie on Saturday June 28, 2025 @10:30AM (#44404973)
We did this sort of thing at SFU some 25-30 years ago; though we stopped short of running an OS and compiler on it, and it wasn't a group project.

For those interesting in trying this sort of experiment, but wish to have some guidance and accessible tooling, I highly recommend Turing Complete; you'll go from a few gates to a full computer. Components can be shared with the community; where you'll find things like a RiscV core and such. Anyhow, it's great fun. Do recommend. It's on Steam:

https://store.steampowered.com/app/1444480/Turing_Complete/

Re:We ran a Unix-like OS Xv6 on our home-built CPU with a ho... by s3graham on Saturday June 28, 2025 @11:16AM (#44405277)
That looks like the game-version of nand2tetris which I enjoyed doing a while back too (as another suggestion).
Re:We ran a Unix-like OS Xv6 on our home-built CPU with a ho... by b0a04gl on Saturday June 28, 2025 @11:40AM (#44405497)
while building altogether cpu + compiler + os ,there's no platform under you. you're the platform.. every bug you hit is a law of your system.. most of us debug through layers someone else wrote. here, even the rules are homemade..op debugged his own rules
Re:We ran a Unix-like OS Xv6 on our home-built CPU with a ho... by Tepix on Saturday June 28, 2025 @10:11AM (#44404824)
Very impressive! Low end work is often tedious and time consuming, especially if you lack the essentials like a debugger.
Re:We ran a Unix-like OS Xv6 on our home-built CPU with a ho... by 73kl4453dz on Saturday June 28, 2025 @11:27AM (#44405375)
Until you've used an oscilloscopes to debug your buggy kprintf, you haven't lived.
Re:We ran a Unix-like OS Xv6 on our home-built CPU with a ho... by tonyarkles on Saturday June 28, 2025 @12:13PM (#44405782)
LOL in my 4th year Advanced Operating Systems Concepts course we wrote a toy x86 OS from scratch. We obviously didn't have to make our own hardware, but uhhhh I definitely added a bunch of printfs inside QEMU to dump out CPU states when we couldn't figure out the chain of events that led to hard faults.

On the other side... have also definitely used a pair of LEDs to try to debug an RTOS on a microcontroller with no JTAG access...

Re:We ran a Unix-like OS Xv6 on our home-built CPU with a ho... by ForOldHack on Sunday June 29, 2025 @02:27AM (#44410751)
"couldn't figure out the chain of events that led to hard faults..."

Tales from the terminal/dark side/h4x0r pro in da house!

Re:We ran a Unix-like OS Xv6 on our home-built CPU with a ho... by userbinator on Saturday June 28, 2025 @05:37PM (#44408370)
First thing to do is get a working UART.
Re:We ran a Unix-like OS Xv6 on our home-built CPU with a ho... by _sbrk on Saturday June 28, 2025 @05:59PM (#44408513)
First thing to do is get a GPIO pin or two to toggle. Plenty of debug patterns that one can blink out.
Re:We ran a Unix-like OS Xv6 on our home-built CPU with a ho... by djoldman on Saturday June 28, 2025 @09:52AM (#44404705)
Re:We ran a Unix-like OS Xv6 on our home-built CPU with a ho... by _sbrk on Saturday June 28, 2025 @11:40AM (#44405490)
Magic-1 and BMOW did similar, a while back. See: https://www.homebrewcpu.com/

The actual list of sites who have built their own CPUs: https://www.homebrewcpuring.org/

Re:We ran a Unix-like OS Xv6 on our home-built CPU with a ho... by layer8 on Saturday June 28, 2025 @09:33AM (#44404603)
(2020)
Re:We ran a Unix-like OS Xv6 on our home-built CPU with a ho... by ummonk on Saturday June 28, 2025 @03:03PM (#44407239)
Now they gotta run to the semiconductor lab and get them to fabricate the CPU instead of configuring an FPGA to run it.
Re:We ran a Unix-like OS Xv6 on our home-built CPU with a ho... by Taniwha on Sunday June 29, 2025 @01:39AM (#44410600)
TinyTapeout is right there to help you do that
Re:We ran a Unix-like OS Xv6 on our home-built CPU with a ho... by winterqt on Saturday June 28, 2025 @07:15PM (#44408959)
This reminds me of a kind of similar academic(?) project that at the very least had a custom C compiler alongside a custom OS… I can’t remember what it is offhand though.
Re:We ran a Unix-like OS Xv6 on our home-built CPU with a ho... by absurdo on Saturday June 28, 2025 @11:12PM (#44410068)
Maybe I missed it but which FPGA did they use for this? I’m interested in learning FPGAs but there doesn’t seem to be a lot of freewheel documentation or software out there, it’s mostly vendor locked. I’m spoiled by the availability of STM32, AT, TI, etc MCUs and how easy it is to kludge things together.
Re:We ran a Unix-like OS Xv6 on our home-built CPU with a ho... by Jotalea on Sunday June 29, 2025 @02:42AM (#44410802)
I wish I could do something like this.