
Learning operating system development using Linux kernel and Raspberry Pi - weeber
https://s-matyukevich.github.io/raspberry-pi-os/
======
teleforce
If you are looking to learn operating system concepts using RPi there is a new
textbook by Prof. Vanderbauwhede, under ARM textbook initiative [1].

I think for educational purposes it will be very interesting and useful if
someone develop from scratch a simple System V UNIX for RPi based on Bach's
description in his seminal book on "The Design of the UNIX Operating System"
[2]. The book also covers multi processors topic as supported by modern
platforms such as RPi.

[1][https://www.arm.com/resources/education/books/operating-
syst...](https://www.arm.com/resources/education/books/operating-systems)

[2][https://github.com/suvratapte/Maurice-Bach-
Notes/blob/master...](https://github.com/suvratapte/Maurice-Bach-
Notes/blob/master/README.md)

~~~
bla3
Is the ebook of the textbook a regular PDF/epub/mobi or is it only viewable in
their viewer apps? The page doesn't say, and I don't want to spend money on it
and then realize it's not a real download.

~~~
jakamau
I was curious about that as well. The official ARM site doesn't list one but
another distributor lists the related ISBN as epub.

[https://www.vitalsource.com/products/operating-systems-
found...](https://www.vitalsource.com/products/operating-systems-foundations-
with-linux-on-the-wim-vanderbauwhede-jeremy-v9781911531203)

~~~
pumanoir
The "book" you download from this website is _not_ an epub. You must use their
apps to read it.

------
lewis1028282
Might be a bit controversial but I found writing drivers for Linux on my
raspberry pi helped me understand kernels, virtual memory etc. I used Linux
Device Drivers (ldd3) which is free online. The book was written for the 2.6
kernel but someone on GitHub updated the code for the latest kernels.

~~~
stevekemp
I've never written a driver myself, because all my hardware is supported. But
I've certainly added new PCI IDs to existing drivers, and done that kind of
low-level learning.

I expect if I found a random piece of hardware that was close to an existing
one that adding the driver, or updating things so that it worked on the new
hardware would be possible. It's just not a situation I've come across.

What I found useful/educational was writing a simple linux security module.

1\. LSMs are essentially isolated. 2\. They don't care about hardware. 3\. You
can do lots of things with them. Even horrid evils things.

For example I put together the following module in which the kernel calls back
to userspace every single time you execute a binary, to decide whether it
should be permitted or not:

[https://github.com/skx/linux-security-modules](https://github.com/skx/linux-
security-modules)

(And yes, I appreciate that is almost exactly as horrid as it sounds! So much
fun to hack around with though.)

~~~
lewis1028282
You can just write char drivers that operate a slab of kernel memory, and
implement all the syscalls like open, read, write on that piece of memory.

------
ObsoleteNerd
The offical Raspberry Pi distro of Linux is already called “Raspberry Pi OS”:

[https://www.raspberrypi.org/downloads/raspberry-pi-
os/](https://www.raspberrypi.org/downloads/raspberry-pi-os/)

~~~
Yuioup
Renamed from "Raspbian". Perhaps the article was written before the name
change?

~~~
amatecha
Yeah the github repo ( [https://github.com/s-matyukevich/raspberry-pi-
os](https://github.com/s-matyukevich/raspberry-pi-os) ) shows it as being
created just a little under 2 years ago

------
mikece
In terms of teaching fundamentals of operating system theory and systems
programming, is there such a thing as an operating system kernel written in
Python or some language which is meant to be easy to hack on for educational
purposes? I wonder how useful that would be for a CS student, taking the
complexity of C, C++, or Rust out of the picture and just running a kernel in
a VM for educational purposes.

~~~
mywittyname
An OS course taught in Python is really just a data structures and algorithms
course. When you ignore the hardware aspect, topics like scheduling and
virtual memory management are about selecting an algorithm with the
appropriate trade-offs.

My OS course was hacking on x86 Linux in C. The C wasn't really the difficult
part. Honestly, neither was the assembly, as most of was boilerplate: here's
how you configure to registers for a system call, here's how you trigger the
interrupt for the system call, here's how you get the return codes, etc.

I don't think the class would have been nearly as valuable if C were replaced
with Python. At that point, so many of the interesting details would be hand-
waved away that it wouldn't really be all that different from the other
programming classes I took.

~~~
Nzen
If the language is boilerplate and the algorithms/data-structures derive from
the physical constraints, was the OS course you completed mostly about
hardware ?

As to the inciting question, there is a Stonybrook OS course [0] designed
around a java simulator that students implement modules for. Springer
published M Kifer's book [1] about this OSP2 system. (The binaries are
accessible via the link 'Students: Software Download'.) I'm of the impression
that the course involves examining the trade-offs of each module. So the
thread section spawns a bunch of request events per process for a module to
deal with, whether with round robin or priority queues or whatever.

[0]
[https://www3.cs.stonybrook.edu/~kifer/Courses/cse306/](https://www3.cs.stonybrook.edu/~kifer/Courses/cse306/)

[1]
[https://www.springer.com/gp/book/9781846288425](https://www.springer.com/gp/book/9781846288425)

------
OldTechSucks
I want to learn about firmware development. I have been playing with rpi gpio
and arduino i2c but have no idea how to start with firmware development.
please throw at me references, i'm very fragile but i'll take it and learn
from.

------
lukaspu
I just wanted to say thank you. The resource is really really good. I learned
a ton during the first two chapters alone

------
ma5ter
Is there a similar tutorial that support rpi 2 ?

