OSo ("bear" in Spanish) is a microkernel for embedded systems as designed and developed by Roberto Valenzuela (roemvaar). It currently supports Raspberry Pi 4 Model B.
Small operating system with for "real-world" applications.
Start from scratch to get a better understanding of things that you may take for granted, such as booting, device interaction, memory management, timing, threading and concurrency.
The documentation for the project is in the Wiki page.
The assignment-related files are stored on the course site (here).
- Raspberry Pi 4 (RPi4) Model B (with power supply)
- MicroSD Card (and an adapter to write to it)
- USB to TTL serial adapter
- Dev machine (to develop the firmware)
The RPi4 boot mechanism is closed source, therefore, we need to install Raspbian OS. See the official documentation for detailed instructions. After you make sure that your RPi4 is booting Raspbian correctly, we are going to be able to boot our own code (explained in the next section).
First, install the cross toolchain, instructions here.
$ make X_DIR=/path/to/cross_toolchain
Make sure to specify the path to the cross toolchain on your dev machine.
The make
command will produce kernel8.img
, which is a memory image of our kernel. This binary is the
one that needs to be deployed to the RPi4 and run. The steps consists of flashing the image into the SD
card, then inserting it into the RPi4, then powering the board, and the kernel should start booting and
running the user space "applications".
To build and test the kernel follow this instructions:
- Build code
$ make
-
Copy the generated
kernel8.img
file to theboot
partition of the RPi4 flash card. Make sure that you leave all other files in the boot partition untouched. -
Connect the USB-to-TTL serial cable.
$ sudo picocom -b 115200 /dev/ttyUSB0
-
Power on the Raspberry Pi 4.
-
On the terminal, you should be able to see the OS booting.
$ make debug
The debug
target produces the objdump.txt
and readelf.txt
that help to debug the kernel.
Roberto Valenzuela (roemvaar).
We stand on the shoulders of giants.
Here are some useful resources that we have encountered regarding developing a kernel, real time or otherwise.
MIT license.