Skip to content

Commit

Permalink
dont strip libraries - add node.md
Browse files Browse the repository at this point in the history
  • Loading branch information
gilesknap committed Feb 29, 2024
1 parent 2e7e3ff commit 76d8ac2
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// For format details, see https://containers.dev/implementors/json_reference/
{
"name": "epics-containers IOC devcontainer",
"image": "ghcr.io/epics-containers/rtems6-powerpc-linux-developer:main",
"image": "ghcr.io/epics-containers/rtems6-powerpc-linux-developer:6.2rc1",
"remoteEnv": {
// allows X11 apps to run inside the container
"DISPLAY": "${localEnv:DISPLAY}",
Expand Down
21 changes: 10 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ RUN curl https://ftp.rtems.org/pub/rtems/releases/${RTEMS_MAJOR}/rc/${RTEMS_VERS

# build the cross compilation tool suite
WORKDIR rsb/rtems
RUN ../source-builder/sb-set-builder --jobs=6 --prefix=${RTEMS_ROOT} ${RTEMS_MAJOR}/rtems-${RTEMS_ARCH}
RUN ../source-builder/sb-set-builder --prefix=${RTEMS_ROOT} ${RTEMS_MAJOR}/rtems-${RTEMS_ARCH} && \
strip $(find ${RTEMS_ROOT}) && \


# get the kernel
WORKDIR ${RTEMS_BASE}
Expand All @@ -56,8 +58,7 @@ 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|" \
-e "s|BUILD_TESTS = False|BUILD_TESTS = True|" \
-e "s|RTEMS_POSIX_API = False|RTEMS_POSIX_API = True|"
config.ini && \
./waf configure --prefix=${RTEMS_ROOT}

Expand All @@ -77,20 +78,18 @@ RUN git submodule init && \

from environment AS runtime_prep

# to make this container much smaller we take just the BSP and strip it
# To make this container much smaller we take just the BSP and remove any
# unecessary files.
#
# At present epics-base will not build in github with the developer version
# because of the 7GB limit on the size GHA filesystem. Therefore this 'runtime'
# container is used there.
#
# Note: stripping the rtems libraries causes final executable link failure.

COPY --from=developer ${RTEMS_ROOT} ${RTEMS_ROOT}

RUN apt-get update -y && apt-get upgrade -y && \
apt-get install -y --no-install-recommends \
binutils \
&& rm -rf /var/lib/apt/lists/*

RUN powerpc-rtems6-strip $(find ${RTEMS_ROOT}) 2>/dev/null || true
RUN strip $(find ${RTEMS_ROOT}) 2>/dev/null || true
RUN echo 'will remove any redundant files here'

from environment AS runtime

Expand Down
40 changes: 40 additions & 0 deletions notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Notes on reducing the size of the beatnik BSP

Motivation: keep the containers small.

1. we can strip all of the x86 binaries with strip from binutils
1. we cannot strip the powerpc libraries because this makes final link fail
1. can we strip any powerpc binaries? how do I find them?
1. gcc builds for a range of powerpc variants - getting rid of all but m7400 will be a massive help.

## patching gcc build in the RS

- the bset file that refers to which gcc gets built is
- `rtems/config/6/rtems-default.bset`(default tools built for rtems)
- from
- `rtems/config/6/rtems-powerpc.bset` (settings for ppc arch)
- The gcc config for this is
- `rtems/config/tools/rtems-gcc-13.2-newlib-head.cfg`
- The tar file it gets is
- `https://ftp.rtems.org/pub/rtems/releases/6/rc/6.1-rc2/sources/gcc-13.2.0.tar.xz`
- Which ends up in
- `sources/gcc-13.2.0.tar.xz`

It looks like we need to add something like this:
```
%patch add gcc %{rtems_gcc_patches}/gcc-core-4.4.7-rtems4.10-20120314.diff
%hash md5 gcc-core-4.4.7-rtems4.10-20120314.diff 084c9085c255b1f6a9204e239dde0579
```
to `rtems-gcc-13.2-newlib-head.cfg` in order to patch the gcc build.

Note the value of %{rtems_gcc_pathces} gets set here:
- `rtems/config/rtems-urls.bset`

See https://docs.rtems.org/branches/master/user/rsb/project-sets.html#patches.

## working out what needs patching

The above tar file is expanded into
- `rtems/build/powerpc-rtems6-gcc-13.2.0-newlib-3cacedb-x86_64-linux-gnu-1`

So just need to look through that and work out a patch! :-O

0 comments on commit 76d8ac2

Please sign in to comment.