Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
c3012f4
Add 'writev' syscall
jmi-reds Oct 7, 2025
623f054
writev - Fix error in error case
jmi-reds Oct 7, 2025
b1bbc34
Add 'readv' syscall
jmi-reds Oct 7, 2025
53669db
[syscall] Update readv & writev from comments in MR #207
jmi-reds Oct 8, 2025
8026825
[syscall] readv & writev clean-up - MR #207
jmi-reds Oct 9, 2025
2c2dc86
Run format checking for branch 144-support-musl
jmi-reds Oct 9, 2025
c148c6d
[syscall] mmap: Add support for ANONYMOUS flag
jmi-reds Oct 9, 2025
e9d8ded
[syscall] mmap: Define USER_ANONYMOUS_VADDR for 39bits case
jmi-reds Oct 9, 2025
d8363ba
[syscall] mmap: Define USER_ANONYMOUS_VADDR for arm32b
jmi-reds Oct 10, 2025
ab69437
change syscall number to correct ones
clemdiep Aug 28, 2025
602d48d
rename sbrk to brk
clemdiep Aug 28, 2025
6f8b84d
add dup3 simple implementation
clemdiep Aug 28, 2025
45898ea
implement time32 version for clock_gettime and gettimeofday
clemdiep Sep 2, 2025
7a77075
wait4 and getdents
clemdiep Sep 2, 2025
c723d93
add mmap2 and openat
clemdiep Sep 2, 2025
4954027
remove support for sysinfo
clemdiep Sep 25, 2025
f459bcd
add pipe2
clemdiep Sep 30, 2025
16c1ea7
add rt_sig, fstatat and correct syscall table
clemdiep Sep 30, 2025
07180e7
correction after rebase
clemdiep Oct 10, 2025
25464ac
remove unwanted comment in syscall_number
clemdiep Oct 10, 2025
a2290e2
correct syscall arguments and numbers
clemdiep Oct 10, 2025
34badab
cleanups
clemdiep Oct 13, 2025
289e04f
rename llseek to _llseek
clemdiep Oct 13, 2025
ead0434
autogenerate syscall table
clemdiep Oct 13, 2025
847ce4b
fix sh to bash in script
clemdiep Oct 30, 2025
caad894
rework thread creation to match pthread
clemdiep Nov 3, 2025
09e4eaf
fix style and missing comments
clemdiep Nov 10, 2025
31241fa
Add template for futex syscall
jmi-reds Nov 3, 2025
b60d83c
[futex] Initial implementation of FUTEX_WAIT cmd
jmi-reds Nov 4, 2025
cc6dbe3
[futex] Initial implementation of FUTEX_WAKE cmd
jmi-reds Nov 4, 2025
821843f
[futex] Clean-up
jmi-reds Nov 7, 2025
61ad9ed
[futex] fix clang-format
jmi-reds Nov 7, 2025
df1af90
Remove "mutex" syscalls
jmi-reds Nov 10, 2025
7b5698f
[futex] clean-up based on code review
jmi-reds Nov 10, 2025
58d41a9
[futex] Fix typo introduced in previous commit
jmi-reds Nov 10, 2025
247c50c
[futex] make clearer the search of key in lists
jmi-reds Nov 11, 2025
1f98a20
remove ptrace support
clemdiep Nov 10, 2025
0dd1857
implement child tid behavior
clemdiep Nov 5, 2025
4cb9ff6
rework args/env setup to add aux values
clemdiep Nov 19, 2025
d43de6f
fix futex miss call
clemdiep Nov 19, 2025
d914f1f
small improvement
clemdiep Nov 19, 2025
e8ec3ef
fix clang-format from copied files
clemdiep Nov 19, 2025
a485bbd
fix brk implementation
clemdiep Nov 19, 2025
28ab498
change default heap base address to be after the program
clemdiep Nov 19, 2025
18414ae
add rt_sigprocmask syscall
clemdiep Dec 3, 2025
ec3aa48
rework console to support simple cannon and raw mode
clemdiep Dec 3, 2025
eb4186e
[usr] Use musl as libc - It does not compile !
jmi-reds Nov 10, 2025
257c729
[musl] Fix build errors & warnings when building so3/usr
jmi-reds Nov 10, 2025
705c32f
[usr] arm32 - complile usr with MUSL lib
jmi-reds Nov 17, 2025
efa1c62
[musl] Add script to generate arm & aarch64 MUSL toolchain
jmi-reds Nov 17, 2025
e2731e2
[musl] small clean-up in toolchain compilation script
jmi-reds Nov 18, 2025
3545443
[doc] Add info on how to build MUSL toolchain
jmi-reds Nov 18, 2025
d58580b
update CI with MUSL toolchains
jmi-reds Nov 18, 2025
f7a7317
Generate updated Docker - needed to get MUSL toolchain
jmi-reds Nov 18, 2025
57cd9ae
[CI] Test
jmi-reds Dec 3, 2025
0407601
[ci] Add test branch
jmi-reds Dec 3, 2025
d7fb6a5
[ci] new test with added musl toolchain
jmi-reds Dec 3, 2025
465e9c5
[CI] Add new docker image to build toolchains
jmi-reds Dec 3, 2025
73ef01d
[CI] Add tags for docker toolchains image
jmi-reds Dec 4, 2025
2e0c876
[ci] Dockerfile.env update for ubuntu 24.04
jmi-reds Dec 4, 2025
3b213f4
[CI] Add toolchains dependency for usr build
jmi-reds Dec 4, 2025
d0ded74
[CI] Fix issue with lvgl 32 docker image
jmi-reds Dec 4, 2025
b60b1f5
[CI] Fix bug in lvgl 32b docker image
jmi-reds Dec 4, 2025
5f9f05f
[CI] Fix bug in lvgl 32b docker image (again)
jmi-reds Dec 4, 2025
06444bb
[ci] Some fixes
jmi-reds Dec 5, 2025
80b1d2e
Add missing <sys/ioctl.h> header file
jmi-reds Dec 5, 2025
4ad9292
[musl] remove the original so3 libc src
jmi-reds Dec 10, 2025
7dd8122
[musl] remove old cmake toolchain files
jmi-reds Dec 10, 2025
365ba6e
[musl] small fixes based on review
jmi-reds Dec 10, 2025
f9f45b2
fixes to correct bug introduced by the MUSL support
clemdiep Dec 3, 2025
f867f79
rename rt_kill into kill in syscall.tbl
clemdiep Dec 3, 2025
b1a52dd
rename thread_yield to sched_yield
clemdiep Dec 3, 2025
7f2ab96
add missing fix on process
clemdiep Dec 10, 2025
99d5216
fix for userspace threads
clemdiep Dec 17, 2025
dabbc12
add mising copyright
clemdiep Dec 17, 2025
8bb2c14
allow for syscall with empty implementation to hide warning message
clemdiep Dec 17, 2025
53c7fdf
fix bug on arm32 after musl support
clemdiep Dec 18, 2025
2dc0b62
fix nanosleep and futex
clemdiep Jan 6, 2026
d67443a
revert no more necessary branch condition in workflows
clemdiep Jan 14, 2026
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
  •  
  •  
  •  
11 changes: 5 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ on:
branches:
- main
pull_request:
branches:
- main
branches: ["main"]

jobs:
build-so3:
Expand All @@ -25,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 @@ -43,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
27 changes: 21 additions & 6 deletions so3/Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,31 @@
# Kbuild for top-level directory of the kernel
# This file takes care of the following:

# Generate asm-offsets.h
# Generate syscall_table.h.in and syscall_number.h

syscall-files = include/generated/syscall_table.h.in
syscall-files += include/generated/syscall_number.h
syscall-script = scripts/syscall_gen.sh
syscall-src = syscall.tbl arch/$(SRCARCH)/syscall.h.in

quiet_cmd_syscall_gen = GEN $@
cmd_syscall_gen = $(syscall-script) $(syscall-src) $(syscall-files)

$(syscall-files) &: $(syscall-script) $(syscall-src) Kbuild FORCE
$(call if_changed,syscall_gen)

always := $(syscall-files)
targets := $(syscall-files)

# Generate asm-offsets.h
#

offsets-file := include/generated/asm-offsets.h

always := $(offsets-file)
targets := $(offsets-file)
always += $(offsets-file)
targets += $(offsets-file)
targets += arch/$(SRCARCH)/asm-offsets.s

# Default sed regexp - multiline due to syntax constraints
define sed-y
"/^->/{s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; s:->::; p;}"
Expand All @@ -34,10 +50,9 @@ define cmd_offsets
endef

# We use internal kbuild rules to avoid the "is up to date" message from make
arch/$(SRCARCH)/asm-offsets.s: $(srctree)/arch/$(SRCARCH)/asm-offsets.c FORCE
arch/$(SRCARCH)/asm-offsets.s: $(srctree)/arch/$(SRCARCH)/asm-offsets.c include/generated/syscall_number.h FORCE
$(Q)mkdir -p $(dir $@)
$(call if_changed_dep,cc_s_c)

$(offsets-file): arch/$(SRCARCH)/asm-offsets.s Kbuild
$(call cmd,offsets)

3 changes: 2 additions & 1 deletion so3/arch/arm32/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
obj-y += head.o
obj-y += setup.o exception.o context.o fault.o
obj-y += cache_v7_asm.o cache_v7.o cache-cp15.o
obj-y += thread.o ptrace.o
obj-y += thread.o
obj-y += vfp.o
obj-y += backtrace.o backtrace_asm.o
obj-y += smccc-call.o
obj-y += syscalls.o

obj-y += lib/

Expand Down
1 change: 1 addition & 0 deletions so3/arch/arm32/asm-offsets.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ int main(void)
DEFINE(OFFSET_PSR, offsetof(cpu_regs_t, psr));
DEFINE(OFFSET_SP_USR, offsetof(cpu_regs_t, sp_usr));
DEFINE(OFFSET_LR_USR, offsetof(cpu_regs_t, lr_usr));
DEFINE(OFFSET_TLS_USR, offsetof(cpu_regs_t, tls_usr));

BLANK();

Expand Down
Loading