-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
279 additions
and
8,052 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
24.2.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
.vscode/ | ||
dist/ | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,120 @@ | ||
# Corteca Toolchain v23.12.1 | ||
# Base image for Corteca Toolchain | ||
|
||
Part of Corteca Developer Toolkit, Toolchain is a set of compilation tools that help isolate the application within the container, avoiding interaction with the host system's libraries in the creation of applications for [Corteca Marketplace](https://www.nokia.com/networks/fixed-networks/corteca-applications/). This repository is hosted on [https://github.com/nokia/corteca-toolchain](https://github.com/nokia/corteca-toolchain) | ||
|
||
## Clone the repository | ||
|
||
### Clone with submodules | ||
|
||
```bash | ||
git clone --recurse-submodules https://github.com/nokia/corteca-toolchain.git | ||
``` | ||
|
||
### Add submodules after cloning | ||
|
||
In case you have previously cloned the repository without `--recurse-submodules` you can do: | ||
|
||
```bash | ||
git submodule update --init --recursive | ||
``` | ||
|
||
## Repo layout | ||
|
||
```shell | ||
├── context # Toolchain image context (files to be included in the images) | ||
│ ├── config # Buildroot configuration files for each toolchain | ||
│ ├── environments # Environment variables for each toolchain | ||
│ └── scripts | ||
│ └── nokia_toolchain.sh # Script for invoking toolchain actions inside the container | ||
├── images # Image resources for this file | ||
├── sample-application # Sample Container Application | ||
├── Dockerfile # Toolchain image Dockerfile | ||
├── README.md # this file | ||
└── USAGE.md # Corteca Development Platform Documentation | ||
├── Documentation # Documentation | ||
├──.VERSION # Toolchain image version | ||
├── Jenkinsfile # Pipeline | ||
├── README.md # This file | ||
└── Dockerfile # Toolchain image Dockerfile | ||
``` | ||
|
||
## Introduction | ||
## Build toolchain | ||
|
||
### Prerequisites | ||
|
||
The toolchain image is a multi-platform image, this means that a single image is created and depending on the running platform docker only pulls the layers for the specific architecture. | ||
To enable multi-platform image build we need to change the storage driver and enable docker to run images for different CPU architectures. | ||
|
||
This repository contains the files needed to build the Corteca Toolchains. There are 2 flavors of the toolchain depending on the target CPU architecture: | ||
#### Storage drivers | ||
|
||
| Toolchain name | CPU Architecture | Indicative list of Corteca devices | | ||
| ---------- | ----------------------- | ------------ | | ||
| `corteca-toolchain-armv7` | armv7, arm-el, 32-bits | Beacon 6 | | ||
| `corteca-toolchain-armv8` | armv8, aarch64, 64-bits | Beacon 10, Beacon 24, Beacon G6, XS-2426X-A, XS-2426G-B, Beacon3.1 / G-1426G-A | | ||
In order to be able to build multi-platform images you need to change the storage driver of docker. The easiest way to do it is to use the [`containerd image store`](https://docs.docker.com/storage/containerd/) | ||
|
||
Both of the images are based on Buildroot v2023.02.1 and are configured for each CPU architecture. The following packages are installed by default in the target filesystem: | ||
create file `/etc/docker/daemon.json` with the following contents and restart docker daemon | ||
|
||
- Linux Kernel Headers v4.14.x | ||
- binutils v2.37 | ||
- libc: musl v1.2.3 | ||
- gcc v10 | ||
- ubus | ||
- mbedTLS | ||
```text | ||
{ | ||
"features": { | ||
"containerd-snapshotter": true | ||
} | ||
} | ||
``` | ||
|
||
#### Execution of different multi-architecture | ||
|
||
Since we build the image for multiple platforms we need to support the execution of different platforms, we also need that in order to run arm64 containers on intel/amd 64bit CPUs. | ||
|
||
## Prerequisites | ||
For this we need enable execution of different multi-architecture containers by QEMU and binfmt_misc. For more information, see [qemu-user-static](https://github.com/multiarch/qemu-user-static). | ||
|
||
In order to be able to build your application you need to have docker installed and create a directory structure to hold the source code and all the other files that are need for your application. | ||
```shell | ||
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | ||
``` | ||
|
||
### Docker | ||
### Build a multi-platform base image | ||
|
||
The toolchains for compiling and building the containers require docker or a compatible container engine. This document assumes that you use docker. Make sure you have docker installed. | ||
Currently we build an image for amd64, arm32 and arm64. | ||
|
||
```shell | ||
docker --version | ||
docker buildx build \ | ||
--platform linux/amd64,linux/arm64,linux/arm/v7 \ | ||
-t ghcr.io/nokia/corteca-toolchain:$(cat .VERSION) \ | ||
-t ghcr.io/nokia/corteca-toolchain \ | ||
- < Dockerfile | ||
``` | ||
|
||
If this fails, please follow the installation procedure for your OS. | ||
### Test the images | ||
|
||
### Sample application | ||
We can test that our image supports multiple platforms and test each one of those | ||
|
||
In order to be able to build your application you need to create a specific directory structure to hold the source code and all the other files that are need for the container package creation. For more information on this, you can take a look at the [Sample Container Application Documentation](sample-application/README.md). | ||
#### Arm v8 (64bits) | ||
|
||
For instructions on using the toolchain to build your application, refer to [Corteca Development Platform Documentation](USAGE.md) | ||
```shell | ||
docker run --rm -it --platform linux/arm64 ghcr.io/nokia/corteca-toolchain uname -m | ||
``` | ||
|
||
expected output: | ||
|
||
```text | ||
aarch64 | ||
``` | ||
|
||
#### Arm v7 (32bits) | ||
|
||
```shell | ||
docker run --rm -it --platform linux/arm/v7 ghcr.io/nokia/corteca-toolchain uname -m | ||
``` | ||
|
||
expected output: | ||
|
||
```text | ||
armv7l | ||
``` | ||
|
||
#### Amd64 (64bits) | ||
|
||
```shell | ||
docker run --rm -it --platform linux/amd64 ghcr.io/nokia/corteca-toolchain uname -m | ||
``` | ||
|
||
expected output: | ||
|
||
```text | ||
x86_64 | ||
``` | ||
|
||
### Run a container | ||
|
||
You can create a running container e.g. for arm64: | ||
|
||
```shell | ||
docker run --rm -it --platform linux/arm64 ghcr.io/nokia/corteca-toolchain | ||
``` |
Oops, something went wrong.