-
-
Notifications
You must be signed in to change notification settings - Fork 1
Building userspace applications
This page outlines the steps and tools required to build and install laritOS applications.
laritos-toolchain comes with a python build script designed to ease the process of building applications. You can list all the options with:
$ $LARITOSTOOL/build/build.py -h
usage: build.py [-h] [-i path | -c] [--arch ARCH] [--subarch SUBARCH] [-p] [--crossc CROSSC] [-v] app [app ...]
laritOS application builder
positional arguments:
app Path to the application to build
optional arguments:
-h, --help show this help message and exit
-i path, --install path
Install object files in the given system image root
path (default: None)
-c, --clean Remove all objects rather than building the app/s
(default: False)
--arch ARCH Target architecture (default: arm)
--subarch SUBARCH Target sub-architecture (if any) (default: armv7-a)
-p, --printdatabase Print the data base (rules and variable values) that
results from reading the makefiles (default: False)
--crossc CROSSC Cross compiler (default: arm-none-eabi-)
-v, --verbose Increase logging (default: False)
As you can see from the build.py -h
command output, in order to build an app you need to indicate the path to the application. For example, to build the shell
:
$LARITOSTOOL/build/build.py $LARITOSAPPS/shell
This will generate an ELF
(Executable and Linkable Format) binary under the $LARITOSAPPS/shell/<architecture>/bin
folder.
If you want to have the application available in the OS, you need to install it in either the system
or data
image. To do that, build.py
provides the -i
option to install the app binary and all its resources under the given directory.
For example, to build and install the shell in the OS system image:
$LARITOSTOOL/build/build.py $LARITOSAPPS/shell -i $LARITOS/bin/image/system
You'll see in the output all the binaries and resources being copied into the system image folder:
Building 'shell'
make: Entering directory '/home/lzungri/dev/src/laritos-apps/shell'
CC bin/arm//home/lzungri/dev/src/laritos-toolchain/arch/generic/src/heap.o
CC bin/arm//home/lzungri/dev/src/laritos-toolchain/arch/generic/src/stack.o
CC bin/arm//home/lzungri/dev/src/laritos-toolchain/arch/generic/src/printf.o
CC bin/arm//home/lzungri/dev/src/laritos-toolchain/arch/generic/src/string.o
CC bin/arm//home/lzungri/dev/src/laritos-toolchain/arch/generic/src/stdio.o
CC bin/arm/main.o
CC bin/arm/builtins.o
AS bin/arm//home/lzungri/dev/src/laritos-toolchain/arch/arm/src/start.o
LD bin/arm/shell.elf
CP banners/1 -> /home/lzungri/dev/src/laritos/bin/image/system/res/shell/banners/1
CP banners/2 -> /home/lzungri/dev/src/laritos/bin/image/system/res/shell/banners/2
CP banners/3 -> /home/lzungri/dev/src/laritos/bin/image/system/res/shell/banners/3
CP banners/4 -> /home/lzungri/dev/src/laritos/bin/image/system/res/shell/banners/4
CP banners/5 -> /home/lzungri/dev/src/laritos/bin/image/system/res/shell/banners/5
CP banners/6 -> /home/lzungri/dev/src/laritos/bin/image/system/res/shell/banners/6
CP banners/7 -> /home/lzungri/dev/src/laritos/bin/image/system/res/shell/banners/7
CP banners/8 -> /home/lzungri/dev/src/laritos/bin/image/system/res/shell/banners/8
CP banners/9 -> /home/lzungri/dev/src/laritos/bin/image/system/res/shell/banners/9
CP bin/arm/shell.elf -> /home/lzungri/dev/src/laritos/bin/image/system/bin
make: Leaving directory '/home/lzungri/dev/src/laritos-apps/shell'
Once you copy the binary+resources you'll need to regenerate the OS system image with:
cd $LARITOS
CROSS_COMPILE=arm-none-eabi- make system.img
or just rebuild the whole OS with:
cd $LARITOS
CROSS_COMPILE=arm-none-eabi- make
If you don't rebuild, the binary will still be located under the system image folder [*] but not packaged into the system.img
file, which is the actual filesystem mounted by the OS.
[*] The folder is just a temporary storage for generating the system.img
$LARITOSTOOL/build/build.py * -i $LARITOS/bin/image/system
$LARITOSTOOL/build/build.py -c *
$LARITOSTOOL/build/build.py -v shell