armbian-next: rootfs: converge rootfs-cache and rootfs together; exchange BOARD for ARCH

This commit is contained in:
Ricardo Pardini
2023-01-22 18:35:06 +01:00
parent 695bfb387b
commit d17157885c
3 changed files with 52 additions and 36 deletions

View File

@@ -6,7 +6,7 @@ function cli_rootfs_pre_run() {
}
function cli_rootfs_run() {
declare -a vars_cant_be_set=("BOARD" "LINUXFAMILY" "BOARDFAMILY")
declare -a vars_cant_be_set=("LINUXFAMILY" "BOARDFAMILY")
# loop through all vars and check if they are set and bomb out
for var in "${vars_cant_be_set[@]}"; do
if [[ -n ${!var} ]]; then
@@ -14,6 +14,20 @@ function cli_rootfs_run() {
fi
done
# If BOARD is set, use it to convert to an ARCH.
if [[ -n ${BOARD} ]]; then
display_alert "BOARD is set, converting to ARCH for rootfs building" "${BOARD}" "warn"
# Convert BOARD to ARCH; source the BOARD and FAMILY stuff
LOG_SECTION="config_source_board_file" do_with_conditional_logging config_source_board_file
LOG_SECTION="config_source_board_file" do_with_conditional_logging source_family_config_and_arch
display_alert "Done sourcing board file" "${BOARD} - arch: ${ARCH}" "warn"
fi
declare -a vars_need_to_be_set=("RELEASE" "ARCH") # Maybe the rootfs version?
# loop through all vars and check if they are not set and bomb out if so
for var in "${vars_need_to_be_set[@]}"; do

View File

@@ -23,13 +23,13 @@ function armbian_register_commands() {
["distccd"]="distccd" # implemented in cli_distccd_pre_run and cli_distccd_run
["rootfs"]="rootfs" # implemented in cli_rootfs_pre_run and cli_rootfs_run
["rootfs-cache"]="rootfs" # idem, alias
# shortcuts, see vars set below. the use legacy single build, and try to control it via variables
["kernel"]="standard_build"
["u-boot"]="standard_build"
["uboot"]="standard_build"
["rootfs-cache"]="standard_build"
["undecided"]="undecided" # implemented in cli_undecided_pre_run and cli_undecided_run - relaunches either build or docker
)
@@ -50,8 +50,6 @@ function armbian_register_commands() {
["u-boot"]="KERNEL_ONLY='yes' JUST_UBOOT='yes' UBOOT_IGNORE_DEB='yes'"
["uboot"]="KERNEL_ONLY='yes' JUST_UBOOT='yes' UBOOT_IGNORE_DEB='yes'"
["rootfs-cache"]="ROOT_FS_CREATE_ONLY='yes' KERNEL_ONLY='no' KERNEL_CONFIGURE='prebuilt' BRANCH='current'"
["undecided"]="UNDECIDED='yes'"
)
# Override the LOG_CLI_ID to change the log file name.

View File

@@ -217,38 +217,9 @@ function do_main_configuration() {
#BOOTFS_TYPE=''
## ------ Sourcing family config ---------------------------
declare -a family_source_paths=("${SRC}/config/sources/families/${LINUXFAMILY}.conf" "${USERPATCHES_PATH}/config/sources/families/${LINUXFAMILY}.conf")
declare -i family_sourced_ok=0
for family_source_path in "${family_source_paths[@]}"; do
[[ ! -f "${family_source_path}" ]] && continue
display_alert "Sourcing family configuration" "${family_source_path}" "info"
# shellcheck source=/dev/null
source "${family_source_path}"
# @TODO: reset error handling, go figure what they do in there.
family_sourced_ok=$((family_sourced_ok + 1))
done
# If no families sourced (and not allowed by ext var), bail out
if [[ ${family_sourced_ok} -lt 1 ]]; then
if [[ "${allow_no_family:-"no"}" != "yes" ]]; then
exit_with_error "Sources configuration not found" "tried ${family_source_paths[*]}"
fi
fi
# load "all-around common arch defaults" common.conf
display_alert "Sourcing common arch configuration" "common.conf" "debug"
# shellcheck source=config/sources/common.conf
source "${SRC}/config/sources/common.conf"
# load architecture defaults
display_alert "Sourcing arch configuration" "${ARCH}.conf" "info"
# shellcheck source=/dev/null
source "${SRC}/config/sources/${ARCH}.conf"
source_family_config_and_arch
if [[ "$HAS_VIDEO_OUTPUT" == "no" ]]; then
SKIP_BOOTSPLASH="yes"
PLYMOUTH="no"
@@ -439,3 +410,36 @@ function write_config_summary_output_file() {
CPU configuration: $CPUMIN - $CPUMAX with $GOVERNOR
EOF
}
function source_family_config_and_arch() {
declare -a family_source_paths=("${SRC}/config/sources/families/${LINUXFAMILY}.conf" "${USERPATCHES_PATH}/config/sources/families/${LINUXFAMILY}.conf")
declare -i family_sourced_ok=0
for family_source_path in "${family_source_paths[@]}"; do
[[ ! -f "${family_source_path}" ]] && continue
display_alert "Sourcing family configuration" "${family_source_path}" "info"
# shellcheck source=/dev/null
source "${family_source_path}"
# @TODO: reset error handling, go figure what they do in there.
family_sourced_ok=$((family_sourced_ok + 1))
done
# If no families sourced (and not allowed by ext var), bail out
if [[ ${family_sourced_ok} -lt 1 ]]; then
if [[ "${allow_no_family:-"no"}" != "yes" ]]; then
exit_with_error "Sources configuration not found" "tried ${family_source_paths[*]}"
fi
fi
# load "all-around common arch defaults" common.conf
display_alert "Sourcing common arch configuration" "common.conf" "debug"
# shellcheck source=config/sources/common.conf
source "${SRC}/config/sources/common.conf"
# load architecture defaults
display_alert "Sourcing arch configuration" "${ARCH}.conf" "info"
# shellcheck source=/dev/null
source "${SRC}/config/sources/${ARCH}.conf"
}