Skip to content

Instantly share code, notes, and snippets.

@troeger
Last active August 29, 2019 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save troeger/1c213eeebfbd357dcfcc to your computer and use it in GitHub Desktop.
Save troeger/1c213eeebfbd357dcfcc to your computer and use it in GitHub Desktop.
Cross-compilation of PyPy for RaspberryPi

An adoption of https://pypy.readthedocs.org/en/release-2.4.x/arm.html

Get RPI Cross Compiler

mkdir crosscompiler
cd crosscompiler/
git clone git://github.com/raspberrypi/tools.git --depth 1
cd ..

Setup of cross-compile environment

mkdir rasbian
qemu-debootstrap --no-check-gpg --variant=buildd --arch=armhf wheezy rasbian http://archive.raspbian.org/raspbian
cp /usr/bin/qemu-arm-static rasbian/usr/bin/
vim /etc/schroot/schroot.conf 
sb2-init -c /usr/bin/qemu-arm ARM /root/crosscompiler/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-gcc

Cross-compile minimal static PyPy

Description of compilation options: http://doc.pypy.org/en/latest/config/commandline.html

Under normal circumstances, you should leave out the --no-allworkingmodules –withmod-__builtin__options.

export SB2=/root/rasbian
export SB2OPT='-t ARM'
pypy pypy/rpython/bin/rpython -O2 --platform=arm --gcrootfinder=shadowstack --jit-backend=arm --no-shared pypy/pypy/goal/targetpypystandalone.py --no-allworkingmodules –withmod-__builtin__
cp pypy-c rasbian/
schroot -c rasbian
/pypy-c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment