These instructions explain how to set up Cobalt for your workstation and your Raspberry Pi device.
Configure the Raspberry Pi memory split.
sudo raspi-config
Cobalt assumes the Raspberry Pi is configured to use non-default thread schedulers and priorities. Ensure that /etc/security/limits.conf sets rtprio and nice limits for the user. For example, if the user is pi, then limits.conf should have the following lines:
@pi hard rtprio 99 @pi soft rtprio 99 @pi hard nice -20 @pi soft nice -20
The following commands update the package configuration on your Raspberry Pi so that Cobalt can run properly:
$ apt-get remove -y --purge --auto-remove libgl1-mesa-dev \ libegl1-mesa-dev libgles2-mesa libgles2-mesa-dev $ apt-get install -y libpulse-dev libasound2-dev libavformat-dev \ libavresample-dev
The following steps install the cross-compiling toolchain on your workstation. The toolchain runs on an x86 workstation and compiles binaries for your ARM Raspberry Pi.
Choose a location for the installed toolchain – e.g. raspi-tools
– and set $RASPI_HOME
to that location.
Add $RASPI_HOME
to your .bashrc
(or equivalent).
Create the directory for the installed toolchain and go to it:
mkdir -p $RASPI_HOME cd $RASPI_HOME
Clone the GitHub repository for Raspberry Pi tools:
git clone git://github.com/raspberrypi/tools.git
Sync your sysroot by completing the following steps:
Boot up your RasPi, and set $RASPI_ADDR
to the device's IP address.
Run mkdir -p $RASPI_HOME/sysroot
Run:
rsync -avzh --safe-links \ --delete-after pi@$RASPI_ADDR:/{opt,lib,usr} \ --exclude="lib/firmware" --exclude="lib/modules" \ --include="usr/lib" --include="usr/include" \ --include="usr/local/include" --include="usr/local/lib" \ --exclude="usr/*" --include="opt/vc" --exclude="opt/*" \ $RASPI_HOME/sysroot password: raspberry
Run the following commands to build Cobalt:
$ gyp_cobalt raspi-2 $ ninja -C out/raspi-2_debug cobalt
Run the following command to install your Cobalt binary (and content) on the device:
rsync -avzh --exclude="obj*" \ $COBALT_SRC/out/raspi-2_debug pi@$RASPI_ADDR:~/
The rsyncs
get somewhat faster after the first time, as rsync
is good at doing the minimum necessary effort.
Even if you have a keyboard hooked up to the RasPi, you should SSH into the device to run Cobalt. Using SSH will make it easy for you to quit or restart Cobalt.
ssh pi@$RASPI_ADDR cd raspi-2_debug ./cobalt
With this approach, you can just hit [CTRL-C]
to close Cobalt. If you were to run it from the console, you would have no way to quit without SSHing into the device and killing the Cobalt process by its PID.
Note that you can also exit YouTube on Cobalt by hitting the [Esc]
key enough times to bring up the “Do you want to quit YouTube?” dialog and selecting “yes”.