completely remove any traces of KERNEL_ONLY and exit with error if set

This commit is contained in:
Ricardo Pardini
2023-03-17 00:03:34 -03:00
committed by Igor Pečovnik
parent 6d1c5fb8b7
commit 6b965c605c
18 changed files with 49 additions and 63 deletions

View File

@@ -90,7 +90,7 @@ extension_prepare_config__prepare_rpi_flash_kernel() {
fi
fi
else
if [[ "${KERNEL_ONLY}" != "yes" ]]; then
if [[ "${BUILDING_IMAGE}" == "yes" ]]; then
display_alert "Can't use release for ${BOARD}. Try: ${usable_releases}" "${RELEASE}" "err"
exit 27
fi

View File

@@ -1,7 +1,6 @@
# Read build script documentation https://docs.armbian.com/Developer-Guide_Build-Options/
# for detailed explanation of these options and for additional options not listed here
KERNEL_ONLY="" # leave empty to select each time, set to "yes" or "no" to skip dialog prompt
KERNEL_CONFIGURE="" # leave empty to select each time, set to "yes" or "no" to skip dialog prompt
CLEAN_LEVEL="" # comma-separated list of clean targets:
: # --> "make-atf" = make clean for ATF, if it is built.

View File

@@ -19,7 +19,7 @@ function extension_prepare_config__prepare_grub-riscv64() {
export EXTRA_BSP_NAME="${EXTRA_BSP_NAME}-grub" # Unique bsp name.
export UEFI_GRUB_TARGET="riscv64-efi" # Default for x86_64
if [[ "${DISTRIBUTION}" != "Ubuntu" && "${KERNEL_ONLY}" == "no" ]]; then
if [[ "${DISTRIBUTION}" != "Ubuntu" && "${BUILDING_IMAGE}" == "yes" ]]; then
exit_with_error "${DISTRIBUTION} is not supported yet"
fi

View File

@@ -71,7 +71,6 @@ function artifact_firmware_cli_adapter_pre_run() {
}
function artifact_firmware_cli_adapter_config_prep() {
declare KERNEL_ONLY="yes" # @TODO: this is a hack, for the board/family code's benefit...
use_board="no" prep_conf_main_minimal_ni < /dev/null # no stdin for this, so it bombs if tries to be interactive.
}

View File

@@ -79,7 +79,6 @@ function artifact_full_firmware_cli_adapter_pre_run() {
}
function artifact_full_firmware_cli_adapter_config_prep() {
declare KERNEL_ONLY="yes" # @TODO: this is a hack, for the board/family code's benefit...
use_board="no" prep_conf_main_minimal_ni < /dev/null # no stdin for this, so it bombs if tries to be interactive.
}

View File

@@ -178,7 +178,6 @@ function artifact_kernel_cli_adapter_pre_run() {
}
function artifact_kernel_cli_adapter_config_prep() {
declare KERNEL_ONLY="yes" # @TODO: this is a hack, for the board/family code's benefit...
use_board="yes" prep_conf_main_minimal_ni < /dev/null # no stdin for this, so it bombs if tries to be interactive.
}

View File

@@ -101,7 +101,6 @@ function artifact_uboot_cli_adapter_pre_run() {
}
function artifact_uboot_cli_adapter_config_prep() {
declare KERNEL_ONLY="yes" # @TODO: this is a hack, for the board/family code's benefit...
use_board="yes" prep_conf_main_minimal_ni < /dev/null # no stdin for this, so it bombs if tries to be interactive.
}

View File

@@ -15,6 +15,9 @@ function cli_standard_build_pre_run() {
}
function cli_standard_build_run() {
declare -g -r BUILDING_IMAGE=yes # Marker; meaning "we are building an image, not just an artifact"
declare -g -r NEEDS_BINFMT="yes" # Marker; make sure binfmts are installed during prepare_host_interactive
# configuration etc - it initializes the extension manager; handles its own logging sections
prep_conf_main_build_single
@@ -41,7 +44,6 @@ function produce_repeat_args_array() {
[[ -n ${RELEASE} ]] && repeat_args+=("RELEASE=${RELEASE}")
[[ -n ${BUILD_MINIMAL} ]] && repeat_args+=("BUILD_MINIMAL=${BUILD_MINIMAL}")
[[ -n ${BUILD_DESKTOP} ]] && repeat_args+=("BUILD_DESKTOP=${BUILD_DESKTOP}")
[[ -n ${KERNEL_ONLY} ]] && repeat_args+=("KERNEL_ONLY=${KERNEL_ONLY}")
[[ -n ${KERNEL_CONFIGURE} ]] && repeat_args+=("KERNEL_CONFIGURE=${KERNEL_CONFIGURE}")
[[ -n ${DESKTOP_ENVIRONMENT} ]] && repeat_args+=("DESKTOP_ENVIRONMENT=${DESKTOP_ENVIRONMENT}")
[[ -n ${DESKTOP_ENVIRONMENT_CONFIG_NAME} ]] && repeat_args+=("DESKTOP_ENVIRONMENT_CONFIG_NAME=${DESKTOP_ENVIRONMENT_CONFIG_NAME}")

View File

@@ -26,7 +26,6 @@ function cli_patch_kernel_run() {
display_alert "Patching kernel" "$BRANCH" "info"
declare -g SYNC_CLOCK=no # don't waste time syncing the clock
declare -g JUST_KERNEL=yes # only for kernel.
declare -g KERNEL_ONLY=yes # don't build images
declare -g PATCHES_TO_GIT=yes # commit to git.
declare -g PATCH_ONLY=yes # stop after patching.
declare -g DEBUG_PATCHING=yes # debug patching.

View File

@@ -18,7 +18,7 @@ function mark_aggregation_required_in_default_build_start() {
}
function aggregate_packages_in_logging_section() {
# Aggregate packages, in its own logging section; this decides internally on KERNEL_ONLY=no
# Aggregate packages, in its own logging section
# We need aggregation to be able to build bsp packages, which contain scripts coming from the aggregation.
LOG_SECTION="aggregate_packages" do_with_logging aggregate_packages
}
@@ -26,23 +26,21 @@ function aggregate_packages_in_logging_section() {
# This used to be called from config (main-config), but now it's moved default-build, after prepare_host, so Python hostdeps are available.
# So the aggregation results (hash, etc) are not available for config-dump.
function aggregate_packages() {
if [[ "${KERNEL_ONLY}" != "yes" ]]; then # @TODO: remove, this is not the right place to decide this.
if [[ ${aggregation_has_already_run:-0} -gt 0 ]]; then
exit_with_error "aggregate_packages: Aggregation has already run"
fi
display_alert "Aggregating packages" "rootfs" "info"
aggregate_all_packages_python
call_extension_method "post_aggregate_packages" "user_config_post_aggregate_packages" <<- 'POST_AGGREGATE_PACKAGES'
*After all aggregations are done*
Called after aggregating all package lists.
Packages will still be installed after this is called. It is not possible to change anything, though.
POST_AGGREGATE_PACKAGES
declare -i -g -r aggregation_has_already_run=1 # global, readonly.
if [[ ${aggregation_has_already_run:-0} -gt 0 ]]; then
exit_with_error "aggregate_packages: Aggregation has already run"
fi
display_alert "Aggregating packages" "rootfs" "info"
aggregate_all_packages_python
call_extension_method "post_aggregate_packages" "user_config_post_aggregate_packages" <<- 'POST_AGGREGATE_PACKAGES'
*After all aggregations are done*
Called after aggregating all package lists.
Packages will still be installed after this is called. It is not possible to change anything, though.
POST_AGGREGATE_PACKAGES
declare -i -g -r aggregation_has_already_run=1 # global, readonly.
}
function aggregate_all_packages_python() {

View File

@@ -33,21 +33,9 @@ function interactive_finish() {
}
function interactive_config_ask_kernel() {
interactive_config_ask_kernel_only
interactive_config_ask_kernel_configure
}
function interactive_config_ask_kernel_only() {
# if KERNEL_ONLY, KERNEL_CONFIGURE, BOARD, BRANCH or RELEASE are not set, display selection menu
[[ -n ${KERNEL_ONLY} ]] && return 0
options+=("no" "Full OS image for flashing")
options+=("yes" "U-boot and kernel packages ONLY")
dialog_if_terminal_set_vars --title "Choose an option" --backtitle "$backtitle" --no-tags --menu "Select what to build" $TTY_Y $TTY_X $((TTY_Y - 8)) "${options[@]}"
KERNEL_ONLY="${DIALOG_RESULT}"
[[ "${DIALOG_EXIT_CODE}" != "0" ]] && exit_with_error "You cancelled interactive during KERNEL_ONLY selection: '${DIALOG_EXIT_CODE}'" "Build cancelled: ${DIALOG_EXIT_CODE}"
unset options
}
function interactive_config_ask_kernel_configure() {
[[ -n ${KERNEL_CONFIGURE} ]] && return 0
options+=("no" "Do not change the kernel configuration")
@@ -201,7 +189,6 @@ function interactive_config_ask_branch() {
}
function interactive_config_ask_release() {
[[ $KERNEL_ONLY == yes ]] && return 0 # Don't ask if building packages only.
[[ -n ${RELEASE} ]] && return 0
declare -a options=()
@@ -217,7 +204,6 @@ function interactive_config_ask_desktop_build() {
# don't show desktop option if we choose minimal build
[[ $HAS_VIDEO_OUTPUT == no || $BUILD_MINIMAL == yes ]] && BUILD_DESKTOP=no
[[ $KERNEL_ONLY == yes ]] && return 0
[[ -n ${BUILD_DESKTOP} ]] && return 0
# read distribution support status which is written to the armbian-release file
@@ -238,7 +224,7 @@ function interactive_config_ask_desktop_build() {
}
function interactive_config_ask_standard_or_minimal() {
[[ $KERNEL_ONLY == yes ]] && return 0
[[ "${BUILDING_IMAGE}" != "yes" ]] && return 0
[[ $BUILD_DESKTOP != no ]] && return 0
[[ -n $BUILD_MINIMAL ]] && return 0
options=()

View File

@@ -0,0 +1,7 @@
function error_if_kernel_only_set() {
if [[ "x${KERNEL_ONLY}x" != "xx" ]]; then
display_alert "KERNEL_ONLY is not supported; use new" "./compile.sh kernel BOARD=${BOARD} BRANCH=${BRANCH} kernel" "err"
exit_with_error "KERNEL_ONLY is set.This is not supported anymore. Please remove it, and use the new CLI commands."
return 1
fi
}

View File

@@ -113,11 +113,12 @@ function prepare_host_noninteractive() {
download_external_toolchains # Mostly deprecated, since SKIP_EXTERNAL_TOOLCHAINS=yes is the default
fi
# if we're building an image, not only packages...
# NEEDS_BINFMT=yes is set by default build and rootfs artifact build.
# if we're building an image, not only packages/artifacts...
# ... and the host arch does not match the target arch ...
# ... we then require binfmt_misc to be enabled.
# "enable arm binary format so that the cross-architecture chroot environment will work"
if [[ "${KERNEL_ONLY}" != "yes" ]] || [[ "${NEEDS_BINFMT:-"no"}" == "yes" ]]; then
if [[ "${NEEDS_BINFMT:-"no"}" == "yes" ]]; then
if [[ "${SHOW_DEBUG}" == "yes" ]]; then
display_alert "Debugging binfmt - early" "/proc/sys/fs/binfmt_misc/" "debug"

View File

@@ -94,16 +94,6 @@ function main_default_build_packages() {
overlayfs_wrapper "cleanup"
reset_uid_owner "${DEB_STORAGE}"
# end of kernel-only, so display what was built.
if [[ "${KERNEL_ONLY}" != "yes" ]]; then
display_alert "Kernel build done" "@host" "target-reached"
display_alert "Target directory" "${DEB_STORAGE}/" "info"
display_alert "File name" "${CHOSEN_KERNEL}_${REVISION}_${ARCH}.deb" "info"
elif [[ "${KERNEL_ONLY}" == "yes" ]]; then
display_alert "using legacy option" "KERNEL_ONLY=yes; stopping build mid-packages" "warn"
return 0
fi
# Further packages require aggregation (BSPs use aggregated stuff, etc)
assert_requires_aggregation # Bombs if aggregation has not run

View File

@@ -8,10 +8,9 @@
# https://github.com/armbian/build/
function config_possibly_interactive_kernel_board() {
# if KERNEL_ONLY, KERNEL_CONFIGURE, BOARD, BRANCH or RELEASE are not set, display selection menu
# if KERNEL_CONFIGURE, BOARD, BRANCH or RELEASE are not set, display selection menu
interactive_config_ask_kernel
[[ -z $KERNEL_ONLY ]] && exit_with_error "No option selected: KERNEL_ONLY"
[[ -z $KERNEL_CONFIGURE ]] && exit_with_error "No option selected: KERNEL_CONFIGURE"
interactive_config_ask_board_list # this uses get_list_of_all_buildable_boards
@@ -26,7 +25,8 @@ function config_possibly_interactive_branch_release_desktop_minimal() {
[[ ${KERNEL_TARGET} != *${BRANCH}* && ${BRANCH} != "ddk" ]] && exit_with_error "Kernel branch not defined for this board: '${BRANCH}' for '${BOARD}'"
interactive_config_ask_release
[[ -z $RELEASE && ${KERNEL_ONLY} != yes ]] && exit_with_error "No release selected: RELEASE"
# If building image or rootfs (and thus "NEEDS_BINFMT=yes"), then RELEASE must be set.
[[ -z $RELEASE && ${NEEDS_BINFMT} == yes ]] && exit_with_error "No release selected: RELEASE"
interactive_config_ask_desktop_build
interactive_config_ask_standard_or_minimal

View File

@@ -9,16 +9,15 @@
# This does NOT run under the logging manager.
function full_build_packages_rootfs_and_image() {
error_if_kernel_only_set
main_default_build_packages # has its own logging sections # requires aggregation
# build rootfs, if not only kernel. Again, read "KERNEL_ONLY" as if it was "PACKAGES_ONLY"
if [[ "${KERNEL_ONLY}" != "yes" ]]; then
display_alert "Building image" "${BOARD}" "target-started"
assert_requires_aggregation # Bombs if aggregation has not run
build_rootfs_and_image # old "debootstrap-ng"; has its own logging sections.
display_alert "Done building image" "${BOARD}" "target-reached"
fi
# build rootfs and image
display_alert "Building image" "${BOARD}" "target-started"
assert_requires_aggregation # Bombs if aggregation has not run
build_rootfs_and_image # old "debootstrap-ng"; has its own logging sections.
display_alert "Done building image" "${BOARD}" "target-reached"
}
function do_with_default_build() {

View File

@@ -523,6 +523,15 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
# shellcheck source=lib/functions/general/countdown.sh
source "${SRC}"/lib/functions/general/countdown.sh
# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
set -o errtrace # trace ERR through - enabled
set -o errexit ## set -e : exit the script if any statement returns a non-true return value - enabled
### lib/functions/general/deprecations.sh
# shellcheck source=lib/functions/general/deprecations.sh
source "${SRC}"/lib/functions/general/deprecations.sh
# no errors tolerated. invoked before each sourced file to make sure.
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled
@@ -1045,6 +1054,7 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
# shellcheck source=lib/functions/rootfs/trap-rootfs.sh
source "${SRC}"/lib/functions/rootfs/trap-rootfs.sh
# no errors tolerated. one last time for the win!
#set -o pipefail # trace ERR through pipes - will be enabled "soon"
#set -o nounset ## set -u : exit the script if you try to use an uninitialised variable - one day will be enabled

View File

@@ -133,7 +133,6 @@ if not os.path.exists(compile_sh_full_path):
raise Exception("Can't find compile.sh")
common_compile_params = {
"KERNEL_ONLY": "yes",
"BUILD_MINIMAL": "no",
# "DEB_COMPRESS": "none",
# "CLOUD_IMAGE": "yes",