From 8aad142794f9d61d51e1ad01a9fbb7611479202d Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Wed, 3 Feb 2021 22:01:54 +0100 Subject: [PATCH 1/3] buildscript: remove unneeded global download directory link Some time ago, the firmware created a directory for each target and built OpenWrt separately there. In this situation, it made sense to download files only once and share them between these build directories. However, since we nowadays only have one build directory for all targets, this makes no sense anymore. Remove the link. Signed-off-by: Adrian Schmutzler --- buildscript | 4 ---- 1 file changed, 4 deletions(-) diff --git a/buildscript b/buildscript index f7889e92..3736e508 100755 --- a/buildscript +++ b/buildscript @@ -140,10 +140,6 @@ prepare() { # exists in builddir. apply_variant - #saves ~200MB for each build - test -d ./src/dl || mkdir ./src/dl - ln -s ../src/dl "$builddir"/dl - update_feeds } -- 2.39.2 From 2d8334e2df558b44821a1676099c6314b43fabaa Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Wed, 3 Feb 2021 22:36:10 +0100 Subject: [PATCH 2/3] buildscript: do not overwrite build directory on prepare So far, we remove the old and copy a fresh new OpenWrt directory into the build directory on prepare. There is no need to do this, as OpenWrt/Make is capable of detecting changes and we do properly update the feeds and patches already. So, just clone the OpenWrt main repo into builddir directly, and just checkout/apply patches during prepare. Signed-off-by: Adrian Schmutzler --- buildscript | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/buildscript b/buildscript index 3736e508..a954f866 100755 --- a/buildscript +++ b/buildscript @@ -62,6 +62,11 @@ checkout_git(){ if [ -d "$DIRECTORY" ]; then if $MYGIT remote -v | grep -q "$REPO_URL" ; then echo "Right remote detected" + # Reset tracked files + $MYGIT reset --hard HEAD + # Remove untracked files + $MYGIT clean -f -d + # Select desired commit if ! $MYGIT checkout "$COMMITID" ; then echo "commitid not found trying to fetch new commits" $MYGIT pull && $MYGIT checkout "$COMMITID" @@ -82,14 +87,11 @@ checkout_git(){ } get_source() { - test -d src || mkdir src - cd src + #Get the OpenWrt main repo + checkout_git $builddir $OPENWRTURL $OPENWRTREV - #Get the OpenWrt Core Source for Firmware - checkout_git openwrt $OPENWRTURL $OPENWRTREV - - test -d packages || mkdir packages - cd packages + test -d src/packages || mkdir -p src/packages + cd src/packages #checkout needed package feeds for FEEDVAR in "${FEEDS[@]}" ; do @@ -129,11 +131,6 @@ patch_target() { prepare() { get_source - test -d $builddir || mkdir $builddir - - /bin/rm -rf "$builddir" - cp -a src/openwrt "$builddir" - patch_target # apply variant to ensure the included file "variant.mk" @@ -342,7 +339,7 @@ buildrelease() { } clean() { - /bin/rm -rf bin $builddir src/openwrt + /bin/rm -rf bin $builddir # remove downloaded package feeds for FEEDVAR in "${FEEDS[@]}" ; do -- 2.39.2 From 2c807356ea3d4565086c322d04628cb6203abd95 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Wed, 3 Feb 2021 22:39:56 +0100 Subject: [PATCH 3/3] buildscript: remove obsolete template rewrite We do not use any *.tpl files anymore, so remove the routine for installing them. Signed-off-by: Adrian Schmutzler --- buildscript | 7 ------- 1 file changed, 7 deletions(-) diff --git a/buildscript b/buildscript index a954f866..9a368533 100755 --- a/buildscript +++ b/buildscript @@ -190,13 +190,6 @@ prebuild() { cp -r ./bsp/default/root_file_system/* "$builddir"/files/ cp ./bsp/"$machine"/.config "$builddir"/.config - while IFS= read -r -d '' template - do - echo "Translating $template .." - $tpl_translate "$template" > "$(dirname "$template")"/"$(basename "$template" .tpl)" - /bin/rm "$template" - done < <(find "${builddir}/files" -name '*.tpl' -print0) - #insert actual firware version informations into release file variant=$(cat selected_variant) version=$(git describe --tags --dirty) -- 2.39.2