summaryrefslogtreecommitdiff
path: root/Documentation/building
diff options
context:
space:
mode:
authorJan Vorlicek <janvorli@microsoft.com>2018-06-02 10:23:10 +0200
committerGitHub <noreply@github.com>2018-06-02 10:23:10 +0200
commite7ad6110bfc1b888aceba9e0abbcbaae475517a8 (patch)
tree0c1415dd51b748a77b4beca3d75775d4f8e8515e /Documentation/building
parentfd895f1c74712edd9dbee4cf265e7a4d39f55f4c (diff)
downloadcoreclr-e7ad6110bfc1b888aceba9e0abbcbaae475517a8.tar.gz
coreclr-e7ad6110bfc1b888aceba9e0abbcbaae475517a8.tar.bz2
coreclr-e7ad6110bfc1b888aceba9e0abbcbaae475517a8.zip
Enable Alpine cross build for arm and arm64 (#18234)
* Enable Alpine cross build for arm and arm64 This change enables cross build and rootfs creation for Alpine Linux ARM / ARM64 targets. Besides that, I've cleaned up the toolchain.cmake and got rid of the explicit specification of GCC version specific include and lib folders for all targets except of Tizen. Clang is able to figure that out on its own the same way as it does when doing regular non-cross builds, but it needed one more option for that. I've also fixed a bug in the `add_compile_param` macro that caused ignoring of parameters in cases where another parameter that was a substring of the one being added was already present. So for example if an option `-L${CMAKE_SYSROOT}/usr/lib/gcc` was already added, attempt to add option `-L${CMAKE_SYSROOT}/usr/lib` would do nothing. * Fix to make it work with cmake 2.8 too The older cmake that is still in use on Ubuntu 14.04 doesn't have support for specifying sysroot and target via cmake variables. So I've replaced those by explicit setting of the compiler / linker options instead.
Diffstat (limited to 'Documentation/building')
-rw-r--r--Documentation/building/cross-building.md28
1 files changed, 22 insertions, 6 deletions
diff --git a/Documentation/building/cross-building.md b/Documentation/building/cross-building.md
index 5a4060c910..d0047f90af 100644
--- a/Documentation/building/cross-building.md
+++ b/Documentation/building/cross-building.md
@@ -16,13 +16,13 @@ Build using "-arm" as the architecture. For example:
C:\coreclr> build.cmd -arm -debug
-Cross Compilation for ARM on Linux
-==================================
+Cross Compilation for ARM, ARM64 or x86 on Linux
+================================================
Through cross compilation, on Linux it is possible to build CoreCLR for arm or arm64.
-Requirements
-------------
+Requirements for targetting Debian based distros
+------------------------------------------------
You need a Debian based host and the following packages needs to be installed:
@@ -37,14 +37,30 @@ and conversely for arm64:
ben@ubuntu ~/git/coreclr/ $ sudo apt-get install binutils-aarch64-linux-gnu
+Requirements for targetting ARM or ARM64 Alpine Linux
+-----------------------------------------------------
+
+You can use any Linux distro as a host. The qemu, qemu-user-static and binfmt-support packages need to be installed (the names may be different for some distros).
+
+In addition, to cross compile CoreCLR, the binutils for Alpine need to be built from the https://github.com/richfelker/musl-cross-make repo, since they are not available as packages.
+
+To build them, use the following steps:
+* Clone the repo
+* Create a new config.mak file in the root directory of the repo and add the following lines into it:
+ * `TARGET = armv6-alpine-linux-musleabihf` for ARM or `TARGET = aarch64-alpine-linux-musl` for ARM64
+ * `OUTPUT = /usr`
+ * `BINUTILS_CONFIG=--enable-gold=yes`
+* Run `make` with current directory set to the root of the repo
+* Run `sudo make install`
+
Generating the rootfs
---------------------
The `cross\build-rootfs.sh` script can be used to download the files needed for cross compilation. It will generate an rootfs as this is what CoreCLR targets.
Usage: ./cross/build-rootfs.sh [BuildArch] [LinuxCodeName] [lldbx.y] [--skipunmount]
BuildArch can be: arm(default), armel, arm64, x86
- LinuxCodeName - optional, Code name for Linux, can be: trusty(default), vivid, wily, xenial. If BuildArch is armel, LinuxCodeName is jessie(default) or tizen.
- lldbx.y - optional, LLDB version, can be: lldb3.6(default), lldb3.8
+ LinuxCodeName - optional, Code name for Linux, can be: trusty(default), vivid, wily, xenial or alpine. If BuildArch is armel, LinuxCodeName is jessie(default) or tizen.
+ lldbx.y - optional, LLDB version, can be: lldb3.6(default), lldb3.8. This is ignored when building rootfs for Alpine Linux.
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.