@ -6,6 +6,13 @@ Now that we enabled safe globals in the previous tutorial, the infrastructure is
laid for adding the first real device drivers. We throw out the magic QEMU
console and use a real UART now. Like serious embedded hackers do!
- For the first time, we will be able to run the code on the real hardware.
- Therefore, building is now differentiated between the **RPi 3** and the **RPi4**.
- By default, all `Makefile` targets will build for the **RPi 3**.
- In order to build for the the **RPi4**, prepend `BSP=rpi4` to each target. For example:
- `BSP=rpi4 make`
- `BSP=rpi4 make doc`
- Unfortunately, QEMU does not yet support the **RPi4**, so `BSP=rpi4 make qemu` won't work.
- A `DeviceDriver` trait is added for abstracting `BSP` driver implementations
from kernel code.
- Drivers are stored in `bsp/driver`, and can be reused between `BSP`s.
@ -18,19 +25,54 @@ console and use a real UART now. Like serious embedded hackers do!
## Boot it from SD card
Some steps for preparing the SD card differ between RPi3 and RPi4, so be careful.
### Common for both
1. Make a single `FAT32` partition named `boot`.
2. Copy [bootcode.bin](https://github.com/raspberrypi/firmware/raw/master/boot/bootcode.bin), [fixup.dat](https://github.com/raspberrypi/firmware/raw/master/boot/fixup.dat) and [start.elf](https://github.com/raspberrypi/firmware/raw/master/boot/start.elf) from the [Raspberry Pi firmware repo](https://github.com/raspberrypi/firmware/tree/master/boot) onto the SD card.
3. Copy our [kernel8.img](kernel8.img) onto the SD card.
4. Insert the SD card into the RPi and connect the USB serial to your host PC.
2. On the card, generate a file named `config.txt` with the following contents:
```txt
init_uart_clock=48000000
```
### Pi 3
3. Copy the following files from the [Raspberry Pi firmware repo](https://github.com/raspberrypi/firmware/tree/master/boot) onto the SD card: