From 079aa0ed8e808e7d27549a7ee4cce49fe00e3d83 Mon Sep 17 00:00:00 2001 From: Rafa Couto Date: Thu, 22 Dec 2016 05:26:56 +0100 Subject: [PATCH] Compilation of openwrt. --- Dockerfile | 8 ++++---- README.md | 4 ++-- scripts/build.sh | 19 ++++++++----------- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3c3a25e..d1652b3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,15 +9,15 @@ RUN apt-get update \ gawk subversion mercurial wget gettext \ && rm -rf /var/lib/apt/lists/* -ENV WORKDIR=/usr/local/openwrt +ENV WORKDIR="/usr/local/openwrt" OPENWRT_RELEASE="v15.05.1" + +WORKDIR $WORKDIR VOLUME ["$WORKDIR/src"] ADD configs $WORKDIR/configs ADD scripts $WORKDIR/scripts -WORKDIR $WORKDIR/src - -CMD ["../scripts/build.sh"] +CMD ["scripts/build.sh"] diff --git a/README.md b/README.md index 6d0d1ac..aaf8f89 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ This image provides a toolchain to build OpenWRT for different hardware devices. ## Usage - docker run --rm caligari/openwrt-builder + docker run --rm -e OPENWRT_TARGET=rpi-3 caligari/openwrt-builder shows the help: @@ -24,7 +24,7 @@ shows the help: ### Docker volumes - docker run -v $(pwd)/src:/usr/local/openwrt/src --rm caligari/openwrt-builder + docker run -v $(pwd)/src:/usr/local/openwrt/src -e OPENWRT_TARGET=rpi-3 caligari/openwrt-builder ### Compile an OpenWRT version to a hardware target diff --git a/scripts/build.sh b/scripts/build.sh index e533369..7ffbec5 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -2,24 +2,21 @@ # ToDo: show target options -# ToDo -echo 'ToDo: examine targets from env vars...' -echo "WORKDIR=$WORKDIR" -echo "OPENWRT_RELEASE=$OPENWRT_RELEASE" -echo "OPENWRT_TARGET=$OPENWRT_TARGET" -exit 0 +# ToDo: examine targets from env vars... + +export OPENWRT_SRC="$WORKDIR/src" # get the sources -git clone https://github.com/openwrt/openwrt.git $WORKDIR/src +git clone https://github.com/openwrt/openwrt.git $OPENWRT_SRC +cd $OPENWRT_SRC git checkout $OPENWRT_RELEASE # set the config file -cp "$WORKDIR/target-configs/$OPENWRT_TARGET.diff" \ - "$WORKDIR/src/.config" && exit 1 +cp "$WORKDIR/configs/$OPENWRT_TARGET.diff" "$OPENWRT_SRC/.config" # update feeds -./scripts/feeds update -a && exit 1 -./scripts/feeds install -a && exit 1 +./scripts/feeds update -a +./scripts/feeds install -a # compile ionice -c 3 nice -n19 make -j3 V=s