aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Dockerfile58
-rw-r--r--Makefile3
-rw-r--r--README.md15
-rw-r--r--defconfig6
-rwxr-xr-xextract_rootfs.sh25
-rw-r--r--trimui_config/Config.in0
-rw-r--r--trimui_config/configs/trimui_defconfig40
-rw-r--r--trimui_config/external.mk1
8 files changed, 130 insertions, 18 deletions
diff --git a/Dockerfile b/Dockerfile
index 82f370c..2e1df97 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,35 +1,73 @@
FROM ubuntu:16.04
RUN apt-get -y update \
- && apt-get -y install bzip2 bc cpio g++ make locales patch perl python unzip rsync wget zip \
+ && apt-get -y install \
+ bc \
+ bison \
+ build-essential \
+ bzip2 \
+ clang \
+ cpio \
+ curl \
+ g++ \
+ git \
+ libboost-dev \
+ libncurses5-dev \
+ libz-dev \
+ locales \
+ libtool \
+ make \
+ patch \
+ perl \
+ python \
+ unzip \
+ rsync \
+ wget \
+ zip \
&& rm -rf /var/lib/apt/lists/*
+
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \
locale-gen
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
-RUN useradd -d /home/trimui -m -s /bin/bash -U trimui
-RUN ln -s /home/trimui/buildroot/output/host/usr /opt/trimui-toolchain
-
-USER trimui
-WORKDIR /home/trimui
+ENV BUILDROOT_HOST_DIR /var/lib/trimui-toolchain
+ENV BUILDROOT_SYSROOT ${BUILDROOT_HOST_DIR}/usr/arm-buildroot-linux-gnueabi/sysroot/
ENV BR_VER 2016.05
ENV BR_DIR buildroot-${BR_VER}
ENV BR_TAR ${BR_DIR}.tar.bz2
ENV BR_URL https://buildroot.org/downloads/${BR_TAR}
+
+
+RUN useradd -d /home/trimui -m -s /bin/bash -U trimui
+RUN mkdir -p ${BUILDROOT_HOST_DIR} && \
+ chown -R trimui:trimui ${BUILDROOT_HOST_DIR} && \
+ ln -s ${BUILDROOT_HOST_DIR}/usr /opt/trimui-toolchain
+
+
+USER trimui
+WORKDIR /home/trimui
+
+COPY trimui_config trimui_config
+
RUN echo ${BR_DIR} && wget ${BR_URL} && ls -l && tar xf ${BR_TAR} && rm -f ${BR_TAR}
RUN ln -s ${BR_DIR} buildroot
WORKDIR /home/trimui/buildroot
-COPY libpng12.patch libpng12.patch
-RUN patch -p0 < libpng12.patch
+RUN make trimui_defconfig BR2_EXTERNAL=../trimui_config && make toolchain
-COPY defconfig defconfig
+COPY *.patch .
+RUN for patch in *.patch; do patch -p0 < $patch; done
+RUN make
+
+WORKDIR /home/trimui
-RUN make defconfig BR2_DEFCONFIG=./defconfig && make toolchain libpng sdl sdl_image bzip2
+COPY extract_rootfs.sh .
+RUN ./extract_rootfs.sh
+RUN mkdir -p $BUILDROOT_SYSROOT/usr && cp -R trimui_rootfs/usr/trimui $BUILDROOT_SYSROOT/usr/trimui
VOLUME /home/trimui/workspace
WORKDIR /home/trimui/workspace
diff --git a/Makefile b/Makefile
index 678c804..6b1e355 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,11 @@
WORKSPACE_DIR := $(shell pwd)/workspace
+CONFIG_FILES := $(shell find trimui_config -type f)
shell: .build
docker run -it --rm -v $(WORKSPACE_DIR):/home/trimui/workspace trimui-toolchain /bin/bash
.PHONY: shell
-.build: Dockerfile defconfig *.patch
+.build: Dockerfile extract_rootfs.sh *.patch $(CONFIG_FILES)
docker build -t trimui-toolchain .
touch .build
diff --git a/README.md b/README.md
index 0515b54..b0d2ee0 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,20 @@ With Docker installed and running, `make shell` builds the toolchain and drops i
After building the first time, unless a dependency of the image has changed, `make shell` will skip building and drop into the shell.
-## Workflow:
+## Workflow
- On your host machine, clone repositories into `./workspace` and make changes as usual.
- In the container shell, find the repository in `~/workspace` and build as usual.
+
+### Changing the buildroot configuration
+
+In `~/buildroot`:
+
+- `make menuconfig`, change options
+- `make savedefconfig BR2_DEFCONFIG=../workspace/defconfig`
+
+Then, on the host, copy `./workspace/defconfig` to `./trimui_config/configs/trimui_defconfig`.
+
+## Docker for Mac
+
+Docker for Mac has a memory limit that can make the toolchain build fail. Follow [these instructions](https://docs.docker.com/docker-for-mac/) to increase the memory limit.
diff --git a/defconfig b/defconfig
deleted file mode 100644
index 2530ecb..0000000
--- a/defconfig
+++ /dev/null
@@ -1,6 +0,0 @@
-BR2_arm=y
-BR2_ENABLE_DEBUG=y
-BR2_TOOLCHAIN_BUILDROOT_GLIBC=y
-BR2_GCC_VERSION_6_X=y
-BR2_TOOLCHAIN_BUILDROOT_CXX=y
-BR2_PACKAGE_HOST_GDB=y
diff --git a/extract_rootfs.sh b/extract_rootfs.sh
new file mode 100755
index 0000000..d253d71
--- /dev/null
+++ b/extract_rootfs.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+set -xe
+
+TRIMUI_RESTORE_IMAGE=http://www.trimui.com/download/Trimui_Factory_Recovery_model_S_dark_V0.105_en.zip
+TRIMUI_IMG_FILE=trimui_model_S_dark_V0.105_en.img
+AWUTILS_REVISION=3f1cbb2c67752b392a88b252c51158d13d8809b5
+EXTFSTOOLS_REVISION=dac938546cc769eca6e57e35d7bb49d0ef458cd3
+
+mkdir -p extract_rootfs && cd extract_rootfs
+
+curl -L https://github.com/Ithamar/awutils/archive/$AWUTILS_REVISION.zip -o awutils.zip && unzip awutils.zip
+cd awutils-$AWUTILS_REVISION && make awimage && cd ..
+
+curl -L https://github.com/petib/extfstools/archive/$EXTFSTOOLS_REVISION.zip -o extfstools.zip && unzip extfstools.zip
+cd extfstools-$EXTFSTOOLS_REVISION && make && cd ..
+
+curl -L $TRIMUI_RESTORE_IMAGE -o trimui_restore_image.zip && unzip trimui_restore_image.zip
+
+awutils-$AWUTILS_REVISION/awimage $TRIMUI_IMG_FILE
+
+mkdir -p ../trimui_rootfs
+extfstools-$EXTFSTOOLS_REVISION/ext2rd $TRIMUI_IMG_FILE.dump/RFSFAT16_ROOTFS_FEX000000 ./:../trimui_rootfs
+
+cd .. && rm -r extract_rootfs
+
diff --git a/trimui_config/Config.in b/trimui_config/Config.in
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/trimui_config/Config.in
diff --git a/trimui_config/configs/trimui_defconfig b/trimui_config/configs/trimui_defconfig
new file mode 100644
index 0000000..763732a
--- /dev/null
+++ b/trimui_config/configs/trimui_defconfig
@@ -0,0 +1,40 @@
+BR2_arm=y
+BR2_HOST_DIR="/var/lib/trimui-toolchain/"
+BR2_ENABLE_DEBUG=y
+BR2_KERNEL_HEADERS_3_10=y
+BR2_TOOLCHAIN_BUILDROOT_GLIBC=y
+BR2_GCC_VERSION_6_X=y
+BR2_TOOLCHAIN_BUILDROOT_CXX=y
+BR2_PACKAGE_HOST_GDB=y
+BR2_INIT_NONE=y
+BR2_SYSTEM_BIN_SH_NONE=y
+# BR2_PACKAGE_BUSYBOX is not set
+BR2_PACKAGE_ALSA_UTILS=y
+BR2_PACKAGE_BZIP2=y
+BR2_PACKAGE_ZIP=y
+BR2_PACKAGE_SDL=y
+BR2_PACKAGE_SDL_IMAGE=y
+BR2_PACKAGE_SDL_IMAGE_JPEG=y
+BR2_PACKAGE_SDL_IMAGE_PNG=y
+BR2_PACKAGE_SDL_MIXER=y
+BR2_PACKAGE_SDL_NET=y
+BR2_PACKAGE_SDL_SOUND=y
+BR2_PACKAGE_SDL_TTF=y
+BR2_PACKAGE_SDL2=y
+BR2_PACKAGE_UBUS=y
+BR2_PACKAGE_LIBAO=y
+BR2_PACKAGE_LIBMAD=y
+BR2_PACKAGE_TINYALSA=y
+BR2_PACKAGE_OPENSSL=y
+BR2_PACKAGE_TSLIB=y
+BR2_PACKAGE_LIBXML2=y
+BR2_PACKAGE_LIBNL=y
+BR2_PACKAGE_LIBNL_TOOLS=y
+BR2_PACKAGE_LIBUCI=y
+BR2_PACKAGE_NCURSES_WCHAR=y
+BR2_PACKAGE_READLINE=y
+BR2_PACKAGE_OPKG=y
+BR2_PACKAGE_OPKG_GPG_SIGN=y
+BR2_PACKAGE_UTIL_LINUX=y
+BR2_PACKAGE_UTIL_LINUX_LIBBLKID=y
+# BR2_TARGET_ROOTFS_TAR is not set
diff --git a/trimui_config/external.mk b/trimui_config/external.mk
new file mode 100644
index 0000000..40f7eae
--- /dev/null
+++ b/trimui_config/external.mk
@@ -0,0 +1 @@
+include $(sort $(wildcard $(BR2_EXTERNAL)/package/*/*.mk))