This document covers the steps to build the Linux Test Project for morello using morello-sdk.
Create the following workspace structure:
ltp/
|-> workspace/
|-> ltp.env
|-> docker-compose.yml
Create a docker-compose.yml
file in ltp/
as follows:
# Docker composer file for Morello LTP
version: '3.8'
services:
ltp-morello-sdk:
image: "git.morello-project.org:5050/morello/morello-sdk/morello-sdk:latest"
container_name: "ltp-morello-sdk"
volumes:
- ./workspace:/home/morello/workspace
tty: true
restart: unless-stopped
Clone the LTP
repository you want to build in ltp/workspace
:
cd ltp/workspace
git clone https://git.morello-project.org/morello/morello-linux-ltp.git ltp
Then, bring up the container (from ltp/)
:
$ docker-compose up -d
Note: It is important to update always to the latest version of the morello-sdk. If you are unsure on which version you are running instead of the command above execute:
$ docker-compose pull
$ docker-compose up -d
Create a ltp.env
file in ltp/workspace
as follows:
export CC=clang
export HOST_CFLAGS="-O2 -Wall"
export HOST_LDFLAGS="-Wall"
export CONFIGURE_OPT_EXTRA="--prefix=/ --host=aarch64-linux-gnu --disable-metadata --without-numa"
export BUILD_DIR=/home/morello/workspace/build_purecap
export LTP_INSTALL="$BUILD_DIR"/install
export TARGET_FEATURE="-march=morello -mabi=purecap"
export TRIPLE=aarch64-linux-musl_purecap
export KHDR_DIR=/morello/usr/include
export CFLAGS="--target=${TRIPLE} ${TARGET_FEATURE} \
--sysroot=${MUSL_HOME} \
-isystem ${KHDR_DIR} -g -Wall"
export LDFLAGS="--target=${TRIPLE} -rtlib=compiler-rt \
--sysroot=${MUSL_HOME} \
-fuse-ld=lld -static -L${BUILD_DIR}/lib"
export MAKE_OPTS="TST_NEWER_64_SYSCALL=no TST_COMPAT_16_SYSCALL=no"
export TARGETS="pan tools/apicmds testcases/kernel/syscalls"
To enter into the container, run the command:
$ docker exec -it -u root ltp-morello-sdk /bin/bash
Inside the container, run the commands:
cd ltp
source /morello/env/morello-sdk
source ../ltp.env
./build.sh -t cross -o out -ip "${LTP_INSTALL}"
The build output will be in ltp/workspace/build_purecap/install
.
Have a lot of fun!
Note (1): Once you started the docker container the files of your project are accessible at /home/morello/workspace/ltp
.
Note (2): This will build LTP in purecap only.
For further information please refer to the Docker documentation.