From a30d2be8af00cef27ded5978617501ee035b3aac Mon Sep 17 00:00:00 2001 From: Alan Cudmore Date: Fri, 13 May 2022 08:42:30 -0700 Subject: [PATCH 1/2] Fix #11, Add RTEMS-6 container for cFS github workflow --- .github/workflows/registry.yml | 19 ++++++++++ rtems-6/Dockerfile | 63 ++++++++++++++++++++++++++++++++++ rtems-6/config.ini | 4 +++ rtems-6/testbusy.c | 37 ++++++++++++++++++++ 4 files changed, 123 insertions(+) create mode 100644 rtems-6/Dockerfile create mode 100644 rtems-6/config.ini create mode 100644 rtems-6/testbusy.c diff --git a/.github/workflows/registry.yml b/.github/workflows/registry.yml index 2828ad9..4ba78e3 100644 --- a/.github/workflows/registry.yml +++ b/.github/workflows/registry.yml @@ -7,6 +7,25 @@ on: - main jobs: + build-rtems-6: + + name: Build and Push qemu-rtems-6 + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Build and Push + uses: mr-smithers-excellent/docker-build-push@v5 + with: + image: qemu-rtems-6 + dockerfile: rtems-6/Dockerfile + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + tags: latest + build-rtems-5: name: Build and Push qemu-rtems-5 diff --git a/rtems-6/Dockerfile b/rtems-6/Dockerfile new file mode 100644 index 0000000..3bc0c46 --- /dev/null +++ b/rtems-6/Dockerfile @@ -0,0 +1,63 @@ +from ubuntu:18.04 + +# Basic dependencies +run apt-get update && apt-get install -y git make + +# rtems dependencies +run apt-get install -y flex bison texinfo python-dev g++ unzip + +# 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 git://git.rtems.org/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 + && cd ${HOME} \ + && git clone git://git.rtems.org/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 + && cd ${HOME} \ + && git clone git://git.rtems.org/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 libcurl4-gnutls-dev libexpat1-dev gettext unzip git flex bison texinfo curl +run apt-get autoremove -y diff --git a/rtems-6/config.ini b/rtems-6/config.ini new file mode 100644 index 0000000..31446e6 --- /dev/null +++ b/rtems-6/config.ini @@ -0,0 +1,4 @@ +[i386/pc686] +RTEMS_POSIX_API = False +BUILD_TESTS = False + diff --git a/rtems-6/testbusy.c b/rtems-6/testbusy.c new file mode 100644 index 0000000..51c6a71 --- /dev/null +++ b/rtems-6/testbusy.c @@ -0,0 +1,37 @@ +/* + * 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 ); +} From e13b0fb5d3d1622999f9da80d1b3189903b498e1 Mon Sep 17 00:00:00 2001 From: Alan Cudmore Date: Wed, 18 May 2022 10:57:32 -0700 Subject: [PATCH 2/2] Fix #11, use specific commits for RTEMS repos --- rtems-6/Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rtems-6/Dockerfile b/rtems-6/Dockerfile index 3bc0c46..f448478 100644 --- a/rtems-6/Dockerfile +++ b/rtems-6/Dockerfile @@ -16,10 +16,12 @@ copy rtems-6/config.ini /config.ini copy rtems-6/testbusy.c /testbusy.c # setup and compile RTEMS BSP +# Git commits are from 13 May 2022 run mkdir -p ${HOME}/rtems-6 \ && cd ${HOME} \ && git clone git://git.rtems.org/rtems-source-builder.git \ && cd rtems-source-builder/rtems \ + && git checkout 620b6243 \ && ../source-builder/sb-set-builder --prefix=$HOME/rtems-6 6/rtems-i386 \ # clone RTEMS source tree && cd ${HOME} \ @@ -27,6 +29,7 @@ run mkdir -p ${HOME}/rtems-6 \ && export PATH=$HOME/rtems-6/bin:$PATH \ # Build RTEMS BSP && cd rtems \ + && git checkout 3ccfb583 \ && mv /config.ini . \ && ./waf configure --prefix=${HOME}/rtems-6 \ && ./waf \ @@ -35,6 +38,7 @@ run mkdir -p ${HOME}/rtems-6 \ && cd ${HOME} \ && git clone git://git.rtems.org/rtems-net-legacy.git \ && cd rtems-net-legacy \ + && git checkout 1d492241 \ && git submodule update --init \ && mv /testbusy.c libtest/testbusy.c \ && ./waf configure --prefix=$HOME/rtems-6 \