The Raspberry Pi is an inexpensive credit-card sized computer designed for educational use. This page gives an overview of the port of Embedded Xinu to the Raspberry Pi, or XinuPi. XinuPi provides a simple, lightweight operating system for the Raspberry Pi that contains several orders of magnitude fewer lines of code than the Linux-based software stacks that normally run on the device. Its purpose is to provide an inexpensive, convenient platform for various areas of computer science education at a University level, including operating systems, embedded systems, networking, and programming languages.
General Raspberry Pi information
This section provides some important details about the Raspberry Pi in the context of those interested in running Embedded Xinu on it. Readers unfamiliar with the Raspberry Pi are advised to also see other sources such as the Raspberry Pi foundation's website.
Acquiring the hardware
Model A vs. Model B
The Raspberry Pi Model A costs $25, whereas the Raspberry Pi Model B costs $35. Since Embedded Xinu is very lightweight, differences in memory are essentially irrelevant. However, we recommend the Model B because it includes an Ethernet port and 2 USB ports, as opposed to the Model A which merely has 1 USB port.
One way the cost of the Raspberry Pi was kept down was increasing modularity. A consequence of this is that a Raspberry Pi board by itself is useless until at least two additional components have been added:
- SD card. To boot, the Raspberry Pi requires an appropriately formatted SD card containing certain boot files as well as the operating system or kernel to run. Note: as of this writing, Embedded Xinu has no SD card driver; therefore, when running Embedded Xinu the SD card is only used for booting. Useful tip: Since the SD card can easily be removed, it is trivial to have different SD cards and swap them out when needed. This trick can be used to easily use the same Raspberry Pis for different purposes.
- Power source. The Raspberry Pi requires 700 mA at 5V, delivered either through the microUSB port or through the GPIO pins. For the microUSB port, most cell phone chargers should work. For the GPIO pins, a useful trick is that a USB to TTL Serial converter, such as this one, can double as a power source as well as a serial connection to the Raspberry Pi over which the console runs. We have primarily used the latter method while developing Embedded Xinu.
Other useful hardware and accessories include the following:
- Monitor or TV to show graphics output. While important for Linux, this is less important for Embedded Xinu, which is primarily intended to produce text output over a serial connection. However, Embedded Xinu does support a framebuffer console and a turtle graphics application for those interested.
- USB devices, such as mouse and keyboard. Note: as of this writing, Embedded Xinu does not have working mouse and keyboard drivers, so the serial connection remains the only way to send input to XinuPi.
- Case to enclose the Raspberry Pi in. This protects the board and adds aesthetic value; otherwise it has no purpose.
The Raspberry Pi can only boot from its SD card, not from any external devices, and it requires several files in order to do so. Several boot files, which are not distributed with Embedded Xinu, must be placed in the root directory of a FAT-formatted partition of the SD card.
The following binary blobs (created by Broadcom, but freely distributable, at least when using them on Raspberry Pis) must exist:
- "bootcode.bin" is a first-stage bootloader. [Download link].
- "loader.bin" is a second-stage bootloader. Apparently, this file is no longer required.
- "start.elf" is the GPU firmware.[Download link].
The following text files are optional:
- "config.txt" is parsed by the GPU firmware and is used to set various hardware parameters. Xinu runs fine with the default parameters, so "config.txt" need not exist.
- "cmdline.txt" is used to pass a command line to the Linux kernel. This file need not exist for the Xinu kernel, which does not take command line parameters.
Finally, the actual kernel:
- "kernel.img" must exist and is loaded as raw data at physical memory address 0x8000 by the GPU firmware. The ARM begins execution at the very first instruction in this loaded image. "kernel.img" can be a Xinu kernel (rename "xinu.boot" to "kernel.img"), a Linux kernel, or other bare-metal code such as the "raspbootin" bootloader. "raspbootin" has been helpful in the initial stages of porting Xinu to the Raspberry Pi; see its documentation for more information.
There are a couple ways you can actually achieve the final result of a properly set up SD card:
- Follow the installation instructions for a Linux distribution supported on the Raspberry Pi, such as Raspbian or Arch Linux ARM. This will leave the appropriate boot files. To switch to Embedded Xinu, simply replace "kernel.img" on the FAT partition with "xinu.boot". (Perhaps rename "kernel.img" to "linux.img" to save a backup first.)
- Manually partition the SD card and create a FAT filesystem, then copy the boot files to the filesystem. The binary blobs can be downloaded using the links provided above.