This page is about cross-building your own arm64 kernel for use with ARM's Fast Models (Foundation model or VE model).


Linaro provides pre-built AArch64 cross-toolchains for at least two targets: * bare-metal: will build bootloaders and kernels or plain binaries * GNU/Linux: will build programs linked to a libc and running under a Linux kernel

AArch64 toolchain downloads are listed on:

Unpack the toolchain to a location of your choice and add the bin/ subdirectory to your PATH; for instance:

    % mkdir ~/aarch64-toolchain
    % cd ~/aarch64-toolchain
    % wget
    % tar xf gcc-linaro-aarch64-linux-gnu-4.7+bzr115029-20121015+bzr2506_linux.tar.bz2
    % export PATH=$PATH:$PWD/gcc-linaro-aarch64-linux-gnu-4.7+bzr115029-20121015+bzr2506_linux/bin

You should be able to run aarch64-linux-gnu-gcc -v or aarch64-none-elf-gcc -v depending on whether you're running a GNU/Linux or a bare-metal toolchain:

    % aarch64-linux-gnu-gcc -v
    gcc version 4.7.3 20121001 (prerelease) [gcc-linaro/4.7 revision 115029] (crosstool-NG linaro-1.13.1+bzr2506 - ARM aarch64 via Linaro)


While the core arch/arm64 code was merged in Linux 3.7rc1, support for the Versatile Express platform for arm64 isn't fully upstream yet. Linaro builds use;h=refs/heads/linaro-aarch64-3.6 which is based on Catalin Marinas' soc-armv8-model branch.

For instance to clone the linaro-aarch64 branch:

    % mkdir ~/aarch64-kernel
    % cd ~/aarch64-kernel
    % git clone git://
    % cd linaro-aarch64
    % git checkout -b linaro-aarch64 origin/linaro-aarch64

To configure the kernel, the vexpress_defconfig file is suitable for both Foundation and VE models.

Assuming you're using a GNU/Linux toolchain and 4 concurrent builds, you would build with:

    % make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- distclean vexpress_defconfig
    % make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- -j4 Image

With a bare-metal toolchain you'd just use CROSS_COMPILE=aarch64-none-elf- above.

Boot wrapper

The bootwrapper is used by the model as a boot loader replacement for target initialisation and to pass control to the kernel; it provides a Device Tree to the kernel and a kernel boot command line. Eventually it should be superseded by a real bootloader.

Linaro uses Catalin's bootwrapper branch which you'd clone and link to your kernel tree as follows:

    % cd ~/aarch64-kernel
    % git clone git://
    % cd boot-wrapper-aarch64
    % ln -sf ~/aarch64-kernel/linaro-aarch64/scripts/dtc/dtc
    % ln -sf ~/aarch64-kernel/linaro-aarch64/arch/arm64/boot/dts/vexpress-v2p-aarch64.dts
    % ln -sf ~/aarch64-kernel/linaro-aarch64/arch/arm64/boot/dts/vexpress-foundation-v8.dts
    % ln -sf ~/aarch64-kernel/linaro-aarch64/arch/arm64/boot/dts/vexpress-v2m-rs1.dtsi
    % ln -sf ~/aarch64-kernel/linaro-aarch64/arch/arm64/boot/dts/skeleton.dtsi
    % ln -sf ~/aarch64-kernel/linaro-aarch64/arch/arm64/boot/Image

With a GNU/Linux toolchain you'd build with:

    make clean
    make CROSS_COMPILE=aarch64-linux-gnu- BOOTARGS='"root=/dev/mmcblk0p2 consolelog=9 rw console=ttyAMA0"'
    make IMAGE=linux-system-foundation.axf clean
    make CROSS_COMPILE=aarch64-linux-gnu- BOOTARGS='"root=/dev/vda2 consolelog=9 rw console=ttyAMA0"' FDT_SRC=vexpress-foundation-v8.dts IMAGE=linux-system-foundation.axf

This should generate a linux-system.axf ELF binary which you can start with a VE model and a linux-system-foundation.axf suitable for a Foundation model.

If the build complains about No rule to make target rtsm_ve-aemv8a.dts then symlink the relevant existing dts file according to whether you are using the Foundation Model or the Fast Model. e.g. for the Foundation model:

ln -sf /home/aarch64-kernel/linaro-aarch64/arch/arm64/boot/dts/vexpress-foundation-v8.dts rtsm_ve-aemv8a.dts


See to download pre-built root filesystems and for instructions on running the Foundation model and see XXX for instructions for the VE model.

HowTo/BuildArm64Kernel (last modified 2013-08-21 20:27:02)