Pass ROOTFS_PARTSIZE to IB

This commit is contained in:
2026-05-11 19:12:42 -04:00
parent 0485481023
commit f5f32ed8d4
2 changed files with 46 additions and 39 deletions

View File

@@ -175,7 +175,7 @@ install_dependencies() {
lock_file="$BUILD_ROOT/.dependencies_imagebuilder.lock" lock_file="$BUILD_ROOT/.dependencies_imagebuilder.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, skipping dependency install" && return 0
if [[ "$mode" == "source" ]]; then if [[ "$mode" == "source" ]]; then
# For building from source code see: # For building from source code see:
@@ -403,31 +403,51 @@ ssh_backup() {
[[ -d "$FILES_DIR" ]] || execute mkdir -p "$FILES_DIR" [[ -d "$FILES_DIR" ]] || execute mkdir -p "$FILES_DIR"
# Make backup archive on remote # Make backup archive on remote
if ! execute "ssh -t $SSH_BACKUP_PATH sysupgrade -b /tmp/$backup_fname"; then if ! execute ssh -t "$SSH_BACKUP_PATH" sysupgrade -b "/tmp/$backup_fname"; then
echo "SSH backup failed" echo "SSH backup failed"
exit 1 exit 1
fi fi
# Move backup archive locally # Move backup archive locally
if ! execute "rsync -avz --remove-source-files $SSH_BACKUP_PATH:/tmp/$backup_fname $BUILD_DIR/"; then if ! execute rsync -avz --remove-source-files "$SSH_BACKUP_PATH:/tmp/$backup_fname" "$BUILD_DIR/"; then
echo "Could not copy SSH backup" echo "Could not copy SSH backup"
exit 1 exit 1
fi fi
# Extract backup archive # Extract backup archive
if ! execute "tar -C $FILES_DIR -xzf $BUILD_DIR/$backup_fname"; then if ! execute tar -C "$FILES_DIR" -xzf "$BUILD_DIR/$backup_fname"; then
echo "Could not extract SSH backup" echo "Could not extract SSH backup"
exit 1 exit 1
fi fi
execute "rm $BUILD_DIR/$backup_fname" execute rm "$BUILD_DIR/$backup_fname"
} }
make_images() { make_images() {
debug "${FUNCNAME[0]}" debug "${FUNCNAME[0]}"
local -a make_opts local -a make_opts; ((DEBUG)) && make_opts+=("V=sc")
local rootfs_partsize
# Image Builder accepts ROOTFS_PARTSIZE, not CONFIG_TARGET_ROOTFS_PARTSIZE.
# Parse profile KCONFIGS (scalar string) and extract only this value.
for kconfig in $KCONFIGS; do
case "$kconfig" in
CONFIG_TARGET_ROOTFS_PARTSIZE=*) rootfs_partsize="${kconfig#*=}" ;;
esac
done
local -a make_cmd=(make "${make_opts[@]}" image
BIN_DIR="$BIN_DIR"
PROFILE="$DEVICE"
PACKAGES="$PACKAGES"
FILES="$FILES_DIR"
--directory="$BUILD_DIR"
--jobs="$JOBS")
[[ -n "$rootfs_partsize" ]] && make_cmd+=("ROOTFS_PARTSIZE=$rootfs_partsize")
# Reuse the existing output # Reuse the existing output
# TODO Disable for now since it was causing issues
# if [[ -d "$BIN_DIR" ]]; then # if [[ -d "$BIN_DIR" ]]; then
# if ask_ok "$BIN_DIR exists. Rebuild?"; then # if ask_ok "$BIN_DIR exists. Rebuild?"; then
# execute rm -rf "$BIN_DIR" # execute rm -rf "$BIN_DIR"
@@ -436,21 +456,9 @@ make_images() {
# fi # fi
# fi # fi
((DEBUG)) && make_opts+=("V=sc") # Debug manually so we can log output
debug "${make_cmd[*]}"
debug make "${make_opts[@]}" image BIN_DIR="$BIN_DIR" \ "${make_cmd[@]}" > "$BUILD_DIR/make.log" 2>&1
PROFILE="$DEVICE" PACKAGES="$PACKAGES" \
FILES="$FILES_DIR" --directory="$BUILD_DIR" \
--jobs="$JOBS"
make "${make_opts[@]}" image \
BIN_DIR="$BIN_DIR" \
PROFILE="$DEVICE" \
PACKAGES="$PACKAGES" \
FILES="$FILES_DIR" \
--directory="$BUILD_DIR" \
--jobs="$JOBS" \
> "$BUILD_DIR/make.log"
} }
flash_images() { flash_images() {
@@ -504,15 +512,14 @@ ssh_upgrade() {
} }
# @description Builds OpenWRT from source code using the the default buildbot as base # @description Builds OpenWRT from source code using the the default buildbot as base
# This enables the use of kernel config options in profiles
from_source() { from_source() {
debug "${FUNCNAME[0]}" debug "${FUNCNAME[0]}"
local src_url="https://github.com/openwrt/openwrt.git" local src_url="https://github.com/openwrt/openwrt.git"
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 description local pkg kconfig commit description
local -a make_opts local -a make_opts
local -a config_opts=( local -a kconfigs=(
"CONFIG_TARGET_${TARGET%%/*}=y" "CONFIG_TARGET_${TARGET%%/*}=y"
"CONFIG_TARGET_${TARGET//\//_}=y" "CONFIG_TARGET_${TARGET//\//_}=y"
"CONFIG_TARGET_PROFILE=DEVICE_$DEVICE" "CONFIG_TARGET_PROFILE=DEVICE_$DEVICE"
@@ -670,22 +677,23 @@ from_source() {
# Add custom packages # Add custom packages
for pkg in $PACKAGES; do for pkg in $PACKAGES; do
if [[ $pkg == -* ]]; then if [[ $pkg == -* ]]; then
config_opts+=("CONFIG_PACKAGE_${pkg#-}=n") # remove package kconfigs+=("CONFIG_PACKAGE_${pkg#-}=n") # remove package
else else
config_opts+=("CONFIG_PACKAGE_$pkg=y") # add package kconfigs+=("CONFIG_PACKAGE_$pkg=y") # add package
fi fi
done done
# Add profile config options # Add profile kconfig options
for config in $CONFIGS; do # $KCONFIGS is a scalar, use a loop to split and avoid SC2068
config_opts+=("$config") for kconfig in $KCONFIGS; do
kconfigs+=("$kconfig")
done done
# Reset and write options to config seed file # Reset and write options to config seed file
[[ -f $seed_file ]] && execute rm -f "$seed_file" [[ -f $seed_file ]] && execute rm -f "$seed_file"
for config in "${config_opts[@]}"; do for kconfig in "${kconfigs[@]}"; do
debug "Writing $config to $seed_file" debug "Writing $kconfig to $seed_file"
echo "$config" >> "$seed_file" echo "$kconfig" >> "$seed_file"
done done
# Expand seed into full config # Expand seed into full config
@@ -813,7 +821,7 @@ main() {
declare -g PACKAGES="${P_ARR[packages]:-}" # scalar declare -g PACKAGES="${P_ARR[packages]:-}" # scalar
declare -g CHERRYPICKS="${P_ARR[cherrypicks]:-}" # scalar declare -g CHERRYPICKS="${P_ARR[cherrypicks]:-}" # scalar
declare -g BRANCHES="${P_ARR[branches]:-}" # scalar declare -g BRANCHES="${P_ARR[branches]:-}" # scalar
declare -g CONFIGS="${P_ARR[configs]:-}" # scalar declare -g KCONFIGS="${P_ARR[kconfigs]:-}" # scalar
install_dependencies "$MODE" install_dependencies "$MODE"

View File

@@ -13,7 +13,7 @@ default_packages=(
) )
# Default kernel configs # Default kernel configs
default_configs=( default_kconfigs=(
) )
# Current devices # Current devices
@@ -27,9 +27,9 @@ declare -Ag r4s=(
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" ethtool ca-bundle tailscale"
[configs]="${default_configs[*]} \ [kconfigs]="${default_kconfigs[*]} \
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_KERNEL_BTRFS_FS_POSIX_ACL=y CONFIG_BTRFS_PROGS_ZSTD=y"
[files]="/mnt/backup" [files]="/mnt/backup"
# For 24.10 branch (Linux 6.6) # For 24.10 branch (Linux 6.6)
# [cherrypicks]="https://github.com/wurzerj/openwrt.git:59d6e31 \ # [cherrypicks]="https://github.com/wurzerj/openwrt.git:59d6e31 \
@@ -65,7 +65,7 @@ declare -Ag n5100=(
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 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"
[configs]="${default_configs[*]} \ [kconfigs]="${default_kconfigs[*]} \
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"
@@ -107,7 +107,6 @@ declare -Ag w1700k_ap=(
[release]="snapshot" [release]="snapshot"
[packages]="${default_packages[*]} \ [packages]="${default_packages[*]} \
-dnsmasq -odhcpd-ipv6only -nftables -firewall4 \ -dnsmasq -odhcpd-ipv6only -nftables -firewall4 \
irqblance luci-app-irqbalance \
wpad-openssl libiwinfo-data tailscale bridger switch smp_util \ wpad-openssl libiwinfo-data tailscale bridger switch smp_util \
kmod-crypto-hw-eip93" kmod-crypto-hw-eip93"
# [branches]="https://github.com/OpenWRT-fanboy/OpenW1700k.git@minimal" # [branches]="https://github.com/OpenWRT-fanboy/OpenW1700k.git@minimal"