Compare commits
19 Commits
3ba76a4e8d
...
aeead798c3
| Author | SHA1 | Date | |
|---|---|---|---|
| aeead798c3 | |||
| 72355bb65a | |||
| 3053b24063 | |||
| 186fe21d73 | |||
| d63a909d54 | |||
| 9128c453f3 | |||
| ffbd193b79 | |||
| 5259c72de4 | |||
| 045f43b51f | |||
| 89cc3cddeb | |||
| cd7449dd7c | |||
| 2b35e1e017 | |||
| 983f9ecb04 | |||
| b5f567ce2b | |||
| a16e713895 | |||
| 70d24d7fae | |||
| d5069d4c40 | |||
| 718b29cfe8 | |||
| e3ce0b6e57 |
@@ -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
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
# 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.2"}"
|
: "${RELEASE:="24.10.3"}"
|
||||||
|
|
||||||
# @internal
|
# @internal
|
||||||
print_help() {
|
print_help() {
|
||||||
@@ -58,7 +58,7 @@ init() {
|
|||||||
|
|
||||||
# Save the script directory
|
# Save the script directory
|
||||||
# https://stackoverflow.com/a/4774063
|
# https://stackoverflow.com/a/4774063
|
||||||
SCRIPT_DIR="$(cd -- "$(dirname "$0")" >/dev/null 2>&1 || exit $? ; pwd -P)"
|
SCRIPT_DIR=$(readlink -f "$(dirname "${BASH_SOURCE[0]}")")
|
||||||
|
|
||||||
if [[ -e "/etc/os-release" ]]; then
|
if [[ -e "/etc/os-release" ]]; then
|
||||||
source "/etc/os-release"
|
source "/etc/os-release"
|
||||||
@@ -172,7 +172,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" && return 0
|
[[ -f $lock_file ]] && debug "$lock_file lock file exists but skipping for --debug" && return 0
|
||||||
|
|
||||||
if [[ "$mode" == "source" ]]; then
|
if [[ "$mode" == "source" ]]; then
|
||||||
# For building from source code see:
|
# For building from source code see:
|
||||||
@@ -186,6 +186,7 @@ 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
|
||||||
@@ -204,6 +205,7 @@ install_dependencies() {
|
|||||||
python3-devel
|
python3-devel
|
||||||
python3-pyelftools
|
python3-pyelftools
|
||||||
python3-setuptools
|
python3-setuptools
|
||||||
|
quilt
|
||||||
rsync
|
rsync
|
||||||
swig
|
swig
|
||||||
tar
|
tar
|
||||||
@@ -222,10 +224,12 @@ 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
|
||||||
@@ -250,6 +254,7 @@ install_dependencies() {
|
|||||||
gcc
|
gcc
|
||||||
gettext
|
gettext
|
||||||
git
|
git
|
||||||
|
golang
|
||||||
grep
|
grep
|
||||||
groff
|
groff
|
||||||
gzip
|
gzip
|
||||||
@@ -264,6 +269,7 @@ install_dependencies() {
|
|||||||
patch
|
patch
|
||||||
pkgconf
|
pkgconf
|
||||||
python
|
python
|
||||||
|
quilt
|
||||||
rsync
|
rsync
|
||||||
sed
|
sed
|
||||||
texinfo
|
texinfo
|
||||||
@@ -524,7 +530,7 @@ from_source() {
|
|||||||
|
|
||||||
# Pull or clone source repo
|
# Pull or clone source repo
|
||||||
if [[ -d "$SRC_DIR" ]]; then
|
if [[ -d "$SRC_DIR" ]]; then
|
||||||
execute git -C "$SRC_DIR" pull
|
execute git -C "$SRC_DIR" fetch --all --prune --tags
|
||||||
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"
|
||||||
@@ -535,7 +541,7 @@ from_source() {
|
|||||||
execute rm -rf "$BUILD_DIR"
|
execute rm -rf "$BUILD_DIR"
|
||||||
fi
|
fi
|
||||||
execute git -C "$SRC_DIR" worktree prune --verbose
|
execute git -C "$SRC_DIR" worktree prune --verbose
|
||||||
execute git -C "$SRC_DIR" worktree add --detach "$BUILD_DIR" "$ref"
|
execute git -C "$SRC_DIR" worktree add --detach "$BUILD_DIR" "origin/$ref"
|
||||||
|
|
||||||
# Add cherrypick commits if specified in profile
|
# Add cherrypick commits if specified in profile
|
||||||
for entry in ${P_ARR[cherrypicks]}; do
|
for entry in ${P_ARR[cherrypicks]}; do
|
||||||
@@ -623,21 +629,22 @@ from_source() {
|
|||||||
config_opts+=("CONFIG_IB=n")
|
config_opts+=("CONFIG_IB=n")
|
||||||
config_opts+=("CONFIG_MAKE_TOOLCHAIN=n")
|
config_opts+=("CONFIG_MAKE_TOOLCHAIN=n")
|
||||||
|
|
||||||
|
# Serial make prep is more reliable
|
||||||
|
execute make "${make_opts[@]}" "-j1" defconfig
|
||||||
|
|
||||||
# Write options to config seed file
|
# 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
|
||||||
|
|
||||||
# Serial make prep is more reliable
|
execute bash -c "yes '' | make ${make_opts[*]} -j1 oldconfig"
|
||||||
execute make "${make_opts[@]}" "-j1" defconfig
|
|
||||||
execute make "${make_opts[@]}" "-j1" download
|
|
||||||
|
|
||||||
# make_opts+=("-j$(($(nproc)-1))")
|
# make_opts+=("-j$(($(nproc)-2))")
|
||||||
((DEBUG)) && make_opts+=("-j1") || make_opts+=("-j$(($(nproc)-1))")
|
((DEBUG)) && make_opts+=("-j1") || make_opts+=("-j$(($(nproc)-2))")
|
||||||
|
|
||||||
# Make image
|
# Make image
|
||||||
if ! execute ionice -c 3 chrt --idle 0 nice -n19 make "${make_opts[@]}" world; then
|
if ! execute ionice -c 3 chrt --idle 0 nice -n19 make "${make_opts[@]}" download world; then
|
||||||
echo "Error: make failed"
|
echo "Error: make failed"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@@ -768,7 +775,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]:-}"
|
||||||
|
|||||||
18
profiles
18
profiles
@@ -2,13 +2,14 @@
|
|||||||
# Device profiles for openwrtbuilder
|
# Device profiles for openwrtbuilder
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
|
|
||||||
# Default (but optional) packages
|
# Default (but optional) packages (precede with "-" to exclude)
|
||||||
default_packages=(nano htop diffutils tar iperf3 zsh rsync
|
default_packages=(nano htop diffutils tar iperf3 zsh rsync curl tcpdump
|
||||||
openssh-sftp-server 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-cpu)
|
collectd-mod-sensors collectd-mod-thermal collectd-mod-conntrack collectd-mod-cpu
|
||||||
|
)
|
||||||
|
|
||||||
# Default (but optional) kernel configs
|
# Default (but optional) kernel configs
|
||||||
default_configs=("CONFIG_ALL_KMODS=n" "CONFIG_BUILDBOT=n")
|
default_configs=("CONFIG_BUILDBOT=n")
|
||||||
|
|
||||||
# Current devices
|
# Current devices
|
||||||
declare -Ag r4s=(
|
declare -Ag r4s=(
|
||||||
@@ -18,9 +19,10 @@ declare -Ag r4s=(
|
|||||||
[filesystem]="ext4"
|
[filesystem]="ext4"
|
||||||
[packages]="${default_packages[*]} \
|
[packages]="${default_packages[*]} \
|
||||||
luci-app-ddns luci-app-sqm irqbalance \
|
luci-app-ddns luci-app-sqm irqbalance \
|
||||||
|
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 \
|
||||||
curl ethtool ca-bundle tailscale"
|
ethtool ca-bundle tailscale"
|
||||||
[config]="${default_configs[*]} \
|
[config]="${default_configs[*]} \
|
||||||
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"
|
||||||
@@ -35,7 +37,8 @@ declare -Ag ax6000=(
|
|||||||
[target]="mediatek/filogic"
|
[target]="mediatek/filogic"
|
||||||
[release]="snapshot"
|
[release]="snapshot"
|
||||||
[filesystem]="squashfs"
|
[filesystem]="squashfs"
|
||||||
[packages]="${default_packages[*]} -dnsmasq -odhcpd-ipv6only -nftables -firewall4 tailscale"
|
[packages]="${default_packages[*]} \
|
||||||
|
-dnsmasq -odhcpd-ipv6only -nftables -firewall4 tailscale"
|
||||||
)
|
)
|
||||||
|
|
||||||
declare -Ag ax6000_uboot=(
|
declare -Ag ax6000_uboot=(
|
||||||
@@ -44,7 +47,8 @@ declare -Ag ax6000_uboot=(
|
|||||||
[target]="mediatek/filogic"
|
[target]="mediatek/filogic"
|
||||||
[release]="snapshot"
|
[release]="snapshot"
|
||||||
[filesystem]="squashfs"
|
[filesystem]="squashfs"
|
||||||
[packages]="${default_packages[*]} -dnsmasq -odhcpd-ipv6only -nftables -firewall4"
|
[packages]="${default_packages[*]} \
|
||||||
|
-dnsmasq -odhcpd-ipv6only -nftables -firewall4"
|
||||||
)
|
)
|
||||||
|
|
||||||
declare -Ag n5100=(
|
declare -Ag n5100=(
|
||||||
|
|||||||
Reference in New Issue
Block a user