Skip to content

Commit 9a6103a

Browse files
committed
build in docker container
1 parent a72adf3 commit 9a6103a

File tree

16 files changed

+91
-41
lines changed

16 files changed

+91
-41
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,5 @@ deploy/
5252
controlbox/build
5353

5454
app/cbox/proto/cpp/
55+
56+
build/target/

app/cbox/env.mk

Lines changed: 0 additions & 2 deletions
This file was deleted.

app/controller/env.mk

Lines changed: 0 additions & 2 deletions
This file was deleted.

app/controller/test/makefile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,9 @@ CFLAGS += -Werror=deprecated-declarations
7979
# Generate dependency files automatically.
8080
CFLAGS += -MD -MP -MF $@.d
8181
CFLAGS += -DDEBUG_BUILD
82-
# OSX includes sys/wait.h which defines "wait"
83-
CFLAGS += -D_SYS_WAIT_H_ -D_SYS_WAIT_H
8482

8583
CPPFLAGS += -std=gnu++11
86-
# doesn't work on osx
87-
#LDFLAGS += -Wl,--gc-sections
84+
LDFLAGS += -Wl,--gc-sections
8885

8986
# Collect all object and dep files
9087
ALLOBJ += $(addprefix $(BUILD_PATH), $(CSRC:.c=.o))

platform/spark/build-all.sh renamed to build/build-all.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
function makeit()
42
{
53
echo "building $*"
@@ -14,11 +12,10 @@ fi
1412

1513
function makeapp()
1614
{
17-
makeit PLATFORM=core $*
1815
makeit PLATFORM=photon $*
1916
makeit PLATFORM=P1 $*
2017
}
2118

2219
pwd
23-
makeapp APP=controller
20+
# makeapp APP=controller
2421
makeapp APP=cbox

build/makefile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
$(MAKECMDGOALS) : run_make
2+
3+
.PHONY: run_make
4+
5+
current_dir := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
6+
APPDIR := $(realpath $(current_dir)/..)
7+
SPARKDIR := $(APPDIR)/platform/spark/firmware
8+
9+
APP ?= controller
10+
APP_MAKEFILE := app/$(APP)/build.mk
11+
WARNINGS_AS_ERRORS ?=n
12+
USE_PRINTF_FLOAT ?=n
13+
14+
run_make:
15+
echo "Building app $(APP) from $(APP_MAKEFILE)"
16+
@$(MAKE) -C $(SPARKDIR)/main \
17+
APPDIR=$(APPDIR) \
18+
USER_MAKEFILE=$(APP_MAKEFILE) \
19+
USE_PRINTF_FLOAT=$(USE_PRINTF_FLOAT) \
20+
WARNINGS_AS_ERRORS=$(WARNINGS_AS_ERRORS) \
21+
TARGET_DIR=$(current_dir)/target/$(APP)-$(PLATFORM) \
22+
BUILD_PATH_BASE=$(current_dir)/target \
23+
$(MAKEOVERRIDES) $(MAKECMDGOALS)

ci/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ result=$?
2020
popd
2121
status $result
2222

23-
pushd platform/spark
23+
pushd build
2424
./build-all.sh
2525
result=$?
2626
popd

ci/install_boost.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
BOOST_VERSION=1_63_0
2-
url=http://downloads.sourceforge.net/project/boost/boost/1.63.0/boost_$BOOST_VERSION.tar.gz
1+
BOOST_VERSION=1_67_0
2+
url=http://downloads.sourceforge.net/project/boost/boost/1.67.0/boost_$BOOST_VERSION.tar.gz
33
mkdir -p .cache/boost
44
dl=.cache/boost/boost_$BOOST_VERSION.tar.gz
55
test -f $dl || (

docker/Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM ubuntu:16.04
2+
3+
RUN apt-get update -q && apt-get install -qy git bash curl
4+
RUN apt-get update -q && apt-get install -qy build-essential
5+
6+
ENV GCC_ARM_URL="https://launchpad.net/gcc-arm-embedded/5.0/5-2016-q1-update/+download/gcc-arm-none-eabi-5_3-2016q1-20160330-linux.tar.bz2"
7+
ENV GCC_ARM_VERSION="5_3-2016q1"
8+
9+
RUN dpkg --add-architecture i386 && apt-get update -q && apt-get install -qy make isomd5sum bzip2 vim-common libarchive-zip-perl libc6:i386 \
10+
&& curl -o /tmp/gcc-arm-none-eabi.tar.bz2 -sSL ${GCC_ARM_URL} \
11+
&& tar xjvf /tmp/gcc-arm-none-eabi.tar.bz2 -C /usr/local \
12+
&& mv /usr/local/gcc-arm-none-eabi-${GCC_ARM_VERSION}/ /usr/local/gcc-arm-embedded \
13+
&& apt-get remove -qy bzip2 && apt-get clean && apt-get purge \
14+
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/local/gcc-arm-embedded/share
15+
16+
ENV PATH /usr/local/gcc-arm-embedded/bin:$PATH
17+
18+
COPY scripts /scripts
19+
20+
ENV BOOST_VERSION=1_67_0
21+
ENV BOOST_HOME=/boost
22+
ENV BOOST_ROOT=$BOOST_HOME/boost_$BOOST_VERSION
23+
24+
RUN bash /scripts/download_boost.sh
25+
RUN bash /scripts/build_boost.sh
26+
27+
WORKDIR /firmware/build
28+
CMD bash

docker/docker-compose.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: '2'
2+
services:
3+
compiler:
4+
build: .
5+
image: brewpi/firmware-compiler
6+
container_name: firmware-compiler
7+
hostname: firmware-compiler.local
8+
volumes:
9+
- ../:/firmware
10+
- "/etc/timezone:/etc/timezone:ro"
11+
- "/etc/localtime:/etc/localtime:ro"
12+
13+
networks:
14+
default:
15+
driver: bridge
16+

docker/readme.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
To make it easier to build the firmware on various platforms, a docker container is used to run the build process.
2+
3+
To build simply run these commands in the docker directory:
4+
5+
docker-compose build
6+
docker-compose run compiler make PLATFORM=p1

docker/scripts/build-modules.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
cd /firmware/platform/spark/firmware/modules
2+
make all PLATFORM=p1
3+
make all PLATFORM=photon

docker/scripts/build_boost.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
pushd $BOOST_ROOT
2+
./bootstrap.sh
3+
./b2 --with-thread --with-system --with-program_options --with-random --with-regex --threading=single
4+
popd

docker/scripts/download_boost.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
url=http://downloads.sourceforge.net/project/boost/boost/1.67.0/boost_$BOOST_VERSION.tar.gz
2+
mkdir -p $BOOST_HOME
3+
curl -sSL ${url} | tar -xz -C $BOOST_HOME

platform/spark/makefile

Lines changed: 0 additions & 26 deletions
This file was deleted.

platform/spark/modules/EEPROM/EepromAccessImpl.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "flashee-eeprom.h"
44

55
#include "EepromTypes.h"
6+
#include <algorithm>
67

78
namespace Flashee {
89
class FlashDevice;

0 commit comments

Comments
 (0)