-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.beatnik
97 lines (78 loc) · 3 KB
/
Dockerfile.beatnik
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
FROM ubuntu:22.04 as environment
ENV VIRTUALENV /venv
ENV RTEMS_MAJOR=6
ENV RTEMS_MINOR=1-rc2
ENV RTEMS_VERSION=${RTEMS_MAJOR}.${RTEMS_MINOR}
ENV RTEMS_ARCH=powerpc
ENV RTEMS_BSP=beatnik
ENV RTEMS_TOP=/rtems6-${RTEMS_BSP}-legacy
ENV RTEMS_PREFIX=${RTEMS_TOP}/rtems/${RTEMS_VERSION}
ENV PATH=${RTEMS_PREFIX}/bin:${PATH}
FROM environment AS developer
# build tools for x86 including python and busybox (for unzip and others)
# https://docs.rtems.org/branches/master/user/start/preparation.html#host-computer
RUN apt-get update -y && apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
bison \
busybox \
curl \
build-essential \
diffutils \
flex \
git \
python3-dev \
python3-venv \
&& rm -rf /var/lib/apt/lists/* && \
busybox --install
# setup a python venv - requried by the RSB to find 'python'
RUN python3 -m venv ${VIRTUALENV}
ENV PATH=${VIRTUALENV}/bin:${PATH}
# get the RTEMS Source Builder
WORKDIR ${RTEMS_TOP}
RUN curl https://ftp.rtems.org/pub/rtems/releases/${RTEMS_MAJOR}/rc/${RTEMS_VERSION}/sources/rtems-source-builder-${RTEMS_VERSION}.tar.xz \
| tar -xJ && \
mv rtems-source-builder-${RTEMS_VERSION} rsb
# add in a gcc patch to only build for m7400
COPY local_patch local_patch
RUN local_patch/patch-rsb.sh
# build the cross compilation tool suite and strip symbols to minimize size
WORKDIR rsb/rtems
RUN ../source-builder/sb-set-builder --prefix=${RTEMS_PREFIX} ${RTEMS_MAJOR}/rtems-${RTEMS_ARCH} && \
strip $(find ${RTEMS_PREFIX}) 2> /dev/null || true && \
ranlib $(find ${RTEMS_PREFIX} -name '*.a')
# get the kernel
WORKDIR ${RTEMS_TOP}
RUN curl https://ftp.rtems.org/pub/rtems/releases/${RTEMS_MAJOR}/rc/${RTEMS_VERSION}/sources/rtems-${RTEMS_VERSION}.tar.xz \
| tar -xJ && \
mv rtems-${RTEMS_VERSION} kernel
# patch the kernel
WORKDIR ${RTEMS_TOP}/kernel
COPY VMEConfig.patch .
RUN git apply VMEConfig.patch && \
./waf bspdefaults --rtems-bsps=${RTEMS_ARCH}/${RTEMS_BSP} > config.ini && \
sed -i -e "s|RTEMS_POSIX_API = False|RTEMS_POSIX_API = True|" config.ini && \
./waf configure --prefix=${RTEMS_PREFIX}
# build the Board Support Package with patched kernel
RUN ./waf && \
./waf install
RUN git clone git://git.rtems.org/rtems-net-legacy.git ${RTEMS_TOP}/rtems-net-legacy
# add in the legacy network stack
WORKDIR ${RTEMS_TOP}/rtems-net-legacy
RUN git submodule init && \
git submodule update && \
./waf configure --prefix=${RTEMS_PREFIX} --rtems-bsps=${RTEMS_ARCH}/${RTEMS_BSP} && \
./waf && \
./waf install
from environment AS runtime_prep
# To make this container target smaller we take just the BSP
COPY --from=developer ${RTEMS_PREFIX} ${RTEMS_PREFIX}
# remove files that are not required
RUN rm -r \
${RTEMS_PREFIX}/share/doc \
${RTEMS_PREFIX}/share/man \
${RTEMS_PREFIX}/share/info \
${RTEMS_PREFIX}/powerpc-rtems6/lib/ldscripts
from runtime_prep AS runtime
# environment variables for epics-base build
ENV RTEMS_BASE=${RTEMS_PREFIX}
COPY --from=runtime_prep ${RTEMS_PREFIX} ${RTEMS_PREFIX}