This page contains some simple instructions to get you started on Morello. In less than 10 minutes you should be able to setup a docker container with everything you need to build an application for Morello.
The development kit includes includes:
To set it up please follow the instructions below.
Note: This approach requires a Morello Board to deploy the final application.
If you want to replicate the development environment directly on your system without using docker please follow the instructions at morello-sdk setup and use the morello/mainline branch of this project.
$ curl -sSL https://get.docker.com | sh
Note: This guide requires to run docker as a non-root user. After the completion of the command above execute:
$ dockerd-rootless-setuptool.sh install
and follow the instructions on screen. For further information please refer to the Docker documentation.
$ sudo curl -L "https://github.com/docker/compose/releases/download/v2.17.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
Provide correct permissions to docker compose:
$ sudo chmod +x /usr/local/bin/docker-compose
$ docker-compose --version
Create the following workspace structure:
<project> must be replaced by the name of the project you are trying to build. The same thing applies to the rest of the document.
docker-compose.yml file and map the morello directory into
<project>/ as follows:
# Docker composer file for Morello Linux
<project> you want to build in
git clone <project-repo>
Note: To create a simple helloworld project please refer to the relevant section.
Then, bring up the container (from
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
To enter into the container, run the command:
$ docker exec -it -u root <project>-morello-sdk /bin/bash
Have a lot of fun!
Note: Once you started the docker container the files of your project are accessible at
Cleanup the morello-sdk container
/!\ WARNING: execute this step only if there are no more
<project>s using the morello-sdk container.
To recover the space used by the
<project>-morello-sdk container execute the following commands:
STEP 1: Stop all the projects using morello-sdk container.
$ docker stop <project>-morello-sdk
STEP 2: Remove all the files belonging to the morello-sdk container.
$ docker image rm git.morello-project.org:5050/morello/morello-sdk/morello-sdk:latest -f
$ docker image prune
For further information please refer to the Docker documentation.
Build a hello world application using morello-sdk development kit
To write and build a hello world application please make sure you started the morello-sdk container following the instructions listed above.
Once the container is started, if everything went well, you should be welcomed by the prompt:
At this point create the following file and directory structure:
Edit the Makefile and insert the code below:
# SPDX-License-Identifier: BSD-3-Clause
# This Makefile will compile an helloworld application using Morello Clang and the Musl libc compiled for purecap.
# ELF_PATCH is used to check that the correct elf flag for Morello is present
CLANG_RESOURCE_DIR=$(shell clang -print-resource-dir)
# we want the same result no matter where we're cross compiling (x86_64, aarch64)
mkdir -p $(OUT)
$(CC) -c -g -march=morello -mabi=purecap \
--target=$(TARGET) --sysroot $(MUSL_HOME) \
main.c -o $(OUT)/morello-helloworld.c.o
$(CC) -fuse-ld=lld -march=morello -mabi=purecap \
--target=$(TARGET) --sysroot $(MUSL_HOME) \
-o $(OUT)/morello-helloworld -static
Edit main.c and insert the code below:
/* SPDX-License-Identifier: BSD-3-Clause */
printf("Hello from Morello!!\n");
At this point you have everything you need. Source the development kit environment file:
If everything went well your helloworld binary for morello should be waiting for you in workspace/helloworld/bin.
Note: the same binary will be accessible outside of the container at:
Examples of projects that can be built via morello-sdk
This section containt the instructions to build some projects via morello-sdk:
/morello/env/morello-sdk exposes the following environment variables:
MORELLO_HOME points to the root directory of the development kit.
MUSL_HOME points to the musl C library binaries.
The kernel headers are contained in /morello/usr/include.
clang compiler is in the path after sourcing /morello/env/morello-sdk.
Please make sure that the Makefile of the application you are trying to port to Morello using this development kit is compliant with these assumptions.
morello-sdk generated containers are signed using cosign. To verify the validity of a container before donwloading it please follow the information contained in the .cosign directory.