Xamarin Public Jenkins (auto-signing) 6bdd276d05 Imported Upstream version 5.0.0.42
Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
2017-04-10 11:41:01 +00:00

52 lines
1.8 KiB
Markdown

Cross Compilation for ARM on Linux
==================================
Through cross compilation, on Linux it is possible to build CoreCLR for arm or arm64.
Requirements
------------
You need a Debian based host and the following packages needs to be installed:
$ sudo apt-get install qemu qemu-user-static binfmt-support debootstrap
In addition, to cross compile CoreCLR the binutils for the target are required. So for arm you need:
$ sudo apt-get install binutils-arm-linux-gnueabihf
and conversely for arm64:
$ sudo apt-get install binutils-aarch64-linux-gnu
Generating the rootfs
---------------------
The `cross\build-rootfs.sh` script can be used to download the files needed for cross compilation. It will generate an Ubuntu 14.04 rootfs as this is what CoreCLR targets.
Usage: build-rootfs.sh [BuildArch]
BuildArch can be: arm, arm64
The `build-rootfs.sh` script must be run as root as it has to make some symlinks to the system, it will by default generate the rootfs in `cross\rootfs\<BuildArch>` however this can be changed by setting the `ROOTFS_DIR` environment variable.
For example, to generate an arm rootfs:
$ sudo ./cross/build-rootfs.sh arm
and if you wanted to generate the rootfs elsewhere:
$ sudo ROOTFS_DIR=~/coreclr-cross/arm ./build-rootfs.sh arm
Cross compiling CoreCLR
-----------------------
Once the rootfs has been generated, it will be possible to cross compile CoreCLR. If `ROOTFS_DIR` was set when generating the rootfs, then it must also be set when running `build.sh`.
So, without `ROOTFS_DIR`:
$ ./build.sh arm debug verbose clean cross
And with:
$ ROOTFS_DIR=~/coreclr-cross/arm ./build.sh arm debug verbose clean cross
As usual the resulting binaries will be found in `bin/Product/BuildOS.BuildArch.BuildType/`