From 4ad5efd6071cefe6cc813d5d6b38869b54a44eaf Mon Sep 17 00:00:00 2001 From: neonloop Date: Sat, 6 Mar 2021 16:38:07 +0000 Subject: Stops extracting rootfs and puts extra files in the sysroot trimui rootfs only contains .so files, not that helpful for development. The script is still useful, so it moves to utils. Extra libs and headers can now be put into `./extras` and are moved into `sysroot/usr` during the build process. --- .gitignore | 3 ++- Dockerfile | 7 ++++--- Makefile | 3 ++- README.md | 4 ++++ extract_rootfs.sh | 25 ------------------------- extras/include/.keep | 0 extras/lib/.keep | 0 utils/extract_rootfs.sh | 28 ++++++++++++++++++++++++++++ 8 files changed, 40 insertions(+), 30 deletions(-) delete mode 100755 extract_rootfs.sh create mode 100644 extras/include/.keep create mode 100644 extras/lib/.keep create mode 100755 utils/extract_rootfs.sh diff --git a/.gitignore b/.gitignore index b4d5d53..d713d0f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .build -workspace/* \ No newline at end of file +workspace/* +extras/* \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 2e1df97..7fb7e1e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -63,11 +63,12 @@ COPY *.patch . RUN for patch in *.patch; do patch -p0 < $patch; done RUN make + WORKDIR /home/trimui -COPY extract_rootfs.sh . -RUN ./extract_rootfs.sh -RUN mkdir -p $BUILDROOT_SYSROOT/usr && cp -R trimui_rootfs/usr/trimui $BUILDROOT_SYSROOT/usr/trimui +COPY extras extras + +RUN rsync -av extras/* $BUILDROOT_SYSROOT/usr/ VOLUME /home/trimui/workspace WORKDIR /home/trimui/workspace diff --git a/Makefile b/Makefile index 6b1e355..c15fc2b 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,12 @@ WORKSPACE_DIR := $(shell pwd)/workspace CONFIG_FILES := $(shell find trimui_config -type f) +EXTRA_FILES := $(shell find extras -type f) shell: .build docker run -it --rm -v $(WORKSPACE_DIR):/home/trimui/workspace trimui-toolchain /bin/bash .PHONY: shell -.build: Dockerfile extract_rootfs.sh *.patch $(CONFIG_FILES) +.build: Dockerfile *.patch $(CONFIG_FILES) $(EXTRA_FILES) docker build -t trimui-toolchain . touch .build diff --git a/README.md b/README.md index b0d2ee0..cf180ae 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,10 @@ After building the first time, unless a dependency of the image has changed, `ma - 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. +### Adding additional files to the toolchain sysroot + +Put files that you want included in the sysroot (libs and headers, you've built, etc.) in `./extras`. They will be copied to `$SYSROOT/usr` as the container is built. + ### Changing the buildroot configuration In `~/buildroot`: diff --git a/extract_rootfs.sh b/extract_rootfs.sh deleted file mode 100755 index d253d71..0000000 --- a/extract_rootfs.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/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/extras/include/.keep b/extras/include/.keep new file mode 100644 index 0000000..e69de29 diff --git a/extras/lib/.keep b/extras/lib/.keep new file mode 100644 index 0000000..e69de29 diff --git a/utils/extract_rootfs.sh b/utils/extract_rootfs.sh new file mode 100755 index 0000000..8edcc9b --- /dev/null +++ b/utils/extract_rootfs.sh @@ -0,0 +1,28 @@ +#!/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 +WORKDIR="${TMPDIR:-/tmp}"/extract_rootfs + +mkdir -p $WORKDIR && pushd $WORKDIR + +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 + +popd + +mkdir -p trimui_rootfs + +$WORKDIR/extfstools-$EXTFSTOOLS_REVISION/ext2rd $WORKDIR/$TRIMUI_IMG_FILE.dump/RFSFAT16_ROOTFS_FEX000000 ./:./trimui_rootfs + +rm -r $WORKDIR -- cgit v1.2.3