Compare commits
1 Commits
dev
...
251b54937b
| Author | SHA1 | Date | |
|---|---|---|---|
| 251b54937b |
@@ -13,9 +13,9 @@ Build and deploy OpenWRT images using shell-style device profiles, via source co
|
|||||||
--release,-r,--version,-v RELEASE ("snapshot", "22.03.3")
|
--release,-r,--version,-v RELEASE ("snapshot", "22.03.3")
|
||||||
--buildroot,-b PATH (Default: script directory)
|
--buildroot,-b PATH (Default: script directory)
|
||||||
--source
|
--source
|
||||||
Build image from source code, not from Image Builder.
|
Build image from source code, not from Image Builder
|
||||||
Allows make config options to be passed in profile.
|
Allows make config options to be passed in profile
|
||||||
Uses git worktree for multi-profile deduplication.
|
Uses git worktree for multi-profile deduplication
|
||||||
--ssh-upgrade HOST
|
--ssh-upgrade HOST
|
||||||
Example: root@192.168.1.1
|
Example: root@192.168.1.1
|
||||||
--ssh-backup SSH_PATH
|
--ssh-backup SSH_PATH
|
||||||
|
|||||||
185
openwrtbuilder
185
openwrtbuilder
@@ -1,11 +1,10 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Build and deploy OpenWRT images using shell-style device profiles, via source code or the official Image Builder.
|
# Build and deploy OpenWRT images using shell-style device profiles, via source code or the official Image Builder.# Copyright 2022-25 Bryan C. Roessler
|
||||||
# Copyright 2022-25 Bryan C. Roessler
|
|
||||||
# Apache 2.0 License
|
# Apache 2.0 License
|
||||||
# See README and ./profiles for device configuration
|
# See README and profiles for device configuration
|
||||||
|
|
||||||
# Set default release
|
# Set default release
|
||||||
: "${RELEASE:="24.10.5"}"
|
: "${RELEASE:="24.10.2"}"
|
||||||
|
|
||||||
# @internal
|
# @internal
|
||||||
print_help() {
|
print_help() {
|
||||||
@@ -22,16 +21,18 @@ print_help() {
|
|||||||
--release,-r,--version,-v RELEASE ("snapshot", "22.03.5")
|
--release,-r,--version,-v RELEASE ("snapshot", "22.03.5")
|
||||||
--buildroot,-b PATH
|
--buildroot,-b PATH
|
||||||
Default: location of openwrtbuilder script
|
Default: location of openwrtbuilder script
|
||||||
--source[=CLEAN]
|
--source
|
||||||
Build image from source, not from Image Builder
|
Build image from source, not from Image Builder
|
||||||
Optional CLEAN runs the given clean mode before building
|
Allows make config options to be passed in profile
|
||||||
(clean|targetclean|dirclean|distclean)
|
Uses git worktree for multi-profile deduplication
|
||||||
--ssh-upgrade HOST
|
--ssh-upgrade HOST
|
||||||
Examples: root@192.168.1.1, root@router.lan
|
Examples: root@192.168.1.1, root@router.lan
|
||||||
--ssh-backup SSH_PATH
|
--ssh-backup SSH_PATH
|
||||||
Enabled by default for --ssh-upgrade
|
Enabled by default for --ssh-upgrade
|
||||||
--flash,-f DEVICE
|
--flash,-f DEVICE
|
||||||
Example: /dev/sdX
|
Example: /dev/sdX
|
||||||
|
--reset
|
||||||
|
Cleanup all source and output files
|
||||||
--depends
|
--depends
|
||||||
Force dependency installation
|
Force dependency installation
|
||||||
--yes,-y
|
--yes,-y
|
||||||
@@ -56,7 +57,7 @@ init() {
|
|||||||
|
|
||||||
# Save the script directory
|
# Save the script directory
|
||||||
# https://stackoverflow.com/a/4774063
|
# https://stackoverflow.com/a/4774063
|
||||||
SCRIPT_DIR=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")
|
SCRIPT_DIR="$(cd -- "$(dirname "$0")" >/dev/null 2>&1 || exit $? ; pwd -P)"
|
||||||
|
|
||||||
if [[ -e "/etc/os-release" ]]; then
|
if [[ -e "/etc/os-release" ]]; then
|
||||||
source "/etc/os-release"
|
source "/etc/os-release"
|
||||||
@@ -125,8 +126,8 @@ parse_input() {
|
|||||||
debug "${FUNCNAME[0]}" "$*"
|
debug "${FUNCNAME[0]}" "$*"
|
||||||
declare -ga PROFILES
|
declare -ga PROFILES
|
||||||
declare -gi RESET=0 FROM_SOURCE=0 YES=0 DEBUG=0 FORCE_DEPENDS=0
|
declare -gi RESET=0 FROM_SOURCE=0 YES=0 DEBUG=0 FORCE_DEPENDS=0
|
||||||
declare -g USER_RELEASE SSH_UPGRADE_PATH SSH_BACKUP_PATH FLASH_DEV SOURCE_CLEAN
|
declare -g USER_RELEASE SSH_UPGRADE_PATH SSH_BACKUP_PATH FLASH_DEV
|
||||||
local long_opts='release:,version:,profile:,buildroot:,source::,'
|
local long_opts='release:,version:,profile:,buildroot:,source,'
|
||||||
long_opts+='ssh-upgrade:,ssh-backup:,flash:,reset,depends,yes,debug,help'
|
long_opts+='ssh-upgrade:,ssh-backup:,flash:,reset,depends,yes,debug,help'
|
||||||
|
|
||||||
if _input=$(getopt -o +r:v:p:b:sf:ydh -l $long_opts -- "$@"); then
|
if _input=$(getopt -o +r:v:p:b:sf:ydh -l $long_opts -- "$@"); then
|
||||||
@@ -136,12 +137,7 @@ parse_input() {
|
|||||||
--release|-r|--version|-v) shift; USER_RELEASE="$1" ;;
|
--release|-r|--version|-v) shift; USER_RELEASE="$1" ;;
|
||||||
--profile|-p) shift; PROFILES+=("$1") ;;
|
--profile|-p) shift; PROFILES+=("$1") ;;
|
||||||
--buildroot|-b) shift; BUILD_ROOT="$1" ;;
|
--buildroot|-b) shift; BUILD_ROOT="$1" ;;
|
||||||
--source|-s) FROM_SOURCE=1
|
--source|-s) FROM_SOURCE=1 ;;
|
||||||
case "$1" in
|
|
||||||
-*|"") ;; # if empty
|
|
||||||
*) SOURCE_CLEAN="$1"; shift ;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
--ssh-upgrade) shift; SSH_UPGRADE_PATH="$1" ;;
|
--ssh-upgrade) shift; SSH_UPGRADE_PATH="$1" ;;
|
||||||
--ssh-backup) shift; SSH_BACKUP_PATH="$1" ;;
|
--ssh-backup) shift; SSH_BACKUP_PATH="$1" ;;
|
||||||
--flash|-f) shift; FLASH_DEV="$1" ;;
|
--flash|-f) shift; FLASH_DEV="$1" ;;
|
||||||
@@ -175,7 +171,7 @@ install_dependencies() {
|
|||||||
lock_file="$BUILD_ROOT/.dependencies_ib.lock"
|
lock_file="$BUILD_ROOT/.dependencies_ib.lock"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ -f $lock_file ]] && debug "$lock_file lock file exists but skipping for --debug" && return 0
|
[[ -f $lock_file ]] && debug "$lock_file lock file exists" && return 0
|
||||||
|
|
||||||
if [[ "$mode" == "source" ]]; then
|
if [[ "$mode" == "source" ]]; then
|
||||||
# For building from source code see:
|
# For building from source code see:
|
||||||
@@ -189,7 +185,6 @@ install_dependencies() {
|
|||||||
gcc
|
gcc
|
||||||
gcc-c++
|
gcc-c++
|
||||||
git
|
git
|
||||||
golang
|
|
||||||
llvm15-libs # for qosify
|
llvm15-libs # for qosify
|
||||||
make
|
make
|
||||||
ncurses-devel
|
ncurses-devel
|
||||||
@@ -208,7 +203,6 @@ install_dependencies() {
|
|||||||
python3-devel
|
python3-devel
|
||||||
python3-pyelftools
|
python3-pyelftools
|
||||||
python3-setuptools
|
python3-setuptools
|
||||||
quilt
|
|
||||||
rsync
|
rsync
|
||||||
swig
|
swig
|
||||||
tar
|
tar
|
||||||
@@ -227,12 +221,10 @@ install_dependencies() {
|
|||||||
gcc-multilib
|
gcc-multilib
|
||||||
gettext
|
gettext
|
||||||
git
|
git
|
||||||
golang
|
|
||||||
liblzma-dev
|
liblzma-dev
|
||||||
libncurses5-dev
|
libncurses5-dev
|
||||||
libssl-dev
|
libssl-dev
|
||||||
python3-distutils
|
python3-distutils
|
||||||
quilt
|
|
||||||
rsync
|
rsync
|
||||||
patch
|
patch
|
||||||
unzip
|
unzip
|
||||||
@@ -257,7 +249,6 @@ install_dependencies() {
|
|||||||
gcc
|
gcc
|
||||||
gettext
|
gettext
|
||||||
git
|
git
|
||||||
golang
|
|
||||||
grep
|
grep
|
||||||
groff
|
groff
|
||||||
gzip
|
gzip
|
||||||
@@ -272,7 +263,6 @@ install_dependencies() {
|
|||||||
patch
|
patch
|
||||||
pkgconf
|
pkgconf
|
||||||
python
|
python
|
||||||
quilt
|
|
||||||
rsync
|
rsync
|
||||||
sed
|
sed
|
||||||
texinfo
|
texinfo
|
||||||
@@ -517,29 +507,11 @@ from_source() {
|
|||||||
local seed_file="$BUILD_DIR/.config"
|
local seed_file="$BUILD_DIR/.config"
|
||||||
local worktree_meta="$SRC_DIR/.git/worktrees/source-$ref"
|
local worktree_meta="$SRC_DIR/.git/worktrees/source-$ref"
|
||||||
local pkg config commit seed_file description
|
local pkg config commit seed_file description
|
||||||
local -a make_opts
|
local -a make_opts config_opts
|
||||||
local -a config_opts=(
|
|
||||||
"CONFIG_TARGET_${TARGET%%/*}=y"
|
|
||||||
"CONFIG_TARGET_${TARGET//\//_}=y"
|
|
||||||
"CONFIG_TARGET_PROFILE=DEVICE_$DEVICE"
|
|
||||||
"CONFIG_TARGET_${TARGET//\//_}_DEVICE_$DEVICE=y"
|
|
||||||
"CONFIG_TARGET_ROOTFS_${FILESYSTEM^^}=y"
|
|
||||||
"CONFIG_TARGET_MULTI_PROFILE=n"
|
|
||||||
"CONFIG_BUILDBOT=n"
|
|
||||||
"CONFIG_ALL_KMODS=n"
|
|
||||||
"CONFIG_ALL_NONSHARED=n"
|
|
||||||
"CONFIG_DEVEL=n"
|
|
||||||
"CONFIG_COLLECT_KERNEL_DEBUG=n"
|
|
||||||
"CONFIG_SDK=n"
|
|
||||||
"CONFIG_SDK_LLVM_BPF=n"
|
|
||||||
"CONFIG_IB=n"
|
|
||||||
"CONFIG_MAKE_TOOLCHAIN=n"
|
|
||||||
"CONFIG_TARGET_PER_DEVICE_ROOTFS=n"
|
|
||||||
)
|
|
||||||
|
|
||||||
echo "Building from source is under development"
|
echo "Building from source is under development"
|
||||||
|
|
||||||
# Remove all build directories and worktrees if --reset
|
# Remove all build directories and worktrees
|
||||||
if ((RESET)); then
|
if ((RESET)); then
|
||||||
if [[ -d "$BUILD_DIR" || -d "$worktree_meta" ]]; then
|
if [[ -d "$BUILD_DIR" || -d "$worktree_meta" ]]; then
|
||||||
execute git -C "$SRC_DIR" worktree remove --force --force "$BUILD_DIR"
|
execute git -C "$SRC_DIR" worktree remove --force --force "$BUILD_DIR"
|
||||||
@@ -549,63 +521,24 @@ from_source() {
|
|||||||
[[ -d "$BUILD_DIR" ]] && execute rm -rf "$BUILD_DIR"
|
[[ -d "$BUILD_DIR" ]] && execute rm -rf "$BUILD_DIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Fetch or clone source repo (no local merges)
|
# Pull or clone source repo
|
||||||
if [[ -d "$SRC_DIR" ]]; then
|
if [[ -d "$SRC_DIR" ]]; then
|
||||||
execute git -C "$SRC_DIR" fetch origin --tags --prune
|
execute git -C "$SRC_DIR" pull
|
||||||
else
|
else
|
||||||
execute mkdir -p "$SRC_DIR"
|
execute mkdir -p "$SRC_DIR"
|
||||||
execute git clone "$src_url" "$SRC_DIR"
|
execute git clone "$src_url" "$SRC_DIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Reuse worktree if present; otherwise create it (support branches and tags)
|
# Remove existing build dir and add new worktree
|
||||||
if git -C "$BUILD_DIR" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
|
if [[ -d "$BUILD_DIR" ]]; then
|
||||||
execute git -C "$BUILD_DIR" fetch origin --tags --prune
|
execute rm -rf "$BUILD_DIR"
|
||||||
execute git -C "$BUILD_DIR" reset --hard "origin/$ref" || \
|
|
||||||
execute git -C "$BUILD_DIR" reset --hard "$ref" || \
|
|
||||||
execute git -C "$BUILD_DIR" checkout --detach "$ref"
|
|
||||||
else
|
|
||||||
execute git -C "$SRC_DIR" worktree prune --verbose
|
|
||||||
# Prefer local tag/branch if present, otherwise use remote-tracking branch
|
|
||||||
if ! execute git -C "$SRC_DIR" worktree add --detach "$BUILD_DIR" "$ref"; then
|
|
||||||
execute git -C "$SRC_DIR" worktree add --detach "$BUILD_DIR" "origin/$ref"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
execute git -C "$SRC_DIR" worktree prune --verbose
|
||||||
|
execute git -C "$SRC_DIR" worktree add --detached "$BUILD_DIR" "$ref"
|
||||||
|
|
||||||
# Add cherrypicks
|
|
||||||
for entry in ${P_ARR[cherrypicks]}; do
|
|
||||||
url_branch="${entry%%:*}"
|
|
||||||
commit="${entry##*:}"
|
|
||||||
|
|
||||||
branch=""
|
|
||||||
url="$url_branch"
|
|
||||||
if [[ "$url_branch" == *"@"* ]]; then
|
|
||||||
url="${url_branch%@*}"
|
|
||||||
branch="${url_branch#*@}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
remote="${url%.git}"
|
|
||||||
remote="${remote##*/}"
|
|
||||||
remote=${remote//[^A-Za-z0-9._-]/_}
|
|
||||||
[[ -z $remote ]] && remote="cherry"
|
|
||||||
|
|
||||||
if ! git -C "$BUILD_DIR" remote | grep -q "^$remote$"; then
|
|
||||||
execute git -C "$BUILD_DIR" remote add "$remote" "$url"
|
|
||||||
else
|
|
||||||
execute git -C "$BUILD_DIR" remote set-url "$remote" "$url"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -n $branch ]]; then
|
|
||||||
execute git -C "$BUILD_DIR" fetch "$remote" "$branch"
|
|
||||||
else
|
|
||||||
execute git -C "$BUILD_DIR" fetch "$remote"
|
|
||||||
fi
|
|
||||||
execute git -C "$BUILD_DIR" merge-base --is-ancestor "$commit" HEAD ||
|
|
||||||
execute git -C "$BUILD_DIR" cherry-pick "$commit"
|
|
||||||
done
|
|
||||||
|
|
||||||
# Print commit info
|
# Print commit info
|
||||||
commit=$(git -C "$BUILD_DIR" rev-parse HEAD)
|
commit=$(git -C "$BUILD_DIR" rev-parse HEAD)
|
||||||
description=$(git -C "$BUILD_DIR" describe --always --dirty)
|
description=$(git -C "$BUILD_DIR" describe)
|
||||||
echo "Current commit hash: $commit"
|
echo "Current commit hash: $commit"
|
||||||
echo "Git worktree description: $description"
|
echo "Git worktree description: $description"
|
||||||
|
|
||||||
@@ -617,24 +550,29 @@ from_source() {
|
|||||||
# Begin OpenWRT build process
|
# Begin OpenWRT build process
|
||||||
((DEBUG)) && make_opts+=("V=sc")
|
((DEBUG)) && make_opts+=("V=sc")
|
||||||
|
|
||||||
# Cleanup build environment: heavy clean only when --reset was used earlier
|
# Cleanup build environment
|
||||||
|
execute make "${make_opts[@]}" "-j1" distclean
|
||||||
# make clean # compiled output
|
# make clean # compiled output
|
||||||
# make targetclean # compiled output, toolchain
|
# make targetclean # compiled output, toolchain
|
||||||
# make dirclean # compiled output, toolchain, build tools
|
# make dirclean # compiled output, toolchain, build tools
|
||||||
# make distclean # compiled output, toolchain, build tools, .config, feeds, .ccache
|
# make distclean # compiled output, toolchain, build tools, .config, feeds, .ccache
|
||||||
if [[ -n $SOURCE_CLEAN ]]; then
|
|
||||||
execute make "${make_opts[@]}" "-j1" "$SOURCE_CLEAN"
|
|
||||||
else
|
|
||||||
debug "Skipping cleanup step"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Use a custom (faster) mirror
|
# Use a custom (faster) mirror
|
||||||
execute sed -i -E 's;git.openwrt.org/(feed|project);github.com/openwrt;' feeds.conf.default
|
# execute sed -i -E 's;git.openwrt.org/(feed|project);github.com/openwrt;' feeds.conf.default
|
||||||
|
|
||||||
# Update package feed
|
# Update package feed
|
||||||
./scripts/feeds update -a -f &&
|
./scripts/feeds update -a -f &&
|
||||||
./scripts/feeds install -a -f
|
./scripts/feeds install -a -f
|
||||||
|
|
||||||
|
# Grab the release seed config
|
||||||
|
if ! execute "$DL_TOOL" "-o" "$seed_file" "$seed_url"; then
|
||||||
|
echo "Could not obtain $seed_file from $seed_url"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set compilation output dir
|
||||||
|
config_opts+=("CONFIG_BINARY_FOLDER=\"$BIN_DIR\"")
|
||||||
|
|
||||||
# Add custom packages
|
# Add custom packages
|
||||||
for pkg in $PACKAGES; do
|
for pkg in $PACKAGES; do
|
||||||
if [[ $pkg == -* ]]; then
|
if [[ $pkg == -* ]]; then
|
||||||
@@ -644,37 +582,54 @@ from_source() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Add profile config options
|
# Add config options from profile
|
||||||
for config in ${P_ARR[config]}; do
|
for config in ${P_ARR[config]}; do
|
||||||
config_opts+=("$config")
|
config_opts+=("$config")
|
||||||
done
|
done
|
||||||
|
|
||||||
# Reset and write options to config seed file
|
# Only compile selected fs
|
||||||
[[ -f $seed_file ]] && execute rm -f "$seed_file"
|
execute sed -i '/CONFIG_TARGET_ROOTFS_/d' "$seed_file"
|
||||||
|
config_opts+=("CONFIG_TARGET_PER_DEVICE_ROOTFS=n")
|
||||||
|
if [[ $FILESYSTEM == "squashfs" ]]; then
|
||||||
|
config_opts+=("CONFIG_TARGET_ROOTFS_EXT4FS=n")
|
||||||
|
config_opts+=("CONFIG_TARGET_ROOTFS_SQUASHFS=y")
|
||||||
|
elif [[ $FILESYSTEM == "ext4" ]]; then
|
||||||
|
config_opts+=("CONFIG_TARGET_ROOTFS_SQUASHFS=n")
|
||||||
|
config_opts+=("CONFIG_TARGET_ROOTFS_EXT4FS=y")
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Only compile selected target image
|
||||||
|
execute sed -i '/CONFIG_TARGET_DEVICE_/d' "$seed_file"
|
||||||
|
config_opts+=("CONFIG_TARGET_MULTI_PROFILE=n")
|
||||||
|
config_opts+=("CONFIG_TARGET_PROFILE=DEVICE_$DEVICE")
|
||||||
|
config_opts+=("CONFIG_TARGET_${TARGET//\//_}_DEVICE_$DEVICE=y")
|
||||||
|
config_opts+=("CONFIG_SDK=n")
|
||||||
|
config_opts+=("CONFIG_SDK_LLVM_BPF=n")
|
||||||
|
config_opts+=("CONFIG_IB=n")
|
||||||
|
config_opts+=("CONFIG_MAKE_TOOLCHAIN=n")
|
||||||
|
|
||||||
|
# Write options to config seed file
|
||||||
for config in "${config_opts[@]}"; do
|
for config in "${config_opts[@]}"; do
|
||||||
debug "Writing $config to $seed_file"
|
debug "Writing $config to $seed_file"
|
||||||
echo "$config" >> "$seed_file"
|
echo "$config" >> "$seed_file"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Expand seed into full config
|
# Serial make prep is more reliable
|
||||||
execute make "${make_opts[@]}" "-j1" defconfig
|
execute make "${make_opts[@]}" "-j1" defconfig
|
||||||
|
|
||||||
# Run serial make download for better reliability
|
|
||||||
execute make "${make_opts[@]}" "-j1" download
|
execute make "${make_opts[@]}" "-j1" download
|
||||||
|
|
||||||
# (Optional) Disable multicore make world
|
# make_opts+=("-j$(($(nproc)-1))")
|
||||||
# ((DEBUG)) && make_opts+=("-j1") || make_opts+=("-j$(($(nproc)-2))")
|
((DEBUG)) && make_opts+=("-j1") || make_opts+=("-j$(($(nproc)-1))")
|
||||||
make_opts+=("-j$(($(nproc)-2))")
|
|
||||||
|
|
||||||
# Make image
|
# Make image
|
||||||
if ! execute ionice -c2 -n7 nice -n19 make "${make_opts[@]}" BIN_DIR="$BIN_DIR" world; then
|
if ! execute ionice -c 3 chrt --idle 0 nice -n19 make "${make_opts[@]}" world; then
|
||||||
echo "Error: make failed"
|
echo "Error: make failed"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
execute popd || return 1
|
execute popd || return 1
|
||||||
|
|
||||||
# Symlink output images to root of BIN_DIR (match Image Builder behavior)
|
# Symlink output images to root of BIN_DIR (match Image Builder)
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
for image in "$BIN_DIR/targets/${TARGET}/"*.{img,img.gz,ubi}; do
|
for image in "$BIN_DIR/targets/${TARGET}/"*.{img,img.gz,ubi}; do
|
||||||
execute ln -fs "$image" "$BIN_DIR/${image##*/}"
|
execute ln -fs "$image" "$BIN_DIR/${image##*/}"
|
||||||
@@ -798,7 +753,7 @@ main() {
|
|||||||
|
|
||||||
# Store profile in P_ARR nameref
|
# Store profile in P_ARR nameref
|
||||||
local -n P_ARR="$profile"
|
local -n P_ARR="$profile"
|
||||||
local mode="${P_ARR[mode]:-"imagebuilder"}"
|
local mode="${P_ARR[mode]:="imagebuilder"}"
|
||||||
((FROM_SOURCE)) && mode="source" # allow cli override
|
((FROM_SOURCE)) && mode="source" # allow cli override
|
||||||
install_dependencies "$mode"
|
install_dependencies "$mode"
|
||||||
local repo="${P_ARR[repo]:-}"
|
local repo="${P_ARR[repo]:-}"
|
||||||
@@ -814,8 +769,8 @@ main() {
|
|||||||
read -r release ref < <(normalize_and_ref "$raw_release" "$mode")
|
read -r release ref < <(normalize_and_ref "$raw_release" "$mode")
|
||||||
|
|
||||||
declare -g SRC_DIR="$BUILD_ROOT/src/.openwrt"
|
declare -g SRC_DIR="$BUILD_ROOT/src/.openwrt"
|
||||||
declare -g BUILD_DIR="$BUILD_ROOT/src/$profile/$ref-$mode"
|
declare -g BUILD_DIR="$BUILD_ROOT/src/$profile/$mode-$ref"
|
||||||
declare -g BIN_DIR="$BUILD_ROOT/bin/$profile/$ref-$mode"
|
declare -g BIN_DIR="$BUILD_ROOT/bin/$profile/$mode-$ref"
|
||||||
|
|
||||||
if [[ "$release" == "snapshot" ]]; then
|
if [[ "$release" == "snapshot" ]]; then
|
||||||
local url_prefix="https://downloads.openwrt.org/snapshots/targets/$TARGET"
|
local url_prefix="https://downloads.openwrt.org/snapshots/targets/$TARGET"
|
||||||
@@ -839,7 +794,7 @@ main() {
|
|||||||
declare -g SYSUPGRADEIMGGZ="$BUILD_DIR/$img_fname-sysupgrade.img.gz"
|
declare -g SYSUPGRADEIMGGZ="$BUILD_DIR/$img_fname-sysupgrade.img.gz"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
backup "$SYSUPGRADEIMGGZ" "$BACKUP_DIR/$profile/$ref-$mode"
|
backup "$SYSUPGRADEIMGGZ" "$BACKUP_DIR/$profile/$mode-$ref"
|
||||||
|
|
||||||
if [[ "$mode" == "source" ]]; then
|
if [[ "$mode" == "source" ]]; then
|
||||||
from_source "$seed_url" "$profile" "$ref" || return $?
|
from_source "$seed_url" "$profile" "$ref" || return $?
|
||||||
@@ -873,9 +828,5 @@ main() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# Roughly turn debugging on for pre-init
|
|
||||||
# Reset and reparse in parse_input() with getopt
|
|
||||||
[[ " $* " =~ ( --debug | -d ) ]] && DEBUG=1
|
|
||||||
|
|
||||||
main "$@"
|
main "$@"
|
||||||
exit
|
exit
|
||||||
|
|||||||
92
profiles
92
profiles
@@ -1,16 +1,12 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Device profiles for openwrtbuilder
|
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
|
# Device profiles for openwrtbuilder
|
||||||
|
|
||||||
# Default (but optional) packages (precede with "-" to exclude)
|
# Default packages
|
||||||
default_packages=(nano htop diffutils tar iperf3 zsh rsync curl tcpdump
|
default_packages="luci luci-ssl luci-proto-wireguard luci-app-statistics \
|
||||||
openssh-sftp-server luci luci-ssl luci-proto-wireguard luci-app-statistics
|
collectd-mod-sensors collectd-mod-thermal collectd-mod-conntrack \
|
||||||
collectd-mod-sensors collectd-mod-thermal collectd-mod-conntrack collectd-mod-cpu
|
collectd-mod-cpu nano htop diffutils tar iperf3 zsh rsync \
|
||||||
)
|
openssh-sftp-server"
|
||||||
|
|
||||||
# Default (but optional) kernel configs
|
|
||||||
default_configs=(
|
|
||||||
)
|
|
||||||
|
|
||||||
# Current devices
|
# Current devices
|
||||||
declare -Ag r4s=(
|
declare -Ag r4s=(
|
||||||
@@ -18,19 +14,14 @@ declare -Ag r4s=(
|
|||||||
[device]="friendlyarm_nanopi-r4s"
|
[device]="friendlyarm_nanopi-r4s"
|
||||||
[target]="rockchip/armv8"
|
[target]="rockchip/armv8"
|
||||||
[filesystem]="ext4"
|
[filesystem]="ext4"
|
||||||
[packages]="${default_packages[*]} \
|
[packages]="$default_packages luci-app-ddns luci-app-sqm irqbalance \
|
||||||
luci-app-ddns luci-app-sqm \
|
|
||||||
adblock luci-app-adblock \
|
|
||||||
collectd-mod-df usbutils kmod-usb-storage kmod-usb-storage-uas \
|
collectd-mod-df usbutils kmod-usb-storage kmod-usb-storage-uas \
|
||||||
kmod-fs-btrfs btrfs-progs block-mount smcroute avahi-daemon \
|
kmod-fs-btrfs btrfs-progs block-mount smcroute avahi-daemon \
|
||||||
ethtool ca-bundle tailscale"
|
curl ethtool ca-bundle tailscale"
|
||||||
[config]="${default_configs[*]} \
|
[config]="CONFIG_KERNEL_BTRFS_FS_POSIX_ACL=y CONFIG_BTRFS_PROGS_ZSTD=y \
|
||||||
CONFIG_KERNEL_BTRFS_FS_POSIX_ACL=y CONFIG_BTRFS_PROGS_ZSTD=y \
|
CONFIG_TARGET_ROOTFS_PARTSIZE=512 CONFIG_TARGET_KERNEL_PARTSIZE=32 \
|
||||||
CONFIG_TARGET_ROOTFS_PARTSIZE=512 CONFIG_TARGET_KERNEL_PARTSIZE=32"
|
CONFIG_BUILDBOT=n"
|
||||||
[files]="/mnt/backup"
|
[files]="/mnt/backup"
|
||||||
# For 24.10 branch (Linux 6.6)
|
|
||||||
# [cherrypicks]="https://github.com/wurzerj/openwrt.git:59d6e31 \
|
|
||||||
# https://github.com/wurzerj/openwrt.git:bb251b8" # fix inconsistent reboot
|
|
||||||
)
|
)
|
||||||
|
|
||||||
declare -Ag ax6000=(
|
declare -Ag ax6000=(
|
||||||
@@ -39,8 +30,7 @@ declare -Ag ax6000=(
|
|||||||
[target]="mediatek/filogic"
|
[target]="mediatek/filogic"
|
||||||
[release]="snapshot"
|
[release]="snapshot"
|
||||||
[filesystem]="squashfs"
|
[filesystem]="squashfs"
|
||||||
[packages]="${default_packages[*]} \
|
[packages]="$default_packages -dnsmasq -odhcpd-ipv6only -nftables -firewall4 tailscale"
|
||||||
-dnsmasq -odhcpd-ipv6only -nftables -firewall4 tailscale"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
declare -Ag ax6000_uboot=(
|
declare -Ag ax6000_uboot=(
|
||||||
@@ -49,61 +39,29 @@ declare -Ag ax6000_uboot=(
|
|||||||
[target]="mediatek/filogic"
|
[target]="mediatek/filogic"
|
||||||
[release]="snapshot"
|
[release]="snapshot"
|
||||||
[filesystem]="squashfs"
|
[filesystem]="squashfs"
|
||||||
[packages]="${default_packages[*]} \
|
[packages]="$default_packages -dnsmasq -odhcpd-ipv6only -nftables -firewall4"
|
||||||
-dnsmasq -odhcpd-ipv6only -nftables -firewall4"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
declare -Ag n5100=(
|
declare -Ag n5100=(
|
||||||
[device]="generic"
|
[device]="generic"
|
||||||
[target]="x86/64"
|
[target]="x86/64"
|
||||||
[filesystem]="squashfs"
|
[filesystem]="squashfs"
|
||||||
[packages]="${default_packages[*]} \
|
[packages]="$default_packages luci-app-ddns irqbalance collectd-mod-df \
|
||||||
luci-app-ddns irqbalance collectd-mod-df \
|
|
||||||
usbutils kmod-usb-storage kmod-usb-storage-uas kmod-fs-btrfs \
|
usbutils kmod-usb-storage kmod-usb-storage-uas kmod-fs-btrfs \
|
||||||
btrfs-progs block-mount cryptsetup kmod-crypto-xts smcroute \
|
btrfs-progs block-mount cryptsetup kmod-crypto-xts smcroute \
|
||||||
avahi-daemon ethtool ca-bundle smartmontools intel-microcode \
|
avahi-daemon curl ethtool ca-bundle smartmontools intel-microcode \
|
||||||
lm-sensors samba4-server luci-app-samba4 tailscale shadow-useradd"
|
lm-sensors samba4-server luci-app-samba4 tailscale shadow-useradd"
|
||||||
[config]="${default_configs[*]} \
|
[config]="CONFIG_KERNEL_BTRFS_FS_POSIX_ACL=y CONFIG_BTRFS_PROGS_ZSTD=y \
|
||||||
CONFIG_KERNEL_BTRFS_FS_POSIX_ACL=y CONFIG_BTRFS_PROGS_ZSTD=y \
|
|
||||||
CONFIG_TARGET_ROOTFS_PARTSIZE=512 CONFIG_TARGET_KERNEL_PARTSIZE=32"
|
CONFIG_TARGET_ROOTFS_PARTSIZE=512 CONFIG_TARGET_KERNEL_PARTSIZE=32"
|
||||||
# [files]="/mnt/backup"
|
# [files]="/mnt/backup"
|
||||||
)
|
)
|
||||||
|
|
||||||
declare -Ag w1700k=(
|
|
||||||
[mode]="source"
|
|
||||||
[device]="gemtek_w1700k"
|
|
||||||
[target]="airoha/an7581"
|
|
||||||
[filesystem]="squashfs"
|
|
||||||
[release]="snapshot"
|
|
||||||
[packages]="${default_packages[*]} \
|
|
||||||
luci-app-ddns luci-app-sqm \
|
|
||||||
adblock luci-app-adblock \
|
|
||||||
smcroute avahi-daemon \
|
|
||||||
lm-sensors samba4-server luci-app-samba4 tailscale shadow-useradd \
|
|
||||||
ethtool ca-bundle tailscale"
|
|
||||||
[cherrypicks]="\
|
|
||||||
https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:4cfd50f648 \
|
|
||||||
https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:59bb20c522 \
|
|
||||||
https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:1d58331f5c \
|
|
||||||
https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:c2712ff093 \
|
|
||||||
https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:dc3dd61835 \
|
|
||||||
https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:32caca6a76 \
|
|
||||||
https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:cf66b89f84 \
|
|
||||||
https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:ef002d6422 \
|
|
||||||
https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:af3e569610 \
|
|
||||||
https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:66b0757616 \
|
|
||||||
https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:26398bc2c6 \
|
|
||||||
https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:16be0246ca \
|
|
||||||
https://github.com/OpenWRT-fanboy/OpenW1700k.git@lumos:3cdf63b0ec"
|
|
||||||
)
|
|
||||||
|
|
||||||
declare -Ag rpi4=(
|
declare -Ag rpi4=(
|
||||||
[device]="rpi-4"
|
[device]="rpi-4"
|
||||||
[target]="bcm27xx/bcm2711"
|
[target]="bcm27xx/bcm2711"
|
||||||
[filesystem]="ext4"
|
[filesystem]="ext4"
|
||||||
[packages]="${default_packages[*]} \
|
[packages]="$default_packages kmod-usb-net-asix-ax88179 kmod-usb-net-rtl8152 \
|
||||||
luci-app-upnp luci-app-pbr -dnsmasq dnsmasq-full luci-app-ddns luci-app-sqm \
|
luci-app-upnp luci-app-pbr -dnsmasq dnsmasq-full luci-app-ddns luci-app-sqm"
|
||||||
kmod-usb-net-asix-ax88179 kmod-usb-net-rtl8152"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
declare -Ag r4s_stock=(
|
declare -Ag r4s_stock=(
|
||||||
@@ -117,8 +75,7 @@ declare -Ag totolink=(
|
|||||||
[device]="totolink_x5000r"
|
[device]="totolink_x5000r"
|
||||||
[target]="ramips/mt7621"
|
[target]="ramips/mt7621"
|
||||||
[filesystem]="squashfs"
|
[filesystem]="squashfs"
|
||||||
[packages]="${default_packages[*]} \
|
[packages]="$default_packages -dnsmasq -odhcpd-ipv6only -nftables -firewall4 \
|
||||||
-dnsmasq -odhcpd-ipv6only -nftables -firewall4 \
|
|
||||||
-kmod-nft-offload collectd-mod-iwinfo"
|
-kmod-nft-offload collectd-mod-iwinfo"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -126,7 +83,7 @@ declare -Ag archer=(
|
|||||||
[device]="tplink_archer-c7-v2"
|
[device]="tplink_archer-c7-v2"
|
||||||
[target]="ath79/generic"
|
[target]="ath79/generic"
|
||||||
[filesystem]="squashfs"
|
[filesystem]="squashfs"
|
||||||
[packages]="${default_packages[*]} -dnsmasq -odhcpd -iptables \
|
[packages]="$default_packages -dnsmasq -odhcpd -iptables \
|
||||||
-ath10k-firmware-qca988x-ct ath10k-firmware-qca988x-ct-full-htt"
|
-ath10k-firmware-qca988x-ct ath10k-firmware-qca988x-ct-full-htt"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -134,16 +91,14 @@ declare -Ag linksys=(
|
|||||||
[device]="linksys_ea8300"
|
[device]="linksys_ea8300"
|
||||||
[target]="ipq40xx/generic"
|
[target]="ipq40xx/generic"
|
||||||
[filesystem]="squashfs"
|
[filesystem]="squashfs"
|
||||||
[packages]="${default_packages[*]} \
|
[packages]="$default_packages -dnsmasq -odhcpd -iptables"
|
||||||
-dnsmasq -odhcpd -iptables"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
declare -Ag r2s=(
|
declare -Ag r2s=(
|
||||||
[device]="friendlyarm_nanopi-r2s"
|
[device]="friendlyarm_nanopi-r2s"
|
||||||
[target]="rockchip/armv8"
|
[target]="rockchip/armv8"
|
||||||
[filesystem]="ext4"
|
[filesystem]="ext4"
|
||||||
[packages]="${default_packages[*]} \
|
[packages]="$default_packages luci-app-upnp luci-app-pbr -dnsmasq dnsmasq-full \
|
||||||
luci-app-upnp luci-app-pbr -dnsmasq dnsmasq-full \
|
|
||||||
luci-app-ddns luci-app-sqm luci-app-statistics collectd-mod-sensors \
|
luci-app-ddns luci-app-sqm luci-app-statistics collectd-mod-sensors \
|
||||||
collectd-mod-thermal collectd-mod-conntrack smcroute curl ethtool"
|
collectd-mod-thermal collectd-mod-conntrack smcroute curl ethtool"
|
||||||
)
|
)
|
||||||
@@ -152,8 +107,7 @@ declare -Ag r2s_tr=(
|
|||||||
[device]="friendlyarm_nanopi-r2s"
|
[device]="friendlyarm_nanopi-r2s"
|
||||||
[target]="rockchip/armv8"
|
[target]="rockchip/armv8"
|
||||||
[filesystem]="ext4"
|
[filesystem]="ext4"
|
||||||
[packages]="${default_packages[*]} \
|
[packages]="$default_packages luci-app-upnp luci-app-pbr luci-app-ddns \
|
||||||
luci-app-upnp luci-app-pbr luci-app-ddns \
|
|
||||||
luci-app-statistics collectd-mod-sensors collectd-mod-thermal \
|
luci-app-statistics collectd-mod-sensors collectd-mod-thermal \
|
||||||
collectd-mod-conntrack curl ethtool travelmate"
|
collectd-mod-conntrack curl ethtool travelmate"
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user