# Raspberry Pi

Dusk OS runs on the RPi models 1, 2 and 3. The port is still very young and the
only supported I/O for now is the UART that is exposed through GPIO pins.

The RPi image can be built with `make rpifat.img` and can be ran under QEMU with
`make rpirun`. This builds a kernel for the RPi model 1. To build a kernel for
models 2 and 3 (they can run the same kernel), modify "kernel1" for "kernel2"
in /xcomp/arm/rpi/build.fs and then run `make rpifat.img`. To run this kernel
with QEMU, modify the Makefile and change "raspi1ap" for "raspi2b".

Note that CTRL+D isn't sufficient to quit QEMU, you have to go
through QEMU's monitor by pressing CTRL-A, then C. From there, you can type
"quit" to quit.

## Deploying on a real machine

To deploy on a real machine, you do:

1. "make rpifat.img"
2. "dd" "rpifat.img" to a SD card
3. Mount that SD card.
4. Copy "rpikernel.img" to mounted FAT as "kernel.img". If it's a "kernel2"
   image, copy to "kernel7.img" instead.
5. Copy the "bootcode.bin" and "start.elf" files from the "firmware/rpi"
   directory into the root of the SD card.
6. Insert your SD card in the Raspberry Pi and power it on. It should boot!

At this moment, only the GPIO-based UART is supported, so "power it on" means to
connect the RPi to a tty-UART adapter and send it power from there.

If you can't type, make sure you disable hardware flow control from your tty
line.

On the RPi 3, I've noticed a pretty big delay in EMMC initialization, I'm not
sure of its root cause. It can take up to 10 seconds before you see the "Dusk
OS" prompt.

## Further information

The main source of information for Raspberry Pi development is from the
Raspberry Pi foundation itself[1].

This Git repository contains, for example, the BCM2835 technical documentation,
which is the main document against which Dusk's first foray into the ARM world
is built.

[1]: https://github.com/raspberrypi/documentation.git
