Compare commits
9 Commits
b75597946d
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| 5b9f1f2f39 | |||
| c5bfc7907b | |||
| 533b0b5ffc | |||
| eba54804d3 | |||
| 09b62923a8 | |||
| 960755e6a2 | |||
| 0fa9b0d85a | |||
| 4de18e6696 | |||
| 3772d373bb |
@@ -22,18 +22,16 @@ print_help() {
|
||||
--release,-r,--version,-v RELEASE ("snapshot", "22.03.5")
|
||||
--buildroot,-b PATH
|
||||
Default: location of openwrtbuilder script
|
||||
--source
|
||||
--source[=CLEAN]
|
||||
Build image from source, not from Image Builder
|
||||
Allows make config options to be passed in profile
|
||||
Uses git worktree for multi-profile deduplication
|
||||
Optional CLEAN runs the given clean mode before building
|
||||
(clean|targetclean|dirclean|distclean)
|
||||
--ssh-upgrade HOST
|
||||
Examples: root@192.168.1.1, root@router.lan
|
||||
--ssh-backup SSH_PATH
|
||||
Enabled by default for --ssh-upgrade
|
||||
--flash,-f DEVICE
|
||||
Example: /dev/sdX
|
||||
--reset
|
||||
Cleanup all source and output files
|
||||
--depends
|
||||
Force dependency installation
|
||||
--yes,-y
|
||||
@@ -127,8 +125,8 @@ parse_input() {
|
||||
debug "${FUNCNAME[0]}" "$*"
|
||||
declare -ga PROFILES
|
||||
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
|
||||
local long_opts='release:,version:,profile:,buildroot:,source,'
|
||||
declare -g USER_RELEASE SSH_UPGRADE_PATH SSH_BACKUP_PATH FLASH_DEV SOURCE_CLEAN
|
||||
local long_opts='release:,version:,profile:,buildroot:,source::,'
|
||||
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
|
||||
@@ -138,7 +136,12 @@ parse_input() {
|
||||
--release|-r|--version|-v) shift; USER_RELEASE="$1" ;;
|
||||
--profile|-p) shift; PROFILES+=("$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-backup) shift; SSH_BACKUP_PATH="$1" ;;
|
||||
--flash|-f) shift; FLASH_DEV="$1" ;;
|
||||
@@ -516,16 +519,12 @@ from_source() {
|
||||
local pkg config commit seed_file description
|
||||
local -a make_opts
|
||||
local -a config_opts=(
|
||||
"CONFIG_TARGET_${TARGET%%/*}=y"
|
||||
"CONFIG_TARGET_${TARGET//\//_}=y"
|
||||
"CONFIG_TARGET_${TARGET//\//_}_${TARGET##*/}=y"
|
||||
"CONFIG_TARGET_PROFILE=DEVICE_$DEVICE"
|
||||
"CONFIG_TARGET_${TARGET//\//_}_DEVICE_$DEVICE=y"
|
||||
"CONFIG_TARGET_ROOTFS_${FILESYSTEM^^}=y"
|
||||
|
||||
# Needed?
|
||||
"CONFIG_TARGET_MULTI_PROFILE=n"
|
||||
|
||||
# Not sure if needed yet
|
||||
"CONFIG_BUILDBOT=n"
|
||||
"CONFIG_ALL_KMODS=n"
|
||||
"CONFIG_ALL_NONSHARED=n"
|
||||
@@ -540,7 +539,7 @@ from_source() {
|
||||
|
||||
echo "Building from source is under development"
|
||||
|
||||
# Remove all build directories and worktrees
|
||||
# Remove all build directories and worktrees if --reset
|
||||
if ((RESET)); then
|
||||
if [[ -d "$BUILD_DIR" || -d "$worktree_meta" ]]; then
|
||||
execute git -C "$SRC_DIR" worktree remove --force --force "$BUILD_DIR"
|
||||
@@ -599,21 +598,18 @@ from_source() {
|
||||
((DEBUG)) && make_opts+=("V=sc")
|
||||
|
||||
# Cleanup build environment: heavy clean only when --reset was used earlier
|
||||
if ((RESET)); then
|
||||
execute make "${make_opts[@]}" "-j1" distclean
|
||||
else
|
||||
debug "Skipping distclean for incremental build"
|
||||
fi
|
||||
|
||||
# Advanced build environment cleanup options for debugging and future use
|
||||
# execute make "${make_opts[@]}" "-j1" distclean
|
||||
# make clean # compiled output
|
||||
# make targetclean # compiled output, toolchain
|
||||
# make dirclean # compiled output, toolchain, build tools
|
||||
# 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
|
||||
# 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
|
||||
./scripts/feeds update -a -f &&
|
||||
@@ -633,7 +629,8 @@ from_source() {
|
||||
config_opts+=("$config")
|
||||
done
|
||||
|
||||
# Write options to config seed file
|
||||
# Reset and write options to config seed file
|
||||
[[ -f $seed_file ]] && execute rm -f "$seed_file"
|
||||
for config in "${config_opts[@]}"; do
|
||||
debug "Writing $config to $seed_file"
|
||||
echo "$config" >> "$seed_file"
|
||||
@@ -642,11 +639,15 @@ from_source() {
|
||||
# Expand seed into full config
|
||||
execute make "${make_opts[@]}" "-j1" defconfig
|
||||
|
||||
# make_opts+=("-j$(($(nproc)-2))")
|
||||
((DEBUG)) && make_opts+=("-j1") || make_opts+=("-j$(($(nproc)-2))")
|
||||
# Run serial make download for better reliability
|
||||
execute make "${make_opts[@]}" "-j1" download
|
||||
|
||||
# (Optional) Disable multicore make world
|
||||
# ((DEBUG)) && make_opts+=("-j1") || make_opts+=("-j$(($(nproc)-2))")
|
||||
make_opts+=("-j$(($(nproc)-2))")
|
||||
|
||||
# Make image
|
||||
if ! execute ionice -c 3 chrt --idle 0 nice -n19 make "${make_opts[@]}" BIN_DIR="$BIN_DIR" download world; then
|
||||
if ! execute ionice -c2 -n7 nice -n19 make "${make_opts[@]}" BIN_DIR="$BIN_DIR" world; then
|
||||
echo "Error: make failed"
|
||||
return 1
|
||||
fi
|
||||
|
||||
2
profiles
2
profiles
@@ -19,7 +19,7 @@ declare -Ag r4s=(
|
||||
[target]="rockchip/armv8"
|
||||
[filesystem]="ext4"
|
||||
[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 \
|
||||
kmod-fs-btrfs btrfs-progs block-mount smcroute avahi-daemon \
|
||||
|
||||
Reference in New Issue
Block a user