Compare commits

...

9 Commits

Author SHA1 Message Date
dc3ccef3fd Update comments 2024-11-26 11:13:35 -05:00
5ae94d72b4 Use make distclean 2024-11-25 17:23:59 -05:00
b245bffbc8 Disable buildbot 2024-11-20 11:41:10 -05:00
98c17f4ad7 Don't remove build dir 2024-11-19 20:01:52 -05:00
a75505f467 Reuse build dir 2024-11-18 09:55:48 -05:00
cabd3aca8b Add python3-devel to RHEL dependencies 2024-11-15 20:46:11 -05:00
75303a619e Use single-threaded make for --debug 2024-11-15 13:58:14 -05:00
60c73cac78 Don't pause on commit hash 2024-11-14 17:13:47 -05:00
3c8b230cc3 Skip unavailable dependencies 2024-11-12 13:10:57 -05:00
2 changed files with 34 additions and 41 deletions

View File

@@ -2,7 +2,7 @@
# Builds and deploys OpenWRT images # Builds and deploys OpenWRT images
# Copyright 2022-24 Bryan C. Roessler # Copyright 2022-24 Bryan C. Roessler
# Apache 2.0 License # Apache 2.0 License
# See README.md and ./profiles # See README.md and ./profiles for device configuration
# Set default release # Set default release
: "${RELEASE:="23.05.5"}" : "${RELEASE:="23.05.5"}"
@@ -81,15 +81,15 @@ init() {
raspbian) ID="debian" ;; raspbian) ID="debian" ;;
*) *)
echo "Autodetecting distro, this may be unreliable" echo "Autodetecting distro, this may be unreliable"
if hash dnf &>/dev/null; then if command -v dnf &>/dev/null; then
ID="fedora" ID="fedora"
RPM_MGR="dnf" RPM_MGR="dnf"
elif hash yum &>/dev/null; then elif command -v yum &>/dev/null; then
ID="centos" ID="centos"
RPM_MGR="yum" RPM_MGR="yum"
elif hash apt &>/dev/null; then elif command -v apt &>/dev/null; then
ID="ubuntu" ID="ubuntu"
elif hash pacman &>/dev/null; then elif command -v pacman &>/dev/null; then
ID="arch" ID="arch"
else else
return 1 return 1
@@ -101,8 +101,8 @@ init() {
# Set distro-specific functions # Set distro-specific functions
case "$ID" in case "$ID" in
fedora|centos) pkg_install(){ sudo "$RPM_MGR" install -y "$@"; } ;; fedora|centos) pkg_install(){ sudo "$RPM_MGR" install --skip-unavailable -y "$@"; } ;;
debian|ubuntu) pkg_install(){ sudo apt-get install -y -q0 "$@"; } ;; debian|ubuntu) pkg_install(){ sudo apt-get install --ignore-missing -y -q0 "$@"; } ;;
suse) pkg_install(){ sudo zypper --non-interactive -q install --force --no-confirm "$@"; } ;; suse) pkg_install(){ sudo zypper --non-interactive -q install --force --no-confirm "$@"; } ;;
arch) pkg_install(){ sudo pacman -S --noconfirm --needed "$@"; } ;; arch) pkg_install(){ sudo pacman -S --noconfirm --needed "$@"; } ;;
esac esac
@@ -182,8 +182,8 @@ install_dependencies() {
"wget" "wget"
"which" "which"
"diffutils" "diffutils"
"python2"
"python3" "python3"
"python3-devel"
"python3-setuptools" "python3-setuptools"
"python3-pyelftools" "python3-pyelftools"
"perl-base" "perl-base"
@@ -316,7 +316,6 @@ install_dependencies() {
get_imagebuilder() { get_imagebuilder() {
debug "${FUNCNAME[0]}" "$*" debug "${FUNCNAME[0]}" "$*"
local -a url_file_pairs=("$@") local -a url_file_pairs=("$@")
for ((i=0; i<${#url_file_pairs[@]}; i+=2)); do for ((i=0; i<${#url_file_pairs[@]}; i+=2)); do
@@ -381,13 +380,13 @@ make_images() {
debug "${FUNCNAME[0]}" debug "${FUNCNAME[0]}"
# Reuse the existing output # Reuse the existing output
if [[ -d "$BINDIR" ]]; then # if [[ -d "$BINDIR" ]]; then
if ask_ok "$BINDIR exists. Rebuild?"; then # if ask_ok "$BINDIR exists. Rebuild?"; then
execute rm -rf "$BINDIR" # execute rm -rf "$BINDIR"
else # else
return 0 # return 0
fi # fi
fi # fi
debug make image BIN_DIR="$BINDIR" \ debug make image BIN_DIR="$BINDIR" \
PROFILE="$DEVICE" PACKAGES="$PACKAGES" \ PROFILE="$DEVICE" PACKAGES="$PACKAGES" \
@@ -426,7 +425,7 @@ flash_images() {
if execute sudo dd if="$img" of="$dev" bs=2M conv=fsync; then if execute sudo dd if="$img" of="$dev" bs=2M conv=fsync; then
sync sync
echo "Image flashed sucessfully!" echo "Image flashed successfully!"
else else
echo "dd failed!" echo "dd failed!"
return 1 return 1
@@ -474,9 +473,7 @@ from_source() {
# Generate commitish for git worktree # Generate commitish for git worktree
case "$RELEASE" in case "$RELEASE" in
snapshot) snapshot) wt_commit="origin/main" ;;
wt_commit="origin/main"
;;
[0-9][0-9].[0-9][0-9].*) [0-9][0-9].[0-9][0-9].*)
local branch="openwrt-${RELEASE%.*}" local branch="openwrt-${RELEASE%.*}"
local tag="v$RELEASE" local tag="v$RELEASE"
@@ -493,16 +490,16 @@ from_source() {
esac esac
# TODO There's a bug in the make clean functions that seem to invoke a full make # TODO There's a bug in the make clean functions that seem to invoke a full make
# if [[ -d "$GITWORKTREEDIR" ]]; then if [[ -d "$GITWORKTREEDIR" ]]; then
# execute git -C "$GITWORKTREEDIR" checkout "$wt_commit" execute git -C "$GITWORKTREEDIR" checkout "$wt_commit"
# execute git -C "$GITWORKTREEDIR" pull execute git -C "$GITWORKTREEDIR" pull
# else else
# execute git -C "$GITSRCDIR" worktree add --force --detach "$GITWORKTREEDIR" "$wt_commit" execute git -C "$GITSRCDIR" worktree add --force --detach "$GITWORKTREEDIR" "$wt_commit"
# fi fi
# To workaround bug, don't use make *clean, blow it away and start fresh # To workaround bug, don't use make *clean, blow it away and start fresh
[[ -d "$GITWORKTREEDIR" ]] && execute rm -rf "$GITWORKTREEDIR" # [[ -d "$GITWORKTREEDIR" ]] && execute rm -rf "$GITWORKTREEDIR"
execute git -C "$GITSRCDIR" worktree add --force --detach "$GITWORKTREEDIR" "$wt_commit" # execute git -C "$GITSRCDIR" worktree add --force --detach "$GITWORKTREEDIR" "$wt_commit"
# Print commit information # Print commit information
commit=$(git -C "$GITWORKTREEDIR" rev-parse HEAD) commit=$(git -C "$GITWORKTREEDIR" rev-parse HEAD)
@@ -510,13 +507,7 @@ from_source() {
echo "Current commit hash: $commit" echo "Current commit hash: $commit"
echo "Git worktree description: $description" echo "Git worktree description: $description"
if ((DEBUG)); then ((DEBUG)) && git --no-pager -C "$GITWORKTREEDIR" log -1
if ((YES)); then
git --no-pager -C "$GITWORKTREEDIR" log -1
else
git -C "$GITWORKTREEDIR" log -1
fi
fi
# Enter worktree # Enter worktree
execute pushd "$GITWORKTREEDIR" || return 1 execute pushd "$GITWORKTREEDIR" || return 1
@@ -584,12 +575,13 @@ from_source() {
# Make prep # Make prep
((DEBUG)) && make_opts+=("V=s") ((DEBUG)) && make_opts+=("V=s")
#execute make "${make_opts[@]}" "-j1" dirclean # TODO 'dirclean' has a bug that triggers menuconfig execute make "${make_opts[@]}" "-j1" distclean # TODO 'dirclean' has a bug that triggers menuconfig
execute make "${make_opts[@]}" "-j1" defconfig execute make "${make_opts[@]}" "-j1" defconfig
execute make "${make_opts[@]}" "-j1" download execute make "${make_opts[@]}" "-j1" download
((DEBUG)) && make_opts+=("-j1") || make_opts+=("-j$(($(nproc)+1))")
# Make image # Make image
if ! execute ionice -c 3 chrt --idle 0 nice -n19 make "${make_opts[@]}" "-j$(($(nproc)+1))" 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
@@ -630,7 +622,7 @@ verify() {
local sumfile="$2" local sumfile="$2"
local checksum local checksum
hash sha256sum &>/dev/null || return 1 command -v sha256sum &>/dev/null || return 1
[[ -f $sumfile && -f $file_to_check ]] || return 1 [[ -f $sumfile && -f $file_to_check ]] || return 1
checksum=$(grep "${file_to_check##*/}" "$sumfile" | cut -f1 -d' ') checksum=$(grep "${file_to_check##*/}" "$sumfile" | cut -f1 -d' ')
echo -n "$checksum $file_to_check" | sha256sum --check --status echo -n "$checksum $file_to_check" | sha256sum --check --status
@@ -782,4 +774,4 @@ main() {
} }
main "$@" main "$@"
exit $? exit

View File

@@ -46,12 +46,13 @@ r4s['packages']="\
curl \ curl \
ethtool \ ethtool \
ca-bundle" ca-bundle"
# The following are source mode only # The following only work in --source mode
r4s['config']="\ r4s['config']="\
CONFIG_KERNEL_BTRFS_FS_POSIX_ACL=y \ CONFIG_KERNEL_BTRFS_FS_POSIX_ACL=y \
CONFIG_BTRFS_PROGS_ZSTD=y \ CONFIG_BTRFS_PROGS_ZSTD=y \
CONFIG_TARGET_ROOTFS_PARTSIZE=512 \ CONFIG_TARGET_ROOTFS_PARTSIZE=512 \
CONFIG_TARGET_KERNEL_PARTSIZE=32" CONFIG_TARGET_KERNEL_PARTSIZE=32 \
CONFIG_BUILDBOT=n"
r4s['files']="\ r4s['files']="\
/mnt/backup" /mnt/backup"