Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #11, Add RTEMS 6 container for cFS test workflow #12

Merged
merged 2 commits into from May 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/registry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
67 changes: 67 additions & 0 deletions rtems-6/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
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
# 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} \
&& git clone git://git.rtems.org/rtems.git \
&& 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 \
&& ./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 checkout 1d492241 \
&& 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
4 changes: 4 additions & 0 deletions rtems-6/config.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[i386/pc686]
RTEMS_POSIX_API = False
BUILD_TESTS = False

37 changes: 37 additions & 0 deletions rtems-6/testbusy.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (c) 2014, 2018 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Dornierstr. 4
* 82178 Puchheim
* Germany
* <rtems@embedded-brains.de>
*
* 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 <rtems/test-info.h>
#include <rtems/score/threadimpl.h>

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 );
}