From e27db2989e46461a152d5b6f090aeed5b7bd219c Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Thu, 2 Apr 2026 11:20:04 -0400 Subject: [PATCH 01/11] Initial set of sanitized images for running on public infrastructure These use publicly available dockerhub images as the basis --- Makefile | 148 +++++++++++++++++++++++ README.md | 3 - arm-linux-sdk/Dockerfile | 19 +++ cfsbuildenv-arm-linux/Dockerfile | 13 ++ cfsbuildenv-doxygen/Dockerfile | 22 ++++ cfsbuildenv-doxygen/README.md | 13 ++ cfsbuildenv-dpkg/Dockerfile | 27 +++++ cfsbuildenv-gaisler-sparc-rcc/Dockerfile | 13 ++ cfsbuildenv-mcdc/Dockerfile | 24 ++++ cfsbuildenv-rpm/Dockerfile | 34 ++++++ cfsbuildenv-rtems/Dockerfile | 30 +++++ cfsbuildenv-yocto/Dockerfile | 31 +++++ cfsexec-dpkg/Dockerfile | 19 +++ cfsexec-qemu/Dockerfile | 21 ++++ docker-executor/Dockerfile | 25 ++++ docker-executor/docker.asc | 62 ++++++++++ gaisler-sparc-rcc-sdk/Dockerfile | 19 +++ mcdc/Dockerfile | 39 ------ rtems-4.11/Dockerfile | 72 ----------- rtems-5/Dockerfile | 62 ---------- rtems-6/Dockerfile | 71 ----------- rtems-6/config.ini | 3 - rtems-6/testbusy.c | 37 ------ rtems-rtos/Dockerfile | 63 ++++++++++ rtems-tools/Dockerfile | 27 +++++ yocto-sdk/Dockerfile | 39 ++++++ 26 files changed, 649 insertions(+), 287 deletions(-) create mode 100644 Makefile delete mode 100644 README.md create mode 100644 arm-linux-sdk/Dockerfile create mode 100644 cfsbuildenv-arm-linux/Dockerfile create mode 100644 cfsbuildenv-doxygen/Dockerfile create mode 100644 cfsbuildenv-doxygen/README.md create mode 100644 cfsbuildenv-dpkg/Dockerfile create mode 100644 cfsbuildenv-gaisler-sparc-rcc/Dockerfile create mode 100644 cfsbuildenv-mcdc/Dockerfile create mode 100644 cfsbuildenv-rpm/Dockerfile create mode 100644 cfsbuildenv-rtems/Dockerfile create mode 100644 cfsbuildenv-yocto/Dockerfile create mode 100644 cfsexec-dpkg/Dockerfile create mode 100644 cfsexec-qemu/Dockerfile create mode 100644 docker-executor/Dockerfile create mode 100644 docker-executor/docker.asc create mode 100644 gaisler-sparc-rcc-sdk/Dockerfile delete mode 100644 mcdc/Dockerfile delete mode 100644 rtems-4.11/Dockerfile delete mode 100644 rtems-5/Dockerfile delete mode 100644 rtems-6/Dockerfile delete mode 100644 rtems-6/config.ini delete mode 100644 rtems-6/testbusy.c create mode 100644 rtems-rtos/Dockerfile create mode 100644 rtems-tools/Dockerfile create mode 100644 yocto-sdk/Dockerfile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..17e0d36 --- /dev/null +++ b/Makefile @@ -0,0 +1,148 @@ +# Example makefile for building all the images locally +# This is useful when debugging, so as to not REQUIRE the use of CI/CD to build + +LOCAL_TAG ?= test +TGT_REPO ?= ghcr.io/core-flight-system/containers +REPO_TAG ?= latest + +# The option --no-cache can be specified on command line if desired +EXTRA_BUILDARGS += --progress=plain + +BASIC_IMAGE_SET += docker-executor +BASIC_IMAGE_SET += cfsexec-qemu +# BASIC_IMAGE_SET += yocto-sdk +BASIC_IMAGE_SET += gaisler-sparc-rcc-sdk +BASIC_IMAGE_SET += arm-linux-sdk +ALL_IMAGE_SET += $(BASIC_IMAGE_SET) + +BUILDENV_IMAGE_SET += cfsbuildenv-doxygen +BUILDENV_IMAGE_SET += cfsbuildenv-mcdc +BUILDENV_IMAGE_SET += cfsbuildenv-linux +BUILDENV_IMAGE_SET += cfsbuildenv-rtems5 +BUILDENV_IMAGE_SET += cfsbuildenv-rtems6 +BUILDENV_IMAGE_SET += cfsbuildenv-el9 +BUILDENV_IMAGE_SET += cfsbuildenv-el8 +# BUILDENV_IMAGE_SET += cfsbuildenv-yocto +BUILDENV_IMAGE_SET += cfsbuildenv-arm-linux +BUILDENV_IMAGE_SET += cfsbuildenv-gaisler-sparc-rcc +ALL_IMAGE_SET += $(BUILDENV_IMAGE_SET) + +# The rest of the images each need a custom rule with custom deps +ALL_IMAGE_SET += rtems5-tools +ALL_IMAGE_SET += rtems6-tools +ALL_IMAGE_SET += rtems5-rtos +ALL_IMAGE_SET += rtems6-rtos + +BASIC_IMAGE_TARGETS := $(addsuffix .image,$(BASIC_IMAGE_SET)) +BUILDENV_IMAGE_TARGETS := $(addsuffix .image,$(BUILDENV_IMAGE_SET)) +ALL_IMAGE_TARGETS := $(addsuffix .image,$(ALL_IMAGE_SET)) +ALL_PUSH_TARGETS := $(addsuffix .push,$(ALL_IMAGE_SET)) +ALL_PULL_TARGETS := $(addsuffix .pull,$(ALL_IMAGE_SET)) + +$(ALL_IMAGE_TARGETS) $(ALL_PUSH_TARGETS) $(ALL_PULL_TARGETS): IMAGE_NAME = $(basename $(@)) + +#$(BUILDENV_IMAGE_TARGETS): $(BASIC_IMAGE_TARGETS) + +$(BASIC_IMAGE_TARGETS): + docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) -f $(subst rtems5-,rtems-,$(subst rtems6-,rtems-,$(IMAGE_NAME)))/Dockerfile . + +# RTEMS 5 Tools +rtems5-tools.image: + docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) \ + --build-arg RTEMS_VER=5 \ + -f rtems-tools/Dockerfile . + +# RTEMS 6 Tools +rtems6-tools.image: + docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) \ + --build-arg RTEMS_VER=6 \ + -f rtems-tools/Dockerfile . + +# RTEMS 5 RTOS +rtems5-rtos.image: rtems5-tools.image + docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) \ + --build-arg TOOLS_IMAGE=rtems5-tools:$(LOCAL_TAG) \ + --build-arg RTEMS_VER=5 \ + -f rtems-rtos/Dockerfile . + +# RTEMS 6 RTOS +rtems6-rtos.image: rtems6-tools.image + docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) \ + --build-arg TOOLS_IMAGE=rtems6-tools:$(LOCAL_TAG) \ + --build-arg RTEMS_VER=6 \ + -f rtems-rtos/Dockerfile . + +# cFS Build Environment - RTEMS 5 +cfsbuildenv-rtems5.image: rtems5-rtos.image + docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) \ + --build-arg RTEMS_RTOS_IMAGE=rtems5-rtos:$(LOCAL_TAG) \ + -f cfsbuildenv-rtems/Dockerfile . + +# cFS Build Environment - RTEMS 6 +cfsbuildenv-rtems6.image: rtems6-rtos.image + docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) \ + --build-arg RTEMS_RTOS_IMAGE=rtems6-rtos:$(LOCAL_TAG) \ + -f cfsbuildenv-rtems/Dockerfile . + +cfsbuildenv-doxygen.image: + docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) -f cfsbuildenv-doxygen/Dockerfile . + +cfsbuildenv-mcdc.image: + docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) -f cfsbuildenv-mcdc/Dockerfile . + +cfsbuildenv-linux.image cfsbuildenv-ubuntu22.image: + docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) -f cfsbuildenv-dpkg/Dockerfile . + +cfsbuildenv-el8.image cfsbuildenv-el9.image: + docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) -f cfsbuildenv-rpm/Dockerfile . + +cfsbuildenv-yocto.image: + docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) \ + --build-arg YOCTO_SDK_IMAGE=yocto-sdk:$(LOCAL_TAG) \ + -f cfsbuildenv-yocto/Dockerfile . + +cfsbuildenv-arm-linux.image: arm-linux-sdk.image cfsbuildenv-linux.image + docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) \ + --build-arg BASE_IMAGE=cfsbuildenv-linux:$(LOCAL_TAG) \ + --build-arg SDK_IMAGE=arm-linux-sdk:$(LOCAL_TAG) \ + -f cfsbuildenv-arm-linux/Dockerfile . + +cfsbuildenv-gaisler-sparc-rcc.image: gaisler-sparc-rcc-sdk.image cfsbuildenv-linux.image + docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) \ + --build-arg BASE_IMAGE=cfsbuildenv-linux:$(LOCAL_TAG) \ + --build-arg SDK_IMAGE=gaisler-sparc-rcc-sdk:$(LOCAL_TAG) \ + -f cfsbuildenv-gaisler-sparc-rcc/Dockerfile . + +cfsexec-linux.image cfsexec-ubuntu22.image: + docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) -f cfsexec-dpkg/Dockerfile . + +$(ALL_PUSH_TARGETS): + docker tag $(IMAGE_NAME):$(LOCAL_TAG) $(TGT_REPO)/$(IMAGE_NAME):$(REPO_TAG) + docker push $(TGT_REPO)/$(IMAGE_NAME):$(REPO_TAG) + +$(ALL_PULL_TARGETS): + docker pull $(TGT_REPO)/$(IMAGE_NAME):$(REPO_TAG) + +push: $(ALL_PUSH_TARGETS) +pull: $(ALL_PULL_TARGETS) +all: $(ALL_IMAGE_TARGETS) + +BASE_IMAGE_TGTS += arm-linux-sdk.image +BASE_IMAGE_TGTS += cfsbuildenv-doxygen.image +BASE_IMAGE_TGTS += docker-executor.image +BASE_IMAGE_TGTS += gaisler-sparc-rcc-sdk.image +BASE_IMAGE_TGTS += rtems5-rtos.image +BASE_IMAGE_TGTS += rtems5-tools.image +BASE_IMAGE_TGTS += rtems6-rtos.image +BASE_IMAGE_TGTS += rtems6-tools.image +BASE_IMAGE_TGTS += cfsbuildenv-rtems5.image +BASE_IMAGE_TGTS += cfsbuildenv-rtems6.image +BASE_IMAGE_TGTS += cfsbuildenv-linux.image +BASE_IMAGE_TGTS += cfsexec-linux.image + +$(BASE_IMAGE_TGTS): EXTRA_BUILDARGS += --build-arg BASE_IMAGE=debian:bookworm + +cfsbuildenv-el8.image: EXTRA_BUILDARGS += --build-arg BASE_IMAGE=rockylinux:8 +cfsbuildenv-el9.image: EXTRA_BUILDARGS += --build-arg BASE_IMAGE=rockylinux:9 + +cfsbuildenv-ubuntu22.image cfsexec-ubuntu22.image: EXTRA_BUILDARGS += --build-arg BASE_IMAGE=ubuntu:jammy diff --git a/README.md b/README.md deleted file mode 100644 index 8787afb..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# QEMU RTEMS Dockerfiles - -This Dockerfile was created to be used for building and testing nasa/cFS in RTEMS in QEMU for GitHub Actions CI. diff --git a/arm-linux-sdk/Dockerfile b/arm-linux-sdk/Dockerfile new file mode 100644 index 0000000..62500c1 --- /dev/null +++ b/arm-linux-sdk/Dockerfile @@ -0,0 +1,19 @@ +######################################################### +# Build the ARM SDK image - contains the reference toolchain from the ARM developer website +######################################################### + +ARG BASE_IMAGE=debian:latest +FROM ${BASE_IMAGE} AS arm-linux-sdk + +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + tar xz-utils curl ca-certificates \ + ${EXTRA_PKGS} && \ + rm -rf /var/cache/apt + +# Fetch SDK binary packages +RUN curl -fsL -o /root/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-linux-gnueabihf.tar.xz 'https://developer.arm.com/-/media/Files/downloads/gnu/11.3.rel1/binrel/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-linux-gnueabihf.tar.xz?rev=65520e9cdf324eca9c02f5302c904fa4&hash=0A1256D118EB7077B4BAA5B2A44FFB72' + +# Install SDK +RUN mkdir -p /opt && \ + tar Jxf /root/arm-gnu-toolchain-11.3.rel1-x86_64-arm-none-linux-gnueabihf.tar.xz -C /opt && \ + chown -R root:root /opt/ diff --git a/cfsbuildenv-arm-linux/Dockerfile b/cfsbuildenv-arm-linux/Dockerfile new file mode 100644 index 0000000..ba7bb38 --- /dev/null +++ b/cfsbuildenv-arm-linux/Dockerfile @@ -0,0 +1,13 @@ +######################################################### +# This adds all the needed packages to build CFS +# for an embedded Linux target using Yocto +######################################################### + +ARG SDK_IMAGE=arm-linux-sdk:test +ARG BASE_IMAGE=cfsbuildenv-linux:test + +FROM ${SDK_IMAGE} AS arm-linux-sdk +FROM ${BASE_IMAGE} AS cfsbuildenv-arm-linux + +# Bring the SDK entirely from the sdk image, +COPY --from=arm-linux-sdk /opt /opt diff --git a/cfsbuildenv-doxygen/Dockerfile b/cfsbuildenv-doxygen/Dockerfile new file mode 100644 index 0000000..9e15842 --- /dev/null +++ b/cfsbuildenv-doxygen/Dockerfile @@ -0,0 +1,22 @@ +######################################################### +# This adds all the needed packages to build CFS +# documentation and guides using Doxygen +######################################################### + +ARG BASE_IMAGE=debian:latest +FROM ${BASE_IMAGE} AS cfsbuildenv-doxygen + +ARG EXTRA_PKGS="" + +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + sudo build-essential git cmake curl lsb-release software-properties-common rsync jq \ + doxygen graphviz texlive texlive-plain-generic texlive-fonts-extra texlive-latex-extra \ + ${EXTRA_PKGS} && \ + rm -rf /var/cache/apt + +# Create a non-root user to do the build, but grant sudo to permit adding dependencies if needed +RUN useradd -m -c "Docker user" -U -G sudo docker && \ + echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers + +USER docker +WORKDIR /home/docker diff --git a/cfsbuildenv-doxygen/README.md b/cfsbuildenv-doxygen/README.md new file mode 100644 index 0000000..19586f7 --- /dev/null +++ b/cfsbuildenv-doxygen/README.md @@ -0,0 +1,13 @@ +# cfsbuildenv-ubuntu22 container + +This container is intended to host containerized jobs in workflows + +It is not started or built directly from this docker compose because +it would only be started via workflow jobs when needed. + +It must be built separately using `docker build`, for example: + +``` +docker build -t cfsbuildenv-ubuntu22:latest . +``` + diff --git a/cfsbuildenv-dpkg/Dockerfile b/cfsbuildenv-dpkg/Dockerfile new file mode 100644 index 0000000..7860991 --- /dev/null +++ b/cfsbuildenv-dpkg/Dockerfile @@ -0,0 +1,27 @@ +######################################################### +# This adds all the needed packages to build CFS +# in the native configurations +# +# This variant of the container may be built on a Debian-style base +# that uses dpkg and apt as the package management system +######################################################### + +ARG BASE_IMAGE=debian:latest +FROM ${BASE_IMAGE} AS cfsbuildenv-dpkg + +ARG EXTRA_PKGS="" + +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + sudo ca-certificates curl lsb-release software-properties-common \ + build-essential gcc g++ gawk cmake lcov xsltproc rsync jq \ + python3 python3-venv python3-dev python3-pip openssh-client \ + libexpat-dev liblua5.3-dev libjson-c-dev xz-utils cppcheck clang-format \ + ${EXTRA_PKGS} && \ + rm -rf /var/cache/apt + +# Create a non-root user to do the build, but grant sudo to permit adding dependencies if needed +RUN useradd -m -c "Docker user" -U -G sudo docker && \ + echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers + +USER docker +WORKDIR /home/docker diff --git a/cfsbuildenv-gaisler-sparc-rcc/Dockerfile b/cfsbuildenv-gaisler-sparc-rcc/Dockerfile new file mode 100644 index 0000000..8fe77ac --- /dev/null +++ b/cfsbuildenv-gaisler-sparc-rcc/Dockerfile @@ -0,0 +1,13 @@ +######################################################### +# This adds all the needed packages to build CFS +# for an embedded Linux target using Yocto +######################################################### + +ARG SDK_IMAGE=gaisler-sparc-rcc:test +ARG BASE_IMAGE=cfsbuildenv-linux:test + +FROM ${SDK_IMAGE} AS gaisler-sparc-rcc-sdk +FROM ${BASE_IMAGE} AS cfsbuildenv-gaisler-sparc-rcc + +# Bring the SDK entirely from the sdk image, +COPY --from=gaisler-sparc-rcc-sdk /opt /opt diff --git a/cfsbuildenv-mcdc/Dockerfile b/cfsbuildenv-mcdc/Dockerfile new file mode 100644 index 0000000..d612fe9 --- /dev/null +++ b/cfsbuildenv-mcdc/Dockerfile @@ -0,0 +1,24 @@ +######################################################### +# Image capable of building CFS and providing MC/DC coverage analysis +# This requires use of a very recent GCC version +######################################################### + +ARG BASE_IMAGE=docker.io/gcc:14 +FROM ${BASE_IMAGE} AS gcc14-build + +ARG EXTRA_PKGS="" + +# Install the basic CFS build environment +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + sudo curl lsb-release apt-transport-https \ + git gawk cmake lcov xsltproc rsync jq \ + python3 python3-venv python3-dev libexpat-dev liblua5.3-dev libjson-c-dev \ + ${EXTRA_PKGS} && \ + rm -rf /var/cache/apt + +# Create a non-root user to do the build, but grant sudo to permit adding dependencies if needed +RUN useradd -m -c "Docker user" -U -G sudo docker && \ + echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers + +USER docker +WORKDIR /home/docker diff --git a/cfsbuildenv-rpm/Dockerfile b/cfsbuildenv-rpm/Dockerfile new file mode 100644 index 0000000..18b8ff6 --- /dev/null +++ b/cfsbuildenv-rpm/Dockerfile @@ -0,0 +1,34 @@ +######################################################### +# This adds all the needed packages to build CFS +# in the native configurations +# +# This variant of the container may be built on a RHEL-style base +# that uses rpm and dnf as the package management system +######################################################### + +ARG BASE_IMAGE=rockylinux:9 +FROM ${BASE_IMAGE} AS cfsbuildenv-rpm + +ARG EXTRA_PKGS="" + +# Add the EPEL key so the next dnf command does not fail +RUN export KEYFILE=$(. /etc/os-release && echo "RPM-GPG-KEY-EPEL-${VERSION_ID%%.*}") && \ + rpmkeys --import https://dl.fedoraproject.org/pub/epel/${KEYFILE} + +# Note that there are no strict dependencies on EPEL packages, but +# historically it also offered a newer version of CMake where the version in RHEL was obsolete. +RUN export EL_VERSION=$(. /etc/os-release && echo "${VERSION_ID%%.*}") && \ + dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-${EL_VERSION}.noarch.rpm && \ + /usr/bin/crb enable && \ + dnf install -y --allowerasing \ + ca-certificates curl jq openssl git rsync \ + glibc-devel libstdc++-devel gawk gcc gcc-c++ make cmake \ + python3 python3-pip python3-devel expat-devel json-c-devel lua-devel \ + ${EXTRA_PKGS} && \ + dnf clean all + +# This just creates a normal user without sudo privileges +RUN useradd -m -c "Docker user" -U docker + +USER docker +WORKDIR /home/docker diff --git a/cfsbuildenv-rtems/Dockerfile b/cfsbuildenv-rtems/Dockerfile new file mode 100644 index 0000000..ea433b2 --- /dev/null +++ b/cfsbuildenv-rtems/Dockerfile @@ -0,0 +1,30 @@ +######################################################### +# This adds all the needed packages to build CFS +# for the the RTEMS operating system +######################################################### + +ARG RTEMS_RTOS_IMAGE=rtems-rtos +ARG BASE_IMAGE=debian:latest + +FROM ${RTEMS_RTOS_IMAGE} AS rtems-rtos +FROM ${BASE_IMAGE} AS cfsbuildenv-rtems + +ARG EXTRA_PKGS="" + +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + ca-certificates curl lsb-release software-properties-common jq \ + build-essential gawk cmake lcov python3 python3-venv python3-dev \ + python3-pip parted dosfstools mtools bsdextrautils \ + qemu-utils qemu-system-x86 \ + ${EXTRA_PKGS} && \ + rm -rf /var/cache/apt + +# This just creates a normal user without sudo privileges +RUN useradd -m -c "Docker user" -U docker + +# Bring the RTEMS tree entirely from the rtems-rtos image, +COPY --chown=docker:docker --from=rtems-rtos /opt /opt +ENV PATH=/opt/rtems/bin:$PATH + +USER docker +WORKDIR /home/docker diff --git a/cfsbuildenv-yocto/Dockerfile b/cfsbuildenv-yocto/Dockerfile new file mode 100644 index 0000000..6451960 --- /dev/null +++ b/cfsbuildenv-yocto/Dockerfile @@ -0,0 +1,31 @@ +######################################################### +# This adds all the needed packages to build CFS +# for an embedded Linux target using Yocto +######################################################### + +ARG YOCTO_SDK_IMAGE=yocto-sdk +ARG BASE_IMAGE=debian:trixie + +FROM ${YOCTO_SDK_IMAGE} AS yocto-sdk +FROM ${BASE_IMAGE} AS cfsbuildenv-yocto + +ARG EXTRA_PKGS="" + +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + sudo ca-certificates curl lsb-release \ + build-essential gcc g++ gawk cmake git xsltproc jq \ + python3 python3-venv python3-dev python3-pip \ + libexpat-dev liblua5.4-dev libjson-c-dev xz-utils \ + qemu-utils bsdextrautils e2fsprogs \ + ${EXTRA_PKGS} && \ + rm -rf /var/cache/apt + +# Bring the SDK entirely from the yocto-sdk image, +COPY --from=yocto-sdk /opt /opt + +# Create a non-root user to do the build, but grant sudo to permit adding dependencies if needed +RUN useradd -m -c "Docker user" -U -G sudo docker && \ + echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers + +USER docker +WORKDIR /home/docker diff --git a/cfsexec-dpkg/Dockerfile b/cfsexec-dpkg/Dockerfile new file mode 100644 index 0000000..56c278e --- /dev/null +++ b/cfsexec-dpkg/Dockerfile @@ -0,0 +1,19 @@ +######################################################### +# This adds all the needed packages to execute a cFS build in QEMU +# +# This variant of the container may be built on a Debian-style base +# that uses dpkg and apt as the package management system +######################################################### + +ARG BASE_IMAGE=debian:latest +FROM ${BASE_IMAGE} AS cfsexec-ubuntu22 + +ARG EXTRA_PKGS="" + +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + sudo ca-certificates curl lsb-release dumb-init jq \ + python3-minimal liblua5.3 libexpat1 libjson-c5 xz-utils \ + ${EXTRA_PKGS} && \ + rm -rf /var/cache/apt + +ENTRYPOINT ["/usr/bin/dumb-init", "--" ] diff --git a/cfsexec-qemu/Dockerfile b/cfsexec-qemu/Dockerfile new file mode 100644 index 0000000..58498e9 --- /dev/null +++ b/cfsexec-qemu/Dockerfile @@ -0,0 +1,21 @@ +######################################################### +# This adds all the needed packages to execute a cFS build in QEMU +# +# This variant of the container may be built on a Debian-style base +# that uses dpkg and apt as the package management system +######################################################### + +ARG BASE_IMAGE=debian:trixie +FROM ${BASE_IMAGE} AS cfsexec-qemu + +ARG EXTRA_PKGS="" + +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + sudo ca-certificates curl lsb-release dumb-init jq \ + qemu-system-x86 qemu-system-mips qemu-system-riscv qemu-system-arm qemu-system-ppc qemu-system-sparc \ + qemu-efi-riscv64 qemu-efi-arm qemu-efi-aarch64 \ + qemu-utils qemu-block-extra openssh-client \ + ${EXTRA_PKGS} && \ + rm -rf /var/cache/apt + +ENTRYPOINT ["/usr/bin/dumb-init", "--" ] diff --git a/docker-executor/Dockerfile b/docker-executor/Dockerfile new file mode 100644 index 0000000..8f5865b --- /dev/null +++ b/docker-executor/Dockerfile @@ -0,0 +1,25 @@ +######################################################### +######################################################### + +ARG BASE_IMAGE=debian:latest +FROM ${BASE_IMAGE} AS gitlab-docker-executor + +# Install docker repo +RUN install -m 0755 -d /etc/apt/keyrings +COPY --chmod=0644 docker-executor/docker.asc /etc/apt/keyrings/docker.asc + +RUN apt-get update && \ + env DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + curl openssl ca-certificates && \ + echo "deb [arch=$(dpkg --print-architecture) \ + signed-by=/etc/apt/keyrings/docker.asc] \ + $(. /etc/os-release && echo "https://download.docker.com/linux/${ID} ${UBUNTU_CODENAME:-$VERSION_CODENAME}") \ + stable" | tee /etc/apt/sources.list.d/docker.list && \ + apt-get update && \ + env DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \ + docker-ce-cli docker-buildx-plugin && \ + apt-get autoclean && \ + apt-get autoremove && \ + rm -rf /var/cache/apt + +RUN /usr/sbin/update-ca-certificates -v diff --git a/docker-executor/docker.asc b/docker-executor/docker.asc new file mode 100644 index 0000000..ee7872e --- /dev/null +++ b/docker-executor/docker.asc @@ -0,0 +1,62 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQINBFit2ioBEADhWpZ8/wvZ6hUTiXOwQHXMAlaFHcPH9hAtr4F1y2+OYdbtMuth +lqqwp028AqyY+PRfVMtSYMbjuQuu5byyKR01BbqYhuS3jtqQmljZ/bJvXqnmiVXh +38UuLa+z077PxyxQhu5BbqntTPQMfiyqEiU+BKbq2WmANUKQf+1AmZY/IruOXbnq +L4C1+gJ8vfmXQt99npCaxEjaNRVYfOS8QcixNzHUYnb6emjlANyEVlZzeqo7XKl7 +UrwV5inawTSzWNvtjEjj4nJL8NsLwscpLPQUhTQ+7BbQXAwAmeHCUTQIvvWXqw0N +cmhh4HgeQscQHYgOJjjDVfoY5MucvglbIgCqfzAHW9jxmRL4qbMZj+b1XoePEtht +ku4bIQN1X5P07fNWzlgaRL5Z4POXDDZTlIQ/El58j9kp4bnWRCJW0lya+f8ocodo +vZZ+Doi+fy4D5ZGrL4XEcIQP/Lv5uFyf+kQtl/94VFYVJOleAv8W92KdgDkhTcTD +G7c0tIkVEKNUq48b3aQ64NOZQW7fVjfoKwEZdOqPE72Pa45jrZzvUFxSpdiNk2tZ +XYukHjlxxEgBdC/J3cMMNRE1F4NCA3ApfV1Y7/hTeOnmDuDYwr9/obA8t016Yljj +q5rdkywPf4JF8mXUW5eCN1vAFHxeg9ZWemhBtQmGxXnw9M+z6hWwc6ahmwARAQAB +tCtEb2NrZXIgUmVsZWFzZSAoQ0UgZGViKSA8ZG9ja2VyQGRvY2tlci5jb20+iQI3 +BBMBCgAhBQJYrefAAhsvBQsJCAcDBRUKCQgLBRYCAwEAAh4BAheAAAoJEI2BgDwO +v82IsskP/iQZo68flDQmNvn8X5XTd6RRaUH33kXYXquT6NkHJciS7E2gTJmqvMqd +tI4mNYHCSEYxI5qrcYV5YqX9P6+Ko+vozo4nseUQLPH/ATQ4qL0Zok+1jkag3Lgk +jonyUf9bwtWxFp05HC3GMHPhhcUSexCxQLQvnFWXD2sWLKivHp2fT8QbRGeZ+d3m +6fqcd5Fu7pxsqm0EUDK5NL+nPIgYhN+auTrhgzhK1CShfGccM/wfRlei9Utz6p9P +XRKIlWnXtT4qNGZNTN0tR+NLG/6Bqd8OYBaFAUcue/w1VW6JQ2VGYZHnZu9S8LMc +FYBa5Ig9PxwGQOgq6RDKDbV+PqTQT5EFMeR1mrjckk4DQJjbxeMZbiNMG5kGECA8 +g383P3elhn03WGbEEa4MNc3Z4+7c236QI3xWJfNPdUbXRaAwhy/6rTSFbzwKB0Jm +ebwzQfwjQY6f55MiI/RqDCyuPj3r3jyVRkK86pQKBAJwFHyqj9KaKXMZjfVnowLh +9svIGfNbGHpucATqREvUHuQbNnqkCx8VVhtYkhDb9fEP2xBu5VvHbR+3nfVhMut5 +G34Ct5RS7Jt6LIfFdtcn8CaSas/l1HbiGeRgc70X/9aYx/V/CEJv0lIe8gP6uDoW +FPIZ7d6vH+Vro6xuWEGiuMaiznap2KhZmpkgfupyFmplh0s6knymuQINBFit2ioB +EADneL9S9m4vhU3blaRjVUUyJ7b/qTjcSylvCH5XUE6R2k+ckEZjfAMZPLpO+/tF +M2JIJMD4SifKuS3xck9KtZGCufGmcwiLQRzeHF7vJUKrLD5RTkNi23ydvWZgPjtx +Q+DTT1Zcn7BrQFY6FgnRoUVIxwtdw1bMY/89rsFgS5wwuMESd3Q2RYgb7EOFOpnu +w6da7WakWf4IhnF5nsNYGDVaIHzpiqCl+uTbf1epCjrOlIzkZ3Z3Yk5CM/TiFzPk +z2lLz89cpD8U+NtCsfagWWfjd2U3jDapgH+7nQnCEWpROtzaKHG6lA3pXdix5zG8 +eRc6/0IbUSWvfjKxLLPfNeCS2pCL3IeEI5nothEEYdQH6szpLog79xB9dVnJyKJb +VfxXnseoYqVrRz2VVbUI5Blwm6B40E3eGVfUQWiux54DspyVMMk41Mx7QJ3iynIa +1N4ZAqVMAEruyXTRTxc9XW0tYhDMA/1GYvz0EmFpm8LzTHA6sFVtPm/ZlNCX6P1X +zJwrv7DSQKD6GGlBQUX+OeEJ8tTkkf8QTJSPUdh8P8YxDFS5EOGAvhhpMBYD42kQ +pqXjEC+XcycTvGI7impgv9PDY1RCC1zkBjKPa120rNhv/hkVk/YhuGoajoHyy4h7 +ZQopdcMtpN2dgmhEegny9JCSwxfQmQ0zK0g7m6SHiKMwjwARAQABiQQ+BBgBCAAJ +BQJYrdoqAhsCAikJEI2BgDwOv82IwV0gBBkBCAAGBQJYrdoqAAoJEH6gqcPyc/zY +1WAP/2wJ+R0gE6qsce3rjaIz58PJmc8goKrir5hnElWhPgbq7cYIsW5qiFyLhkdp +YcMmhD9mRiPpQn6Ya2w3e3B8zfIVKipbMBnke/ytZ9M7qHmDCcjoiSmwEXN3wKYI +mD9VHONsl/CG1rU9Isw1jtB5g1YxuBA7M/m36XN6x2u+NtNMDB9P56yc4gfsZVES +KA9v+yY2/l45L8d/WUkUi0YXomn6hyBGI7JrBLq0CX37GEYP6O9rrKipfz73XfO7 +JIGzOKZlljb/D9RX/g7nRbCn+3EtH7xnk+TK/50euEKw8SMUg147sJTcpQmv6UzZ +cM4JgL0HbHVCojV4C/plELwMddALOFeYQzTif6sMRPf+3DSj8frbInjChC3yOLy0 +6br92KFom17EIj2CAcoeq7UPhi2oouYBwPxh5ytdehJkoo+sN7RIWua6P2WSmon5 +U888cSylXC0+ADFdgLX9K2zrDVYUG1vo8CX0vzxFBaHwN6Px26fhIT1/hYUHQR1z +VfNDcyQmXqkOnZvvoMfz/Q0s9BhFJ/zU6AgQbIZE/hm1spsfgvtsD1frZfygXJ9f +irP+MSAI80xHSf91qSRZOj4Pl3ZJNbq4yYxv0b1pkMqeGdjdCYhLU+LZ4wbQmpCk +SVe2prlLureigXtmZfkqevRz7FrIZiu9ky8wnCAPwC7/zmS18rgP/17bOtL4/iIz +QhxAAoAMWVrGyJivSkjhSGx1uCojsWfsTAm11P7jsruIL61ZzMUVE2aM3Pmj5G+W +9AcZ58Em+1WsVnAXdUR//bMmhyr8wL/G1YO1V3JEJTRdxsSxdYa4deGBBY/Adpsw +24jxhOJR+lsJpqIUeb999+R8euDhRHG9eFO7DRu6weatUJ6suupoDTRWtr/4yGqe +dKxV3qQhNLSnaAzqW/1nA3iUB4k7kCaKZxhdhDbClf9P37qaRW467BLCVO/coL3y +Vm50dwdrNtKpMBh3ZpbB1uJvgi9mXtyBOMJ3v8RZeDzFiG8HdCtg9RvIt/AIFoHR +H3S+U79NT6i0KPzLImDfs8T7RlpyuMc4Ufs8ggyg9v3Ae6cN3eQyxcK3w0cbBwsh +/nQNfsA6uu+9H7NhbehBMhYnpNZyrHzCmzyXkauwRAqoCbGCNykTRwsur9gS41TQ +M8ssD1jFheOJf3hODnkKU+HKjvMROl1DK7zdmLdNzA1cvtZH/nCC9KPj1z8QC47S +xx+dTZSx4ONAhwbS/LN3PoKtn8LPjY9NP9uDWI+TWYquS2U+KHDrBDlsgozDbs/O +jCxcpDzNmXpWQHEtHU7649OXHP7UeNST1mCUCH5qdank0V1iejF6/CfTFU4MfcrG +YT90qFF93M3v01BbxP+EIY2/9tiIPbrd +=0YYh +-----END PGP PUBLIC KEY BLOCK----- diff --git a/gaisler-sparc-rcc-sdk/Dockerfile b/gaisler-sparc-rcc-sdk/Dockerfile new file mode 100644 index 0000000..0a444db --- /dev/null +++ b/gaisler-sparc-rcc-sdk/Dockerfile @@ -0,0 +1,19 @@ +######################################################### +# Build the Yocto SDK image - contains QEMU riscv64 and mips toolchains +######################################################### + +ARG BASE_IMAGE=debian:latest +FROM ${BASE_IMAGE} AS gaisler-sparc-rcc-sdk + +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + curl tar xz-utils \ + ${EXTRA_PKGS} && \ + rm -rf /var/cache/apt + +# Fetch SDK binary packages +RUN curl -fsL -o /root/sparc-rtems-5-gcc-10.5.0-1.3.2-linux.txz 'https://download.gaisler.com/anonftp/rcc/rcc-1.3/1.3.2/sparc-rtems-5-gcc-10.5.0-1.3.2-linux.txz' + +# Install SDK +RUN mkdir -p /opt && \ + tar Jxf /root/sparc-rtems-5-gcc-10.5.0-1.3.2-linux.txz -C /opt && \ + chown -R root:root /opt/ diff --git a/mcdc/Dockerfile b/mcdc/Dockerfile deleted file mode 100644 index 566e58a..0000000 --- a/mcdc/Dockerfile +++ /dev/null @@ -1,39 +0,0 @@ -FROM ubuntu:22.04 -ENV DEBIAN_FRONTEND=noninteractive - -# Install dependencies -RUN apt-get update && apt-get install -y \ - build-essential \ - libgmp-dev \ - libmpfr-dev \ - libmpc-dev \ - wget \ - tar \ - gcc \ - g++ \ - make \ - git \ - cmake \ - lcov \ - python3 \ - jq \ - && rm -rf /var/lib/apt/lists/* - -# Configure dynamic linker to include /usr/local/lib (for GCC libraries) -RUN echo "/usr/local/lib" > /etc/ld.so.conf.d/gcc.conf && ldconfig - -# Download and build GCC -RUN wget http://ftp.gnu.org/gnu/gcc/gcc-14.1.0/gcc-14.1.0.tar.gz && \ - tar -xf gcc-14.1.0.tar.gz && \ - cd gcc-14.1.0 && \ - ./contrib/download_prerequisites && \ - ./configure --prefix=/usr/local/gcc-14.1.0 --enable-languages=c,c++ --disable-multilib && \ - make -j$(nproc) && \ - make install && \ - ln -sf /usr/local/gcc-14.1.0/bin/gcc /usr/bin/gcc && \ - ln -sf /usr/local/gcc-14.1.0/bin/g++ /usr/bin/g++ && \ - rm -rf /var/lib/apt/lists/* && \ - rm -rf /gcc-14.1.0 - -# Set the GCC binary path globally for the build process -ENV PATH=/usr/local/gcc-14.1.0/bin:$PATH \ No newline at end of file diff --git a/rtems-4.11/Dockerfile b/rtems-4.11/Dockerfile deleted file mode 100644 index b1289b7..0000000 --- a/rtems-4.11/Dockerfile +++ /dev/null @@ -1,72 +0,0 @@ -from ubuntu:22.04 -ENV DEBIAN_FRONTEND=noninteractive - -# Basic dependencies -run apt-get update && apt-get install -y git make curl - -# rtems dependencies -run apt-get install -y flex bison texinfo python2-dev g++ unzip libgmp-dev libmpfr-dev bzip2 xz-utils - -# Make python2 the default python -run ln -s /usr/bin/python2 /usr/bin/python - -# QEMU dependencies -run apt-get install -y qemu-system-i386 - -# setup and compile RTEMS BSP -run mkdir -p ${HOME}/rtems-4.11 \ - && cd ${HOME} \ - && git clone -b 4.11 https://gitlab.rtems.org/rtems/tools/rtems-source-builder.git \ - && cd rtems-source-builder/rtems \ -# Download gnu mpc before source builder will fail to download it - && mkdir sources \ - && curl https://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz --output sources/mpc-1.0.3.tar.gz \ - && ../source-builder/sb-set-builder --prefix=$HOME/rtems-4.11 4.11/rtems-i386 \ - -# clone and bootstrap RTEMS source tree - && cd ${HOME} \ - && git clone -b 4.11 https://gitlab.rtems.org/rtems/rtos/rtems.git \ - && export PATH=$HOME/rtems-4.11/bin:$PATH \ - && cd rtems && ./bootstrap \ - -# Build and install RTEMS pc686 BSP - && cd ${HOME} \ - && mkdir b-pc686 \ - && cd b-pc686 \ - && ../rtems/configure --target=i386-rtems4.11 \ - --enable-rtemsbsp=pc686 \ - --prefix=${HOME}/rtems-4.11 \ - --enable-networking \ - --enable-cxx \ - --disable-posix \ - --disable-deprecated \ - BSP_ENABLE_VGA=0 \ - CLOCK_DRIVER_USE_TSC=1 \ - USE_COM1_AS_CONSOLE=1 \ - BSP_PRESS_KEY_FOR_RESET=0 \ - BSP_RESET_BOARD_AT_EXIT=1 \ - && make \ - && make install - -# install git from source for updated version -run apt-get install -y libz-dev libssl-dev libcurl4-gnutls-dev libexpat1-dev gettext cmake -run curl -o git.tar.gz https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.26.2.tar.gz -run tar -zxf git.tar.gz && rm git.tar.gz -run cd git-* && make prefix=/usr/local && make prefix=/usr/local install - -# Delete unnecessary directories now that rtems is built -run cd ${HOME} \ - && rm -rf rtems-source-builder b-pc686 rtems - -# Additional dependencies -run apt-get install -y -f mtools parted udev bsdmainutils - -# Install dosfstools from source release -run curl -o dosfstools.tar.gz http://deb.debian.org/debian/pool/main/d/dosfstools/dosfstools_4.2.orig.tar.gz -run tar -zxf dosfstools.tar.gz && rm dosfstools.tar.gz -run cd dosfstools-* && ./configure && make && make prefix=/usr/local install - -# Remove unecessary dependencies now that rtems is built -run apt-get purge -y libz-dev libssl-dev libexpat1-dev gettext unzip git flex bison texinfo curl \ - libgmp-dev libmpfr-dev bzip2 xz-utils -run apt-get autoremove -y \ No newline at end of file diff --git a/rtems-5/Dockerfile b/rtems-5/Dockerfile deleted file mode 100644 index 9db06e1..0000000 --- a/rtems-5/Dockerfile +++ /dev/null @@ -1,62 +0,0 @@ -from ubuntu:22.04 -ENV DEBIAN_FRONTEND=noninteractive - -# Basic dependencies -run apt-get update && apt-get install -y git make - -# rtems dependencies -run apt-get install -y flex bison texinfo python3-dev g++ unzip libgmp-dev libmpfr-dev bzip2 xz-utils - -# Make python3 the default python -run ln -s /usr/bin/python3 /usr/bin/python - -# QEMU dependencies -run apt-get install -y qemu-system-i386 - -# setup and compile RTEMS BSP -run mkdir -p ${HOME}/rtems-5 \ - && cd ${HOME} \ - && git clone -b 5 https://gitlab.rtems.org/rtems/tools/rtems-source-builder.git \ - && cd rtems-source-builder/rtems \ - && ../source-builder/sb-set-builder --prefix=$HOME/rtems-5 5/rtems-i386 \ -# clone and bootstrap RTEMS source tree - && cd ${HOME} \ - && git clone -b 5 https://gitlab.rtems.org/rtems/rtos/rtems.git \ - && export PATH=$HOME/rtems-5/bin:$PATH \ - && cd rtems && ./bootstrap \ -# Build and install RTEMS pc686 BSP - && cd ${HOME} \ - && mkdir b-pc686 \ - && cd b-pc686 \ - && ../rtems/configure --target=i386-rtems5 \ - --enable-rtemsbsp=pc686 \ - --prefix=${HOME}/rtems-5 \ - --enable-networking \ - --enable-cxx \ - --disable-posix \ - --disable-deprecated \ - && make \ - && make install - -# install git from source for updated version -run apt-get install -y libz-dev libssl-dev libcurl4-gnutls-dev libexpat1-dev gettext cmake -run curl -o git.tar.gz https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.26.2.tar.gz -run tar -zxf git.tar.gz && rm git.tar.gz -run cd git-* && make prefix=/usr/local && make prefix=/usr/local install - -# Delete unnecessary directories now that rtems is built -run cd ${HOME} \ - && rm -rf rtems-source-builder b-pc686 rtems - -# Additional dependencies -run apt-get install -y -f mtools parted udev bsdmainutils - -# Install dosfstools from source release -run curl -o dosfstools.tar.gz http://deb.debian.org/debian/pool/main/d/dosfstools/dosfstools_4.2.orig.tar.gz -run tar -zxf dosfstools.tar.gz && rm dosfstools.tar.gz -run cd dosfstools-* && ./configure && make && make prefix=/usr/local install - -# Remove unecessary dependencies now that rtems is built -run apt-get purge -y libz-dev libssl-dev libexpat1-dev gettext unzip git flex bison texinfo curl \ - libgmp-dev libmpfr-dev bzip2 xz-utils -run apt-get autoremove -y diff --git a/rtems-6/Dockerfile b/rtems-6/Dockerfile deleted file mode 100644 index 3068bf4..0000000 --- a/rtems-6/Dockerfile +++ /dev/null @@ -1,71 +0,0 @@ -from ubuntu:22.04 -ENV DEBIAN_FRONTEND=noninteractive - -# Basic dependencies -run apt-get update && apt-get install -y git make - -# rtems dependencies -run apt-get install -y flex bison texinfo python3-dev g++ unzip libgmp-dev libmpfr-dev bzip2 xz-utils - -# Make python3 the default python -run ln -s /usr/bin/python3 /usr/bin/python - -# Added: Python development package installation for RTEMS build dependencies -run apt-get install -y python3-dev libpython3-dev - -# QEMU dependencies -run apt-get install -y qemu-system-i386 - -# Copy config.ini file - Note that the environment variable HOME will not work here -copy rtems-6/config.ini /config.ini - -# Temporary fix for legacy network stack -copy rtems-6/testbusy.c /testbusy.c - -# Setup and compile RTEMS BSP -run mkdir -p ${HOME}/rtems-6 \ - && cd ${HOME} \ - && git clone -b 6 https://gitlab.rtems.org/rtems/tools/rtems-source-builder.git \ - && cd rtems-source-builder/rtems \ - && ../source-builder/sb-set-builder --prefix=$HOME/rtems-6 6/rtems-i386 -# clone RTEMS source tree -run cd ${HOME} \ - && git clone -b 6 https://gitlab.rtems.org/rtems/rtos/rtems.git \ - && export PATH=$HOME/rtems-6/bin:$PATH \ -# Build RTEMS BSP - && cd rtems \ - && mv /config.ini . \ - && ./waf configure --prefix=${HOME}/rtems-6 \ - && ./waf \ - && ./waf install -# Get and build the legacy network stack -run cd ${HOME} \ - && git clone -b 6 https://gitlab.rtems.org/rtems/pkg/rtems-net-legacy.git \ - && cd rtems-net-legacy \ - && git submodule update --init \ - && mv /testbusy.c libtest/testbusy.c \ - && ./waf configure --prefix=$HOME/rtems-6 \ - && ./waf build install - -# install git from source for updated version -run apt-get install -y libz-dev libssl-dev libcurl4-gnutls-dev libexpat1-dev gettext cmake -run curl -o git.tar.gz https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.26.2.tar.gz -run tar -zxf git.tar.gz && rm git.tar.gz -run cd git-* && make prefix=/usr/local && make prefix=/usr/local install - -# Delete unnecessary directories now that rtems is built -run cd ${HOME} \ - && rm -rf rtems-source-builder rtems rtems-net-legacy - -# Additional dependencies -run apt-get install -y -f mtools parted udev bsdmainutils - -# Install dosfstools from source release -run curl -o dosfstools.tar.gz http://deb.debian.org/debian/pool/main/d/dosfstools/dosfstools_4.2.orig.tar.gz -run tar -zxf dosfstools.tar.gz && rm dosfstools.tar.gz -run cd dosfstools-* && ./configure && make && make prefix=/usr/local install - -# Remove unecessary dependencies now that rtems is built -run apt-get purge -y libz-dev libssl-dev libexpat1-dev gettext unzip git flex bison texinfo curl \ - libgmp-dev libmpfr-dev bzip2 xz-utils -run apt-get autoremove -y diff --git a/rtems-6/config.ini b/rtems-6/config.ini deleted file mode 100644 index 3d2b71e..0000000 --- a/rtems-6/config.ini +++ /dev/null @@ -1,3 +0,0 @@ -[i386/pc686] -RTEMS_POSIX_API = True -BUILD_TESTS = False diff --git a/rtems-6/testbusy.c b/rtems-6/testbusy.c deleted file mode 100644 index 51c6a71..0000000 --- a/rtems-6/testbusy.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2014, 2018 embedded brains GmbH. All rights reserved. - * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include - -void rtems_test_busy_cpu_usage( time_t seconds, long nanoseconds ) -{ - Thread_Control *executing; - Timestamp_Control busy; - Timestamp_Control start; - Timestamp_Control now; - - executing = _Thread_Get_executing(); - start = _Thread_Get_CPU_time_used( executing ); - _Timestamp_Set( &busy, seconds, nanoseconds ); - - do { - now = _Thread_Get_CPU_time_used( executing ); - } while ( now - start < busy ); -} diff --git a/rtems-rtos/Dockerfile b/rtems-rtos/Dockerfile new file mode 100644 index 0000000..46c1d70 --- /dev/null +++ b/rtems-rtos/Dockerfile @@ -0,0 +1,63 @@ +######################################################### +# Build the RTEMS BSP - pc686 by default (version configurable) +######################################################### + +ARG TOOLS_IMAGE=rtems-tools +ARG BASE_IMAGE=debian:latest + +FROM ${TOOLS_IMAGE} AS rtems-tools +FROM ${BASE_IMAGE} AS rtems-rtos + +ARG RTEMS_VER=5 # Default, gets overridden by CI +ARG RTEMS_BSP=pc686 + +# Basic dependencies +RUN apt-get update && env DEBIAN_FRONTEND=noninteractive apt-get install -y curl sudo \ + build-essential g++ git flex bison texinfo python3 unzip bzip2 xz-utils \ + python-is-python3 python3-dev && \ + rm -rf /var/cache/apt + +# Copy the RTEMS tools from the /opt +COPY --from=rtems-tools /opt /opt + +# Create a non-root user to do the RTOS build +RUN useradd -m -c "Docker user" -U -G sudo docker && \ + echo "%sudo ALL=(ALL:ALL) NOPASSWD:ALL" > /etc/sudoers + +USER docker +WORKDIR /home/docker +ENV PATH=/opt/rtems/bin:$PATH + +# Clone RTEMS source +RUN . /opt/rtems/rtems-tools-info && \ + git clone -b ${RTEMS_VER} --depth 1 https://gitlab.rtems.org/rtems/rtos/rtems.git + +# Conditional build based on RTEMS version +RUN . /opt/rtems/rtems-tools-info && \ + cd rtems && \ + if [ "${RTEMS_VER}" = "6" ]; then \ + echo "Building RTEMS 6 with waf..."; \ + echo "[${RTEMS_ARCH}/${RTEMS_BSP}]" > config.ini && \ + echo "BUILD_NETWORKING = True" >> config.ini && \ + echo "BUILD_TESTS = False" >> config.ini && \ + echo "BUILD_SAMPLES = False" >> config.ini && \ + python3 ./waf configure \ + --prefix=/opt/rtems-${RTEMS_VER} && \ + python3 ./waf build && \ + sudo python3 ./waf install; \ + else \ + echo "Building RTEMS 5 with autotools..."; \ + ./bootstrap && \ + cd .. && \ + mkdir b-${RTEMS_BSP} && \ + cd b-${RTEMS_BSP} && \ + ../rtems/configure --target=${RTEMS_ARCH}-rtems${RTEMS_VER} \ + --enable-rtemsbsp=${RTEMS_BSP} \ + --prefix=/opt/rtems-${RTEMS_VER} \ + --enable-networking \ + --enable-cxx \ + --disable-posix \ + --disable-deprecated && \ + make && \ + sudo make install; \ + fi diff --git a/rtems-tools/Dockerfile b/rtems-tools/Dockerfile new file mode 100644 index 0000000..fd49d9b --- /dev/null +++ b/rtems-tools/Dockerfile @@ -0,0 +1,27 @@ +######################################################### +# Build the RTEMS toolchain (version configurable) +######################################################### + +ARG BASE_IMAGE=debian:latest +FROM ${BASE_IMAGE} AS rtems-tools + +ARG RTEMS_VER=5 # Default, gets overridden by CI +ARG RTEMS_ARCH=i386 + +# Basic dependencies +RUN apt-get update && env DEBIAN_FRONTEND=noninteractive apt-get install -y curl \ + build-essential g++ git cmake flex bison texinfo python3 unzip bzip2 xz-utils \ + python-is-python3 python3-dev libgmp-dev libmpfr-dev && \ + rm -rf /var/cache/apt + +# Build the RTEMS toolchains +RUN git clone -b ${RTEMS_VER} --depth 1 https://gitlab.rtems.org/rtems/tools/rtems-source-builder.git && \ + cd rtems-source-builder/rtems && \ + ../source-builder/sb-set-builder --prefix=/opt/rtems-${RTEMS_VER} ${RTEMS_VER}/rtems-${RTEMS_ARCH} && \ + cd ${HOME} && rm -rf rtems-source-builder + +RUN ln -s /opt/rtems-${RTEMS_VER} /opt/rtems +RUN echo "\nRTEMS_VER=${RTEMS_VER}" \ + "\nRTEMS_ARCH=${RTEMS_ARCH}" \ + "\n" \ + > /opt/rtems-${RTEMS_VER}/rtems-tools-info diff --git a/yocto-sdk/Dockerfile b/yocto-sdk/Dockerfile new file mode 100644 index 0000000..7b3a23e --- /dev/null +++ b/yocto-sdk/Dockerfile @@ -0,0 +1,39 @@ +######################################################### +# Build the Yocto SDK image - contains QEMU riscv64 and mips toolchains +######################################################### + +ARG BASE_IMAGE=debian:trixie +FROM ${BASE_IMAGE} AS yocto-sdk-installer + + +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + python3-minimal python3-venv python3-pip file \ + ${EXTRA_PKGS} && \ + rm -rf /var/cache/apt + + +FROM yocto-sdk-installer AS yocto-sdk-qemuriscv64 + +# Fetch SDK binary packages +ADD https://developer.nasa.gov/cFS/yocto-sandbox/releases/download/v0.0.1-testing/poky-glibc-x86_64-core-image-cfecfs-riscv64-qemuriscv64-toolchain-5.0.12.sh /root/qemuriscv64-toolchain.sh + +RUN chmod a+x root/qemuriscv64-toolchain.sh + +# Install SDK +RUN /root/qemuriscv64-toolchain.sh -y + + +FROM yocto-sdk-installer AS yocto-sdk-qemumips + +# Fetch SDK binary packages +ADD https://developer.nasa.gov/cFS/yocto-sandbox/releases/download/v0.0.1-testing/poky-glibc-x86_64-core-image-cfecfs-mips32r2-qemumips-toolchain-5.0.12.sh /root/qemumips-toolchain.sh + +RUN chmod a+x root/qemumips-toolchain.sh + +# Install SDK +RUN /root/qemumips-toolchain.sh -y + +FROM scratch AS yocto-sdk + +COPY --from=yocto-sdk-qemuriscv64 /opt /opt +COPY --from=yocto-sdk-qemumips /opt /opt From 0cf7b30681a9512b45937e169993546396de5046 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Thu, 2 Apr 2026 14:07:31 -0400 Subject: [PATCH 02/11] Updates --- Makefile | 124 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 74 insertions(+), 50 deletions(-) diff --git a/Makefile b/Makefile index 17e0d36..94ff462 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # Example makefile for building all the images locally # This is useful when debugging, so as to not REQUIRE the use of CI/CD to build -LOCAL_TAG ?= test +LOCAL_TAG ?= $(shell git rev-parse --short HEAD) TGT_REPO ?= ghcr.io/core-flight-system/containers REPO_TAG ?= latest @@ -10,21 +10,24 @@ EXTRA_BUILDARGS += --progress=plain BASIC_IMAGE_SET += docker-executor BASIC_IMAGE_SET += cfsexec-qemu +BASIC_IMAGE_SET += cfsexec-linux +BASIC_IMAGE_SET += cfsexec-ubuntu22 # BASIC_IMAGE_SET += yocto-sdk BASIC_IMAGE_SET += gaisler-sparc-rcc-sdk BASIC_IMAGE_SET += arm-linux-sdk ALL_IMAGE_SET += $(BASIC_IMAGE_SET) BUILDENV_IMAGE_SET += cfsbuildenv-doxygen -BUILDENV_IMAGE_SET += cfsbuildenv-mcdc BUILDENV_IMAGE_SET += cfsbuildenv-linux +BUILDENV_IMAGE_SET += cfsbuildenv-mcdc BUILDENV_IMAGE_SET += cfsbuildenv-rtems5 BUILDENV_IMAGE_SET += cfsbuildenv-rtems6 -BUILDENV_IMAGE_SET += cfsbuildenv-el9 -BUILDENV_IMAGE_SET += cfsbuildenv-el8 # BUILDENV_IMAGE_SET += cfsbuildenv-yocto BUILDENV_IMAGE_SET += cfsbuildenv-arm-linux BUILDENV_IMAGE_SET += cfsbuildenv-gaisler-sparc-rcc +BUILDENV_IMAGE_SET += cfsbuildenv-ubuntu22 +BUILDENV_IMAGE_SET += cfsbuildenv-el9 +BUILDENV_IMAGE_SET += cfsbuildenv-el8 ALL_IMAGE_SET += $(BUILDENV_IMAGE_SET) # The rest of the images each need a custom rule with custom deps @@ -33,116 +36,137 @@ ALL_IMAGE_SET += rtems6-tools ALL_IMAGE_SET += rtems5-rtos ALL_IMAGE_SET += rtems6-rtos -BASIC_IMAGE_TARGETS := $(addsuffix .image,$(BASIC_IMAGE_SET)) -BUILDENV_IMAGE_TARGETS := $(addsuffix .image,$(BUILDENV_IMAGE_SET)) +ALL_BUILD_TARGETS := $(addsuffix .build,$(ALL_IMAGE_SET)) ALL_IMAGE_TARGETS := $(addsuffix .image,$(ALL_IMAGE_SET)) ALL_PUSH_TARGETS := $(addsuffix .push,$(ALL_IMAGE_SET)) ALL_PULL_TARGETS := $(addsuffix .pull,$(ALL_IMAGE_SET)) +ALL_TRYPULL_TARGETS := $(addsuffix .trypull,$(ALL_IMAGE_SET)) -$(ALL_IMAGE_TARGETS) $(ALL_PUSH_TARGETS) $(ALL_PULL_TARGETS): IMAGE_NAME = $(basename $(@)) +$(ALL_BUILD_TARGETS) $(ALL_IMAGE_TARGETS) $(ALL_PUSH_TARGETS) $(ALL_PULL_TARGETS): IMAGE_NAME = $(basename $(@)) -#$(BUILDENV_IMAGE_TARGETS): $(BASIC_IMAGE_TARGETS) +all: $(ALL_IMAGE_TARGETS) +push: $(ALL_PUSH_TARGETS) +pull: $(ALL_PULL_TARGETS) + +rtems5-rtos.build: rtems5-tools.image +rtems6-rtos.build: rtems6-tools.image +cfsbuildenv-rtems5.build: rtems5-rtos.image +cfsbuildenv-rtems6.build: rtems6-rtos.image +cfsbuildenv-arm-linux.build: arm-linux-sdk.image cfsbuildenv-linux.image +cfsbuildenv-gaisler-sparc-rcc.build: gaisler-sparc-rcc-sdk.image cfsbuildenv-linux.image -$(BASIC_IMAGE_TARGETS): + +%.build: docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) -f $(subst rtems5-,rtems-,$(subst rtems6-,rtems-,$(IMAGE_NAME)))/Dockerfile . # RTEMS 5 Tools -rtems5-tools.image: +rtems5-tools.build: docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) \ --build-arg RTEMS_VER=5 \ -f rtems-tools/Dockerfile . # RTEMS 6 Tools -rtems6-tools.image: +rtems6-tools.build: docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) \ --build-arg RTEMS_VER=6 \ -f rtems-tools/Dockerfile . # RTEMS 5 RTOS -rtems5-rtos.image: rtems5-tools.image +rtems5-rtos.build: docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) \ --build-arg TOOLS_IMAGE=rtems5-tools:$(LOCAL_TAG) \ --build-arg RTEMS_VER=5 \ -f rtems-rtos/Dockerfile . # RTEMS 6 RTOS -rtems6-rtos.image: rtems6-tools.image +rtems6-rtos.build: docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) \ --build-arg TOOLS_IMAGE=rtems6-tools:$(LOCAL_TAG) \ --build-arg RTEMS_VER=6 \ -f rtems-rtos/Dockerfile . # cFS Build Environment - RTEMS 5 -cfsbuildenv-rtems5.image: rtems5-rtos.image +cfsbuildenv-rtems5.build: docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) \ --build-arg RTEMS_RTOS_IMAGE=rtems5-rtos:$(LOCAL_TAG) \ -f cfsbuildenv-rtems/Dockerfile . # cFS Build Environment - RTEMS 6 -cfsbuildenv-rtems6.image: rtems6-rtos.image +cfsbuildenv-rtems6.build: docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) \ --build-arg RTEMS_RTOS_IMAGE=rtems6-rtos:$(LOCAL_TAG) \ -f cfsbuildenv-rtems/Dockerfile . -cfsbuildenv-doxygen.image: +cfsbuildenv-doxygen.build: docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) -f cfsbuildenv-doxygen/Dockerfile . -cfsbuildenv-mcdc.image: +cfsbuildenv-mcdc.build: docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) -f cfsbuildenv-mcdc/Dockerfile . -cfsbuildenv-linux.image cfsbuildenv-ubuntu22.image: +cfsbuildenv-linux.build cfsbuildenv-ubuntu22.build: docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) -f cfsbuildenv-dpkg/Dockerfile . -cfsbuildenv-el8.image cfsbuildenv-el9.image: +cfsbuildenv-el8.build cfsbuildenv-el9.build: docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) -f cfsbuildenv-rpm/Dockerfile . -cfsbuildenv-yocto.image: +cfsbuildenv-yocto.build: docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) \ --build-arg YOCTO_SDK_IMAGE=yocto-sdk:$(LOCAL_TAG) \ -f cfsbuildenv-yocto/Dockerfile . -cfsbuildenv-arm-linux.image: arm-linux-sdk.image cfsbuildenv-linux.image +cfsbuildenv-arm-linux.build: docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) \ --build-arg BASE_IMAGE=cfsbuildenv-linux:$(LOCAL_TAG) \ --build-arg SDK_IMAGE=arm-linux-sdk:$(LOCAL_TAG) \ -f cfsbuildenv-arm-linux/Dockerfile . -cfsbuildenv-gaisler-sparc-rcc.image: gaisler-sparc-rcc-sdk.image cfsbuildenv-linux.image +cfsbuildenv-gaisler-sparc-rcc.build: docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) \ --build-arg BASE_IMAGE=cfsbuildenv-linux:$(LOCAL_TAG) \ --build-arg SDK_IMAGE=gaisler-sparc-rcc-sdk:$(LOCAL_TAG) \ -f cfsbuildenv-gaisler-sparc-rcc/Dockerfile . -cfsexec-linux.image cfsexec-ubuntu22.image: +cfsexec-linux.build cfsexec-ubuntu22.build: docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) -f cfsexec-dpkg/Dockerfile . -$(ALL_PUSH_TARGETS): - docker tag $(IMAGE_NAME):$(LOCAL_TAG) $(TGT_REPO)/$(IMAGE_NAME):$(REPO_TAG) - docker push $(TGT_REPO)/$(IMAGE_NAME):$(REPO_TAG) +%.push: + docker tag $(IMAGE_NAME):$(LOCAL_TAG) $(TGT_REPO)/$(IMAGE_NAME):$(LOCAL_TAG) + docker push $(TGT_REPO)/$(IMAGE_NAME):$(LOCAL_TAG) -$(ALL_PULL_TARGETS): +%.pull: docker pull $(TGT_REPO)/$(IMAGE_NAME):$(REPO_TAG) -push: $(ALL_PUSH_TARGETS) -pull: $(ALL_PULL_TARGETS) -all: $(ALL_IMAGE_TARGETS) - -BASE_IMAGE_TGTS += arm-linux-sdk.image -BASE_IMAGE_TGTS += cfsbuildenv-doxygen.image -BASE_IMAGE_TGTS += docker-executor.image -BASE_IMAGE_TGTS += gaisler-sparc-rcc-sdk.image -BASE_IMAGE_TGTS += rtems5-rtos.image -BASE_IMAGE_TGTS += rtems5-tools.image -BASE_IMAGE_TGTS += rtems6-rtos.image -BASE_IMAGE_TGTS += rtems6-tools.image -BASE_IMAGE_TGTS += cfsbuildenv-rtems5.image -BASE_IMAGE_TGTS += cfsbuildenv-rtems6.image -BASE_IMAGE_TGTS += cfsbuildenv-linux.image -BASE_IMAGE_TGTS += cfsexec-linux.image - -$(BASE_IMAGE_TGTS): EXTRA_BUILDARGS += --build-arg BASE_IMAGE=debian:bookworm - -cfsbuildenv-el8.image: EXTRA_BUILDARGS += --build-arg BASE_IMAGE=rockylinux:8 -cfsbuildenv-el9.image: EXTRA_BUILDARGS += --build-arg BASE_IMAGE=rockylinux:9 - -cfsbuildenv-ubuntu22.image cfsexec-ubuntu22.image: EXTRA_BUILDARGS += --build-arg BASE_IMAGE=ubuntu:jammy +# the idea here is to check if the image was already built, and if so, just +# use the already-built image from the container repo. This is done by commit hash. +%.image: + docker pull $(TGT_REPO)/$(IMAGE_NAME):$(LOCAL_TAG) || $(MAKE) $(IMAGE_NAME).build + +# The following is a list of images that rely on a base +# image that uses the Debian-style package management via +# apt and dpkg, e.g. Debian/Ubuntu or any derivative thereof. +DPKG_BUILD_TARGETS += arm-linux-sdk.build +DPKG_BUILD_TARGETS += cfsbuildenv-doxygen.build +DPKG_BUILD_TARGETS += docker-executor.build +DPKG_BUILD_TARGETS += gaisler-sparc-rcc-sdk.build +DPKG_BUILD_TARGETS += rtems5-rtos.build +DPKG_BUILD_TARGETS += rtems5-tools.build +DPKG_BUILD_TARGETS += rtems6-rtos.build +DPKG_BUILD_TARGETS += rtems6-tools.build +DPKG_BUILD_TARGETS += cfsbuildenv-rtems5.build +DPKG_BUILD_TARGETS += cfsbuildenv-rtems6.build +DPKG_BUILD_TARGETS += cfsbuildenv-linux.build +DPKG_BUILD_TARGETS += cfsexec-linux.build + +$(DPKG_BUILD_TARGETS): EXTRA_BUILDARGS += --build-arg BASE_IMAGE=debian:bookworm + +# These images use rocky linux as an stand-in for RHEL +# They should work on any RHEL-like distro that uses rpm/dnf package management +%-el8.build: EXTRA_BUILDARGS += --build-arg BASE_IMAGE=rockylinux:8 +%-el9.build: EXTRA_BUILDARGS += --build-arg BASE_IMAGE=rockylinux:9 + +# These images are intentially using the older ubuntu baseline +%-ubuntu22.build: EXTRA_BUILDARGS += --build-arg BASE_IMAGE=ubuntu:jammy + +# attempt to pull the image before building it here +.SECONDEXPANSION: +$(ALL_PUSH_TARGETS): $$(IMAGE_NAME).image From e492b06cd8872208a897eaf1dd5f3bd8b0b1b5d7 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Thu, 2 Apr 2026 14:16:08 -0400 Subject: [PATCH 03/11] Updates --- Makefile | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index 94ff462..30bdfd4 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,8 @@ REPO_TAG ?= latest # The option --no-cache can be specified on command line if desired EXTRA_BUILDARGS += --progress=plain +QUALIFIED_IMAGE_NAME = $(IMAGE_NAME):$(LOCAL_TAG) + BASIC_IMAGE_SET += docker-executor BASIC_IMAGE_SET += cfsexec-qemu BASIC_IMAGE_SET += cfsexec-linux @@ -40,7 +42,6 @@ ALL_BUILD_TARGETS := $(addsuffix .build,$(ALL_IMAGE_SET)) ALL_IMAGE_TARGETS := $(addsuffix .image,$(ALL_IMAGE_SET)) ALL_PUSH_TARGETS := $(addsuffix .push,$(ALL_IMAGE_SET)) ALL_PULL_TARGETS := $(addsuffix .pull,$(ALL_IMAGE_SET)) -ALL_TRYPULL_TARGETS := $(addsuffix .trypull,$(ALL_IMAGE_SET)) $(ALL_BUILD_TARGETS) $(ALL_IMAGE_TARGETS) $(ALL_PUSH_TARGETS) $(ALL_PULL_TARGETS): IMAGE_NAME = $(basename $(@)) @@ -57,81 +58,81 @@ cfsbuildenv-gaisler-sparc-rcc.build: gaisler-sparc-rcc-sdk.image cfsbuildenv-lin %.build: - docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) -f $(subst rtems5-,rtems-,$(subst rtems6-,rtems-,$(IMAGE_NAME)))/Dockerfile . + docker build $(EXTRA_BUILDARGS) -t $(QUALIFIED_IMAGE_NAME) -f $(subst rtems5-,rtems-,$(subst rtems6-,rtems-,$(IMAGE_NAME)))/Dockerfile . # RTEMS 5 Tools rtems5-tools.build: - docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) \ + docker build $(EXTRA_BUILDARGS) -t $(QUALIFIED_IMAGE_NAME) \ --build-arg RTEMS_VER=5 \ -f rtems-tools/Dockerfile . # RTEMS 6 Tools rtems6-tools.build: - docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) \ + docker build $(EXTRA_BUILDARGS) -t $(QUALIFIED_IMAGE_NAME) \ --build-arg RTEMS_VER=6 \ -f rtems-tools/Dockerfile . # RTEMS 5 RTOS rtems5-rtos.build: - docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) \ + docker build $(EXTRA_BUILDARGS) -t $(QUALIFIED_IMAGE_NAME) \ --build-arg TOOLS_IMAGE=rtems5-tools:$(LOCAL_TAG) \ --build-arg RTEMS_VER=5 \ -f rtems-rtos/Dockerfile . # RTEMS 6 RTOS rtems6-rtos.build: - docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) \ + docker build $(EXTRA_BUILDARGS) -t $(QUALIFIED_IMAGE_NAME) \ --build-arg TOOLS_IMAGE=rtems6-tools:$(LOCAL_TAG) \ --build-arg RTEMS_VER=6 \ -f rtems-rtos/Dockerfile . # cFS Build Environment - RTEMS 5 cfsbuildenv-rtems5.build: - docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) \ + docker build $(EXTRA_BUILDARGS) -t $(QUALIFIED_IMAGE_NAME) \ --build-arg RTEMS_RTOS_IMAGE=rtems5-rtos:$(LOCAL_TAG) \ -f cfsbuildenv-rtems/Dockerfile . # cFS Build Environment - RTEMS 6 cfsbuildenv-rtems6.build: - docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) \ + docker build $(EXTRA_BUILDARGS) -t $(QUALIFIED_IMAGE_NAME) \ --build-arg RTEMS_RTOS_IMAGE=rtems6-rtos:$(LOCAL_TAG) \ -f cfsbuildenv-rtems/Dockerfile . cfsbuildenv-doxygen.build: - docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) -f cfsbuildenv-doxygen/Dockerfile . + docker build $(EXTRA_BUILDARGS) -t $(QUALIFIED_IMAGE_NAME) -f cfsbuildenv-doxygen/Dockerfile . cfsbuildenv-mcdc.build: - docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) -f cfsbuildenv-mcdc/Dockerfile . + docker build $(EXTRA_BUILDARGS) -t $(QUALIFIED_IMAGE_NAME) -f cfsbuildenv-mcdc/Dockerfile . cfsbuildenv-linux.build cfsbuildenv-ubuntu22.build: - docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) -f cfsbuildenv-dpkg/Dockerfile . + docker build $(EXTRA_BUILDARGS) -t $(QUALIFIED_IMAGE_NAME) -f cfsbuildenv-dpkg/Dockerfile . cfsbuildenv-el8.build cfsbuildenv-el9.build: - docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) -f cfsbuildenv-rpm/Dockerfile . + docker build $(EXTRA_BUILDARGS) -t $(QUALIFIED_IMAGE_NAME) -f cfsbuildenv-rpm/Dockerfile . cfsbuildenv-yocto.build: - docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) \ + docker build $(EXTRA_BUILDARGS) -t $(QUALIFIED_IMAGE_NAME) \ --build-arg YOCTO_SDK_IMAGE=yocto-sdk:$(LOCAL_TAG) \ -f cfsbuildenv-yocto/Dockerfile . cfsbuildenv-arm-linux.build: - docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) \ + docker build $(EXTRA_BUILDARGS) -t $(QUALIFIED_IMAGE_NAME) \ --build-arg BASE_IMAGE=cfsbuildenv-linux:$(LOCAL_TAG) \ --build-arg SDK_IMAGE=arm-linux-sdk:$(LOCAL_TAG) \ -f cfsbuildenv-arm-linux/Dockerfile . cfsbuildenv-gaisler-sparc-rcc.build: - docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) \ + docker build $(EXTRA_BUILDARGS) -t $(QUALIFIED_IMAGE_NAME) \ --build-arg BASE_IMAGE=cfsbuildenv-linux:$(LOCAL_TAG) \ --build-arg SDK_IMAGE=gaisler-sparc-rcc-sdk:$(LOCAL_TAG) \ -f cfsbuildenv-gaisler-sparc-rcc/Dockerfile . cfsexec-linux.build cfsexec-ubuntu22.build: - docker build $(EXTRA_BUILDARGS) -t $(IMAGE_NAME):$(LOCAL_TAG) -f cfsexec-dpkg/Dockerfile . + docker build $(EXTRA_BUILDARGS) -t $(QUALIFIED_IMAGE_NAME) -f cfsexec-dpkg/Dockerfile . %.push: - docker tag $(IMAGE_NAME):$(LOCAL_TAG) $(TGT_REPO)/$(IMAGE_NAME):$(LOCAL_TAG) - docker push $(TGT_REPO)/$(IMAGE_NAME):$(LOCAL_TAG) + docker tag $(QUALIFIED_IMAGE_NAME) $(TGT_REPO)/$(QUALIFIED_IMAGE_NAME) + docker push $(TGT_REPO)/$(QUALIFIED_IMAGE_NAME) %.pull: docker pull $(TGT_REPO)/$(IMAGE_NAME):$(REPO_TAG) @@ -139,7 +140,7 @@ cfsexec-linux.build cfsexec-ubuntu22.build: # the idea here is to check if the image was already built, and if so, just # use the already-built image from the container repo. This is done by commit hash. %.image: - docker pull $(TGT_REPO)/$(IMAGE_NAME):$(LOCAL_TAG) || $(MAKE) $(IMAGE_NAME).build + docker pull $(TGT_REPO)/$(QUALIFIED_IMAGE_NAME) || $(MAKE) $(IMAGE_NAME).build # The following is a list of images that rely on a base # image that uses the Debian-style package management via From bc6ea9f3f3d22bb907dd13c6c5c387b7fbcdd2be Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Thu, 2 Apr 2026 14:30:48 -0400 Subject: [PATCH 04/11] Updates --- cfsbuildenv-dpkg/Dockerfile | 2 +- yocto-sdk/Dockerfile | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/cfsbuildenv-dpkg/Dockerfile b/cfsbuildenv-dpkg/Dockerfile index 7860991..0313bef 100644 --- a/cfsbuildenv-dpkg/Dockerfile +++ b/cfsbuildenv-dpkg/Dockerfile @@ -13,7 +13,7 @@ ARG EXTRA_PKGS="" RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ sudo ca-certificates curl lsb-release software-properties-common \ - build-essential gcc g++ gawk cmake lcov xsltproc rsync jq \ + build-essential gcc g++ gawk cmake lcov xsltproc rsync jq file \ python3 python3-venv python3-dev python3-pip openssh-client \ libexpat-dev liblua5.3-dev libjson-c-dev xz-utils cppcheck clang-format \ ${EXTRA_PKGS} && \ diff --git a/yocto-sdk/Dockerfile b/yocto-sdk/Dockerfile index 7b3a23e..dc3e433 100644 --- a/yocto-sdk/Dockerfile +++ b/yocto-sdk/Dockerfile @@ -2,10 +2,13 @@ # Build the Yocto SDK image - contains QEMU riscv64 and mips toolchains ######################################################### -ARG BASE_IMAGE=debian:trixie -FROM ${BASE_IMAGE} AS yocto-sdk-installer +ARG BASE_IMAGE=cfsbuildenv-linux:test +FROM ${BASE_IMAGE} AS yocto-sdk-builder +ARG YOCTO_BRANCH=scarthgap +RUN git clone git://git.openembedded.org/meta-openembedded -b ${YOCTO_BRANCH} --depth 1 +RUN git clone git://git.yoctoproject.org/poky -b ${YOCTO_BRANCH} --depth 1 RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ python3-minimal python3-venv python3-pip file \ ${EXTRA_PKGS} && \ From e53ce9071e148110fbc180864ed88552a4a7082e Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Thu, 2 Apr 2026 14:31:05 -0400 Subject: [PATCH 05/11] Squashed 'yocto-sdk/meta-cfecfs/' content from commit dbe5a69 git-subtree-dir: yocto-sdk/meta-cfecfs git-subtree-split: dbe5a6936d3c2dc6b9418b611ff62c2bce972374 --- README.md | 32 + conf/layer.conf | 16 + conf/templates/default/bblayers.conf.sample | 17 + conf/templates/default/conf-notes.txt | 29 + conf/templates/default/local.conf.sample | 272 ++++++ images/core-image-cfecfs-rt.bb | 7 + images/core-image-cfecfs.bb | 6 + images/core-image-cfecfs.inc | 51 ++ recipes/base-files/base-files/qemuall/fstab | 11 + recipes/base-files/base-files_%.bbappend | 3 + recipes/cfs-support/cfs-support_0.1.bb | 28 + recipes/cfs-support/files/LICENSE | 201 +++++ recipes/cfs-support/files/init.d/cfs | 64 ++ recipes/cfs-support/files/manager/Makefile | 18 + .../cfs-support/files/manager/cfs-manager.c | 824 ++++++++++++++++++ .../init-ifupdown/qemuall/interfaces | 8 + .../init-ifupdown/init-ifupdown_%.bbappend | 1 + recipes/lua/lua/lua.pc | 11 + recipes/lua/lua/uclibc-pthread.patch | 13 + recipes/packagegroups/packagegroup-cfecfs.bb | 42 + 20 files changed, 1654 insertions(+) create mode 100644 README.md create mode 100644 conf/layer.conf create mode 100644 conf/templates/default/bblayers.conf.sample create mode 100644 conf/templates/default/conf-notes.txt create mode 100644 conf/templates/default/local.conf.sample create mode 100644 images/core-image-cfecfs-rt.bb create mode 100644 images/core-image-cfecfs.bb create mode 100644 images/core-image-cfecfs.inc create mode 100644 recipes/base-files/base-files/qemuall/fstab create mode 100644 recipes/base-files/base-files_%.bbappend create mode 100644 recipes/cfs-support/cfs-support_0.1.bb create mode 100644 recipes/cfs-support/files/LICENSE create mode 100644 recipes/cfs-support/files/init.d/cfs create mode 100644 recipes/cfs-support/files/manager/Makefile create mode 100644 recipes/cfs-support/files/manager/cfs-manager.c create mode 100644 recipes/init-ifupdown/init-ifupdown/qemuall/interfaces create mode 100644 recipes/init-ifupdown/init-ifupdown_%.bbappend create mode 100644 recipes/lua/lua/lua.pc create mode 100644 recipes/lua/lua/uclibc-pthread.patch create mode 100644 recipes/packagegroups/packagegroup-cfecfs.bb diff --git a/README.md b/README.md new file mode 100644 index 0000000..aa00cc1 --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +# CFE/CFS layer for Yocto + +This repository contains supplemental recipes that aid in creating embedded Linux +targets to host CFE/CFS. Additional image targets are defined which contain the +dependencies for building and running CFS, as well as additional libraries and +tools that may be helpful for flight software deployment on Linux. + +This layer may be used in conjunction with the "Poky" reference distribution from +the Yocto project to test and validate CFS on embedded linux, or as part of a +larger Yocto project based on a BSP from a hardware vendor for real deployment. + +Note that for real deployment, it is expected that the image contents will need +additional customization beyond the "core-image-cfecfs" targets defined here. +This can be done by adding additional layers or by modifying the local.conf +file to customize the image. + +## Getting Started + +The traditional approach for Yocto is to source the `oe-init-build-env` script. +This sets up various enviroment variables in the _current_ shell to allow running +bitbake. This layer also contains a template, and it can be used by setting +`TEMPLATECONF` before initializing the build environment. This is only relevant +when creating new projects. + +For example (to be run from the parent directory, where "meta-cfecfs" and other +layers have been cloned): +``` + export TEMPLATECONF=$PWD/meta-cfecfs/conf/templates/default + cd poky + source ./oe-init-build-env ../ +``` +Replace `` in the above with the desired name of your build directory diff --git a/conf/layer.conf b/conf/layer.conf new file mode 100644 index 0000000..306b28a --- /dev/null +++ b/conf/layer.conf @@ -0,0 +1,16 @@ +# We have a conf and classes directory, add to BBPATH +BBPATH .= ":${LAYERDIR}" + +LAYERSERIES_COMPAT_cfecfs = "kirkstone scarthgap walnascar" + +# We have recipe directories, add to BBFILES +BBFILES += "${LAYERDIR}/recipes/*/*.bb \ + ${LAYERDIR}/recipes/*/*.bbappend \ + ${LAYERDIR}/images/*.bb \ + ${LAYERDIR}/images/*.bbappend " + +BBFILE_COLLECTIONS += "cfecfs" +BBFILE_PATTERN_cfecfs = "^${LAYERDIR}/" +BBFILE_PRIORITY_cfecfs = "7" +LAYERVERSION_cfecfs = "1" + diff --git a/conf/templates/default/bblayers.conf.sample b/conf/templates/default/bblayers.conf.sample new file mode 100644 index 0000000..205a8f9 --- /dev/null +++ b/conf/templates/default/bblayers.conf.sample @@ -0,0 +1,17 @@ +# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf +# changes incompatibly +LCONF_VERSION = "7" + +BBPATH = "${TOPDIR}" +BBFILES ?= "" + +BBLAYERS ?= " \ + ##OEROOT##/meta \ + ##OEROOT##/meta-poky \ + ##OEROOT##/meta-yocto-bsp \ + ##OEROOT##/../meta-cfecfs \ + ##OEROOT##/../meta-openembedded/meta-oe \ + ##OEROOT##/../meta-openembedded/meta-python \ + ##OEROOT##/../meta-openembedded/meta-networking \ + ##OEROOT##/../meta-openembedded/meta-webserver \ + " diff --git a/conf/templates/default/conf-notes.txt b/conf/templates/default/conf-notes.txt new file mode 100644 index 0000000..0f6e4fc --- /dev/null +++ b/conf/templates/default/conf-notes.txt @@ -0,0 +1,29 @@ +### Shell environment set up for builds. ### + +You can now run '[MACHINE=] bitbake ' + +The default machine is a virtualized RISC-V target that +can be launched using QEMU. If targeting real hardware, +obtain a Yocto BSP from the hardware vendor and add it to +the layers using: + bitbake-layers add-layer + +After adding a BSP the MACHINE specification may be +changed accordingly by editing conf/local.conf + +Example targets for CFE/CFS: + core-image-cfecfs + core-image-cfecfs-rt + +Other standard Yocto targets are: + core-image-minimal + core-image-minimal-dev + core-image-minimal-mtdutils + +To build a resuable SDK to compile CFS externally: + bitbake -c populate_sdk core-image-cfecfs + +Other commonly useful commands are: + - 'devtool' and 'recipetool' handle common recipe tasks + - 'bitbake-layers' handles common layer tasks + - 'oe-pkgdata-util' handles common target package tasks diff --git a/conf/templates/default/local.conf.sample b/conf/templates/default/local.conf.sample new file mode 100644 index 0000000..28b6663 --- /dev/null +++ b/conf/templates/default/local.conf.sample @@ -0,0 +1,272 @@ +# +# This file is your local configuration file and is where all local user settings +# are placed. The comments in this file give some guide to the options a new user +# to the system might want to change but pretty much any configuration option can +# be set in this file. More adventurous users can look at +# local.conf.sample.extended which contains other examples of configuration which +# can be placed in this file but new users likely won't need any of them +# initially. There's also site.conf.sample which contains examples of site specific +# information such as proxy server addresses. +# +# Lines starting with the '#' character are commented out and in some cases the +# default values are provided as comments to show people example syntax. Enabling +# the option is a question of removing the # character and making any change to the +# variable as required. + +# +# Machine Selection +# + +# Default to a virtualized RISCV64 target. This is a generic substitute for future +# RISC-V based flight hardware, such as HPSC. It may be changed to target physical +# hardware. +MACHINE ?= "qemuriscv64" + +# These are some of the more commonly used values. Looking at the files in the +# meta/conf/machine directory, or the conf/machine directory of any additional layers +# you add in will show all the available machines. + +# +# Where to place downloads +# +# During a first build the system will download many different source code tarballs +# from various upstream projects. This can take a while, particularly if your network +# connection is slow. These are all stored in DL_DIR. When wiping and rebuilding you +# can preserve this directory to speed up this part of subsequent builds. This directory +# is safe to share between multiple builds on the same machine too. +# +# The default is a downloads directory under the parent of TOPDIR. This allows multiple +# builds to share the same downloads. +# +DL_DIR ?= "${TOPDIR}/../downloads" + +# +# Where to place shared-state files +# +# BitBake has the capability to accelerate builds based on previously built output. +# This is done using "shared state" files which can be thought of as cache objects +# and this option determines where those files are placed. +# +# You can wipe out TMPDIR leaving this directory intact and the build would regenerate +# from these files if no changes were made to the configuration. If changes were made +# to the configuration, only shared state files where the state was still valid would +# be used (done using checksums). +# +# The default is a sstate-cache directory under the parent of TOPDIR. This allows multiple +# builds to share the same sstate-cache. +# +SSTATE_DIR ?= "${TOPDIR}/../sstate-cache" + +# +# Where to place the build output +# +# This option specifies where the bulk of the building work should be done and +# where BitBake should place its temporary files and output. Keep in mind that +# this includes the extraction and compilation of many applications and the toolchain +# which can use Gigabytes of hard disk space. +# +# The default is a tmp directory under TOPDIR. +# +#TMPDIR = "${TOPDIR}/tmp" + +# +# Default policy config +# +# The distribution setting controls which policy settings are used as defaults. +# The default value is fine for general Yocto project use, at least initially. +# Ultimately when creating custom policy, people will likely end up subclassing +# these defaults. +# +DISTRO ?= "poky" +# As an example of a subclass there is a "bleeding" edge policy configuration +# where many versions are set to the absolute latest code from the upstream +# source control systems. This is just mentioned here as an example, its not +# useful to most new users. +# DISTRO ?= "poky-bleeding" + +# +# Package Management configuration +# +# This variable lists which packaging formats to enable. Multiple package backends +# can be enabled at once and the first item listed in the variable will be used +# to generate the root filesystems. +# Options are: +# - 'package_deb' for debian style deb files +# - 'package_ipk' for ipk files are used by opkg (a debian style embedded package manager) +# - 'package_rpm' for rpm style packages +# E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk" +# OE-Core defaults to ipkg, whilst Poky defaults to rpm: +# PACKAGE_CLASSES ?= "package_rpm" + +# +# SDK target architecture +# +# This variable specifies the architecture to build SDK items for and means +# you can build the SDK packages for architectures other than the machine you are +# running the build on (i.e. building i686 packages on an x86_64 host). +# Supported values are i686, x86_64, aarch64 +#SDKMACHINE ?= "i686" + +# +# Extra image configuration defaults +# +# The EXTRA_IMAGE_FEATURES variable allows extra packages to be added to the generated +# images. Some of these options are added to certain image types automatically. Some +# of the features available are: +# "dbg-pkgs" - add -dbg packages for all installed packages +# (adds symbol information for debugging/profiling) +# "src-pkgs" - add -src packages for all installed packages +# (adds source code for debugging) +# "dev-pkgs" - add -dev packages for all installed packages +# (useful if you want to develop against libs in the image) +# "ptest-pkgs" - add -ptest packages for all ptest-enabled packages +# (useful if you want to run the package test suites) +# "tools-sdk" - add development tools (gcc, make, pkgconfig etc.) +# "tools-debug" - add debugging tools (gdb, strace) +# "eclipse-debug" - add Eclipse remote debugging support +# "tools-profile" - add profiling tools (oprofile, lttng, valgrind) +# "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.) +# "allow-empty-password" - allow users to have an empty password +# "empty-root-password" - the root user has no password set +# "allow-root-login - the root user can login +# There are other features that can be used here too, see +# meta/classes-recipe/image.bbclass and +# meta/classes-recipe/core-image.bbclass for more details. +# We default to allowing root login without a password for convenience. +EXTRA_IMAGE_FEATURES ?= "allow-empty-password empty-root-password allow-root-login" + +# +# Additional image features +# +# The following is a list of additional classes to use when building images which +# enable extra features. Some available options which can be included in this variable +# are: +# - 'buildstats' collect build statistics +USER_CLASSES ?= "buildstats" + +# +# Runtime testing of images +# +# The build system can test booting virtual machine images under qemu (an emulator) +# after any root filesystems are created and run tests against those images. It can also +# run tests against any SDK that are built. To enable this uncomment these lines. +# See meta/classes-recipe/test{image,sdk}.bbclass for further details. +#IMAGE_CLASSES += "testimage testsdk" +#TESTIMAGE_AUTO:qemuall = "1" + +# +# Interactive shell configuration +# +# Under certain circumstances the system may need input from you and to do this it +# can launch an interactive shell. It needs to do this since the build is +# multithreaded and needs to be able to handle the case where more than one parallel +# process may require the user's attention. The default is iterate over the available +# terminal types to find one that works. +# +# Examples of the occasions this may happen are when resolving patches which cannot +# be applied, to use the devshell or the kernel menuconfig +# +# Supported values are auto, gnome, xfce, rxvt, screen, konsole (KDE 3.x only), none +# Note: currently, Konsole support only works for KDE 3.x due to the way +# newer Konsole versions behave +#OE_TERMINAL = "auto" +# By default disable interactive patch resolution (tasks will just fail instead): +PATCHRESOLVE = "noop" + +# +# Disk Space Monitoring during the build +# +# Monitor the disk space during the build. If there is less that 1GB of space or less +# than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully +# shutdown the build. If there is less than 100MB or 1K inodes, perform a hard halt +# of the build. The reason for this is that running completely out of space can corrupt +# files and damages the build in ways which may not be easily recoverable. +# It's necessary to monitor /tmp, if there is no space left the build will fail +# with very exotic errors. +BB_DISKMON_DIRS ??= "\ + STOPTASKS,${TMPDIR},1G,100K \ + STOPTASKS,${DL_DIR},1G,100K \ + STOPTASKS,${SSTATE_DIR},1G,100K \ + STOPTASKS,/tmp,100M,100K \ + HALT,${TMPDIR},100M,1K \ + HALT,${DL_DIR},100M,1K \ + HALT,${SSTATE_DIR},100M,1K \ + HALT,/tmp,10M,1K" + +# +# Shared-state files from other locations +# +# As mentioned above, shared state files are prebuilt cache data objects which can be +# used to accelerate build time. This variable can be used to configure the system +# to search other mirror locations for these objects before it builds the data itself. +# +# This can be a filesystem directory, or a remote url such as https or ftp. These +# would contain the sstate-cache results from previous builds (possibly from other +# machines). This variable works like fetcher MIRRORS/PREMIRRORS and points to the +# cache locations to check for the shared objects. +# NOTE: if the mirror uses the same structure as SSTATE_DIR, you need to add PATH +# at the end as shown in the examples below. This will be substituted with the +# correct path within the directory structure. +#SSTATE_MIRRORS ?= "\ +#file://.* https://someserver.tld/share/sstate/PATH;downloadfilename=PATH \ +#file://.* file:///some/local/dir/sstate/PATH" + +# +# Yocto Project SState Mirror +# +# The Yocto Project has prebuilt artefacts available for its releases, you can enable +# use of these by uncommenting some of the following lines. This will mean the build uses +# the network to check for artefacts at the start of builds, which does slow it down +# initially but it will then speed up the builds by not having to build things if they are +# present in the cache. It assumes you can download something faster than you can build it +# which will depend on your network. +# Note: For this to work you also need hash-equivalence passthrough to the matching server +# There is a choice between our sstate server directly and a faster content delivery network +# (CDN) kindly provided by JSDelivr, uncomment one of the SSTATE_MIRRORS lines, not both. +# Using the CDN rather than the yoctoproject.org address is suggested/preferred. +# +#BB_HASHSERVE_UPSTREAM = 'wss://hashserv.yoctoproject.org/ws' +#SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/all/PATH;downloadfilename=PATH" + +# +# Qemu configuration +# +# By default native qemu will build with a builtin VNC server where graphical output can be +# seen. The line below enables the SDL UI frontend too. +PACKAGECONFIG:append:pn-qemu-system-native = " sdl" +# By default libsdl2-native will be built, if you want to use your host's libSDL instead of +# the minimal libsdl built by libsdl2-native then uncomment the ASSUME_PROVIDED line below. +#ASSUME_PROVIDED += "libsdl2-native" + +# You can also enable the Gtk UI frontend, which takes somewhat longer to build, but adds +# a handy set of menus for controlling the emulator. +#PACKAGECONFIG:append:pn-qemu-system-native = " gtk+" + +# +# Hash Equivalence +# +# Enable support for automatically running a local hash equivalence server and +# instruct bitbake to use a hash equivalence aware signature generator. Hash +# equivalence improves reuse of sstate by detecting when a given sstate +# artifact can be reused as equivalent, even if the current task hash doesn't +# match the one that generated the artifact. +# +# A shared hash equivalent server can be set with ":" format +# +#BB_HASHSERVE = "auto" +#BB_SIGNATURE_HANDLER = "OEEquivHash" + +# +# Memory Resident Bitbake +# +# Bitbake's server component can stay in memory after the UI for the current command +# has completed. This means subsequent commands can run faster since there is no need +# for bitbake to reload cache files and so on. Number is in seconds, after which the +# server will shut down. +# +#BB_SERVER_TIMEOUT = "60" + +# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to +# track the version of this file when it was generated. This can safely be ignored if +# this doesn't mean anything to you. +CONF_VERSION = "2" diff --git a/images/core-image-cfecfs-rt.bb b/images/core-image-cfecfs-rt.bb new file mode 100644 index 0000000..30ada6b --- /dev/null +++ b/images/core-image-cfecfs-rt.bb @@ -0,0 +1,7 @@ +# Start with the basic minimal image from the poky upstream +# Although the name suggests minimalism, this base image actually includes quite a bit +require recipes-rt/images/core-image-rt.bb +require images/core-image-cfecfs.inc + +# NOTE: set PREFERRED_PROVIDER_virtual/kernel in local.conf to use this. +# See upstream core-image-rt.bb file diff --git a/images/core-image-cfecfs.bb b/images/core-image-cfecfs.bb new file mode 100644 index 0000000..2ffcc34 --- /dev/null +++ b/images/core-image-cfecfs.bb @@ -0,0 +1,6 @@ +# Start with the basic minimal image from the poky upstream +# Although the name suggests minimalism, this base image actually includes quite a bit +require recipes-core/images/core-image-minimal.bb +require images/core-image-cfecfs.inc + + diff --git a/images/core-image-cfecfs.inc b/images/core-image-cfecfs.inc new file mode 100644 index 0000000..1267351 --- /dev/null +++ b/images/core-image-cfecfs.inc @@ -0,0 +1,51 @@ +# List of additional packages to support CFE/CFS on embedded linux + +# install the kernel modules +IMAGE_INSTALL += "kernel-modules" + +# Time synchronization - this adds dependency to oe "networking" layer +IMAGE_INSTALL += "ntp" + +# Basic startup scripts for CFS +IMAGE_INSTALL += "cfs-support" + +# Connectivity networking packages +IMAGE_INSTALL += "dhcpcd packagegroup-core-ssh-dropbear" + +# Useful tools for file transfer +IMAGE_INSTALL += "lrzsz rsync tftp-hpa" + +# Filesystem and MTD device tools +IMAGE_INSTALL += "mtd-utils e2fsprogs dosfstools util-linux" + +# Generic file compression tools/libraries +IMAGE_INSTALL += "zlib libbz2 xz gzip bzip2 lz4" + +# Support for CFE/STRS OE using embedded webserver/FCGI/JSON +IMAGE_INSTALL += "fcgi json-c lighttpd lua" + +# Additional lighttpd modules +IMAGE_INSTALL += "\ + lighttpd-module-auth \ + lighttpd-module-proxy \ + lighttpd-module-dirlisting \ + lighttpd-module-webdav \ + lighttpd-module-openssl \ + lighttpd-module-deflate \ + lighttpd-module-accesslog \ + lighttpd-module-status \ + " + +# CFS should use a read-only root file system to enhance robustness in the possibility of +# spurious/unclean reboots +IMAGE_FEATURES += "read-only-rootfs" + +# Configuration for the SDK generated with 'populate_sdk' +# Include kernel source so modules can be compiled by the SDK +TOOLCHAIN_TARGET_TASK:append = " kernel-dev" + +# Include static development libraries +SDKIMAGE_FEATURES:append = " staticdev-pkgs" + +# set the hostname to cfs +hostname:pn-base-files = "cfs" \ No newline at end of file diff --git a/recipes/base-files/base-files/qemuall/fstab b/recipes/base-files/base-files/qemuall/fstab new file mode 100644 index 0000000..bb54eed --- /dev/null +++ b/recipes/base-files/base-files/qemuall/fstab @@ -0,0 +1,11 @@ +# stock fstab - you probably want to override this with a machine specific one + +/dev/root / auto defaults 1 1 +proc /proc proc defaults 0 0 +devpts /dev/pts devpts mode=0620,ptmxmode=0666,gid=5 0 0 +tmpfs /run tmpfs mode=0755,nodev,nosuid,strictatime 0 0 +tmpfs /var/volatile tmpfs defaults 0 0 + +# mount point for CFS partition +# this is assumed to be a separate block device +LABEL=cFS /cfs auto relatime 0 2 diff --git a/recipes/base-files/base-files_%.bbappend b/recipes/base-files/base-files_%.bbappend new file mode 100644 index 0000000..ff56e8f --- /dev/null +++ b/recipes/base-files/base-files_%.bbappend @@ -0,0 +1,3 @@ +# This recipe just has some simple overrides for files in the base-files package + +FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:" diff --git a/recipes/cfs-support/cfs-support_0.1.bb b/recipes/cfs-support/cfs-support_0.1.bb new file mode 100644 index 0000000..5ede926 --- /dev/null +++ b/recipes/cfs-support/cfs-support_0.1.bb @@ -0,0 +1,28 @@ +SUMMARY = "Support package for CFE/CFS" +DESCRIPTION = "This includes scripts to mount the CFS partition and start CFS on boot" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327" + +SRC_URI = "file://init.d/cfs \ + file://LICENSE \ + " +S = "${WORKDIR}" + +INHIBIT_DEFAULT_DEPS = "1" + +do_install () { + install -m 0755 -d ${D}/cfs + install -m 0755 -d ${D}/${sysconfdir}/init.d + install -m 0644 ${WORKDIR}/init.d/cfs ${D}${sysconfdir}/init.d/cfs + #install -m 0644 ${WORKDIR}/motd ${D}${sysconfdir}/motd +} + +#PACKAGES = "${PN}-doc ${PN} ${PN}-dev ${PN}-dbg" +FILES:${PN} = "/" + +PACKAGE_ARCH = "${MACHINE_ARCH}" + +#CONFFILES:${PN} = "${sysconfdir}/" +#CONFFILES:${PN} += "${sysconfdir}/motd ${sysconfdir}/nsswitch.conf ${sysconfdir}/profile" +# +#INSANE_SKIP:${PN} += "empty-dirs" diff --git a/recipes/cfs-support/files/LICENSE b/recipes/cfs-support/files/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/recipes/cfs-support/files/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/recipes/cfs-support/files/init.d/cfs b/recipes/cfs-support/files/init.d/cfs new file mode 100644 index 0000000..034459f --- /dev/null +++ b/recipes/cfs-support/files/init.d/cfs @@ -0,0 +1,64 @@ +#! /bin/sh + +### BEGIN INIT INFO +# Provides: cfs +# Required-Start: $network $remote_fs $syslog +# Required-Stop: $network $remote_fs $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: +# Short-Description: Start Core Flight System +### END INIT INFO + +PATH=/sbin:/bin:/usr/bin:/usr/sbin + +DAEMON=$(echo /cfs/core-*) +PIDFILE=/var/run/cfs.pid + +# Source function library. +. /etc/init.d/functions + +# Functions to do individual actions +startcfs(){ + # The -g option allows ntpd to step the time to correct it just + # once. The daemon will exit if the clock drifts too much after + # this. If ntpd seems to disappear after a while assume TICKADJ + # above is set to a totally incorrect value. + echo -n "Starting cfs: " + start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --startas $DAEMON -- "$@" + echo "done" +} +stopcfs(){ + echo -n "Stopping cfs: " + start-stop-daemon --stop --quiet --oknodo -p $PIDFILE + echo "done" +} + +case "$1" in + start) + settick + startdaemon + ;; + stop) + stopdaemon + ;; + force-reload) + stopdaemon + startdaemon + ;; + restart) + stopdaemon + startdaemon + ;; + reload) + stopdaemon + startdaemon + ;; + status) + ;; + *) + echo "Usage: cfs { start | stop | status | restart | reload }" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/recipes/cfs-support/files/manager/Makefile b/recipes/cfs-support/files/manager/Makefile new file mode 100644 index 0000000..5aa95a3 --- /dev/null +++ b/recipes/cfs-support/files/manager/Makefile @@ -0,0 +1,18 @@ + +# This gives the full POSIX 2008 API +CFLAGS += -D_XOPEN_SOURCE=700 + +SOURCES = cfs-manager.c + +.PHONY: all clean + +all: cfs-manager +clean: + rm -f cfs-manager cfs-manager.o + +cfs-manager: $(SOURCES:%.c=%.o) + $(CC) $(CFLAGS) -o $(@) $(^) + +%.o: %c + $(CC) $(CFLAGS) -o $(@) -c $(<) + diff --git a/recipes/cfs-support/files/manager/cfs-manager.c b/recipes/cfs-support/files/manager/cfs-manager.c new file mode 100644 index 0000000..dbdf6f0 --- /dev/null +++ b/recipes/cfs-support/files/manager/cfs-manager.c @@ -0,0 +1,824 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +/* the status/exit code from cFS when a poweron restart is commanded */ +#define CFS_SYSTEM_RESTART_EXITCODE -42 + +/* amount of time cFS must run for in order to be considered a valid boot */ +#define CFS_MINIMUM_RUN_TIME 15 + +/* max number of times to run the main loop */ +/* this is only for rapid loops - if CFS_MINIMUM_RUN_TIME is met, the counter resets */ +#define MAX_LOOP_COUNT 16 + +/* size of ring buffer for stdout, keep to a power of 2 */ +#define BUFFER_RING_SIZE 256 + +const char LOGGER_DEFAULT_IDENT[] = "CFS"; + +typedef enum cfs_statuscode +{ + cfs_statuscode_failure = -1, + cfs_statuscode_undefined = 0, + cfs_statuscode_poweron_restart_req = 1, + cfs_statuscode_processor_restart_req = 2 +} cfs_statuscode_t; + +static struct global +{ + bool verbose; + bool should_daemonize; + bool should_exit; + bool should_reboot; + bool should_chroot; + + pid_t current_child_pid; + struct timespec child_fork_time; + int child_exitstatus; + int child_stdout; + + /* the extra byte ensures a null at the end of the buffer */ + char stdout_buffer[BUFFER_RING_SIZE + 1]; + size_t write_pos; + size_t read_pos; + char logger_ident[16]; + int logger_facility; + + int loop_count; + + const char *workdir_path; + const char *pid_file; + int pidfile_fd; + char **reboot_argv; + char **cfs_argv; + int cfs_argc; +} global; + +/* +** getopts parameter passing options string +*/ +static const char *optString = "dvCp:r:i:f:w:?"; + +/* +** getopts_long long form argument table +*/ +static struct option longOpts[] = { + { "daemonize", no_argument, NULL, 'd' }, + { "chroot", no_argument, NULL, 'C' }, + { "verbose", no_argument, NULL, 'v' }, + { "reboot", required_argument, NULL, 'r' }, + { "pidfile", required_argument, NULL, 'p' }, + { "ident", required_argument, NULL, 'i' }, + { "facility", required_argument, NULL, 'f' }, + { "workdir", required_argument, NULL, 'w' }, + { "help", no_argument, NULL, '?' }, + { NULL, no_argument, NULL, 0 } +}; + +void fork_exec(char * const argv[]) +{ + pid_t pid; + int pipefd[2]; + + global.child_stdout = -1; + global.current_child_pid = 0; + + /* create a pipe for stdout */ + /* [0] is for reading, [1] is for writing */ + if (pipe(pipefd) < 0) + { + perror("pipe"); + return; + } + + pid = fork(); + + if (pid == 0) + { + /* pidfile should not stay open in the child */ + if (global.pidfile_fd >= 0) + { + close (global.pidfile_fd); + } + + /* map the write pipe to stdout */ + if (pipefd[1] != STDOUT_FILENO) + { + dup2(pipefd[1], STDOUT_FILENO); + close(pipefd[1]); + } + close(pipefd[0]); + + /* send stderr to the same log */ + dup2(STDOUT_FILENO, STDERR_FILENO); + + /* child process - exec cFS from here */ + /* if execvp() works this does not return */ + execvp(argv[0], argv); + + /* as the fork() was successful this needs to exit */ + perror("execvp"); + exit(EXIT_FAILURE); + } + + /* only the parent process gets here */ + /* parent never uses the write fd */ + close(pipefd[1]); + + if (pid < 0) + { + /* this means there was some failure to fork() */ + close(pipefd[0]); + perror("fork"); + } + else + { + global.write_pos = 0; + global.read_pos = 0; + global.child_stdout = pipefd[0]; + global.child_exitstatus = 0; + global.current_child_pid = pid; + + clock_gettime(CLOCK_MONOTONIC, &global.child_fork_time); + if (global.verbose) + { + printf("launched %s, pid %d, time=%ld\n", argv[0], (int)pid, + (long)global.child_fork_time.tv_sec); + } + } +} + +void write_child_stdout(void) +{ + size_t rd_idx; + size_t wr_idx; + size_t bufsz; + char *start_p; + char *end_p; + char *msg_p; + char full_message[BUFFER_RING_SIZE + 1]; + + /* check for newlines before updating wr_idx */ + while(true) + { + bufsz = global.write_pos - global.read_pos; + if (bufsz == 0) + { + break; + } + + rd_idx = global.read_pos % BUFFER_RING_SIZE; + wr_idx = global.write_pos % BUFFER_RING_SIZE; + + start_p = &global.stdout_buffer[rd_idx]; + if (rd_idx < wr_idx) + { + /* simple case when no wrap */ + end_p = memchr(start_p, '\n', bufsz); + } + else + { + /* buffer has wrapped */ + end_p = memchr(start_p, '\n', BUFFER_RING_SIZE - rd_idx); + if (end_p == NULL) + { + end_p = memchr(global.stdout_buffer, '\n', wr_idx); + } + } + + if (end_p == NULL) + { + /* nothing to write now */ + break; + } + + msg_p = full_message; + + /* if the buffer wrapped this needs re-assembly */ + if (end_p < start_p) + { + bufsz = BUFFER_RING_SIZE - rd_idx; + memcpy(msg_p, start_p, bufsz); + start_p = &global.stdout_buffer[0]; + global.read_pos += bufsz; + msg_p += bufsz; + } + + if (end_p >= start_p) + { + bufsz = (end_p - start_p); + memcpy(msg_p, start_p, bufsz); + global.read_pos += bufsz + 1; /* to go past the newline */ + msg_p += bufsz; + } + + if (msg_p != full_message) + { + *msg_p = 0; + + /* it would be nice to propagate the log level from cFS into syslog, + * but this is not known by the time it makes its way through stdout */ + syslog(LOG_NOTICE, "%s", full_message); + } + } + +} + +void read_child_stdout(void) +{ + size_t rd_idx; + size_t wr_idx; + size_t fill; + size_t avail; + ssize_t ret; + char *start_p; + char *end_p; + + fill = global.write_pos - global.read_pos; + if (fill >= BUFFER_RING_SIZE) + { + /* buffer is maxed out, dump some data */ + global.read_pos += fill - (BUFFER_RING_SIZE / 2); + fill = global.write_pos - global.read_pos; + } + + /* the buffer is guaranteed to not be completely full */ + wr_idx = global.write_pos % BUFFER_RING_SIZE; + rd_idx = global.read_pos % BUFFER_RING_SIZE; + + if (wr_idx < rd_idx) + { + avail = rd_idx - wr_idx; + } + else + { + avail = BUFFER_RING_SIZE - wr_idx; + } + + ret = read(global.child_stdout, &global.stdout_buffer[wr_idx], avail); + if (ret < 0) + { + perror("read"); + } + + if (ret <= 0) + { + /* zero generally means the other side has closed the pipe */ + close(global.child_stdout); + global.child_stdout = -1; + } + else + { + /* nonzero amount of data input */ + global.write_pos += ret; + + /* this also means the child is alive and well, so reset the loop count */ + global.loop_count = 0; + } +} + +void check_stdout(void) +{ + int ret; + struct pollfd pfd; + + pfd.events = POLLIN; + pfd.revents = 0; + pfd.fd = global.child_stdout; + + ret = poll(&pfd, 1, 500); + if (ret > 0) + { + if (pfd.revents & POLLIN) + { + read_child_stdout(); + } + if (pfd.revents & POLLERR) + { + /* just invoke error handling path */ + if (global.verbose) + { + printf("poll error on child pipe"); + } + ret = -1; + } + } + + if (ret < 0) + { + perror("poll"); + close(global.child_stdout); + global.child_stdout = -1; + } + else if (ret == 0) + { + /* timeout -- reset the loop counter */ + /* a silent child is fine, no problem here */ + global.loop_count = 0; + } +} + +void wait_child(void) +{ + pid_t pid; + int opts; + int stat; + + if (global.child_stdout >= 0) + { + check_stdout(); + + /* check if anything can be forwarded */ + write_child_stdout(); + + opts = WNOHANG; + } + else + { + if (global.verbose) + { + printf("about to wait() on child=%d\n", (int)global.current_child_pid); + } + opts = 0; + } + + /* check if there are any child status change events */ + pid = waitpid(-1, &stat, opts); + + if (pid < 0) + { + perror("wait"); + } + else if (pid == global.current_child_pid) + { + if (WIFEXITED(stat)) + { + /* child is no longer running, check the exit code */ + global.current_child_pid = 0; + + /* positive exitstatus means exit */ + global.child_exitstatus = WEXITSTATUS(stat); + } + else if (WIFSIGNALED(stat)) + { + /* child is no longer running, this means it caught a signal */ + global.current_child_pid = 0; + + /* negative exitstatus means signal */ + global.child_exitstatus = -1 * WTERMSIG(stat); + } + else + { + /* this could be a job control signal, but child is still alive */ + if (global.verbose) + { + printf("wait() status=%d (ignoring)\n", stat); + } + } + + if (global.verbose) + { + printf("wait() returned child=%d, scrubbed exitstatus=%d\n", (int)pid, + (int)global.child_exitstatus); + } + } + + /* clean up the file handle if the child exited */ + if (global.current_child_pid == 0 && global.child_stdout >= 0) + { + close(global.child_stdout); + global.child_stdout = -1; + } +} + +void check_rapid_loop(void) +{ + struct timespec now; + + if (global.loop_count == 0) + { + /* nothing to do first time through */ + return; + } + + if (global.loop_count > MAX_LOOP_COUNT) + { + /* something is broken, looping again will not fix it */ + if (global.verbose) + { + printf("error: looping detected, misconfiguration?\n"); + } + global.should_exit = 1; + } + else if (global.current_child_pid <= 0) + { + /* cFS is not running, check the clock */ + /* get the time elapsed between fork and now */ + clock_gettime(CLOCK_MONOTONIC, &now); + + /* if CFS ran for some time then reset the loop counter */ + /* this is just ignoring nanoseconds, its just a rough estimate */ + if ((now.tv_sec - global.child_fork_time.tv_sec) >= CFS_MINIMUM_RUN_TIME) + { + global.loop_count = 0; + } + else + { + if (global.verbose) + { + printf("short runtime detected, retrying after pause\n"); + } + /* will loop again, but slow down a bit */ + ++now.tv_sec; + clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &now, NULL); + } + } +} + +void write_pid_file(pid_t pid) +{ + char pid_msg[16]; + + if (global.pid_file != NULL) + { + global.pidfile_fd = open(global.pid_file, O_WRONLY|O_CREAT|O_TRUNC, 0644); + + if (global.pidfile_fd < 0) + { + perror(global.pid_file); + exit(EXIT_FAILURE); + } + + snprintf(pid_msg, sizeof(pid_msg), "%u\n", (unsigned int)pid); + write(global.pidfile_fd, pid_msg, strlen(pid_msg)); + fsync(global.pidfile_fd); + + /* note - intentionally leaving fd open for future call to unlinkat() */ + } +} + +void remove_pid_file() +{ + const char *relative_dir; + + if (global.pid_file != NULL) + { + if (global.pidfile_fd >= 0) + { + /* use "unlinkat" and pass a relative dir, such that this should still work after chroot */ + relative_dir = strrchr(global.pid_file, '/'); + if (relative_dir == NULL) + { + relative_dir = global.pid_file; + } + else + { + ++relative_dir; + } + + unlinkat(global.pidfile_fd, relative_dir, 0); + } + else + { + /* just use regular unlink */ + unlink(global.pid_file); + } + } +} + +void sigtermint_handler(int sig, siginfo_t *si, void *arg) +{ +} + +void setup_signals(void) +{ + struct sigaction act; + + memset(&act, 0, sizeof(act)); + act.sa_handler = stopContinue; + sigaction(SIGINT, &act, NULL); +} + +void do_chroot(void) +{ + char workdir[128]; + char *wd; + + wd = getcwd(workdir, sizeof(workdir)); + + if (wd == NULL) + { + perror("getcwd"); + exit(EXIT_FAILURE); + } + + if (chroot(workdir) < 0) + { + fprintf(stderr, "chdir(%s): %s\n", workdir, strerror(errno)); + exit(EXIT_FAILURE); + } +} + +void daemonize(void) +{ + pid_t pid; + + pid = fork(); + + if (pid < 0) + { + perror("fork failed"); + exit(EXIT_FAILURE); + } + + if (pid > 0) + { + /* Parent process exits */ + exit(EXIT_SUCCESS); + } + + /* Child process continues */ + /* become the session leader */ + if (setsid() < 0) + { + perror("setsid failed"); + exit(EXIT_FAILURE); + } + + /* only the child process returns to the caller from here */ + close(STDIN_FILENO); + close(STDOUT_FILENO); + close(STDERR_FILENO); +} + +void show_help(void) +{ + fprintf(stderr, "Usage: cfs-manager [options] \n"); + fprintf(stderr, "\n"); + fprintf(stderr, "Available options:\n"); + fprintf(stderr, " -d|--daemonize : Fork into background when starting cFS\n"); + fprintf(stderr, " -v|--verbose : Increase output level for debugging\n"); + fprintf(stderr, " -p|--pidfile : Create a PID file for the cFS process\n"); + fprintf(stderr, " -w|--workdir : Call chroot() with workdir path before starting cFS\n"); + fprintf(stderr, " -C|--chroot : Call chroot() with workdir path before starting cFS\n"); + fprintf(stderr, " -r|--reboot : Command to execute if a reboot is commanded from cFS\n"); + fprintf(stderr, " -i|--indent : Identifier string to use for syslog (cfs)\n"); + fprintf(stderr, " -f|--facility : Facility value to use for syslog (user)\n"); + fprintf(stderr, " -?|--help : Show this help\n"); + fprintf(stderr, "\n"); + + exit (EXIT_FAILURE); +} + +void parse_options(int argc, char * const argv[]) +{ + int opt; + int longIndex; + + /* Process the arguments with getopt_long() */ + while(true) + { + opt = getopt_long(argc, argv, optString, longOpts, &longIndex); + if (opt < 0) + { + break; + } + + switch(opt) + { + case 'D': + global.should_daemonize = true; + break; + + case 'v': + global.verbose = true; + break; + + case 'C': + global.should_chroot = true; + break; + + case 'p': + global.pid_file = optarg; + break; + + case 'w': + global.workdir_path = optarg; + break; + + case 'r': + global.reboot_argv = malloc(sizeof(char *) * 2); + if (global.reboot_argv == NULL) + { + perror("malloc"); + } + else + { + global.reboot_argv[0] = strdup(optarg); + global.reboot_argv[1] = NULL; + } + break; + + case 'i': + strncpy(global.logger_ident, optarg, sizeof(global.logger_ident) - 1); + break; + + case 'f': + if (strcmp(optarg, "user") == 0) + { + global.logger_facility = LOG_USER; + } + else if (strcmp(optarg, "daemon") == 0) + { + global.logger_facility = LOG_DAEMON; + } + else if (strncmp(optarg, "local", 5) == 0) + { + switch(optarg[5]) + { + case '0': + global.logger_facility = LOG_LOCAL0; + break; + + case '1': + global.logger_facility = LOG_LOCAL1; + break; + + case '2': + global.logger_facility = LOG_LOCAL2; + break; + + case '3': + global.logger_facility = LOG_LOCAL3; + break; + + case '4': + global.logger_facility = LOG_LOCAL4; + break; + + case '5': + global.logger_facility = LOG_LOCAL5; + break; + + case '6': + global.logger_facility = LOG_LOCAL6; + break; + + case '7': + global.logger_facility = LOG_LOCAL7; + break; + } + } + if (global.logger_facility == 0) + { + fprintf(stderr, "Invalid logger facility. Supported values are user, daemon, and local[0-7]\n"); + show_help(); + } + break; + + default: + show_help(); + break; + } + } + + /* defaults if value is not specified on command line */ + if (global.logger_facility == 0) + { + global.logger_facility = LOG_USER; + } + + if (global.logger_ident[0] == 0) + { + strncpy(global.logger_ident, LOGGER_DEFAULT_IDENT, sizeof(global.logger_ident) - 1); + } + + /* file name of cFS binary is required, it must be the first remaining arg */ + if (optind >= argc) + { + fprintf(stderr, "Error: missing cFS command argument\n"); + show_help(); /* does not return */ + } + + global.cfs_argv = malloc(sizeof(char *) * (1 + argc - optind)); + if (global.cfs_argv == NULL) + { + perror("malloc"); + exit(EXIT_FAILURE); + } + + while (optind < argc) + { + global.cfs_argv[global.cfs_argc] = strdup(argv[optind]); + ++global.cfs_argc; + ++optind; + } + + /* this is the extra entry */ + global.cfs_argv[global.cfs_argc] = NULL; +} + +int main(int argc, char *const argv[]) +{ + cfs_statuscode_t sc; + + sc = cfs_statuscode_undefined; + memset(&global, 0, sizeof(global)); + + /* since 0 is a valid descriptor, file descriptors need to be set to -1 */ + global.pidfile_fd = -1; + global.child_stdout = -1; + + parse_options(argc, argv); + + /* open syslog and write pidfile before doing chroot, if indicated */ + openlog(global.logger_ident, LOG_NDELAY, global.logger_facility); + + write_pid_file(getpid()); + + if (global.workdir_path != NULL) + { + if (chdir(global.workdir_path) < 0) + { + fprintf(stderr, "chdir(%s): %s\n", global.workdir_path, strerror(errno)); + exit(EXIT_FAILURE); + } + } + + if (global.should_chroot) + { + do_chroot(); + } + + if (global.should_daemonize) + { + /* note: the current process exits from here */ + /* only the child process returns */ + daemonize(); + } + + while(!global.should_exit) + { + if (global.current_child_pid > 0) + { + /* wait for the child to have some action */ + wait_child(); + } + else if (global.child_exitstatus == CFS_SYSTEM_RESTART_EXITCODE) + { + /* request a full system reboot */ + global.should_exit = true; + global.should_reboot = true; + + if (global.verbose) + { + printf("cFS requested system reboot\n"); + } + } + else + { + /* fork a new instance of cFS */ + fork_exec(global.cfs_argv); + } + + /* check that cFS is actually starting */ + /* in case this starts rapidly looping, this breaks the cycle */ + check_rapid_loop(); + + ++global.loop_count; + } + + /* if a reboot was requested, then kick of the reboot script */ + if (global.should_reboot && global.reboot_argv) + { + fork_exec(global.reboot_argv); + } + + /* try to wait on any other child processes */ + global.loop_count = 0; + while (global.loop_count < MAX_LOOP_COUNT && + global.current_child_pid > 0) + { + wait_child(); + ++global.loop_count; + } + + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/recipes/init-ifupdown/init-ifupdown/qemuall/interfaces b/recipes/init-ifupdown/init-ifupdown/qemuall/interfaces new file mode 100644 index 0000000..c951d9c --- /dev/null +++ b/recipes/init-ifupdown/init-ifupdown/qemuall/interfaces @@ -0,0 +1,8 @@ +# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) + +# The loopback interface +auto lo +iface lo inet loopback + +auto eth0 +iface eth0 inet dhcp diff --git a/recipes/init-ifupdown/init-ifupdown_%.bbappend b/recipes/init-ifupdown/init-ifupdown_%.bbappend new file mode 100644 index 0000000..9accc57 --- /dev/null +++ b/recipes/init-ifupdown/init-ifupdown_%.bbappend @@ -0,0 +1 @@ +FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:" diff --git a/recipes/lua/lua/lua.pc b/recipes/lua/lua/lua.pc new file mode 100644 index 0000000..8032c89 --- /dev/null +++ b/recipes/lua/lua/lua.pc @@ -0,0 +1,11 @@ +prefix=/usr +libdir=${prefix}/lib +includedir=${prefix}/include + +Name: Lua +Description: Lua language engine +Version: 5.2.4 +Requires: +Libs: -L${libdir} -llua +Libs.private: -lm +Cflags: -I${includedir} diff --git a/recipes/lua/lua/uclibc-pthread.patch b/recipes/lua/lua/uclibc-pthread.patch new file mode 100644 index 0000000..f4cdc5d --- /dev/null +++ b/recipes/lua/lua/uclibc-pthread.patch @@ -0,0 +1,13 @@ +Index: lua-5.1.4/src/Makefile +=================================================================== +--- a/src/Makefile.orig 2013-10-22 22:17:19.929103523 -0400 ++++ a/src/Makefile 2013-10-22 22:18:27.992104545 -0400 +@@ -9,7 +9,7 @@ + CC= gcc + CFLAGS= -O2 -Wall -DLUA_COMPAT_ALL $(SYSCFLAGS) $(MYCFLAGS) + LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS) +-LIBS= -lm $(SYSLIBS) $(MYLIBS) ++LIBS= -lm -lpthread $(SYSLIBS) $(MYLIBS) + + AR= ar rcu + RANLIB= ranlib diff --git a/recipes/packagegroups/packagegroup-cfecfs.bb b/recipes/packagegroups/packagegroup-cfecfs.bb new file mode 100644 index 0000000..21bfdd2 --- /dev/null +++ b/recipes/packagegroups/packagegroup-cfecfs.bb @@ -0,0 +1,42 @@ +SUMMARY = "A package group to support CFE/CFS and related dependencies" +PR = "r1" + +# +# packages which content depend on MACHINE_FEATURES need to be MACHINE_ARCH +# +PACKAGE_ARCH = "${MACHINE_ARCH}" + +inherit packagegroup + +PROVIDES = "${PACKAGES}" +PACKAGES = ' packagegroup-cfecfs' + +SUMMARY_packagegroup-cfecfs = "Libraries to support CFE/CFS with EDS" + + +# Time synchronization - this adds dependency to oe "networking" layer +RDEPENDS_packagegroup-cfecfs += "ntp" + +# Graphics and image processing libraries +RDEPENDS_packagegroup-cfecfs += "openjpeg libjpeg-turbo libpng" + +# SSH and related tools for remote access +RDEPENDS_packagegroup-cfecfs += "packagegroup-core-ssh-dropbear" + +# Useful tools for file transfer +RDEPENDS_packagegroup-cfecfs += "lrzsz rsync" + +# Filesystem and MTD device tools +#RDEPENDS_packagegroup-cfecfs += "mtd-utils e2fsprogs dosfstools" + +# Generic file compression tools/libraries +RDEPENDS_packagegroup-cfecfs += "zlib libbz2 xz gzip bzip2 lz4" + +# Support for CFE/STRS OE using embedded webserver/FCGI/JSON +RDEPENDS_packagegroup-cfecfs += "fcgi json-c lighttpd lua" + +# Additional lighttpd modules +RDEPENDS_packagegroup-cfecfs += "lighttpd-module-fastcgi lighttpd-module-compress lighttpd-module-alias lighttpd-module-access lighttpd-module-accesslog" + + + From ef91c198d07d9cea23494fd6f09fd326689108c3 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Mon, 6 Apr 2026 09:33:36 -0400 Subject: [PATCH 06/11] Updates --- Makefile | 20 ++- cfsbuildenv-dpkg/Dockerfile | 2 +- yocto-sdk/Dockerfile | 83 ++++++--- yocto-sdk/conf/bblayers.conf | 17 ++ yocto-sdk/conf/conf-notes.txt | 19 +++ yocto-sdk/conf/conf-summary.txt | 1 + yocto-sdk/conf/local.conf | 289 ++++++++++++++++++++++++++++++++ yocto-sdk/conf/templateconf.cfg | 1 + 8 files changed, 397 insertions(+), 35 deletions(-) create mode 100644 yocto-sdk/conf/bblayers.conf create mode 100644 yocto-sdk/conf/conf-notes.txt create mode 100644 yocto-sdk/conf/conf-summary.txt create mode 100644 yocto-sdk/conf/local.conf create mode 100644 yocto-sdk/conf/templateconf.cfg diff --git a/Makefile b/Makefile index 30bdfd4..c06cdca 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ BASIC_IMAGE_SET += docker-executor BASIC_IMAGE_SET += cfsexec-qemu BASIC_IMAGE_SET += cfsexec-linux BASIC_IMAGE_SET += cfsexec-ubuntu22 -# BASIC_IMAGE_SET += yocto-sdk +BASIC_IMAGE_SET += yocto-sdk BASIC_IMAGE_SET += gaisler-sparc-rcc-sdk BASIC_IMAGE_SET += arm-linux-sdk ALL_IMAGE_SET += $(BASIC_IMAGE_SET) @@ -49,12 +49,13 @@ all: $(ALL_IMAGE_TARGETS) push: $(ALL_PUSH_TARGETS) pull: $(ALL_PULL_TARGETS) -rtems5-rtos.build: rtems5-tools.image -rtems6-rtos.build: rtems6-tools.image -cfsbuildenv-rtems5.build: rtems5-rtos.image -cfsbuildenv-rtems6.build: rtems6-rtos.image -cfsbuildenv-arm-linux.build: arm-linux-sdk.image cfsbuildenv-linux.image -cfsbuildenv-gaisler-sparc-rcc.build: gaisler-sparc-rcc-sdk.image cfsbuildenv-linux.image +rtems5-rtos.image: rtems5-tools.image +rtems6-rtos.image: rtems6-tools.image +cfsbuildenv-rtems5.image: rtems5-rtos.image +cfsbuildenv-rtems6.image: rtems6-rtos.image +cfsbuildenv-arm-linux.image: arm-linux-sdk.image cfsbuildenv-linux.image +cfsbuildenv-gaisler-sparc-rcc.image: gaisler-sparc-rcc-sdk.image cfsbuildenv-linux.image +yocto-sdk.image: cfsbuildenv-linux.image %.build: @@ -110,6 +111,11 @@ cfsbuildenv-linux.build cfsbuildenv-ubuntu22.build: cfsbuildenv-el8.build cfsbuildenv-el9.build: docker build $(EXTRA_BUILDARGS) -t $(QUALIFIED_IMAGE_NAME) -f cfsbuildenv-rpm/Dockerfile . +yocto-sdk.build: + docker build $(EXTRA_BUILDARGS) -t $(QUALIFIED_IMAGE_NAME) \ + --build-arg BASE_IMAGE=cfsbuildenv-linux:$(LOCAL_TAG) \ + -f yocto-sdk/Dockerfile . + cfsbuildenv-yocto.build: docker build $(EXTRA_BUILDARGS) -t $(QUALIFIED_IMAGE_NAME) \ --build-arg YOCTO_SDK_IMAGE=yocto-sdk:$(LOCAL_TAG) \ diff --git a/cfsbuildenv-dpkg/Dockerfile b/cfsbuildenv-dpkg/Dockerfile index 0313bef..316822a 100644 --- a/cfsbuildenv-dpkg/Dockerfile +++ b/cfsbuildenv-dpkg/Dockerfile @@ -13,7 +13,7 @@ ARG EXTRA_PKGS="" RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ sudo ca-certificates curl lsb-release software-properties-common \ - build-essential gcc g++ gawk cmake lcov xsltproc rsync jq file \ + build-essential git gcc g++ gawk cmake lcov xsltproc rsync jq file \ python3 python3-venv python3-dev python3-pip openssh-client \ libexpat-dev liblua5.3-dev libjson-c-dev xz-utils cppcheck clang-format \ ${EXTRA_PKGS} && \ diff --git a/yocto-sdk/Dockerfile b/yocto-sdk/Dockerfile index dc3e433..c3f8e57 100644 --- a/yocto-sdk/Dockerfile +++ b/yocto-sdk/Dockerfile @@ -7,36 +7,65 @@ FROM ${BASE_IMAGE} AS yocto-sdk-builder ARG YOCTO_BRANCH=scarthgap +COPY yocto-sdk/meta-cfecfs meta-cfecfs RUN git clone git://git.openembedded.org/meta-openembedded -b ${YOCTO_BRANCH} --depth 1 RUN git clone git://git.yoctoproject.org/poky -b ${YOCTO_BRANCH} --depth 1 -RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ - python3-minimal python3-venv python3-pip file \ - ${EXTRA_PKGS} && \ - rm -rf /var/cache/apt +RUN sudo apt-get update && \ + sudo env DEBIAN_FRONTEND=noninteractive apt-get install -y \ + locales chrpath cpio diffstat lz4 zstd wget +RUN echo 'en_US.UTF-8 UTF-8' | sudo tee /etc/locale.gen && sudo locale-gen +ENV HOME=/home/docker +ENV BUILDDIR="${HOME}/build-cfs" +ENV OE_ADDED_PATHS="${HOME}/poky/scripts:${HOME}/poky/bitbake/bin:" +ENV BB_ENV_PASSTHROUGH_ADDITIONS="ALL_PROXY BBPATH_EXTRA BB_LOGCONFIG BB_NO_NETWORK BB_NUMBER_THREADS BB_SETSCENE_ENFORCE BB_SRCREV_POLICY DISTRO FTPS_PROXY FTP_PROXY GIT_PROXY_COMMAND HTTPS_PROXY HTTP_PROXY MACHINE NO_PROXY PARALLEL_MAKE SCREENDIR SDKMACHINE SOCKS5_PASSWD SOCKS5_USER SSH_AGENT_PID SSH_AUTH_SOCK STAMPS_DIR TCLIBC TCMODE all_proxy ftp_proxy ftps_proxy http_proxy https_proxy no_proxy" -FROM yocto-sdk-installer AS yocto-sdk-qemuriscv64 +RUN mkdir -p ${BUILDDIR} +COPY yocto-sdk/conf ${BUILDDIR}/conf +RUN ls -lR ${BUILDDIR} && cat ${BUILDDIR}/conf/bblayers.conf +RUN env PYTHONPATH=${HOME}/poky/bitbake/lib \ + PATH=${OE_ADDED_PATHS}${PATH} \ + BBPATH=${BUILDDIR} \ + MACHINE=qemuriscv64 \ + bitbake core-image-cfecfs --runall=fetch -# Fetch SDK binary packages -ADD https://developer.nasa.gov/cFS/yocto-sandbox/releases/download/v0.0.1-testing/poky-glibc-x86_64-core-image-cfecfs-riscv64-qemuriscv64-toolchain-5.0.12.sh /root/qemuriscv64-toolchain.sh +FROM yocto-sdk-builder AS yocto-build-qemuriscv64 +RUN env PYTHONPATH=${HOME}/poky/bitbake/lib \ + PATH=${OE_ADDED_PATHS}${PATH} \ + BBPATH=${BUILDDIR} \ + MACHINE=qemuriscv64 \ + bitbake core-image-cfecfs +RUN env PYTHONPATH=${HOME}/poky/bitbake/lib \ + PATH=${OE_ADDED_PATHS}${PATH} \ + BBPATH=${BUILDDIR} \ + MACHINE=qemuriscv64 \ + bitbake core-image-cfecfs -c populate_sdk -RUN chmod a+x root/qemuriscv64-toolchain.sh - -# Install SDK -RUN /root/qemuriscv64-toolchain.sh -y - - -FROM yocto-sdk-installer AS yocto-sdk-qemumips - -# Fetch SDK binary packages -ADD https://developer.nasa.gov/cFS/yocto-sandbox/releases/download/v0.0.1-testing/poky-glibc-x86_64-core-image-cfecfs-mips32r2-qemumips-toolchain-5.0.12.sh /root/qemumips-toolchain.sh - -RUN chmod a+x root/qemumips-toolchain.sh - -# Install SDK -RUN /root/qemumips-toolchain.sh -y - -FROM scratch AS yocto-sdk - -COPY --from=yocto-sdk-qemuriscv64 /opt /opt -COPY --from=yocto-sdk-qemumips /opt /opt +RUN ls -lR build-cfs/tmp/deploy +RUN build-cfs/tmp/deploy/sdk/sh -y +#FROM yocto-sdk-installer AS yocto-sdk-qemuriscv64 +# +## Fetch SDK binary packages +#ADD https://developer.nasa.gov/cFS/yocto-sandbox/releases/download/v0.0.1-testing/poky-glibc-x86_64-core-image-cfecfs-riscv64-qemuriscv64-toolchain-5.0.12.sh /root/qemuriscv64-toolchain.sh +# +#RUN chmod a+x root/qemuriscv64-toolchain.sh +# +## Install SDK +#RUN /root/qemuriscv64-toolchain.sh -y +# +# +#FROM yocto-sdk-installer AS yocto-sdk-qemumips +# +## Fetch SDK binary packages +#ADD https://developer.nasa.gov/cFS/yocto-sandbox/releases/download/v0.0.1-testing/poky-glibc-x86_64-core-image-cfecfs-mips32r2-qemumips-toolchain-5.0.12.sh /root/qemumips-toolchain.sh +# +#RUN chmod a+x root/qemumips-toolchain.sh +# +## Install SDK +#RUN /root/qemumips-toolchain.sh -y +# +#FROM scratch AS yocto-sdk +# +#COPY --from=yocto-sdk-qemuriscv64 /opt /opt +#COPY --from=yocto-sdk-qemumips /opt /opt +# diff --git a/yocto-sdk/conf/bblayers.conf b/yocto-sdk/conf/bblayers.conf new file mode 100644 index 0000000..9151eb5 --- /dev/null +++ b/yocto-sdk/conf/bblayers.conf @@ -0,0 +1,17 @@ +# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf +# changes incompatibly +POKY_BBLAYERS_CONF_VERSION = "2" + +BBPATH = "${TOPDIR}" +BBFILES ?= "" + +BBLAYERS ?= " \ + /home/docker/poky/meta \ + /home/docker/poky/meta-poky \ + /home/docker/poky/meta-yocto-bsp \ + /home/docker/meta-openembedded/meta-oe \ + /home/docker/meta-openembedded/meta-python \ + /home/docker/meta-openembedded/meta-networking \ + /home/docker/meta-openembedded/meta-webserver \ + /home/docker/meta-cfecfs \ + " diff --git a/yocto-sdk/conf/conf-notes.txt b/yocto-sdk/conf/conf-notes.txt new file mode 100644 index 0000000..cfd1f19 --- /dev/null +++ b/yocto-sdk/conf/conf-notes.txt @@ -0,0 +1,19 @@ + +### Shell environment set up for builds. ### + +You can now run 'bitbake ' + +Common targets are: + core-image-minimal + core-image-full-cmdline + core-image-sato + core-image-weston + meta-toolchain + meta-ide-support + +You can also run generated qemu images with a command like 'runqemu qemux86-64'. + +Other commonly useful commands are: + - 'devtool' and 'recipetool' handle common recipe tasks + - 'bitbake-layers' handles common layer tasks + - 'oe-pkgdata-util' handles common target package tasks diff --git a/yocto-sdk/conf/conf-summary.txt b/yocto-sdk/conf/conf-summary.txt new file mode 100644 index 0000000..8fc0303 --- /dev/null +++ b/yocto-sdk/conf/conf-summary.txt @@ -0,0 +1 @@ +This is the default build configuration for the Poky reference distribution. diff --git a/yocto-sdk/conf/local.conf b/yocto-sdk/conf/local.conf new file mode 100644 index 0000000..e440b32 --- /dev/null +++ b/yocto-sdk/conf/local.conf @@ -0,0 +1,289 @@ +# +# This file is your local configuration file and is where all local user settings +# are placed. The comments in this file give some guide to the options a new user +# to the system might want to change but pretty much any configuration option can +# be set in this file. More adventurous users can look at +# local.conf.sample.extended which contains other examples of configuration which +# can be placed in this file but new users likely won't need any of them +# initially. There's also site.conf.sample which contains examples of site specific +# information such as proxy server addresses. +# +# Lines starting with the '#' character are commented out and in some cases the +# default values are provided as comments to show people example syntax. Enabling +# the option is a question of removing the # character and making any change to the +# variable as required. + +# +# Machine Selection +# +# You need to select a specific machine to target the build with. There are a selection +# of emulated machines available which can boot and run in the QEMU emulator: +# +#MACHINE ?= "qemuarm" +#MACHINE ?= "qemuarm64" +#MACHINE ?= "qemumips" +#MACHINE ?= "qemumips64" +#MACHINE ?= "qemuppc" +#MACHINE ?= "qemux86" +#MACHINE ?= "qemux86-64" +# +# There are also the following hardware board target machines included for +# demonstration purposes: +# +#MACHINE ?= "beaglebone-yocto" +#MACHINE ?= "genericarm64" +#MACHINE ?= "genericx86" +#MACHINE ?= "genericx86-64" +# +# This sets the default machine to be qemux86-64 if no other machine is selected: +MACHINE ??= "qemux86-64" + +# These are some of the more commonly used values. Looking at the files in the +# meta/conf/machine directory, or the conf/machine directory of any additional layers +# you add in will show all the available machines. + +# +# Where to place downloads +# +# During a first build the system will download many different source code tarballs +# from various upstream projects. This can take a while, particularly if your network +# connection is slow. These are all stored in DL_DIR. When wiping and rebuilding you +# can preserve this directory to speed up this part of subsequent builds. This directory +# is safe to share between multiple builds on the same machine too. +# +# The default is a downloads directory under TOPDIR which is the build directory. +# +#DL_DIR ?= "${TOPDIR}/downloads" + +# +# Where to place shared-state files +# +# BitBake has the capability to accelerate builds based on previously built output. +# This is done using "shared state" files which can be thought of as cache objects +# and this option determines where those files are placed. +# +# You can wipe out TMPDIR leaving this directory intact and the build would regenerate +# from these files if no changes were made to the configuration. If changes were made +# to the configuration, only shared state files where the state was still valid would +# be used (done using checksums). +# +# The default is a sstate-cache directory under TOPDIR. +# +#SSTATE_DIR ?= "${TOPDIR}/sstate-cache" + +# +# Where to place the build output +# +# This option specifies where the bulk of the building work should be done and +# where BitBake should place its temporary files and output. Keep in mind that +# this includes the extraction and compilation of many applications and the toolchain +# which can use Gigabytes of hard disk space. +# +# The default is a tmp directory under TOPDIR. +# +#TMPDIR = "${TOPDIR}/tmp" + +# +# Default policy config +# +# The distribution setting controls which policy settings are used as defaults. +# The default value is fine for general Yocto project use, at least initially. +# Ultimately when creating custom policy, people will likely end up subclassing +# these defaults. +# +DISTRO ?= "poky" +# As an example of a subclass there is a "bleeding" edge policy configuration +# where many versions are set to the absolute latest code from the upstream +# source control systems. This is just mentioned here as an example, its not +# useful to most new users. +# DISTRO ?= "poky-bleeding" + +# +# Package Management configuration +# +# This variable lists which packaging formats to enable. Multiple package backends +# can be enabled at once and the first item listed in the variable will be used +# to generate the root filesystems. +# Options are: +# - 'package_deb' for debian style deb files +# - 'package_ipk' for ipk files are used by opkg (a debian style embedded package manager) +# - 'package_rpm' for rpm style packages +# E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk" +# OE-Core defaults to ipkg, whilst Poky defaults to rpm: +# PACKAGE_CLASSES ?= "package_rpm" + +# +# SDK target architecture +# +# This variable specifies the architecture to build SDK items for and means +# you can build the SDK packages for architectures other than the machine you are +# running the build on (i.e. building i686 packages on an x86_64 host). +# Supported values are i686, x86_64, aarch64 +#SDKMACHINE ?= "i686" + +# +# Extra image configuration defaults +# +# The EXTRA_IMAGE_FEATURES variable allows extra packages to be added to the generated +# images. Some of these options are added to certain image types automatically. The +# variable can contain the following options: +# "dbg-pkgs" - add -dbg packages for all installed packages +# (adds symbol information for debugging/profiling) +# "src-pkgs" - add -src packages for all installed packages +# (adds source code for debugging) +# "dev-pkgs" - add -dev packages for all installed packages +# (useful if you want to develop against libs in the image) +# "ptest-pkgs" - add -ptest packages for all ptest-enabled packages +# (useful if you want to run the package test suites) +# "tools-sdk" - add development tools (gcc, make, pkgconfig etc.) +# "tools-debug" - add debugging tools (gdb, strace) +# "eclipse-debug" - add Eclipse remote debugging support +# "tools-profile" - add profiling tools (oprofile, lttng, valgrind) +# "tools-testapps" - add useful testing tools (ts_print, aplay, arecord etc.) +# "debug-tweaks" - make an image suitable for development +# e.g. ssh root access has a blank password +# There are other application targets that can be used here too, see +# meta/classes-recipe/image.bbclass and +# meta/classes-recipe/core-image.bbclass for more details. +# We default to enabling the debugging tweaks. +EXTRA_IMAGE_FEATURES ?= "debug-tweaks" + +# +# Additional image features +# +# The following is a list of additional classes to use when building images which +# enable extra features. Some available options which can be included in this variable +# are: +# - 'buildstats' collect build statistics +USER_CLASSES ?= "buildstats" + +# +# Runtime testing of images +# +# The build system can test booting virtual machine images under qemu (an emulator) +# after any root filesystems are created and run tests against those images. It can also +# run tests against any SDK that are built. To enable this uncomment these lines. +# See meta/classes-recipe/test{image,sdk}.bbclass for further details. +#IMAGE_CLASSES += "testimage testsdk" +#TESTIMAGE_AUTO:qemuall = "1" + +# +# Interactive shell configuration +# +# Under certain circumstances the system may need input from you and to do this it +# can launch an interactive shell. It needs to do this since the build is +# multithreaded and needs to be able to handle the case where more than one parallel +# process may require the user's attention. The default is iterate over the available +# terminal types to find one that works. +# +# Examples of the occasions this may happen are when resolving patches which cannot +# be applied, to use the devshell or the kernel menuconfig +# +# Supported values are auto, gnome, xfce, rxvt, screen, konsole (KDE 3.x only), none +# Note: currently, Konsole support only works for KDE 3.x due to the way +# newer Konsole versions behave +#OE_TERMINAL = "auto" +# By default disable interactive patch resolution (tasks will just fail instead): +PATCHRESOLVE = "noop" + +# +# Disk Space Monitoring during the build +# +# Monitor the disk space during the build. If there is less that 1GB of space or less +# than 100K inodes in any key build location (TMPDIR, DL_DIR, SSTATE_DIR), gracefully +# shutdown the build. If there is less than 100MB or 1K inodes, perform a hard halt +# of the build. The reason for this is that running completely out of space can corrupt +# files and damages the build in ways which may not be easily recoverable. +# It's necessary to monitor /tmp, if there is no space left the build will fail +# with very exotic errors. +BB_DISKMON_DIRS ??= "\ + STOPTASKS,${TMPDIR},1G,100K \ + STOPTASKS,${DL_DIR},1G,100K \ + STOPTASKS,${SSTATE_DIR},1G,100K \ + STOPTASKS,/tmp,100M,100K \ + HALT,${TMPDIR},100M,1K \ + HALT,${DL_DIR},100M,1K \ + HALT,${SSTATE_DIR},100M,1K \ + HALT,/tmp,10M,1K" + +# +# Shared-state files from other locations +# +# As mentioned above, shared state files are prebuilt cache data objects which can be +# used to accelerate build time. This variable can be used to configure the system +# to search other mirror locations for these objects before it builds the data itself. +# +# This can be a filesystem directory, or a remote url such as https or ftp. These +# would contain the sstate-cache results from previous builds (possibly from other +# machines). This variable works like fetcher MIRRORS/PREMIRRORS and points to the +# cache locations to check for the shared objects. +# NOTE: if the mirror uses the same structure as SSTATE_DIR, you need to add PATH +# at the end as shown in the examples below. This will be substituted with the +# correct path within the directory structure. +#SSTATE_MIRRORS ?= "\ +#file://.* https://someserver.tld/share/sstate/PATH;downloadfilename=PATH \ +#file://.* file:///some/local/dir/sstate/PATH" + +# +# Yocto Project SState Mirror +# +# The Yocto Project has prebuilt artefacts available for its releases, you can enable +# use of these by uncommenting some of the following lines. This will mean the build uses +# the network to check for artefacts at the start of builds, which does slow it down +# initially but it will then speed up the builds by not having to build things if they are +# present in the cache. It assumes you can download something faster than you can build it +# which will depend on your network. +# Note: For this to work you also need hash-equivalence passthrough to the matching server +# There is a choice between our sstate server directly and a faster content delivery network +# (CDN) kindly provided by JSDelivr, uncomment one of the SSTATE_MIRRORS lines, not both. +# Using the CDN rather than the yoctoproject.org address is suggested/preferred. +# +#BB_HASHSERVE_UPSTREAM = 'wss://hashserv.yoctoproject.org/ws' +#SSTATE_MIRRORS ?= "file://.* http://sstate.yoctoproject.org/all/PATH;downloadfilename=PATH" + +# +# Qemu configuration +# +# By default native qemu will build with a builtin VNC server where graphical output can be +# seen. The line below enables the SDL UI frontend too. +PACKAGECONFIG:append:pn-qemu-system-native = " sdl" +# By default libsdl2-native will be built, if you want to use your host's libSDL instead of +# the minimal libsdl built by libsdl2-native then uncomment the ASSUME_PROVIDED line below. +#ASSUME_PROVIDED += "libsdl2-native" + +# You can also enable the Gtk UI frontend, which takes somewhat longer to build, but adds +# a handy set of menus for controlling the emulator. +#PACKAGECONFIG:append:pn-qemu-system-native = " gtk+" + +# +# Hash Equivalence +# +# Enable support for automatically running a local hash equivalence server and +# instruct bitbake to use a hash equivalence aware signature generator. Hash +# equivalence improves reuse of sstate by detecting when a given sstate +# artifact can be reused as equivalent, even if the current task hash doesn't +# match the one that generated the artifact. +# +# A shared hash equivalent server can be set with ":" format +# +#BB_HASHSERVE = "auto" +#BB_SIGNATURE_HANDLER = "OEEquivHash" + +# +# Memory Resident Bitbake +# +# Bitbake's server component can stay in memory after the UI for the current command +# has completed. This means subsequent commands can run faster since there is no need +# for bitbake to reload cache files and so on. Number is in seconds, after which the +# server will shut down. +# +#BB_SERVER_TIMEOUT = "60" + +# CONF_VERSION is increased each time build/conf/ changes incompatibly and is used to +# track the version of this file when it was generated. This can safely be ignored if +# this doesn't mean anything to you. +CONF_VERSION = "2" + +# perform shallow git clones to save transfer size +BB_GIT_SHALLOW = "1" +INHERIT += "rm_work" diff --git a/yocto-sdk/conf/templateconf.cfg b/yocto-sdk/conf/templateconf.cfg new file mode 100644 index 0000000..0fcf0ff --- /dev/null +++ b/yocto-sdk/conf/templateconf.cfg @@ -0,0 +1 @@ +meta-poky/conf/templates/default From 11fae33f08aab1afe9b009fcc4efd6b7e5d90690 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Tue, 7 Apr 2026 08:25:00 -0400 Subject: [PATCH 07/11] Builds but huge image --- yocto-sdk/Dockerfile | 72 +++++++++++++++------------------------ yocto-sdk/conf/local.conf | 5 +++ 2 files changed, 32 insertions(+), 45 deletions(-) diff --git a/yocto-sdk/Dockerfile b/yocto-sdk/Dockerfile index c3f8e57..80683f2 100644 --- a/yocto-sdk/Dockerfile +++ b/yocto-sdk/Dockerfile @@ -3,7 +3,7 @@ ######################################################### ARG BASE_IMAGE=cfsbuildenv-linux:test -FROM ${BASE_IMAGE} AS yocto-sdk-builder +FROM ${BASE_IMAGE} AS yocto-sources ARG YOCTO_BRANCH=scarthgap @@ -15,57 +15,39 @@ RUN sudo apt-get update && \ locales chrpath cpio diffstat lz4 zstd wget RUN echo 'en_US.UTF-8 UTF-8' | sudo tee /etc/locale.gen && sudo locale-gen +# These environment vars need to be set for bitbake to work ENV HOME=/home/docker ENV BUILDDIR="${HOME}/build-cfs" ENV OE_ADDED_PATHS="${HOME}/poky/scripts:${HOME}/poky/bitbake/bin:" ENV BB_ENV_PASSTHROUGH_ADDITIONS="ALL_PROXY BBPATH_EXTRA BB_LOGCONFIG BB_NO_NETWORK BB_NUMBER_THREADS BB_SETSCENE_ENFORCE BB_SRCREV_POLICY DISTRO FTPS_PROXY FTP_PROXY GIT_PROXY_COMMAND HTTPS_PROXY HTTP_PROXY MACHINE NO_PROXY PARALLEL_MAKE SCREENDIR SDKMACHINE SOCKS5_PASSWD SOCKS5_USER SSH_AGENT_PID SSH_AUTH_SOCK STAMPS_DIR TCLIBC TCMODE all_proxy ftp_proxy ftps_proxy http_proxy https_proxy no_proxy" +ENV PYTHONPATH=${HOME}/poky/bitbake/lib +ENV PATH=${OE_ADDED_PATHS}${PATH} +ENV BBPATH=${BUILDDIR} RUN mkdir -p ${BUILDDIR} COPY yocto-sdk/conf ${BUILDDIR}/conf RUN ls -lR ${BUILDDIR} && cat ${BUILDDIR}/conf/bblayers.conf -RUN env PYTHONPATH=${HOME}/poky/bitbake/lib \ - PATH=${OE_ADDED_PATHS}${PATH} \ - BBPATH=${BUILDDIR} \ - MACHINE=qemuriscv64 \ - bitbake core-image-cfecfs --runall=fetch +RUN bitbake core-image-cfecfs --runall=fetch -FROM yocto-sdk-builder AS yocto-build-qemuriscv64 -RUN env PYTHONPATH=${HOME}/poky/bitbake/lib \ - PATH=${OE_ADDED_PATHS}${PATH} \ - BBPATH=${BUILDDIR} \ - MACHINE=qemuriscv64 \ - bitbake core-image-cfecfs -RUN env PYTHONPATH=${HOME}/poky/bitbake/lib \ - PATH=${OE_ADDED_PATHS}${PATH} \ - BBPATH=${BUILDDIR} \ - MACHINE=qemuriscv64 \ - bitbake core-image-cfecfs -c populate_sdk +FROM yocto-sources AS yocto-build-image -RUN ls -lR build-cfs/tmp/deploy -RUN build-cfs/tmp/deploy/sdk/sh -y -#FROM yocto-sdk-installer AS yocto-sdk-qemuriscv64 -# -## Fetch SDK binary packages -#ADD https://developer.nasa.gov/cFS/yocto-sandbox/releases/download/v0.0.1-testing/poky-glibc-x86_64-core-image-cfecfs-riscv64-qemuriscv64-toolchain-5.0.12.sh /root/qemuriscv64-toolchain.sh -# -#RUN chmod a+x root/qemuriscv64-toolchain.sh -# -## Install SDK -#RUN /root/qemuriscv64-toolchain.sh -y -# -# -#FROM yocto-sdk-installer AS yocto-sdk-qemumips -# -## Fetch SDK binary packages -#ADD https://developer.nasa.gov/cFS/yocto-sandbox/releases/download/v0.0.1-testing/poky-glibc-x86_64-core-image-cfecfs-mips32r2-qemumips-toolchain-5.0.12.sh /root/qemumips-toolchain.sh -# -#RUN chmod a+x root/qemumips-toolchain.sh -# -## Install SDK -#RUN /root/qemumips-toolchain.sh -y -# -#FROM scratch AS yocto-sdk -# -#COPY --from=yocto-sdk-qemuriscv64 /opt /opt -#COPY --from=yocto-sdk-qemumips /opt /opt -# +ARG MACHINE=qemuriscv64 +ENV MACHINE=${MACHINE} + +RUN bitbake core-image-cfecfs + +RUN ls -l build-cfs/tmp/deploy/images +RUN tar -C build-cfs/tmp/deploy/images cvf - . | xz -c > images.tar.xz + +FROM yocto-build-image AS yocto-build-sdk + +RUN bitbake core-image-cfecfs -c populate_sdk + +RUN ls -l build-cfs/tmp/deploy/sdk +RUN /bin/bash -c 'build-cfs/tmp/deploy/sdk/poky*-toolchain-*.sh -y' + +FROM scratch AS yocto-image +COPY --from=yocto-build-image /home/docker/images.tar.xz / + +FROM scratch AS yocto-sdk +COPY --from=yocto-build-sdk /opt /opt diff --git a/yocto-sdk/conf/local.conf b/yocto-sdk/conf/local.conf index e440b32..a8b2d8a 100644 --- a/yocto-sdk/conf/local.conf +++ b/yocto-sdk/conf/local.conf @@ -287,3 +287,8 @@ CONF_VERSION = "2" # perform shallow git clones to save transfer size BB_GIT_SHALLOW = "1" INHERIT += "rm_work" + +# help avoid OOM errors +BB_NUMBER_THREADS = "8" +PARALLEL_MAKE = "-j 8" + From 82923df24b3e2bb7e0b65af2b73fb4be43c12a06 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Tue, 7 Apr 2026 09:15:27 -0400 Subject: [PATCH 08/11] Split yocto stuff more --- Makefile | 32 +++++++++++++- yocto-compile/Dockerfile | 13 ++++++ yocto-image/Dockerfile | 9 ++++ yocto-sdk/Dockerfile | 43 +------------------ yocto-sources/Dockerfile | 30 +++++++++++++ .../conf/bblayers.conf | 0 .../conf/conf-notes.txt | 0 .../conf/conf-summary.txt | 0 {yocto-sdk => yocto-sources}/conf/local.conf | 0 .../conf/templateconf.cfg | 0 .../meta-cfecfs/README.md | 0 .../meta-cfecfs/conf/layer.conf | 0 .../templates/default/bblayers.conf.sample | 0 .../conf/templates/default/conf-notes.txt | 0 .../conf/templates/default/local.conf.sample | 0 .../images/core-image-cfecfs-rt.bb | 0 .../meta-cfecfs/images/core-image-cfecfs.bb | 0 .../meta-cfecfs/images/core-image-cfecfs.inc | 0 .../base-files/base-files/qemuall/fstab | 0 .../recipes/base-files/base-files_%.bbappend | 0 .../recipes/cfs-support/cfs-support_0.1.bb | 0 .../recipes/cfs-support/files/LICENSE | 0 .../recipes/cfs-support/files/init.d/cfs | 0 .../cfs-support/files/manager/Makefile | 0 .../cfs-support/files/manager/cfs-manager.c | 0 .../init-ifupdown/qemuall/interfaces | 0 .../init-ifupdown/init-ifupdown_%.bbappend | 0 .../meta-cfecfs/recipes/lua/lua/lua.pc | 0 .../recipes/lua/lua/uclibc-pthread.patch | 0 .../packagegroups/packagegroup-cfecfs.bb | 0 30 files changed, 84 insertions(+), 43 deletions(-) create mode 100644 yocto-compile/Dockerfile create mode 100644 yocto-image/Dockerfile create mode 100644 yocto-sources/Dockerfile rename {yocto-sdk => yocto-sources}/conf/bblayers.conf (100%) rename {yocto-sdk => yocto-sources}/conf/conf-notes.txt (100%) rename {yocto-sdk => yocto-sources}/conf/conf-summary.txt (100%) rename {yocto-sdk => yocto-sources}/conf/local.conf (100%) rename {yocto-sdk => yocto-sources}/conf/templateconf.cfg (100%) rename {yocto-sdk => yocto-sources}/meta-cfecfs/README.md (100%) rename {yocto-sdk => yocto-sources}/meta-cfecfs/conf/layer.conf (100%) rename {yocto-sdk => yocto-sources}/meta-cfecfs/conf/templates/default/bblayers.conf.sample (100%) rename {yocto-sdk => yocto-sources}/meta-cfecfs/conf/templates/default/conf-notes.txt (100%) rename {yocto-sdk => yocto-sources}/meta-cfecfs/conf/templates/default/local.conf.sample (100%) rename {yocto-sdk => yocto-sources}/meta-cfecfs/images/core-image-cfecfs-rt.bb (100%) rename {yocto-sdk => yocto-sources}/meta-cfecfs/images/core-image-cfecfs.bb (100%) rename {yocto-sdk => yocto-sources}/meta-cfecfs/images/core-image-cfecfs.inc (100%) rename {yocto-sdk => yocto-sources}/meta-cfecfs/recipes/base-files/base-files/qemuall/fstab (100%) rename {yocto-sdk => yocto-sources}/meta-cfecfs/recipes/base-files/base-files_%.bbappend (100%) rename {yocto-sdk => yocto-sources}/meta-cfecfs/recipes/cfs-support/cfs-support_0.1.bb (100%) rename {yocto-sdk => yocto-sources}/meta-cfecfs/recipes/cfs-support/files/LICENSE (100%) rename {yocto-sdk => yocto-sources}/meta-cfecfs/recipes/cfs-support/files/init.d/cfs (100%) rename {yocto-sdk => yocto-sources}/meta-cfecfs/recipes/cfs-support/files/manager/Makefile (100%) rename {yocto-sdk => yocto-sources}/meta-cfecfs/recipes/cfs-support/files/manager/cfs-manager.c (100%) rename {yocto-sdk => yocto-sources}/meta-cfecfs/recipes/init-ifupdown/init-ifupdown/qemuall/interfaces (100%) rename {yocto-sdk => yocto-sources}/meta-cfecfs/recipes/init-ifupdown/init-ifupdown_%.bbappend (100%) rename {yocto-sdk => yocto-sources}/meta-cfecfs/recipes/lua/lua/lua.pc (100%) rename {yocto-sdk => yocto-sources}/meta-cfecfs/recipes/lua/lua/uclibc-pthread.patch (100%) rename {yocto-sdk => yocto-sources}/meta-cfecfs/recipes/packagegroups/packagegroup-cfecfs.bb (100%) diff --git a/Makefile b/Makefile index c06cdca..211a21b 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,6 @@ BASIC_IMAGE_SET += docker-executor BASIC_IMAGE_SET += cfsexec-qemu BASIC_IMAGE_SET += cfsexec-linux BASIC_IMAGE_SET += cfsexec-ubuntu22 -BASIC_IMAGE_SET += yocto-sdk BASIC_IMAGE_SET += gaisler-sparc-rcc-sdk BASIC_IMAGE_SET += arm-linux-sdk ALL_IMAGE_SET += $(BASIC_IMAGE_SET) @@ -33,6 +32,13 @@ BUILDENV_IMAGE_SET += cfsbuildenv-el8 ALL_IMAGE_SET += $(BUILDENV_IMAGE_SET) # The rest of the images each need a custom rule with custom deps +ALL_IMAGE_SET += yocto-sources +ALL_IMAGE_SET += yocto-compile-qemuriscv64 +ALL_IMAGE_SET += yocto-image-qemuriscv64 +ALL_IMAGE_SET += yocto-sdk-qemuriscv64 +ALL_IMAGE_SET += yocto-compile-qemumips +ALL_IMAGE_SET += yocto-image-qemumips +ALL_IMAGE_SET += yocto-sdk-qemumips ALL_IMAGE_SET += rtems5-tools ALL_IMAGE_SET += rtems6-tools ALL_IMAGE_SET += rtems5-rtos @@ -111,9 +117,31 @@ cfsbuildenv-linux.build cfsbuildenv-ubuntu22.build: cfsbuildenv-el8.build cfsbuildenv-el9.build: docker build $(EXTRA_BUILDARGS) -t $(QUALIFIED_IMAGE_NAME) -f cfsbuildenv-rpm/Dockerfile . -yocto-sdk.build: +yocto-sources.build: cfsbuildenv-linux.image +yocto-sources.build: docker build $(EXTRA_BUILDARGS) -t $(QUALIFIED_IMAGE_NAME) \ --build-arg BASE_IMAGE=cfsbuildenv-linux:$(LOCAL_TAG) \ + -f yocto-sources/Dockerfile . + +yocto-compile-%.build: yocto-sources.image +yocto-compile-%.build: + docker build $(EXTRA_BUILDARGS) -t $(QUALIFIED_IMAGE_NAME) \ + --build-arg BASE_IMAGE=yocto-sources-$(*):$(LOCAL_TAG) \ + --build-arg MACHINE=$($*) \ + -f yocto-compile/Dockerfile . + +yocto-image-%.build: yocto-compile-%.image +yocto-image-%.build: + docker build $(EXTRA_BUILDARGS) -t $(QUALIFIED_IMAGE_NAME) \ + --build-arg BASE_IMAGE=yocto-compile-$(*):$(LOCAL_TAG) \ + --build-arg MACHINE=$($*) \ + -f yocto-image/Dockerfile . + +yocto-sdk-%.build: yocto-compile-%.image +yocto-sdk-%.build: + docker build $(EXTRA_BUILDARGS) -t $(QUALIFIED_IMAGE_NAME) \ + --build-arg BASE_IMAGE=yocto-compile-$(*):$(LOCAL_TAG) \ + --build-arg MACHINE=$($*) \ -f yocto-sdk/Dockerfile . cfsbuildenv-yocto.build: diff --git a/yocto-compile/Dockerfile b/yocto-compile/Dockerfile new file mode 100644 index 0000000..93637c8 --- /dev/null +++ b/yocto-compile/Dockerfile @@ -0,0 +1,13 @@ +######################################################### +# Build the Yocto SDK image - contains QEMU riscv64 and mips toolchains +######################################################### + +ARG BASE_IMAGE=yocto-sources:latest +FROM ${BASE_IMAGE} AS yocto-build-image + +ARG MACHINE=qemuriscv64 +ENV MACHINE=${MACHINE} + +RUN bitbake core-image-cfecfs + +RUN ls -l build-cfs/tmp/deploy/images diff --git a/yocto-image/Dockerfile b/yocto-image/Dockerfile new file mode 100644 index 0000000..8bc2498 --- /dev/null +++ b/yocto-image/Dockerfile @@ -0,0 +1,9 @@ +######################################################### +# Build the Yocto SDK image - contains QEMU riscv64 and mips toolchains +######################################################### + +ARG BASE_IMAGE=yocto-compile:latest +FROM ${BASE_IMAGE} AS yocto-compile + +FROM scratch AS yocto-image +COPY --from=yocto-compile /home/docker/build-cfs/tmp/deploy/images /images diff --git a/yocto-sdk/Dockerfile b/yocto-sdk/Dockerfile index 80683f2..9d79138 100644 --- a/yocto-sdk/Dockerfile +++ b/yocto-sdk/Dockerfile @@ -2,52 +2,13 @@ # Build the Yocto SDK image - contains QEMU riscv64 and mips toolchains ######################################################### -ARG BASE_IMAGE=cfsbuildenv-linux:test -FROM ${BASE_IMAGE} AS yocto-sources - -ARG YOCTO_BRANCH=scarthgap - -COPY yocto-sdk/meta-cfecfs meta-cfecfs -RUN git clone git://git.openembedded.org/meta-openembedded -b ${YOCTO_BRANCH} --depth 1 -RUN git clone git://git.yoctoproject.org/poky -b ${YOCTO_BRANCH} --depth 1 -RUN sudo apt-get update && \ - sudo env DEBIAN_FRONTEND=noninteractive apt-get install -y \ - locales chrpath cpio diffstat lz4 zstd wget -RUN echo 'en_US.UTF-8 UTF-8' | sudo tee /etc/locale.gen && sudo locale-gen - -# These environment vars need to be set for bitbake to work -ENV HOME=/home/docker -ENV BUILDDIR="${HOME}/build-cfs" -ENV OE_ADDED_PATHS="${HOME}/poky/scripts:${HOME}/poky/bitbake/bin:" -ENV BB_ENV_PASSTHROUGH_ADDITIONS="ALL_PROXY BBPATH_EXTRA BB_LOGCONFIG BB_NO_NETWORK BB_NUMBER_THREADS BB_SETSCENE_ENFORCE BB_SRCREV_POLICY DISTRO FTPS_PROXY FTP_PROXY GIT_PROXY_COMMAND HTTPS_PROXY HTTP_PROXY MACHINE NO_PROXY PARALLEL_MAKE SCREENDIR SDKMACHINE SOCKS5_PASSWD SOCKS5_USER SSH_AGENT_PID SSH_AUTH_SOCK STAMPS_DIR TCLIBC TCMODE all_proxy ftp_proxy ftps_proxy http_proxy https_proxy no_proxy" -ENV PYTHONPATH=${HOME}/poky/bitbake/lib -ENV PATH=${OE_ADDED_PATHS}${PATH} -ENV BBPATH=${BUILDDIR} - -RUN mkdir -p ${BUILDDIR} -COPY yocto-sdk/conf ${BUILDDIR}/conf -RUN ls -lR ${BUILDDIR} && cat ${BUILDDIR}/conf/bblayers.conf -RUN bitbake core-image-cfecfs --runall=fetch - -FROM yocto-sources AS yocto-build-image - -ARG MACHINE=qemuriscv64 -ENV MACHINE=${MACHINE} - -RUN bitbake core-image-cfecfs - -RUN ls -l build-cfs/tmp/deploy/images -RUN tar -C build-cfs/tmp/deploy/images cvf - . | xz -c > images.tar.xz - -FROM yocto-build-image AS yocto-build-sdk +ARG BASE_IMAGE=yocto-compile:latest +FROM ${BASE_IMAGE} AS yocto-build-sdk RUN bitbake core-image-cfecfs -c populate_sdk RUN ls -l build-cfs/tmp/deploy/sdk RUN /bin/bash -c 'build-cfs/tmp/deploy/sdk/poky*-toolchain-*.sh -y' -FROM scratch AS yocto-image -COPY --from=yocto-build-image /home/docker/images.tar.xz / - FROM scratch AS yocto-sdk COPY --from=yocto-build-sdk /opt /opt diff --git a/yocto-sources/Dockerfile b/yocto-sources/Dockerfile new file mode 100644 index 0000000..323f0e4 --- /dev/null +++ b/yocto-sources/Dockerfile @@ -0,0 +1,30 @@ +######################################################### +# Build the Yocto SDK image - contains QEMU riscv64 and mips toolchains +######################################################### + +ARG BASE_IMAGE=cfsbuildenv-linux:test +FROM ${BASE_IMAGE} AS yocto-sources + +ARG YOCTO_BRANCH=scarthgap + +COPY yocto-sdk/meta-cfecfs meta-cfecfs +RUN git clone git://git.openembedded.org/meta-openembedded -b ${YOCTO_BRANCH} --depth 1 +RUN git clone git://git.yoctoproject.org/poky -b ${YOCTO_BRANCH} --depth 1 +RUN sudo apt-get update && \ + sudo env DEBIAN_FRONTEND=noninteractive apt-get install -y \ + locales chrpath cpio diffstat lz4 zstd wget +RUN echo 'en_US.UTF-8 UTF-8' | sudo tee /etc/locale.gen && sudo locale-gen + +# These environment vars need to be set for bitbake to work +ENV HOME=/home/docker +ENV BUILDDIR="${HOME}/build-cfs" +ENV OE_ADDED_PATHS="${HOME}/poky/scripts:${HOME}/poky/bitbake/bin:" +ENV BB_ENV_PASSTHROUGH_ADDITIONS="ALL_PROXY BBPATH_EXTRA BB_LOGCONFIG BB_NO_NETWORK BB_NUMBER_THREADS BB_SETSCENE_ENFORCE BB_SRCREV_POLICY DISTRO FTPS_PROXY FTP_PROXY GIT_PROXY_COMMAND HTTPS_PROXY HTTP_PROXY MACHINE NO_PROXY PARALLEL_MAKE SCREENDIR SDKMACHINE SOCKS5_PASSWD SOCKS5_USER SSH_AGENT_PID SSH_AUTH_SOCK STAMPS_DIR TCLIBC TCMODE all_proxy ftp_proxy ftps_proxy http_proxy https_proxy no_proxy" +ENV PYTHONPATH=${HOME}/poky/bitbake/lib +ENV PATH=${OE_ADDED_PATHS}${PATH} +ENV BBPATH=${BUILDDIR} + +RUN mkdir -p ${BUILDDIR} +COPY yocto-sdk/conf ${BUILDDIR}/conf +RUN ls -lR ${BUILDDIR} && cat ${BUILDDIR}/conf/bblayers.conf +RUN bitbake core-image-cfecfs --runall=fetch diff --git a/yocto-sdk/conf/bblayers.conf b/yocto-sources/conf/bblayers.conf similarity index 100% rename from yocto-sdk/conf/bblayers.conf rename to yocto-sources/conf/bblayers.conf diff --git a/yocto-sdk/conf/conf-notes.txt b/yocto-sources/conf/conf-notes.txt similarity index 100% rename from yocto-sdk/conf/conf-notes.txt rename to yocto-sources/conf/conf-notes.txt diff --git a/yocto-sdk/conf/conf-summary.txt b/yocto-sources/conf/conf-summary.txt similarity index 100% rename from yocto-sdk/conf/conf-summary.txt rename to yocto-sources/conf/conf-summary.txt diff --git a/yocto-sdk/conf/local.conf b/yocto-sources/conf/local.conf similarity index 100% rename from yocto-sdk/conf/local.conf rename to yocto-sources/conf/local.conf diff --git a/yocto-sdk/conf/templateconf.cfg b/yocto-sources/conf/templateconf.cfg similarity index 100% rename from yocto-sdk/conf/templateconf.cfg rename to yocto-sources/conf/templateconf.cfg diff --git a/yocto-sdk/meta-cfecfs/README.md b/yocto-sources/meta-cfecfs/README.md similarity index 100% rename from yocto-sdk/meta-cfecfs/README.md rename to yocto-sources/meta-cfecfs/README.md diff --git a/yocto-sdk/meta-cfecfs/conf/layer.conf b/yocto-sources/meta-cfecfs/conf/layer.conf similarity index 100% rename from yocto-sdk/meta-cfecfs/conf/layer.conf rename to yocto-sources/meta-cfecfs/conf/layer.conf diff --git a/yocto-sdk/meta-cfecfs/conf/templates/default/bblayers.conf.sample b/yocto-sources/meta-cfecfs/conf/templates/default/bblayers.conf.sample similarity index 100% rename from yocto-sdk/meta-cfecfs/conf/templates/default/bblayers.conf.sample rename to yocto-sources/meta-cfecfs/conf/templates/default/bblayers.conf.sample diff --git a/yocto-sdk/meta-cfecfs/conf/templates/default/conf-notes.txt b/yocto-sources/meta-cfecfs/conf/templates/default/conf-notes.txt similarity index 100% rename from yocto-sdk/meta-cfecfs/conf/templates/default/conf-notes.txt rename to yocto-sources/meta-cfecfs/conf/templates/default/conf-notes.txt diff --git a/yocto-sdk/meta-cfecfs/conf/templates/default/local.conf.sample b/yocto-sources/meta-cfecfs/conf/templates/default/local.conf.sample similarity index 100% rename from yocto-sdk/meta-cfecfs/conf/templates/default/local.conf.sample rename to yocto-sources/meta-cfecfs/conf/templates/default/local.conf.sample diff --git a/yocto-sdk/meta-cfecfs/images/core-image-cfecfs-rt.bb b/yocto-sources/meta-cfecfs/images/core-image-cfecfs-rt.bb similarity index 100% rename from yocto-sdk/meta-cfecfs/images/core-image-cfecfs-rt.bb rename to yocto-sources/meta-cfecfs/images/core-image-cfecfs-rt.bb diff --git a/yocto-sdk/meta-cfecfs/images/core-image-cfecfs.bb b/yocto-sources/meta-cfecfs/images/core-image-cfecfs.bb similarity index 100% rename from yocto-sdk/meta-cfecfs/images/core-image-cfecfs.bb rename to yocto-sources/meta-cfecfs/images/core-image-cfecfs.bb diff --git a/yocto-sdk/meta-cfecfs/images/core-image-cfecfs.inc b/yocto-sources/meta-cfecfs/images/core-image-cfecfs.inc similarity index 100% rename from yocto-sdk/meta-cfecfs/images/core-image-cfecfs.inc rename to yocto-sources/meta-cfecfs/images/core-image-cfecfs.inc diff --git a/yocto-sdk/meta-cfecfs/recipes/base-files/base-files/qemuall/fstab b/yocto-sources/meta-cfecfs/recipes/base-files/base-files/qemuall/fstab similarity index 100% rename from yocto-sdk/meta-cfecfs/recipes/base-files/base-files/qemuall/fstab rename to yocto-sources/meta-cfecfs/recipes/base-files/base-files/qemuall/fstab diff --git a/yocto-sdk/meta-cfecfs/recipes/base-files/base-files_%.bbappend b/yocto-sources/meta-cfecfs/recipes/base-files/base-files_%.bbappend similarity index 100% rename from yocto-sdk/meta-cfecfs/recipes/base-files/base-files_%.bbappend rename to yocto-sources/meta-cfecfs/recipes/base-files/base-files_%.bbappend diff --git a/yocto-sdk/meta-cfecfs/recipes/cfs-support/cfs-support_0.1.bb b/yocto-sources/meta-cfecfs/recipes/cfs-support/cfs-support_0.1.bb similarity index 100% rename from yocto-sdk/meta-cfecfs/recipes/cfs-support/cfs-support_0.1.bb rename to yocto-sources/meta-cfecfs/recipes/cfs-support/cfs-support_0.1.bb diff --git a/yocto-sdk/meta-cfecfs/recipes/cfs-support/files/LICENSE b/yocto-sources/meta-cfecfs/recipes/cfs-support/files/LICENSE similarity index 100% rename from yocto-sdk/meta-cfecfs/recipes/cfs-support/files/LICENSE rename to yocto-sources/meta-cfecfs/recipes/cfs-support/files/LICENSE diff --git a/yocto-sdk/meta-cfecfs/recipes/cfs-support/files/init.d/cfs b/yocto-sources/meta-cfecfs/recipes/cfs-support/files/init.d/cfs similarity index 100% rename from yocto-sdk/meta-cfecfs/recipes/cfs-support/files/init.d/cfs rename to yocto-sources/meta-cfecfs/recipes/cfs-support/files/init.d/cfs diff --git a/yocto-sdk/meta-cfecfs/recipes/cfs-support/files/manager/Makefile b/yocto-sources/meta-cfecfs/recipes/cfs-support/files/manager/Makefile similarity index 100% rename from yocto-sdk/meta-cfecfs/recipes/cfs-support/files/manager/Makefile rename to yocto-sources/meta-cfecfs/recipes/cfs-support/files/manager/Makefile diff --git a/yocto-sdk/meta-cfecfs/recipes/cfs-support/files/manager/cfs-manager.c b/yocto-sources/meta-cfecfs/recipes/cfs-support/files/manager/cfs-manager.c similarity index 100% rename from yocto-sdk/meta-cfecfs/recipes/cfs-support/files/manager/cfs-manager.c rename to yocto-sources/meta-cfecfs/recipes/cfs-support/files/manager/cfs-manager.c diff --git a/yocto-sdk/meta-cfecfs/recipes/init-ifupdown/init-ifupdown/qemuall/interfaces b/yocto-sources/meta-cfecfs/recipes/init-ifupdown/init-ifupdown/qemuall/interfaces similarity index 100% rename from yocto-sdk/meta-cfecfs/recipes/init-ifupdown/init-ifupdown/qemuall/interfaces rename to yocto-sources/meta-cfecfs/recipes/init-ifupdown/init-ifupdown/qemuall/interfaces diff --git a/yocto-sdk/meta-cfecfs/recipes/init-ifupdown/init-ifupdown_%.bbappend b/yocto-sources/meta-cfecfs/recipes/init-ifupdown/init-ifupdown_%.bbappend similarity index 100% rename from yocto-sdk/meta-cfecfs/recipes/init-ifupdown/init-ifupdown_%.bbappend rename to yocto-sources/meta-cfecfs/recipes/init-ifupdown/init-ifupdown_%.bbappend diff --git a/yocto-sdk/meta-cfecfs/recipes/lua/lua/lua.pc b/yocto-sources/meta-cfecfs/recipes/lua/lua/lua.pc similarity index 100% rename from yocto-sdk/meta-cfecfs/recipes/lua/lua/lua.pc rename to yocto-sources/meta-cfecfs/recipes/lua/lua/lua.pc diff --git a/yocto-sdk/meta-cfecfs/recipes/lua/lua/uclibc-pthread.patch b/yocto-sources/meta-cfecfs/recipes/lua/lua/uclibc-pthread.patch similarity index 100% rename from yocto-sdk/meta-cfecfs/recipes/lua/lua/uclibc-pthread.patch rename to yocto-sources/meta-cfecfs/recipes/lua/lua/uclibc-pthread.patch diff --git a/yocto-sdk/meta-cfecfs/recipes/packagegroups/packagegroup-cfecfs.bb b/yocto-sources/meta-cfecfs/recipes/packagegroups/packagegroup-cfecfs.bb similarity index 100% rename from yocto-sdk/meta-cfecfs/recipes/packagegroups/packagegroup-cfecfs.bb rename to yocto-sources/meta-cfecfs/recipes/packagegroups/packagegroup-cfecfs.bb From acc53c732afb49aabd0f83864e43a536a554a061 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Tue, 7 Apr 2026 09:34:30 -0400 Subject: [PATCH 09/11] Updates --- yocto-sources/Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yocto-sources/Dockerfile b/yocto-sources/Dockerfile index 323f0e4..2f1740b 100644 --- a/yocto-sources/Dockerfile +++ b/yocto-sources/Dockerfile @@ -7,7 +7,7 @@ FROM ${BASE_IMAGE} AS yocto-sources ARG YOCTO_BRANCH=scarthgap -COPY yocto-sdk/meta-cfecfs meta-cfecfs +COPY yocto-sources/meta-cfecfs meta-cfecfs RUN git clone git://git.openembedded.org/meta-openembedded -b ${YOCTO_BRANCH} --depth 1 RUN git clone git://git.yoctoproject.org/poky -b ${YOCTO_BRANCH} --depth 1 RUN sudo apt-get update && \ @@ -25,6 +25,6 @@ ENV PATH=${OE_ADDED_PATHS}${PATH} ENV BBPATH=${BUILDDIR} RUN mkdir -p ${BUILDDIR} -COPY yocto-sdk/conf ${BUILDDIR}/conf +COPY yocto-sources/conf ${BUILDDIR}/conf RUN ls -lR ${BUILDDIR} && cat ${BUILDDIR}/conf/bblayers.conf RUN bitbake core-image-cfecfs --runall=fetch From f202ac51704cf4afb9f59a0c3b21a733a6f7cdc7 Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Fri, 10 Apr 2026 12:24:29 -0400 Subject: [PATCH 10/11] Fixups --- Makefile | 50 +++++++++++++++++++++++++++------------- yocto-sources/Dockerfile | 4 ++-- 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 211a21b..c77b92f 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,20 @@ LOCAL_TAG ?= $(shell git rev-parse --short HEAD) TGT_REPO ?= ghcr.io/core-flight-system/containers REPO_TAG ?= latest +# If AUTOBUILD_DEPS is set, then recursively build any missing images +# that are dependencies of the target image. If this is not set, +# then the build will fail if the dependency does not exist. This +# must always be true at the top level or else nothing will build. +ifeq ($(MAKELEVEL),0) +AUTOBUILD_DEPS ?= 1 +endif + +ifneq ($(AUTOBUILD_DEPS),) +BUILD_DEP_CMD = $(MAKE) $(IMAGE_NAME).build +else +BUILD_DEP_CMD = /bin/false +endif + # The option --no-cache can be specified on command line if desired EXTRA_BUILDARGS += --progress=plain @@ -55,6 +69,9 @@ all: $(ALL_IMAGE_TARGETS) push: $(ALL_PUSH_TARGETS) pull: $(ALL_PULL_TARGETS) +check: + env + rtems5-rtos.image: rtems5-tools.image rtems6-rtos.image: rtems6-tools.image cfsbuildenv-rtems5.image: rtems5-rtos.image @@ -126,22 +143,22 @@ yocto-sources.build: yocto-compile-%.build: yocto-sources.image yocto-compile-%.build: docker build $(EXTRA_BUILDARGS) -t $(QUALIFIED_IMAGE_NAME) \ - --build-arg BASE_IMAGE=yocto-sources-$(*):$(LOCAL_TAG) \ - --build-arg MACHINE=$($*) \ + --build-arg BASE_IMAGE=yocto-sources:$(LOCAL_TAG) \ + --build-arg MACHINE=$(*) \ -f yocto-compile/Dockerfile . yocto-image-%.build: yocto-compile-%.image yocto-image-%.build: docker build $(EXTRA_BUILDARGS) -t $(QUALIFIED_IMAGE_NAME) \ --build-arg BASE_IMAGE=yocto-compile-$(*):$(LOCAL_TAG) \ - --build-arg MACHINE=$($*) \ + --build-arg MACHINE=$(*) \ -f yocto-image/Dockerfile . yocto-sdk-%.build: yocto-compile-%.image yocto-sdk-%.build: docker build $(EXTRA_BUILDARGS) -t $(QUALIFIED_IMAGE_NAME) \ --build-arg BASE_IMAGE=yocto-compile-$(*):$(LOCAL_TAG) \ - --build-arg MACHINE=$($*) \ + --build-arg MACHINE=$(*) \ -f yocto-sdk/Dockerfile . cfsbuildenv-yocto.build: @@ -174,29 +191,30 @@ cfsexec-linux.build cfsexec-ubuntu22.build: # the idea here is to check if the image was already built, and if so, just # use the already-built image from the container repo. This is done by commit hash. %.image: - docker pull $(TGT_REPO)/$(QUALIFIED_IMAGE_NAME) || $(MAKE) $(IMAGE_NAME).build + docker pull $(TGT_REPO)/$(QUALIFIED_IMAGE_NAME) || /bin/true + docker inspect $(QUALIFIED_IMAGE_NAME) > /dev/null || $(BUILD_DEP_CMD) # The following is a list of images that rely on a base # image that uses the Debian-style package management via -# apt and dpkg, e.g. Debian/Ubuntu or any derivative thereof. -DPKG_BUILD_TARGETS += arm-linux-sdk.build -DPKG_BUILD_TARGETS += cfsbuildenv-doxygen.build -DPKG_BUILD_TARGETS += docker-executor.build -DPKG_BUILD_TARGETS += gaisler-sparc-rcc-sdk.build -DPKG_BUILD_TARGETS += rtems5-rtos.build +# apt and dpkg, e.g. Debian/Ubuntu or any derivative thereof. +DPKG_BUILD_TARGETS += arm-linux-sdk.build +DPKG_BUILD_TARGETS += cfsbuildenv-doxygen.build +DPKG_BUILD_TARGETS += docker-executor.build +DPKG_BUILD_TARGETS += gaisler-sparc-rcc-sdk.build +DPKG_BUILD_TARGETS += rtems5-rtos.build DPKG_BUILD_TARGETS += rtems5-tools.build -DPKG_BUILD_TARGETS += rtems6-rtos.build +DPKG_BUILD_TARGETS += rtems6-rtos.build DPKG_BUILD_TARGETS += rtems6-tools.build -DPKG_BUILD_TARGETS += cfsbuildenv-rtems5.build -DPKG_BUILD_TARGETS += cfsbuildenv-rtems6.build -DPKG_BUILD_TARGETS += cfsbuildenv-linux.build +DPKG_BUILD_TARGETS += cfsbuildenv-rtems5.build +DPKG_BUILD_TARGETS += cfsbuildenv-rtems6.build +DPKG_BUILD_TARGETS += cfsbuildenv-linux.build DPKG_BUILD_TARGETS += cfsexec-linux.build $(DPKG_BUILD_TARGETS): EXTRA_BUILDARGS += --build-arg BASE_IMAGE=debian:bookworm # These images use rocky linux as an stand-in for RHEL # They should work on any RHEL-like distro that uses rpm/dnf package management -%-el8.build: EXTRA_BUILDARGS += --build-arg BASE_IMAGE=rockylinux:8 +%-el8.build: EXTRA_BUILDARGS += --build-arg BASE_IMAGE=rockylinux:8 %-el9.build: EXTRA_BUILDARGS += --build-arg BASE_IMAGE=rockylinux:9 # These images are intentially using the older ubuntu baseline diff --git a/yocto-sources/Dockerfile b/yocto-sources/Dockerfile index 2f1740b..a605db3 100644 --- a/yocto-sources/Dockerfile +++ b/yocto-sources/Dockerfile @@ -8,8 +8,8 @@ FROM ${BASE_IMAGE} AS yocto-sources ARG YOCTO_BRANCH=scarthgap COPY yocto-sources/meta-cfecfs meta-cfecfs -RUN git clone git://git.openembedded.org/meta-openembedded -b ${YOCTO_BRANCH} --depth 1 -RUN git clone git://git.yoctoproject.org/poky -b ${YOCTO_BRANCH} --depth 1 +RUN git clone https://git.openembedded.org/meta-openembedded -b ${YOCTO_BRANCH} --depth 1 +RUN git clone https://git.yoctoproject.org/poky -b ${YOCTO_BRANCH} --depth 1 RUN sudo apt-get update && \ sudo env DEBIAN_FRONTEND=noninteractive apt-get install -y \ locales chrpath cpio diffstat lz4 zstd wget From 960c23ca24cf03a5737131cb9075f70ef2b6c07a Mon Sep 17 00:00:00 2001 From: Joseph Hickey Date: Mon, 20 Apr 2026 10:26:27 -0400 Subject: [PATCH 11/11] Update rules for yocto --- Makefile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index c77b92f..4a9a915 100644 --- a/Makefile +++ b/Makefile @@ -140,21 +140,24 @@ yocto-sources.build: --build-arg BASE_IMAGE=cfsbuildenv-linux:$(LOCAL_TAG) \ -f yocto-sources/Dockerfile . -yocto-compile-%.build: yocto-sources.image +yocto-compile-qemuriscv64.build: yocto-sources.image +yocto-compile-qemumips.build: yocto-sources.image yocto-compile-%.build: docker build $(EXTRA_BUILDARGS) -t $(QUALIFIED_IMAGE_NAME) \ --build-arg BASE_IMAGE=yocto-sources:$(LOCAL_TAG) \ --build-arg MACHINE=$(*) \ -f yocto-compile/Dockerfile . -yocto-image-%.build: yocto-compile-%.image +yocto-image-qemuriscv64.build: yocto-compile-qemuriscv64.image +yocto-image-qemumips.build: yocto-compile-qemumips.image yocto-image-%.build: docker build $(EXTRA_BUILDARGS) -t $(QUALIFIED_IMAGE_NAME) \ --build-arg BASE_IMAGE=yocto-compile-$(*):$(LOCAL_TAG) \ --build-arg MACHINE=$(*) \ -f yocto-image/Dockerfile . -yocto-sdk-%.build: yocto-compile-%.image +yocto-sdk-qemuriscv64.build: yocto-compile-qemuriscv64.image +yocto-sdk-qemumips.build: yocto-compile-qemumips.image yocto-sdk-%.build: docker build $(EXTRA_BUILDARGS) -t $(QUALIFIED_IMAGE_NAME) \ --build-arg BASE_IMAGE=yocto-compile-$(*):$(LOCAL_TAG) \