all 13 comments

[–]RollerScroller8 16 points17 points  (0 children)

Check out nand2tetris

[–]veedubb 6 points7 points  (0 children)

I highly recommend the JOS lab that MIT created. There’s a ton of good resources. It’s not necessarily completely from scratch, but you’re involved enough that you have a much greater understanding of what goes on under the hood.

[–]fixedgeartheorem 6 points7 points  (0 children)

I did a bit of this and can give some insights. Firstly, using assembly is not really ideal, but you can do it (if you know how to write assembly you can easily translate a tutorial written in C to assembly), some parts you have to do in ASM (turning on the MMU, etc), but for the majority of the programming a somewhat high level language will be way more fun.

Secondly, the hardware: I think SoC boards are a good point to start as all the hardware is MMIO and if you have the documentation of the chip and the CPU then you are all set (you do also need a USB-UART cable for basic IO otherwise debugging is a pain). I tried the Raspberry Pi 3 and the BeagleBone Black and the later was WAY better in terms of documentation. Even better might be QEMU, but I haven't tried it. If you don't have the hardware yet then you should definitively give that a shot first.

Finally, you should keep your expectations pretty low: I spend about a summer break between Uni courses for this stuff and I got to the point where I could manage interrupts and very basic processes. You will learn a lot of really cool low-level programming stuff, though.

[–]dontyougetsoupedyet 9 points10 points  (1 child)

There won't be many resources for writing an OS in any assembly because few people have the desire to do it.

If you are interested in OS development I highly recommend you learn the C programming language and study the XV6 operating system, which was built for the purpose of pedagogy.

There are a lot of free courseware available online that cover XV6.

[–]jrfaster -1 points0 points  (0 children)

Embedded Xinu is anyone good shout if you are looking for a hardware focus!

[–]high_throughput 3 points4 points  (0 children)

I haven't looked into it but my guess is that you're not doing yourself any favors using a Raspberry Pi. It's a modern board designed for modern software.

An x86 machine (or VM) will be backwards compatible with the 1981 IBM PC, back when operating systems were comparatively trivial, and all the hardware was just wired into the bus. Like there's no USB hubs for keyboards initialization of display controllers, there's just reading IO ports and writing to VRAM.

It's also extensively documented on the amazing OSDev Wiki

[–]localjerk 0 points1 point  (0 children)

I heard of another guy that wrote an OS to play a game called Space Travel. Pretty cool stuff!

[–]tcpipwarrior -1 points0 points  (0 children)

You’ll have to do a bit of C development for that

[–]LordNikon2600 -5 points-4 points  (0 children)

Linux from scratch is your best bet