Liberating The Blob

Since the launch of the Raspberry Pi back in 2012 I have been fascinated with what the community surrounding it has become. Diving into the hardware and poking around has become a favorite past time of mine. A few years back on Github, Kristina Brooks released an open source firmware for the Raspberry Pi, replacing the usual bootcode.bin found in the /boot directory of the SD card. Since then the project has matured to a point, where you are able to boot a very minimal linux kernel (with some work).

For a more in-depth look at the firmware and additional information on the project, I encourage you to check out Kristina Brooks’ and Alyssa Rosenzweig’s websites. Both have more detailed information on the firmware than I can provide.

So in hopes of keeping interest on the project and helping others compile the open firmware, I have decided to post some instructions on how to cross compile the bootcode.bin on an X86 Linux machine.

In this build I used Ubuntu as my distro, in the past I have tried Arch and SUSE. I strongly suggest you use Ubuntu or Debian for this build as use of any other distro will probably waste your time.

Total time to compile was about an hour, and most of that was just waiting for it to finish. Set up is a walk in the park.

This is what worked for me, your mileage can and will vary.

Build Instructions for Ubuntu 16.04

First we need to compile Julian Brown’s VC4 toolchain in order to cross compile the firmware, this has its own dependencies.

Install ARM toolchain

add-apt-repository ppa:ubuntu-toolchain-r/test
apt-get update

Install VC4 toolchain dependencies

apt install gcc-6 g++-6
apt install cmake texinfo libgmp-dev libmpc-dev libmpfr-dev flex bison
git clone --recursive https://github.com/puppeh/vc4-toolchain.git
cd vc4-toolchain/

Modify build-all.sh

I did not use CGEN, and it is not necessary to build bootcode.bin. You need to comment out line 10. Just put # before the line. You can use Nano to edit the file.

nano +10 build-all.sh

Compile VC4 toolchain

export CXX=g++-6
./build-all.sh 2>&1 | tee build.log

Compile bootcode.bin

cd ..
git clone https://github.com/christinaa/rpi-open-firmware
cd rpi-open-firmware/
export PATH=$PATH:~/vc4-toolchain/prefix/bin
./buildall.sh

If everything worked correctly then you should have a fresh bootcode.bin in the build directory.

I will update this post in the future if I find any issues with my process.

When I find some time I will make another post on how to build a kernel to use with the liberated firmware.