Run shellfmt to complete code

This commit is contained in:
Igor Pecovnik
2024-06-22 17:54:22 +02:00
committed by Igor
parent 1341c19ef4
commit 75ce67f329
32 changed files with 87 additions and 103 deletions

View File

@@ -30,8 +30,7 @@ case $BOARD in
esac esac
# bootloader releated # bootloader releated
pre_config_uboot_target() pre_config_uboot_target() {
{
# get the firmware # get the firmware
rm -rf ${IMX_FIRMWARE}* rm -rf ${IMX_FIRMWARE}*
wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/${IMX_FIRMWARE}.bin -O ${IMX_FIRMWARE}.bin wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/${IMX_FIRMWARE}.bin -O ${IMX_FIRMWARE}.bin
@@ -46,8 +45,7 @@ pre_config_uboot_target()
export ATF_LOAD_ADDR=${ATF_ADDR} export ATF_LOAD_ADDR=${ATF_ADDR}
} }
write_uboot_platform() write_uboot_platform() {
{
echo ${OFFSET} echo ${OFFSET}
dd if=$1/flash.bin of=$2 bs=1K seek=${OFFSET} status=noxfer conv=fsync > /dev/null 2>&1 dd if=$1/flash.bin of=$2 bs=1K seek=${OFFSET} status=noxfer conv=fsync > /dev/null 2>&1
} }

View File

@@ -31,7 +31,7 @@ case $BOARD in
KERNELPATCHDIR="archive/imx8m-6.6" KERNELPATCHDIR="archive/imx8m-6.6"
;; ;;
edge|default) # use for tests with recent mainline kernels edge | default) # use for tests with recent mainline kernels
;; ;;
esac esac

View File

@@ -35,11 +35,10 @@ elif [[ "$BOARD" == "jethubj200" ]]; then
BOOTPATCHDIR="v2024.01" BOOTPATCHDIR="v2024.01"
fi fi
######## ########
# @TODO: Put this in the board configs of the respective boards # @TODO: Put this in the board configs of the respective boards
######## ########
if [[ "$BOARD" == "jethubj80" ]] || [[ "$BOARD" == "jethubj100" ]] ; then if [[ "$BOARD" == "jethubj80" ]] || [[ "$BOARD" == "jethubj100" ]]; then
function family_tweaks__blacklistrtw88() { function family_tweaks__blacklistrtw88() {
if [[ "$BOARD" == jethubj80 ]] || [[ "$BOARD" == jethubj100 ]]; then if [[ "$BOARD" == jethubj80 ]] || [[ "$BOARD" == jethubj100 ]]; then
mkdir -p "${destination}"/etc/modprobe.d mkdir -p "${destination}"/etc/modprobe.d
@@ -49,19 +48,16 @@ if [[ "$BOARD" == "jethubj80" ]] || [[ "$BOARD" == "jethubj100" ]] ; then
} }
fi fi
# JetHub builds userspace tooling with c++ (gpp) toolchain in buildjethomecmds() below. # JetHub builds userspace tooling with c++ (gpp) toolchain in buildjethomecmds() below.
# The C++ compiler is no longer included by default in the Armbian build system. # The C++ compiler is no longer included by default in the Armbian build system.
# Enable the extension that brings includes it. It could've been an inline extension (eg: the function right here), # Enable the extension that brings includes it. It could've been an inline extension (eg: the function right here),
# but having a core extension allows it to be pre-included in the Dockerfile generation and thus in the Docker images. # but having a core extension allows it to be pre-included in the Dockerfile generation and thus in the Docker images.
enable_extension "c-plus-plus-compiler" enable_extension "c-plus-plus-compiler"
function fetch_sources_tools__jethub_amlogic_fip() { function fetch_sources_tools__jethub_amlogic_fip() {
fetch_from_repo "https://github.com/adeepn/amlogic-boot-fip" "amlogic-boot-fip-jethub" "branch:add_jethub_j200" fetch_from_repo "https://github.com/adeepn/amlogic-boot-fip" "amlogic-boot-fip-jethub" "branch:add_jethub_j200"
} }
uboot_custom_postprocess() { uboot_custom_postprocess() {
if [[ "$BOARD" == "jethubj80" ]]; then if [[ "$BOARD" == "jethubj80" ]]; then
uboot_gxl_postprocess_ng "$SRC/cache/sources/amlogic-boot-fip/jethub-j80" uboot_gxl_postprocess_ng "$SRC/cache/sources/amlogic-boot-fip/jethub-j80"

View File

@@ -128,7 +128,7 @@ function custom_kernel_config__add_khadas_common_drivers() {
memoize_cache_ttl=$common_drivers_cache_ttl_seconds run_memoized GIT_INFO_COMMON_DRIVERS "git2info" memoized_git_ref_to_info memoize_cache_ttl=$common_drivers_cache_ttl_seconds run_memoized GIT_INFO_COMMON_DRIVERS "git2info" memoized_git_ref_to_info
# Hack to ensure that we will recreate kernel if common_drivers source changes # Hack to ensure that we will recreate kernel if common_drivers source changes
kernel_config_modifying_hashes+=( "khadas_common_drivers=${GIT_INFO_COMMON_DRIVERS[SHA1]}" ) kernel_config_modifying_hashes+=("khadas_common_drivers=${GIT_INFO_COMMON_DRIVERS[SHA1]}")
# viraniac: kernel_config_modifying_hashes is only needed during first call of this function to calculate kernel artifact version string. It serves no purpose whatsoever during second call. # viraniac: kernel_config_modifying_hashes is only needed during first call of this function to calculate kernel artifact version string. It serves no purpose whatsoever during second call.
kernel_config_modifying_hashes+=("CONFIG_DEBUG_KERNEL=y" "CONFIG_EXPERT=y" "CONFIG_EMBEDDED=y") kernel_config_modifying_hashes+=("CONFIG_DEBUG_KERNEL=y" "CONFIG_EXPERT=y" "CONFIG_EMBEDDED=y")
@@ -197,7 +197,7 @@ function post_family_tweaks_bsp__disable_uinitrd_generation() {
function image_specific_armbian_env_ready__enable_earlycon() { function image_specific_armbian_env_ready__enable_earlycon() {
display_alert "Enabling earlycon" display_alert "Enabling earlycon"
run_host_command_logged echo "earlycon=on" >>${SDCARD}/boot/armbianEnv.txt run_host_command_logged echo "earlycon=on" >> ${SDCARD}/boot/armbianEnv.txt
} }
function post_family_tweaks_bsp__add_fan_service() { function post_family_tweaks_bsp__add_fan_service() {

View File

@@ -33,7 +33,6 @@ GOVERNOR="ondemand"
function pre_install_kernel_debs__network_manager_ignore_devices() { function pre_install_kernel_debs__network_manager_ignore_devices() {
display_alert "Board: ${BOARD}: Disabling Network-Manager for all devices" "interface-name:eth*,interface-name:wan*,interface-name:lan*,interface-name:br*" "info" display_alert "Board: ${BOARD}: Disabling Network-Manager for all devices" "interface-name:eth*,interface-name:wan*,interface-name:lan*,interface-name:br*" "info"
mkdir -p "${SDCARD}"/etc/NetworkManager/conf.d/ mkdir -p "${SDCARD}"/etc/NetworkManager/conf.d/
cat <<- EOF > "${SDCARD}"/etc/NetworkManager/conf.d/99-ignore-interfaces.conf cat <<- EOF > "${SDCARD}"/etc/NetworkManager/conf.d/99-ignore-interfaces.conf
[keyfile] [keyfile]

View File

@@ -75,7 +75,6 @@ GOVERNOR=ondemand
function pre_install_kernel_debs__network_manager_ignore_devices() { function pre_install_kernel_debs__network_manager_ignore_devices() {
display_alert "Board: ${BOARD}: Disabling Network-Manager for all devices" "interface-name:eth*,interface-name:wan*,interface-name:lan*,interface-name:br*" "info" display_alert "Board: ${BOARD}: Disabling Network-Manager for all devices" "interface-name:eth*,interface-name:wan*,interface-name:lan*,interface-name:br*" "info"
mkdir -p "${SDCARD}"/etc/NetworkManager/conf.d/ mkdir -p "${SDCARD}"/etc/NetworkManager/conf.d/
cat <<- EOF > "${SDCARD}"/etc/NetworkManager/conf.d/99-ignore-interfaces.conf cat <<- EOF > "${SDCARD}"/etc/NetworkManager/conf.d/99-ignore-interfaces.conf
[keyfile] [keyfile]

View File

@@ -15,13 +15,13 @@ OVERLAY_PREFIX='sun50i-h6'
GOVERNOR=ondemand GOVERNOR=ondemand
ASOUND_STATE='asound.state.sun50iw2-dev' ASOUND_STATE='asound.state.sun50iw2-dev'
function post_family_config__install_lightdm_gtk_greeter(){ function post_family_config__install_lightdm_gtk_greeter() {
if [[ ${BUILD_DESKTOP} == "yes" ]] && [[ ! ${DESKTOP_ENVIRONMENT} =~ ^(kde|gnome)$ ]]; then if [[ ${BUILD_DESKTOP} == "yes" ]] && [[ ! ${DESKTOP_ENVIRONMENT} =~ ^(kde|gnome)$ ]]; then
add_packages_to_image lightdm-gtk-greeter add_packages_to_image lightdm-gtk-greeter
fi fi
} }
function post_family_tweaks__switch_to_lightdm_gtk_greeter(){ function post_family_tweaks__switch_to_lightdm_gtk_greeter() {
# Mali T720 seems to have some issues with slick-greeter. # Mali T720 seems to have some issues with slick-greeter.
# Use gtk greeter instead # Use gtk greeter instead
if [[ ${BUILD_DESKTOP} == "yes" ]] && [[ ! ${DESKTOP_ENVIRONMENT} =~ ^(kde|gnome)$ ]]; then if [[ ${BUILD_DESKTOP} == "yes" ]] && [[ ! ${DESKTOP_ENVIRONMENT} =~ ^(kde|gnome)$ ]]; then

View File

@@ -15,4 +15,3 @@ fi
[[ -z $CPUMIN ]] && CPUMIN=480000 [[ -z $CPUMIN ]] && CPUMIN=480000
[[ -z $CPUMAX ]] && CPUMAX=1400000 [[ -z $CPUMAX ]] && CPUMAX=1400000

View File

@@ -69,9 +69,9 @@ function extension_finish_config__prepare_megous_patches() {
run_host_command_logged rm -f ${patch_dir_base}/series.{conf,megous} run_host_command_logged rm -f ${patch_dir_base}/series.{conf,megous}
display_alert "allwinner-kernel-bump" "Extracting latest Megous patches" "info" display_alert "allwinner-kernel-bump" "Extracting latest Megous patches" "info"
megous_trees=( "a83t-suspend" "af8133j" "anx" "audio" "axp" "cam" "drm" megous_trees=("a83t-suspend" "af8133j" "anx" "audio" "axp" "cam" "drm"
"err" "fixes" "mbus" "modem" "opi3" "pb" "pinetab" "pp" "ppkb" "samuel" "err" "fixes" "mbus" "modem" "opi3" "pb" "pinetab" "pp" "ppkb" "samuel"
"speed" "tbs-a711" "ths" ) "speed" "tbs-a711" "ths")
run_host_command_logged mkdir -p ${patch_dir_megous} ${patch_dir_tmp} run_host_command_logged mkdir -p ${patch_dir_megous} ${patch_dir_tmp}

View File

@@ -1,6 +1,6 @@
function post_family_tweaks_bsp__armbian-live-patch() { function post_family_tweaks_bsp__armbian-live-patch() {
display_alert "Installing Armbian Live Patch" "${EXTENSION}" "info" display_alert "Installing Armbian Live Patch" "${EXTENSION}" "info"
run_host_command_logged cat <<- 'armbian-live-patch' > "${destination}"/etc/systemd/system/armbian-live-patch.service run_host_command_logged cat <<- 'armbian-live-patch' > "${destination}"/etc/systemd/system/armbian-live-patch.service
# Armbian simple patch system service # Armbian simple patch system service

View File

@@ -26,7 +26,7 @@ function extension_prepare_config__prepare_ci() {
add_packages_to_image cloud-init cloud-initramfs-dyn-netconf add_packages_to_image cloud-init cloud-initramfs-dyn-netconf
} }
function extension_prepare_config__ci_compatibility_check(){ function extension_prepare_config__ci_compatibility_check() {
# We require fat boot partition, will change and if the user provided another type, will fail. # We require fat boot partition, will change and if the user provided another type, will fail.
if [[ -z "${BOOTFS_TYPE}" ]]; then if [[ -z "${BOOTFS_TYPE}" ]]; then
declare -g BOOTFS_TYPE="fat" declare -g BOOTFS_TYPE="fat"
@@ -53,7 +53,6 @@ function pre_customize_image__inject_cloud_init_config() {
return 0 return 0
} }
# @TODO: would be better to have "armbian first run" as an extension that can be disabled # @TODO: would be better to have "armbian first run" as an extension that can be disabled
function pre_customize_image__disable_armbian_first_run() { function pre_customize_image__disable_armbian_first_run() {
display_alert "Disabling" "armbian first run" "info" display_alert "Disabling" "armbian first run" "info"

View File

@@ -21,7 +21,7 @@ function extension_prepare_config__prepare_cryptroot() {
EXTRA_IMAGE_SUFFIXES+=("-crypt") EXTRA_IMAGE_SUFFIXES+=("-crypt")
} }
function prepare_root_device__encrypt_root_device(){ function prepare_root_device__encrypt_root_device() {
# We encrypt the rootdevice (currently a loop device) and return the new mapped rootdevice # We encrypt the rootdevice (currently a loop device) and return the new mapped rootdevice
check_loop_device "$rootdevice" check_loop_device "$rootdevice"
display_alert "Encrypting root partition with LUKS..." "cryptsetup luksFormat $rootdevice" "" display_alert "Encrypting root partition with LUKS..." "cryptsetup luksFormat $rootdevice" ""

View File

@@ -13,7 +13,6 @@
# Additional log infomration will be created on lvm.log # Additional log infomration will be created on lvm.log
# We will need to create several LVM objects: PV VG VOL on the image from the host # We will need to create several LVM objects: PV VG VOL on the image from the host
function add_host_dependencies__lvm_host_deps() { function add_host_dependencies__lvm_host_deps() {
declare -g EXTRA_BUILD_DEPS="${EXTRA_BUILD_DEPS} lvm2" declare -g EXTRA_BUILD_DEPS="${EXTRA_BUILD_DEPS} lvm2"
@@ -32,7 +31,7 @@ function extension_prepare_config__prepare_lvm() {
add_packages_to_image lvm2 add_packages_to_image lvm2
} }
function post_create_partitions__setup_lvm(){ function post_create_partitions__setup_lvm() {
LOOP=$(losetup -f) LOOP=$(losetup -f)
[[ -z $LOOP ]] && exit_with_error "Unable to find free loop device" [[ -z $LOOP ]] && exit_with_error "Unable to find free loop device"
@@ -71,7 +70,7 @@ function post_create_partitions__setup_lvm(){
display_alert "LVM created volume group" "${EXTENSION}" "info" display_alert "LVM created volume group" "${EXTENSION}" "info"
} }
function prepare_root_device__create_volume_group(){ function prepare_root_device__create_volume_group() {
display_alert "Using LVM root" "${EXTENSION}" "info" display_alert "Using LVM root" "${EXTENSION}" "info"
vgscan vgscan
vgchange -a y ${LVM_VG_NAME} vgchange -a y ${LVM_VG_NAME}
@@ -80,14 +79,14 @@ function prepare_root_device__create_volume_group(){
display_alert "Root device is ${rootdevice}" "${EXTENSION}" "info" display_alert "Root device is ${rootdevice}" "${EXTENSION}" "info"
} }
function format_partitions__format_lvm(){ function format_partitions__format_lvm() {
# Label the root volume # Label the root volume
e2label /dev/mapper/${LVM_VG_NAME}-root armbi_root e2label /dev/mapper/${LVM_VG_NAME}-root armbi_root
blkid | grep ${LVM_VG_NAME} >> "${DEST}"/${LOG_SUBPATH}/lvm.log 2>&1 blkid | grep ${LVM_VG_NAME} >> "${DEST}"/${LOG_SUBPATH}/lvm.log 2>&1
display_alert "LVM labeled partitions" "${EXTENSION}" "info" display_alert "LVM labeled partitions" "${EXTENSION}" "info"
} }
function post_umount_final_image__close_lvm(){ function post_umount_final_image__close_lvm() {
# Deactivat the Volume Group # Deactivat the Volume Group
vgchange -a n ${LVM_VG_NAME} vgchange -a n ${LVM_VG_NAME}
display_alert "LVM deactivated volume group" "${EXTENSION}" "info" display_alert "LVM deactivated volume group" "${EXTENSION}" "info"

View File

@@ -6,8 +6,7 @@ function add_host_dependencies__install_systemd_networkd() {
add_packages_to_image netplan.io add_packages_to_image netplan.io
} }
function pre_install_kernel_debs__configure_systemd_networkd() function pre_install_kernel_debs__configure_systemd_networkd() {
{
display_alert "Extension: ${EXTENSION}: Enabling systemd-networkd" "" "info" display_alert "Extension: ${EXTENSION}: Enabling systemd-networkd" "" "info"
# Enable networkd and resolved # Enable networkd and resolved

View File

@@ -6,8 +6,7 @@ function add_host_dependencies__install_systemd-timesyncd() {
add_packages_to_image systemd-timesyncd add_packages_to_image systemd-timesyncd
} }
function pre_install_kernel_debs__configure_systemd-timesyncd() function pre_install_kernel_debs__configure_systemd-timesyncd() {
{
# Enable timesyncd # Enable timesyncd
display_alert "Extension: ${EXTENSION}: Enabling systemd-timesyncd" "" "info" display_alert "Extension: ${EXTENSION}: Enabling systemd-timesyncd" "" "info"
chroot_sdcard systemctl enable systemd-timesyncd.service chroot_sdcard systemctl enable systemd-timesyncd.service

View File

@@ -16,7 +16,7 @@ function post_install_kernel_debs__install_aic8800_dkms_package() {
aic8800_pcie_url="https://github.com/radxa-pkg/aic8800/releases/download/${latest_version}/aic8800-pcie-dkms_${latest_version}_all.deb" aic8800_pcie_url="https://github.com/radxa-pkg/aic8800/releases/download/${latest_version}/aic8800-pcie-dkms_${latest_version}_all.deb"
aic8800_sdio_url="https://github.com/radxa-pkg/aic8800/releases/download/${latest_version}/aic8800-sdio-dkms_${latest_version}_all.deb" aic8800_sdio_url="https://github.com/radxa-pkg/aic8800/releases/download/${latest_version}/aic8800-sdio-dkms_${latest_version}_all.deb"
aic8800_usb_url="https://github.com/radxa-pkg/aic8800/releases/download/${latest_version}/aic8800-usb-dkms_${latest_version}_all.deb" aic8800_usb_url="https://github.com/radxa-pkg/aic8800/releases/download/${latest_version}/aic8800-usb-dkms_${latest_version}_all.deb"
if [[ "${GITHUB_MIRROR}" == "ghproxy" ]];then if [[ "${GITHUB_MIRROR}" == "ghproxy" ]]; then
ghproxy_header="https://mirror.ghproxy.com/" ghproxy_header="https://mirror.ghproxy.com/"
aic8800_firmware_url=${ghproxy_header}${aic8800_firmware_url} aic8800_firmware_url=${ghproxy_header}${aic8800_firmware_url}
aic8800_pcie_url=${ghproxy_header}${aic8800_pcie_url} aic8800_pcie_url=${ghproxy_header}${aic8800_pcie_url}

View File

@@ -31,4 +31,3 @@ function post_family_tweaks_bsp__install_lima_serverflags() {
return 0 return 0
} }

View File

@@ -643,7 +643,6 @@ driver_mt7921u_add_pids() {
fi fi
} }
### ###
### ###
### NOTICE: <=5.x BELOW ONLY ### NOTICE: <=5.x BELOW ONLY
@@ -654,7 +653,6 @@ driver_mt7921u_add_pids() {
### ###
### v v v v v v v v v v v v v v v v v v v v v v v ### v v v v v v v v v v v v v v v v v v v v v v v
#_bt for blueteeth #_bt for blueteeth
driver_rtl8822cs_bt() { driver_rtl8822cs_bt() {

View File

@@ -27,7 +27,7 @@ grab_version() {
ver[1]=$(grep "^PATCHLEVEL" "${1}"/Makefile | head -1 | awk '{print $(NF)}' | grep -oE '^[[:digit:]]+' || true) ver[1]=$(grep "^PATCHLEVEL" "${1}"/Makefile | head -1 | awk '{print $(NF)}' | grep -oE '^[[:digit:]]+' || true)
ver[2]=$(grep "^SUBLEVEL" "${1}"/Makefile | head -1 | awk '{print $(NF)}' | grep -oE '^[[:digit:]]+' || true) ver[2]=$(grep "^SUBLEVEL" "${1}"/Makefile | head -1 | awk '{print $(NF)}' | grep -oE '^[[:digit:]]+' || true)
ver[3]=$(grep "^EXTRAVERSION" "${1}"/Makefile | head -1 | awk '{print $(NF)}' | grep -oE '^-rc[[:digit:]]+' || true) ver[3]=$(grep "^EXTRAVERSION" "${1}"/Makefile | head -1 | awk '{print $(NF)}' | grep -oE '^-rc[[:digit:]]+' || true)
ver[4]=$(if [ -f localversion-next ];then echo $(cat localversion-next); fi || true) ver[4]=$(if [ -f localversion-next ]; then echo $(cat localversion-next); fi || true)
echo "${ver[0]:-0}${ver[1]:+.${ver[1]}}${ver[2]:+.${ver[2]}}${ver[3]}${ver[4]}" echo "${ver[0]:-0}${ver[1]:+.${ver[1]}}${ver[2]:+.${ver[2]}}${ver[3]}${ver[4]}"
return 0 return 0
} }

View File

@@ -89,8 +89,8 @@ function memoized_git_ref_to_info() {
else \ else \
. + [{\"source\": \$source, \"branch\": \$branch, \"sha1\": \$sha1}] \ . + [{\"source\": \$source, \"branch\": \$branch, \"sha1\": \$sha1}] \
end" /dev/fd/5 >&6 end" /dev/fd/5 >&6
cat /dev/fd/6 >"${SRC}"/output/info/git_sources.json cat /dev/fd/6 > "${SRC}"/output/info/git_sources.json
} 5<>"${SRC}"/output/info/git_sources.json 6<>"${SRC}"/output/info/git_sources.json.new } 5<> "${SRC}"/output/info/git_sources.json 6<> "${SRC}"/output/info/git_sources.json.new
fi fi
if [[ -f "${SRC}"/config/sources/git_sources.json && ${ref_type} == "branch" ]]; then if [[ -f "${SRC}"/config/sources/git_sources.json && ${ref_type} == "branch" ]]; then

View File

@@ -99,7 +99,7 @@ function prepare_partitions() {
fi fi
# Check if we need boot partition # Check if we need boot partition
# Specialized storage extensions like cryptroot or lvm may require a boot partition # Specialized storage extensions like cryptroot or lvm may require a boot partition
if [[ $BOOTSIZE != "0" && ( -n $BOOTFS_TYPE || $ROOTFS_TYPE != ext4 || $BOOTPART_REQUIRED == yes ) ]]; then if [[ $BOOTSIZE != "0" && (-n $BOOTFS_TYPE || $ROOTFS_TYPE != ext4 || $BOOTPART_REQUIRED == yes) ]]; then
local bootpart=$((next++)) local bootpart=$((next++))
local bootfs=${BOOTFS_TYPE:-ext4} local bootfs=${BOOTFS_TYPE:-ext4}
[[ -z $BOOTSIZE || $BOOTSIZE -le 8 ]] && BOOTSIZE=${DEFAULT_BOOTSIZE} [[ -z $BOOTSIZE || $BOOTSIZE -le 8 ]] && BOOTSIZE=${DEFAULT_BOOTSIZE}

View File

@@ -21,10 +21,10 @@ function logging_init() {
# detect terminal background color # detect terminal background color
case "${COLORFGBG+${COLORFGBG#*;}}" in case "${COLORFGBG+${COLORFGBG#*;}}" in
[0-6]|8) [0-6] | 8)
declare -g background_dark_or_light=dark declare -g background_dark_or_light=dark
;; ;;
7|9|1[0-5]) 7 | 9 | 1[0-5])
declare -g background_dark_or_light=light declare -g background_dark_or_light=light
;; ;;
*) *)