Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
fde2c2c
[usr] Use musl as libc - It does not compile !
jmi-reds Nov 10, 2025
9c09570
[musl] Fix build errors & warnings when building so3/usr
jmi-reds Nov 10, 2025
47d95c7
[usr] arm32 - complile usr with MUSL lib
jmi-reds Nov 17, 2025
c37164c
[musl] Add script to generate arm & aarch64 MUSL toolchain
jmi-reds Nov 17, 2025
22347ad
[musl] small clean-up in toolchain compilation script
jmi-reds Nov 18, 2025
9b7a41b
[doc] Add info on how to build MUSL toolchain
jmi-reds Nov 18, 2025
a4d7cc3
update CI with MUSL toolchains
jmi-reds Nov 18, 2025
5f0c556
Generate updated Docker - needed to get MUSL toolchain
jmi-reds Nov 18, 2025
a6d9367
[CI] Test
jmi-reds Dec 3, 2025
b39cc2b
[ci] Add test branch
jmi-reds Dec 3, 2025
849a2ad
[ci] new test with added musl toolchain
jmi-reds Dec 3, 2025
18afa9e
[CI] Add new docker image to build toolchains
jmi-reds Dec 3, 2025
049925f
[CI] Add tags for docker toolchains image
jmi-reds Dec 4, 2025
fd9fc92
[ci] Dockerfile.env update for ubuntu 24.04
jmi-reds Dec 4, 2025
8a65664
[CI] Add toolchains dependency for usr build
jmi-reds Dec 4, 2025
aea9df9
[CI] Fix issue with lvgl 32 docker image
jmi-reds Dec 4, 2025
51474f8
[CI] Fix bug in lvgl 32b docker image
jmi-reds Dec 4, 2025
02e00a0
[CI] Fix bug in lvgl 32b docker image (again)
jmi-reds Dec 4, 2025
95527d8
[ci] Some fixes
jmi-reds Dec 5, 2025
3543a93
Add missing <sys/ioctl.h> header file
jmi-reds Dec 5, 2025
1e626b2
[musl] remove the original so3 libc src
jmi-reds Dec 10, 2025
0553699
[musl] remove old cmake toolchain files
jmi-reds Dec 10, 2025
3c915d8
[musl] small fixes based on review
jmi-reds Dec 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ jobs:

- name: Build
run: |
docker run --rm -v "${PWD}:/so3" ghcr.io/smartobjectoriented/so3-env:main bash -c "cd so3 && make ${{ matrix.CONFIG }} && make -j`nproc`"
docker run --rm -v "${PWD}:/so3" ghcr.io/smartobjectoriented/so3-env:latest bash -c "cd so3 && make ${{ matrix.CONFIG }} && make -j`nproc`"

build-usr:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
CMAKE_TOOLCHAIN_FILE: ['aarch64_toolchain.cmake',
'arm_toolchain.cmake']
CMAKE_TOOLCHAIN_FILE: ['aarch64-linux-musl.cmake',
'arm-linux-musl.cmake']
BUILD_TYPE: ['Debug', 'Release']
steps:
- name: Checkout repository
Expand All @@ -42,4 +42,4 @@ jobs:

- name: Build
run: |
docker run --rm -t -v "${PWD}:/so3" ghcr.io/smartobjectoriented/so3-env:main bash -c "mkdir usr/build && cd usr/build && cmake --no-warn-unused-cli -DCMAKE_C_FLAGS='-Werror' -Wno-dev -DCMAKE_BUILD_TYPE=${{ matrix.BUILD_TYPE }} -DCMAKE_TOOLCHAIN_FILE=../${{matrix.CMAKE_TOOLCHAIN_FILE }} .. && make -j`nproc`"
docker run --rm -t -v "${PWD}:/so3" ghcr.io/smartobjectoriented/so3-env:latest bash -c "mkdir usr/build && cd usr/build && cmake --no-warn-unused-cli -DCMAKE_C_FLAGS='-Werror' -Wno-dev -DCMAKE_BUILD_TYPE=${{ matrix.BUILD_TYPE }} -DCMAKE_TOOLCHAIN_FILE=../${{matrix.CMAKE_TOOLCHAIN_FILE }} .. && make -j`nproc`"
53 changes: 52 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,64 @@ name: Docker Image CI

on:
push:
branches: ["main"]
paths:
- 'docker/Dockerfile.*'
- 'toolchains/*'
workflow_dispatch:

env:
REGISTRY: ghcr.io

jobs:
build-toolchains:
runs-on: ubuntu-latest
strategy:
fail-fast: false

permissions:
contents: read
packages: write
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
submodules: 'true'

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/smartobjectoriented/so3-toolchains
tags: |
type=raw,value=latest

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push
id: build_toolchains
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/Dockerfile.toolchains
push: true
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
cache-from: type=gha
cache-to: type=gha,mode=max

build-image:
runs-on: ubuntu-latest
needs: ['build-toolchains']
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -47,6 +96,8 @@ jobs:
uses: docker/metadata-action@v5
with:
images: ${{ matrix.image }}
tags: |
type=raw,value=latest

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand Down
22 changes: 20 additions & 2 deletions doc/source/user_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ SO3 root directory (main subdirs)::
Build of the environment
************************

About the toolchain
===================
kernel toolchain
================

We use the ``arm-none-eabi`` toolchain which has no dependencies on a libc.

Expand All @@ -78,6 +78,24 @@ The following package can be installed:

apt install gcc-arm-none-eabi

usr-space toolchain
===================

The usr-space uses MUSL as libc. The Musl toolchains can be generated with
``toolchains/build-toolchain.sh`` script.

.. code-block:: bash

$ ./build-toolchain.sh

By default, it generates ``aarch64-linux-musl`` and ``arm-linux-musleabihf``
folder in the ``toolchains`` directory

.. note::

The output directory (by default ``toolchains`` floder) can be changed by setting
the ``OUTPUT_PATH`` variable in the ``build-toolchain.sh`` script

Quick setup & early test
========================

Expand Down
26 changes: 8 additions & 18 deletions docker/Dockerfile.env
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
FROM ubuntu:22.04
FROM ghcr.io/smartobjectoriented/so3-toolchains

ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC

RUN dpkg --add-architecture i386
RUN apt update
RUN apt install libc6:i386 libncurses5:i386 libstdc++6:i386 -y
RUN apt install libc6:i386 libncurses6:i386 libstdc++6:i386 -y
RUN apt install lib32z1-dev -y
RUN apt install zlib1g:i386 -y
RUN apt install pkg-config libgtk2.0-dev bridge-utils -y
Expand All @@ -13,35 +16,22 @@ RUN apt install fdisk -y
RUN apt install libncurses-dev -y
RUN apt install flex bison -y

RUN apt install gcc-arm-none-eabi -y
RUN apt install wget unzip -y
RUN apt install python3-venv -y
RUN apt install ninja-build -y
RUN apt install git -y
RUN apt install cmake -y
RUN apt install python3-pip -y

RUN pip3 install pcpp

# Download aarch64-none-linux-gnu toolchain
RUN wget https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu.tar.xz
RUN tar -xvf gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu.tar.xz
RUN rm gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu.tar.xz

ENV PATH="$PATH:/gcc-arm-10.3-2021.07-x86_64-aarch64-none-linux-gnu/bin"

# Download aarch64-none-elf toolchain
RUN wget https://developer.arm.com/-/media/Files/downloads/gnu/12.3.rel1/binrel/arm-gnu-toolchain-12.3.rel1-x86_64-aarch64-none-elf.tar.xz
RUN tar -xvf arm-gnu-toolchain-12.3.rel1-x86_64-aarch64-none-elf.tar.xz
RUN rm arm-gnu-toolchain-12.3.rel1-x86_64-aarch64-none-elf.tar.xz

ENV PATH="$PATH:/arm-gnu-toolchain-12.3.rel1-x86_64-aarch64-none-elf/bin"
RUN pip install --break-system-packages pcpp

# Get current so3 so we can build qemu
RUN wget https://github.com/smartobjectoriented/so3/archive/refs/heads/main.zip
RUN unzip main.zip
RUN rm main.zip
RUN mv so3-* generated

# Build qemu
RUN cd /generated/qemu && ./fetch.sh && ./configure --target-list=arm-softmmu,aarch64-softmmu --disable-attr --disable-werror --disable-docs
ENV PATH="$PATH:/generated/qemu/build"
# Remove everything except qemu
Expand Down
21 changes: 12 additions & 9 deletions docker/Dockerfile.lvperf_32b
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
FROM alpine:latest AS baseimage
FROM ghcr.io/smartobjectoriented/so3-toolchains:latest AS baseimage

FROM baseimage AS builder

RUN apk update; \
apk add --no-cache make cmake gcc-arm-none-eabi \
g++-arm-none-eabi qemu-system-arm \
bison flex libc-dev libressl-dev dtc
RUN apt update && \
apt install -y build-essential cmake qemu-system-arm gcc-arm-none-eabi \
bison flex libssl-dev device-tree-compiler qemu-system-arm && \
apt clean && \
rm -rf /var/lib/apt/lists/*

WORKDIR /so3

Expand All @@ -29,10 +30,12 @@ RUN cd u-boot;\

FROM baseimage AS runner

RUN apk update; \
apk add --no-cache make cmake gcc-arm-none-eabi \
g++-arm-none-eabi qemu-system-arm \
util-linux dtc u-boot-tools dosfstools python3 py3-pip
RUN apt-get update && \
apt install -y make cmake gcc-arm-none-eabi qemu-system-arm \
util-linux device-tree-compiler u-boot-tools dosfstools python3 \
python3-pip && \
apt clean && \
rm -rf /var/lib/apt/lists/*

RUN pip install --break-system-packages pcpp

Expand Down
35 changes: 22 additions & 13 deletions docker/Dockerfile.lvperf_64b
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
FROM alpine:latest AS baseimage
FROM ghcr.io/smartobjectoriented/so3-toolchains:latest AS baseimage

ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC

FROM baseimage AS builder

RUN apk update; \
apk add --no-cache make cmake gcc-aarch64-none-elf \
qemu-system-aarch64 \
bison flex libc-dev libressl-dev dtc
RUN apt update && \
apt install -y build-essential cmake qemu-system-arm \
bison flex libssl-dev device-tree-compiler && \
apt clean && \
rm -rf /var/lib/apt/lists/*

WORKDIR /so3

Expand All @@ -29,10 +33,19 @@ RUN cd u-boot;\

FROM baseimage AS runner

RUN apk update; \
apk add --no-cache make cmake gcc-aarch64-none-elf \
g++-aarch64-none-elf qemu-system-aarch64 \
util-linux dtc u-boot-tools dosfstools python3 py3-pip
RUN apt update && apt install -y --no-install-recommends \
build-essential \
cmake \
qemu-system-arm \
util-linux \
device-tree-compiler \
u-boot-tools \
dosfstools \
python3 \
python3-pip \
bash patch git && \
apt clean && \
rm -rf /var/lib/apt/lists/*

RUN pip install --break-system-packages pcpp

Expand Down Expand Up @@ -66,10 +79,6 @@ RUN echo "#!/bin/sh" > install_dependencies.sh && chmod +x install_dependencies.
RUN rm -rf /var/cache/apk/*
RUN rm -rf /usr/share/man /usr/share/doc /usr/share/info /var/cache/apk/*

# This env varialbe is read from the usr/build.sh script in order to set a custom aarch64 toolchain
# This may be removed if so3 is fully migrated to the aarch64-none-elf toolchain
# Right now aarch64-none-linux-gnu is still used by default
ENV USR_BUILD_TOOLCHAIN_FILE=aarch64_none_toolchain.cmake
ENV QEMU_ARCH=aarch64
ENV PLATFORM=virt64

Expand Down
29 changes: 29 additions & 0 deletions docker/Dockerfile.toolchains
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Create a Docker image which prepare the toolchains needed by SO3 env.
#
# Copyright (c) 2025 REDS Institute, HEIG-VD
#
# Set 'aarch64-none-elf' toolchain & build arm & aarch64 musl toolchains
#
# Note: 'arm-none-eabi-' is installed for package manager in the others docker images

FROM ubuntu:24.04 AS toolchains-utils

RUN apt-get update && apt-get install -y gcc-arm-none-eabi gcc-11 g++-11 git make \
patch sudo xz-utils wget && \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 10 && \
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-11 10 && \
apt clean && \
rm -rf /var/lib/apt/lists/*

# Download aarch64-none-elf toolchain
RUN wget https://developer.arm.com/-/media/Files/downloads/gnu/12.3.rel1/binrel/arm-gnu-toolchain-12.3.rel1-x86_64-aarch64-none-elf.tar.xz
RUN tar -xvf arm-gnu-toolchain-12.3.rel1-x86_64-aarch64-none-elf.tar.xz
RUN rm arm-gnu-toolchain-12.3.rel1-x86_64-aarch64-none-elf.tar.xz

ENV PATH="$PATH:/arm-gnu-toolchain-12.3.rel1-x86_64-aarch64-none-elf/bin"

COPY toolchains /toolchains
RUN /toolchains/build-toolchain.sh && rm -rf /toolchains/musl-cross-make

ENV PATH=$PATH:/toolchains/aarch64-linux-musl/bin
ENV PATH=$PATH:/toolchains/arm-linux-musleabihf/bin
69 changes: 69 additions & 0 deletions toolchains/build-toolchain.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/bash
#
# Copyright (C) 2025 Jean-Pierre Miceli <jean-pierre.miceli@heig-vd.ch>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#

# This script build 'arm' & 'aarch64' MUSL toolchains

SCRIPTPATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"

# output PATH - select where the toolchain will be installed
#
# The final path will be:
# * arm: <OUTPUT_PATH>/arm-linux-musleabihf
# * aarch64: <OUTPUT_PATH>/aarch64-linux-musl
# default: '<CURRENT DIR>/aarch64-linux-musl' and '<CURRENT DIR>/arm-linux-musleabihf'
#OUTPUT_PATH=

GIT_COMMIT="3635262"

AARCH64_PATH='aarch64-linux-musl'
ARM_PATH='arm-linux-musleabihf'

if [[ $EUID -ne 0 ]]; then
echo "Please run as root"
exit 1
fi

pushd $SCRIPTPATH

if [[ -v $OUTPUT_PATH ]]; then
OUTPUT=$OUTPUT_PATH
else
OUTPUT=$SCRIPTPATH
fi

echo "== base installation path is '$SCRIPTPATH'"

# 1. Retrieve the repo
git clone https://github.com/richfelker/musl-cross-make
cd musl-cross-make
git checkout $GIT_COMMIT

# Compile & install 'aarch64-linux-musl'
echo "== Compiling 'aarch64-linux-musl' (installation path: $OUTPUT/$AARCH64_PATH"
cp ../config.mak.aarch64 config.mak
echo "OUTPUT = $OUTPUT/$AARCH64_PATH" >> config.mak
make && sudo make install

# Compile & install 'arm-linux-musleabihf'
echo "== Compiling 'arm-linux-musleabihf'"
make clean
cp ../config.mak.arm config.mak
echo "OUTPUT = $OUTPUT/$ARM_PATH" >> config.mak
make && sudo make install

popd
Loading