This article describes how to build and run a minimal ILP32 software stack on Arm's Foundation model and provides an example of the upstream support now available. The instructions were tested on an Ubuntu 16.04 LTS host.
Linux on AArch64 uses LP64 as its standard data model, where long and pointer are 64-bit and int is 32-bit. AArch64-ILP32 uses a data model where int, long, and pointer are all 32-bit. For more details see this whitepaper.
long
pointer
int
An AArch64-ILP32 model can can be used to address compatibility issues, where legacy 32-bit userspace applications make assumptions about pointer size. It may also provide performance improvements related to reduced memory size and corresponding cache efficiency, for some specific use cases.
The Armv8 Foundation Model is a fast software model of an Armv8-A compliant implementation. It allows customers to run a full open-source software stack.
Arm and Linaro host an integrated software stack that is routinely tested on the Armv8 Foundation Model. This software does not support ILP32, but we can use the standard deliverables for our firmware components.
Follow the instructions here to fetch the workspace initialisation script and select the following configuration:
+-----------+-------------------------------------+ | Workspace | /path/to/your/workspace | | Platform | [64-bit] ARMv8 Foundation Model FVP | | Build | Use prebuilt configuration | | Prebuilt | latest-armlt + BusyBox | +-----------+-------------------------------------+
This will create a new workspace folder containing a set of binaries and a run_model.sh script. Use run_model.sh to check the software boots.
run_model.sh
export MODEL=/path/to/Linux64_GCC-x.x/Foundation_Platform source ./run_model.sh
This will launch the model and spawn a console window. You should see the software boot and mount the busybox filesystem.
This involves building a new kernel and ramdisk to replace those supplied in the standard deliverables.
This will create an `ilp32test/' subdirectory including the following components:
`ilp32test/'
sync-ilp32.sh
init.sh
default.script
files.txt
test.c
build-ilp32.sh
mkimage
source ./sync-ilp32.sh
This will fetch lp64 and ilp32 compilers, an ilp32 staging kernel and BusyBox sources.
source ./build-ilp32.sh
This will build the kernel and ramdisk and copy the resultant binaries to ./output
Copy the required components from the Arm Platforms software release into ./output
export BINARIES=/path/to/fvp-latest-busybox-uboot cp $BINARIES/{bl1.bin,fip.bin,foundation-v8-gicv3.dtb,run_model.sh} ./
export MODEL=/path/to/Linux64_GCC-4.9/Foundation_Platform source ./run_model.sh
This will launch the model and spawn a console window. You should see the software boot and mount the busybox filesystem. From the busybox prompt you can execute the test applications, these print sizeof a pointer
You can also use the deliverables above with an Open Embedded ILP32 (rather than busybox) filesystem.
Fetch prebuilt image for testing
wget http://snapshots.linaro.org/openembedded/images/minimal-initramfs-armv8-ilp32-gcc-7.1/hikey-/latest/linaro-image-minimal-initramfs-hikey-ilp32-*.rootfs.cpio.gz.u-boot cp linaro-image-minimal-initramfs-*.rootfs.cpio.gz.u-boot ramdisk.img
Use this new ramdisk.img to replace the existing ramdisk in the ./output directory
You can also build OE from source
git clone https://git.linaro.org/openembedded/jenkins-setup.git oe-build cd oe-build MACHINE=hikey-ilp32 bash -x init-and-build.sh -a armv8 -g 7.1 linaro-image-minimal-initramfs cp ./build/tmp-glibc/deploy/images/hikey-ilp32/linaro-image-minimal-initramfs-hikey-ilp32-*.rootfs.cpio.gz.u-boot ramdisk.img
ilp32test.zip