-
Notifications
You must be signed in to change notification settings - Fork 3
Home
The Accelerated Raspberry Pi SDK was created to build applications to Raspberry Pi board. It's accelerated because the build applications (toolchain, cmake, make, etc) have the same architecture as your desktop. It avoids the performance penalty you would suffer when running them with qemu.
The build performance is close to the desktop build.
Important: This chroot must not be used as rootfs.
sudo apt-get install qemu-user-static
Install the binfmt-support
package from the AUR, available at https://aur.archlinux.org/packages/binfmt-support/
Refer to https://wiki.archlinux.org/index.php/Arch_User_Repository#Installing_packages for instructions on how to install packages from the AUR.
You will also need to use something like the following script to enable support for ARM (arm/armeb) program execution by the kernel.
#!/bin/sh
# enable automatic ARM (arm/armeb) program execution by the kernel
# load the binfmt_misc module
if [ ! -d /proc/sys/fs/binfmt_misc ]; then
sudo /sbin/modprobe binfmt_misc
fi
if [ ! -f /proc/sys/fs/binfmt_misc/register ]; then
sudo mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
fi
# unregister if they exist
for a in arm armeb; do
if [ -f /proc/sys/fs/binfmt_misc/${a} ]; then
echo -1 | sudo tee /proc/sys/fs/binfmt_misc/${a} >/dev/null
fi
done
# register the interpreter for each cpu except for the native one
echo ':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-arm-static:C' | sudo tee /proc/sys/fs/binfmt_misc/register >/dev/null
echo ':armeb:M::\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff:/usr/bin/qemu-armeb-static:C' | sudo tee /proc/sys/fs/binfmt_misc/register >/dev/null
for a in arm armeb; do
if [ -f /proc/sys/fs/binfmt_misc/${a} ]; then
echo 1 | sudo tee /proc/sys/fs/binfmt_misc/${a} >/dev/null
fi
done
Run the above script before starting the sdk. Notice it uses /usr/bin/qemu-arm-static
and /usr/bin/qemu-armeb-static
, but those programs will be available within the SDK, so there is no need to install qemu
on the host system.
Download it from https://github.com/WebKitNix/nix-rpi-sdk/blob/master/rpi-sdk-20130405.tar.xz
sudo tar xf rpi-sdk-20130405.tar.xz
Download it from https://github.com/WebKitNix/nix-rpi-sdk/blob/master/start-rpi-sdk
chmod +x start-rpi-sdk
Suggestion: Put it on a $PATH
directory (/usr/bin
, ~/bin
, whatever...)
sudo start-rpi-sdk rpi-sdk
Important: start-rpi-sdk does several mounts (proc, dev, devpts and sys) into chroot directories before chroot. After you leave the chroot, the script umounts these directories. It is also prepared to handle SIGINT and SIGTERM. However, check if there is something mounted before REMOVING the SDK directory to avoid the wasting of your /dev, for instance.
Several binaries were manually copied from host machine to the chroot. The related packages were pinned (locked) to prevent their upgrade as we don't want to decrease the SDK performance.
It's safe to run 'apt-get upgrade' though. However, it's a good idea to be careful when doing the upgrade ;)
sudo start-rpi-sdk SDK_PATH
git clone git://github.com/WebKitNix/webkitnix.git
cd webkitnix
# Build Nix dependencies. It takes ~10min.
Tools/Scripts/update-webkitnix-libs
# Build Nix in RELEASE. It takes ~50min
Tools/Scripts/build-webkit --nix --cmakeargs="-DCMAKE_PREFIX_PATH=/opt/vc" --no-llint --opengles2 --prefix=/opt/nix
You can install the nix dependencies that were built using jhbuild.
In the chroot:
mkdir nix-deps
cp -a webkitnix/WebKitBuild/Dependencies/Root/* nix-deps/.
sed -i 's,/home/pi/.*/Root,/opt/nix-deps,' nix-deps/lib/pkgconfig/*.pc
sudo chown -R root.root nix-deps/*
sudo tar cf nix-deps.tar nix-deps/*
scp nix-deps.tar pi@<rasp_ip_addr>:
In the RPi board:
sudo mkdir /opt/nix-deps
sudo tar xf /home/pi/nix-deps.tar -C /opt/nix-deps
I'm getting the following error:
pi@machine:~$ sudo ls
sudo: effective uid is not 0, is /usr/bin/sudo on a file system with the 'nosuid' option set or an NFS file system without root privileges?
You may have incorrectly extracted the sdk tarball to you computer. You MUST use sudo:
sudo tar xf rpi-sdk-20130405.tar.xz
Although the link bellow is debian related, it may affect other distributions:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=683205
To solve the problem, first make sure the following file has the described content:
pi@machine:~$ cat /usr/share/binfmts/qemu-arm
package qemu-user-static
interpreter /usr/bin/qemu-arm-static
credentials yes
offset 0
magic \x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00
mask \xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff
Run the following commands:
``` bash
sudo update-binfmts --import qemu-arm
sudo update-binfmts --import qemu-arm # Yes, twice. Before complaining, read the bug link
Note that this solution is based on ubuntu/debian distribution. Maybe in your distribution, the qemu interpreter has a different name. Maybe the /usr/share/binfmts/qemu-arm
file does not exists (is in another place?). So, be careful, do not copy-and-paste commands without understand what you're doing.