Open source VPU side bootloader for Raspberry Pi.
C C++ Other
Latest commit 14c6662 Jan 29, 2017 @bobbybee bobbybee Try something else
Permalink
Failed to load latest commit information.
arm_chainloader add preliminary clock code that's expected to be set up by fw, gut ol… Jan 27, 2017
broadcom Move Broadcom headers into a seperate folder. Jan 6, 2017
drivers Try something else Jan 29, 2017
lib add preliminary clock code that's expected to be set up by fw, gut ol… Jan 27, 2017
tools add preliminary clock code that's expected to be set up by fw, gut ol… Jan 27, 2017
vc4_include unified VC4 and ARM runtime code (including C++ runtime), updated som… Jan 6, 2017
AUTHORS.md unified VC4 and ARM runtime code (including C++ runtime), updated som… Jan 6, 2017
BCM2708PlatformStartup.cc add preliminary clock code that's expected to be set up by fw, gut ol… Jan 27, 2017
CONTRIBUTING.md Cleanup README (again) Jan 21, 2017
LICENSE Update LICENSE Jan 7, 2017
Makefile add preliminary clock code that's expected to be set up by fw, gut ol… Jan 27, 2017
README.md Reference compatibility table in README Jan 21, 2017
arm_monitor.c Run astyle on codebase Jan 6, 2017
buildall.sh Restore +x bit on ./buildall.sh Jan 6, 2017
chainloader_inc.s Moved author names into a master AUTHORS file. Jan 6, 2017
hardware.h Run astyle on codebase Jan 6, 2017
linker.lds added driver framework to prepare for driver unification, fixed USB d… Jan 7, 2017
romstage.c add preliminary clock code that's expected to be set up by fw, gut ol… Jan 27, 2017
sdram.c Run astyle on codebase Jan 6, 2017
start.s Further progress on USB Jan 8, 2017
style.sh Run astyle on codebase Jan 6, 2017
trap.c Run astyle on codebase Jan 6, 2017

README.md

Minimal Raspberry Pi VPU firmware

rpi-open-firmware is a small firmware for the RPi VPU, capable of initializing UART, VPU PLL (PLLC), and ARM itself. It's intended as a libre replacement for the stock bootcode.bin normally loaded from the SD card. A UART cable is highly recommended for the time being, though not strictly necessary. Additionally, there is a second-stage chainloader running on ARM capable of initializing eMMC, FAT, and the Linux kernel.

See issue #31 for a compatibility table and related discourse.

Technical discussion occurs in #raspberrypi-internals on Freenode. Please come on IRC before randomly hacking on the codebase :-)

All Broadcom headers are licensed under 3-Clause BSD License while our code is under GPLv2+. See LICENSE for more information. Various external projects are mirrored under a mix of GPL-compatible licenses.

Building

As a prerequisite, Julian Brown's VC4 toolchain is necessary as well as the arm-none-eabi- toolchain (Debian package gcc-arm-none-eabi). You can tweak the VC4 toolchain path in CROSS_COMPILE in Makefile and the ARM path in arm_chainloader/Makefile if necessary. Contributors should not commit their personal paths. After configuration, run buildall.sh. The binary is at build/bootcode.bin, ready to be copied to an SD card.

Building on macOS

macOS compilation is similar to GNU/Linux, save platform errata described here. Instructions to build the ARM toolchain are here. Due to symlinking by default, GCC must be installed manually, and, an older version of guile is necessary (homebrew packages gcc-6 and guile18, respectively). Finally, set the environment variable LIBRARY_PATH to /lib:/lib64 when running `buildall.sh.

Technical Details

The firmware is split into two parts, one running on the VC4 and the other on ARM. The VC4 part initializes PLLC and moves VPU over to it, and then brings up UART. It performs SDRAM initialization, mapping it to 0xC0000000 (uncached alias). Next, ARM is initialized, and the embedded bootloader is mapped to ARM address 0x0. arm_chainloader is then executed.

The ARM chainloader initializes the eMMC controller and accesses the FAT boot partition. From here, it chainloads the Linux kernel (other payloads likely do not work due to mailbox usage).

Does it boot Linux?

Yes, with some conditions. You can boot a very minimal version of Linux without the firmware and get it to work with UART and eMMC. Support for USB, DMA, and Ethernet are in the works, which will be sufficient for certain headless systems. Still, many other peripherals require bringup, such as video. Additionally, drivers for power management need to written.

Thanks To

  • Herman Hermitage for his VC4 documentation and for helping determine suitable ARM PLL configurations.
  • Julian Brown for reviewing the code and for his awesome VC4 toolchain.
  • Alyssa Rosenzweig for her contributions to the firmware especially in areas of Linux bringup and early ARM side initialization, as well as fixing mailbox support.
  • David Given for his initial LLVM project used as the base for the initial LLVM toolchain before moving to GCC.
  • Scott Mansell for reviewing the code.
  • Broadcom for their header release.
  • Various other people not mentioned here.