Skip to content

Commit

Permalink
bring back openwrt rebuilder, related to #157
Browse files Browse the repository at this point in the history
  • Loading branch information
paidforby committed Dec 4, 2019
1 parent add52e2 commit 3934f71
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
38 changes: 38 additions & 0 deletions build_lib
Original file line number Diff line number Diff line change
Expand Up @@ -316,3 +316,41 @@ remove_images()
echo "Warning: ${image_dir} not found, maybe this is an initial build"
fi
}

openwrt_rebuilder()
{

BUILD_CORES=$(($SYSTEM_CORES * 2))
if [ -v $SUDOWRT_DEBUG ]; then
BUILD_CORES=1
fi

local arch=$1
local target=$2

# Rebuild any changes made to openwrt_configs
local build_dir=${workdir}/${BUILD_DIR}/builder.${arch}
local kconfig=${build_dir}/scripts/kconfig.pl
local config_dir=${workdir}/openwrt_config/arch_configs
local config=${build_dir}/config.${arch}
$kconfig 'm+' "${config_dir}/generic" "${config_dir}/${arch}" > "${config}"

cp ${config} ${build_dir}/.config
make defconfig -C ${build_dir}

echo "Deleting old binaries in dir: ${build_dir}/bin/${arch}..."
remove_images "${build_dir}/bin/${arch}"

echo "Rebuilding [${arch}] in dir: ${build_dir}..."

make -j$BUILD_CORES -C "${build_dir}" 2>&1 | tee -a "${build_dir}/build.log"

if [ "$?" != "0" ]; then
echo "Rebuilding [${arch}] failed. See ${build_dir}/build.log for details!"
exit 1
fi

clean_confdir3_leftover "${build_dir}/build_dir/host/findutils-4.4.2"

echo "Rebuilding [${arch}] done."
}
2 changes: 1 addition & 1 deletion build_only
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ source build_lib
validate_architecture $architecture

echo "Building firmware for [${architecture}]..."
openwrt_builder "${architecture}"
openwrt_rebuilder "${architecture}" "${target}"
echo "Building firmware for [${architecture}] done."
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ rm -r $BUILD_DIR/files
cp -r ./files $BUILD_DIR/files

# execute rebuild of firmware
time ./build_only $ARCH
time ./build_only $ARCH $TARGET

mkdir -p ./firmware_images
cp -r $BUILD_DIR/bin/ar71xx /firmware_images/.

0 comments on commit 3934f71

Please sign in to comment.