Build the application

Ledger App Builder is a container image which contains all dependencies to compile an application for Nano S/X.

Important
When you submit an app, using Ledger App Builder to build the application is a Security Requirement.

To use the container image, you need to either install Docker, Podman, or Buildah and apply the following steps.

1. Build the container (standard way)…

The container can be build using standard tools:

# Docker
sudo docker build -t ledger-app-builder:latest .
# Podman (from https://podman.io/)
podman build -t ledger-app-builder:latest .
# Buildah (from https://buildah.io/)
buildah bud -t ledger-app-builder:latest .

… Or Build with App Scanner

Images can embed the Coverity Scan build tool. It is an excellent static analysis tool, and it can be very useful to find bugs in Nano apps.

The build tool must be downloaded before building the image. The archive can be downloaded from https://scan.coverity.com/download. Download is available to everyone, but it requires to create an account. After having registered, download Coverity Build Tool 2020.09 for Linux64 and place the downloaded archive in the coverity directory.

Then, build the container with:

# Docker
sudo docker build -t ledger-app-scanner:latest .
# Podman (from https://podman.io/)
podman build -t ledger-app-scanner:latest .
# Buildah (from https://buildah.io/)
buildah bud -t ledger-app-scanner:latest .

2. Compile your app in the container

2.1 Get the Ledger Boilerplate Application

The Boilerplate Application was specifically designed for developers to play around with and read the code. You can clone it in your working folder to start a new project. Applications that support multiple BOLOS devices are typically contained within a single repository, so you can use the same repository to build an app for different Ledger devices.

git clone https://github.com/LedgerHQ/app-boilerplate.git

2.2 Build the Application

For the Nano S

In the source folder of the application:

$ # docker can be replaced with podman or buildah without sudo
$ sudo docker run --rm -ti -v "$(realpath .):/app" ledger-app-builder:latest
root@656be163fe84:/app# make

For the Nano X

For Nano X, specify the BOLOS_SDK environment variable before building your app, in the source folder of the app:

$ # docker can be replaced with podman or buildah without sudo
$ sudo docker run --rm -ti -v "$(realpath .):/app" ledger-app-builder:latest
root@656be163fe84:/app# BOLOS_SDK=$NANOX_SDK make
Tip
If you change the BOLOS_SDK variable between two builds, you can first use make clean to avoid errors.

Using the Clang Static Analyzer

The Docker image includes the Clang Static Analyzer, which can be invoked with:

$ # docker can be replaced with podman or buildah without sudo
$ sudo docker run --rm -ti -v "$(realpath .):/app" ledger-app-builder:latest
root@656be163fe84:/app# make scan-build

2.3 Exit the image

The build generates several files in your application folder and especially the app.elf that can be loaded to a physical Nano S or an emulated Nano X or S with Speculos.

You can exit the image, with the command exit.


Did you find this page helpful?

What would you like to see here?
Types of applications
Load the app to a Nano S
Getting Started
Theme Features
Customization