19 ms·
Building an Operating System for the Raspberry Pi
- ajb257 9y agoThis is fantastic. Especially the line-by-line explanations on separate pages. Thank you @jsandler18!
- flamedoge 9y agoawesome.. might buy rpi 1 cuz of this
- m-p-3 9y agoI think for the cost, a RasPi is always a nice board to tinker with. And having a bunch of MicroSD cards to experiments makes it easy to test multiple scenarios easily.
- icantdrive55 9y agoRaspberry Pi got me interested in computing/tinkering again. I should have bought one sooner.
- DSMan195276 9y agoVery nice! I've been considering attempting to port an OS that I've been writing to an ARM device like the Pi, but I've never really looked into it much. With that said, I'm surprised the booting portion is so easy, I was under the impression that for the Raspberry Pi (And ARM devices in general) it was more complex. I suppose though, this is started after the bootloader that's normally on the SD card correct? I would imagine that makes things a fair bit simpler if that's the case, since the bootloader would take care of all the secret sauce. Do you have plans to implement paging eventually?
- bpye 9y agoYep the proprietary bootloader on the Raspberry Pi handles most initialisation leaving the SoC in a usable state. If you want to see how things like DRAM init work you can take a look at the open source reverse engineered firmware at https://github.com/christinaa/rpi-open-firmware https://github.com/christinaa/rpi-open-firmware . It isn't complete but it is just about enough to also boot the Linux kernel.
- DSMan195276 9y agoThanks for linking that, that is one impressive piece of work!
- jsandler18 9y agoI do plan to implement paging. I already manage all of the physical pages, I just haven't enabled the mmu yet as I wanted to get more fun features in first
- AndyKelley 9y agoIf you're starting a new operating system project, you might consider using Zig[1] instead of C. It does all the low level stuff that C does but it has some safety features as well as generics. The standard library is usable in freestanding mode, even the data structures that allocate memory, because everything takes an allocator as a parameter. Here are some examples: * i386 OS: https://github.com/AndreaOrru/zen https://github.com/AndreaOrru/zen * ARM (raspberry pi) OS: https://github.com/andrewrk/clashos https://github.com/andrewrk/clashos [1]: http://ziglang.org/ http://ziglang.org/
- derefr 9y agoWhy not Rust? Or, say, Ada?
- panic 9y agoOr go all the way and design a new language too!
- qznc 9y agoAh, the Knuthian approach. Why not go more than all the way and design an architecture too?
- pjmlp 9y agoThat would be to just use Assembly, given Mix.
- snaky 9y agoAssembler is too high level these days. This would be translator from higher languages to hardware. http://conal.net/papers/compiling-to-categories/ http://conal.net/papers/compiling-to-categories/ https://icfp17.sigplan.org/event/icfp-2017-papers-kami-a-platform-for-high-level-parametric-hardware-specification-and-its-modular-verification https://icfp17.sigplan.org/event/icfp-2017-papers-kami-a-pla...
- xkarga00 9y agoI recently discovered dietpi and I am very happy about it. http://dietpi.com/ http://dietpi.com/
- ryanianian 9y agolol from their home page: > A tweakers wet dream! Yikes
- djroomba 9y agoThat is super cool.
- jopsen 9y agoWhen did 400mb linux become light weight? Sorry, wasn't DSL debian based too... Have the basic things needed grown that much?
- tylersmith 9y agoWhen it became less than 100% of the size of the smallest common OS for rpis.
- epynonymous 9y agothis is excellent, i've been thinking about this as well recently. my goal has been to create a small device/appliance using raspberry pi. i tried out lots of operating systems: raspbian, ubuntu-mate, ubuntu core, windows iot, fedora, etc. i needed a lightweight x windows environment, a decent package manager, and modern linux kernel, overall none of these really seemed to match my needs. basically raspbian was too heavyweight, it was a desktop environment with way too many applications like libre office, etc that i just didn't need. ubuntu core required the use of snaps which are based on docker, i'm hosting an electron app so that's just overkill, i'm thinking in terms of preserving memory, too since there's only 1g on the rpi 3 model b so everything has to be optimized. windows iot requires a windows license, a definite non-starter for me. i even looked at chromium and android, but those didn't seem to be a good match because i want to host a golang service and i don't have a touchscreen. i even looked at fuchsia, but that seems too experimental. i even considered doing my own os, but ultimately my goal is to build an appliance so that would be a major distraction. dietpi seems good, i will probably pursue that, but thanks for writing the article.
- tbrock 9y agoWhy not use Arch Linux? The arm version is called ALarm (for obvious reasons). https://archlinuxarm.org/platforms/armv8/broadcom/raspberry-pi-3 https://archlinuxarm.org/platforms/armv8/broadcom/raspberry-...
- epynonymous 9y agoi was once a fan of arch linux, loved having the control of compiling everything. how well is this supported for raspberry pi? it's always nice to know that vendors have tested the exact hardware that i'm using extensively, even if it's just another arm device that looks and smells like the others. also, what package manager is used by arch? it's been like 10 years since i last used it.
- caro_douglos 9y agopacman iirc
- 0xTJ 9y agoI just want to thank you for posting this over here, I've been looking for something like this. I need something where I can develop and understand code as I go, so not a completed system, but that also provides final code so I can have something that actually works. I tried following the OSDev pages to try an x86 kernel, but I gave up when I couldn't get interrupts to fire.
- jsandler18 9y agoOh shoot. this is mine! If you have any questions or suggestions, feel free to ask me!
- waterhouse 9y agoTypos I see from quickly poking around: Part 1: "tar -xf tar -xf gcc-arm-none-eabi-X-XXXX-XX-update-linux.tar.bz2" should probably lose one of the "tar -xf"s. Part 6: "unfmilaiar" Part 8: "Proccess"
- bringtheaction 9y agoIn what order should the extra information pages be read in relation to the tutorial parts?
- jsandler18 9y agoThe extra information is all linked to from the main parts. The reason it's also on the main page is so anyone looking for that info independently of this particular tutorial might find it more easily.
- moondev 9y agoYou can also leverage yocto/bitbake/openembedded to build your own linux distro for the pi https://git.yoctoproject.org/cgit.cgi/meta-raspberrypi/ https://git.yoctoproject.org/cgit.cgi/meta-raspberrypi/