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")
|
||||
--buildroot,-b PATH (Default: script directory)
|
||||
--source
|
||||
Build image from source code, not from Image Builder
|
||||
Allows make config options to be passed in profile
|
||||
Uses git worktree for multi-profile deduplication
|
||||
Build image from source code, not from Image Builder.
|
||||
Allows make config options to be passed in profile.
|
||||
Uses git worktree for multi-profile deduplication.
|
||||
--ssh-upgrade HOST
|
||||
Example: root@192.168.1.1
|
||||
--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.
|
||||
# Copyright 2022-25 Bryan C. Roessler
|
||||
# Apache 2.0 License
|
||||
# See README and profiles for device configuration
|
||||
# See README and ./profiles for device configuration
|
||||
|
||||
# Set default release
|
||||
: "${RELEASE:="24.10.2"}"
|
||||
: "${RELEASE:="24.10.3"}"
|
||||
|
||||
# @internal
|
||||
print_help() {
|
||||
@@ -58,7 +58,7 @@ init() {
|
||||
|
||||
# Save the script directory
|
||||
# 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
|
||||
source "/etc/os-release"
|
||||
@@ -172,7 +172,7 @@ install_dependencies() {
|
||||
lock_file="$BUILD_ROOT/.dependencies_ib.lock"
|
||||
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
|
||||
# For building from source code see:
|
||||
@@ -186,6 +186,7 @@ install_dependencies() {
|
||||
gcc
|
||||
gcc-c++
|
||||
git
|
||||
golang
|
||||
llvm15-libs # for qosify
|
||||
make
|
||||
ncurses-devel
|
||||
@@ -204,6 +205,7 @@ install_dependencies() {
|
||||
python3-devel
|
||||
python3-pyelftools
|
||||
python3-setuptools
|
||||
quilt
|
||||
rsync
|
||||
swig
|
||||
tar
|
||||
@@ -222,10 +224,12 @@ install_dependencies() {
|
||||
gcc-multilib
|
||||
gettext
|
||||
git
|
||||
golang
|
||||
liblzma-dev
|
||||
libncurses5-dev
|
||||
libssl-dev
|
||||
python3-distutils
|
||||
quilt
|
||||
rsync
|
||||
patch
|
||||
unzip
|
||||
@@ -250,6 +254,7 @@ install_dependencies() {
|
||||
gcc
|
||||
gettext
|
||||
git
|
||||
golang
|
||||
grep
|
||||
groff
|
||||
gzip
|
||||
@@ -264,6 +269,7 @@ install_dependencies() {
|
||||
patch
|
||||
pkgconf
|
||||
python
|
||||
quilt
|
||||
rsync
|
||||
sed
|
||||
texinfo
|
||||
@@ -524,7 +530,7 @@ from_source() {
|
||||
|
||||
# Pull or clone source repo
|
||||
if [[ -d "$SRC_DIR" ]]; then
|
||||
execute git -C "$SRC_DIR" pull
|
||||
execute git -C "$SRC_DIR" fetch --all --prune --tags
|
||||
else
|
||||
execute mkdir -p "$SRC_DIR"
|
||||
execute git clone "$src_url" "$SRC_DIR"
|
||||
@@ -535,7 +541,7 @@ from_source() {
|
||||
execute rm -rf "$BUILD_DIR"
|
||||
fi
|
||||
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
|
||||
for entry in ${P_ARR[cherrypicks]}; do
|
||||
@@ -623,21 +629,22 @@ from_source() {
|
||||
config_opts+=("CONFIG_IB=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
|
||||
for config in "${config_opts[@]}"; do
|
||||
debug "Writing $config to $seed_file"
|
||||
echo "$config" >> "$seed_file"
|
||||
done
|
||||
|
||||
# Serial make prep is more reliable
|
||||
execute make "${make_opts[@]}" "-j1" defconfig
|
||||
execute make "${make_opts[@]}" "-j1" download
|
||||
execute bash -c "yes '' | make ${make_opts[*]} -j1 oldconfig"
|
||||
|
||||
# make_opts+=("-j$(($(nproc)-1))")
|
||||
((DEBUG)) && make_opts+=("-j1") || make_opts+=("-j$(($(nproc)-1))")
|
||||
# make_opts+=("-j$(($(nproc)-2))")
|
||||
((DEBUG)) && make_opts+=("-j1") || make_opts+=("-j$(($(nproc)-2))")
|
||||
|
||||
# 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"
|
||||
return 1
|
||||
fi
|
||||
@@ -768,7 +775,7 @@ main() {
|
||||
|
||||
# Store profile in P_ARR nameref
|
||||
local -n P_ARR="$profile"
|
||||
local mode="${P_ARR[mode]:="imagebuilder"}"
|
||||
local mode="${P_ARR[mode]:-"imagebuilder"}"
|
||||
((FROM_SOURCE)) && mode="source" # allow cli override
|
||||
install_dependencies "$mode"
|
||||
local repo="${P_ARR[repo]:-}"
|
||||
|
||||
18
profiles
18
profiles
@@ -2,13 +2,14 @@
|
||||
# Device profiles for openwrtbuilder
|
||||
# shellcheck disable=SC2034
|
||||
|
||||
# Default (but optional) packages
|
||||
default_packages=(nano htop diffutils tar iperf3 zsh rsync
|
||||
# Default (but optional) packages (precede with "-" to exclude)
|
||||
default_packages=(nano htop diffutils tar iperf3 zsh rsync curl tcpdump
|
||||
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_configs=("CONFIG_ALL_KMODS=n" "CONFIG_BUILDBOT=n")
|
||||
default_configs=("CONFIG_BUILDBOT=n")
|
||||
|
||||
# Current devices
|
||||
declare -Ag r4s=(
|
||||
@@ -18,9 +19,10 @@ declare -Ag r4s=(
|
||||
[filesystem]="ext4"
|
||||
[packages]="${default_packages[*]} \
|
||||
luci-app-ddns luci-app-sqm irqbalance \
|
||||
adblock luci-app-adblock \
|
||||
collectd-mod-df usbutils kmod-usb-storage kmod-usb-storage-uas \
|
||||
kmod-fs-btrfs btrfs-progs block-mount smcroute avahi-daemon \
|
||||
curl ethtool ca-bundle tailscale"
|
||||
ethtool ca-bundle tailscale"
|
||||
[config]="${default_configs[*]} \
|
||||
CONFIG_KERNEL_BTRFS_FS_POSIX_ACL=y CONFIG_BTRFS_PROGS_ZSTD=y \
|
||||
CONFIG_TARGET_ROOTFS_PARTSIZE=512 CONFIG_TARGET_KERNEL_PARTSIZE=32"
|
||||
@@ -35,7 +37,8 @@ declare -Ag ax6000=(
|
||||
[target]="mediatek/filogic"
|
||||
[release]="snapshot"
|
||||
[filesystem]="squashfs"
|
||||
[packages]="${default_packages[*]} -dnsmasq -odhcpd-ipv6only -nftables -firewall4 tailscale"
|
||||
[packages]="${default_packages[*]} \
|
||||
-dnsmasq -odhcpd-ipv6only -nftables -firewall4 tailscale"
|
||||
)
|
||||
|
||||
declare -Ag ax6000_uboot=(
|
||||
@@ -44,7 +47,8 @@ declare -Ag ax6000_uboot=(
|
||||
[target]="mediatek/filogic"
|
||||
[release]="snapshot"
|
||||
[filesystem]="squashfs"
|
||||
[packages]="${default_packages[*]} -dnsmasq -odhcpd-ipv6only -nftables -firewall4"
|
||||
[packages]="${default_packages[*]} \
|
||||
-dnsmasq -odhcpd-ipv6only -nftables -firewall4"
|
||||
)
|
||||
|
||||
declare -Ag n5100=(
|
||||
|
||||
Reference in New Issue
Block a user