Skip to content

Commit

Permalink
Run shellfmt to complete code
Browse files Browse the repository at this point in the history
  • Loading branch information
igorpecovnik committed Jun 22, 2024
1 parent 1341c19 commit 75ce67f
Show file tree
Hide file tree
Showing 32 changed files with 87 additions and 103 deletions.
6 changes: 2 additions & 4 deletions config/sources/families/imx8m.conf
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ case $BOARD in
esac

# bootloader releated
pre_config_uboot_target()
{
pre_config_uboot_target() {
# get the firmware
rm -rf ${IMX_FIRMWARE}*
wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/${IMX_FIRMWARE}.bin -O ${IMX_FIRMWARE}.bin
Expand All @@ -46,8 +45,7 @@ pre_config_uboot_target()
export ATF_LOAD_ADDR=${ATF_ADDR}
}

write_uboot_platform()
{
write_uboot_platform() {
echo ${OFFSET}
dd if=$1/flash.bin of=$2 bs=1K seek=${OFFSET} status=noxfer conv=fsync > /dev/null 2>&1
}
Expand Down
4 changes: 2 additions & 2 deletions config/sources/families/include/imx8_common.inc
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ case $BOARD in
LINUXCONFIG='linux-tqma-'$BRANCH # one config for "tq arm modules"
case $BRANCH in

current) # active lts mainline kernel
current) # active lts mainline kernel
KERNEL_MAJOR_MINOR="6.6"
KERNELBRANCH='branch:linux-6.6.y'
KERNELPATCHDIR="archive/imx8m-6.6"
;;

edge|default) # use for tests with recent mainline kernels
edge | default) # use for tests with recent mainline kernels
;;

esac
Expand Down
6 changes: 3 additions & 3 deletions config/sources/families/include/meson_common.inc
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ esac

case $BRANCH in

legacy)
declare -g KERNEL_MAJOR_MINOR="6.1"
;;
legacy)
declare -g KERNEL_MAJOR_MINOR="6.1"
;;

current)
declare -g KERNEL_MAJOR_MINOR="6.6"
Expand Down
8 changes: 2 additions & 6 deletions config/sources/families/jethub.conf
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,10 @@ elif [[ "$BOARD" == "jethubj200" ]]; then
BOOTPATCHDIR="v2024.01"
fi


########
# @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() {
if [[ "$BOARD" == jethubj80 ]] || [[ "$BOARD" == jethubj100 ]]; then
mkdir -p "${destination}"/etc/modprobe.d
Expand All @@ -49,19 +48,16 @@ if [[ "$BOARD" == "jethubj80" ]] || [[ "$BOARD" == "jethubj100" ]] ; then
}
fi


# 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.
# 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.
enable_extension "c-plus-plus-compiler"


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() {
if [[ "$BOARD" == "jethubj80" ]]; then
uboot_gxl_postprocess_ng "$SRC/cache/sources/amlogic-boot-fip/jethub-j80"
Expand Down
12 changes: 6 additions & 6 deletions config/sources/families/meson-s4t7.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ enable_extension "bluetooth-hciattach" # E
case $BRANCH in

legacy)
declare -g KERNEL_MAJOR_MINOR="5.15" # Major and minor versions of this kernel. For mainline caching.
declare -g KERNEL_MAJOR_MINOR="5.15" # Major and minor versions of this kernel. For mainline caching.
declare -g KERNELSOURCE="${GITHUB_SOURCE}/khadas/linux.git" # Khadas kernel
declare -g KERNELBRANCH="branch:khadas-vims-5.15.y" # Branch or tag to build from. It should match MAJOR_MINOR
declare -g KERNELBRANCH="branch:khadas-vims-5.15.y" # Branch or tag to build from. It should match MAJOR_MINOR
declare -g KERNELPATCHDIR="archive/meson-s4t7-5.15"
declare -g COMMON_DRIVERS_SOURCE="${GITHUB_SOURCE}/khadas/common_drivers"
declare -g EXTRAWIFI=no
Expand Down Expand Up @@ -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

# 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.
kernel_config_modifying_hashes+=("CONFIG_DEBUG_KERNEL=y" "CONFIG_EXPERT=y" "CONFIG_EMBEDDED=y")
Expand All @@ -152,7 +152,7 @@ function kernel_copy_extra_sources__khadas_common_drivers() {
rm -rf "${common_drivers_git_bare_tree}"
fi

run_host_command_logged git clone --tags --no-checkout \
run_host_command_logged git clone --tags --no-checkout \
"${COMMON_DRIVERS_SOURCE}" "${common_drivers_git_bare_tree}"

touch "${common_drivers_git_bare_tree_done_marker}"
Expand Down Expand Up @@ -196,8 +196,8 @@ function post_family_tweaks_bsp__disable_uinitrd_generation() {
}

function image_specific_armbian_env_ready__enable_earlycon() {
display_alert "Enabling earlycon"
run_host_command_logged echo "earlycon=on" >>${SDCARD}/boot/armbianEnv.txt
display_alert "Enabling earlycon"
run_host_command_logged echo "earlycon=on" >> ${SDCARD}/boot/armbianEnv.txt
}

function post_family_tweaks_bsp__add_fan_service() {
Expand Down
1 change: 0 additions & 1 deletion config/sources/families/mt7623.conf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ GOVERNOR="ondemand"
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"


mkdir -p "${SDCARD}"/etc/NetworkManager/conf.d/
cat <<- EOF > "${SDCARD}"/etc/NetworkManager/conf.d/99-ignore-interfaces.conf
[keyfile]
Expand Down
1 change: 0 additions & 1 deletion config/sources/families/mvebu64.conf
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ GOVERNOR=ondemand
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"


mkdir -p "${SDCARD}"/etc/NetworkManager/conf.d/
cat <<- EOF > "${SDCARD}"/etc/NetworkManager/conf.d/99-ignore-interfaces.conf
[keyfile]
Expand Down
12 changes: 6 additions & 6 deletions config/sources/families/phytium-embedded.conf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ case "${BRANCH}" in
EXTRAWIFI="no"

;;

current)
KERNELSOURCE='https://github.com/chainsx/phytium-linux-kernel'
KERNELBRANCH="branch:linux-6.6"
Expand All @@ -38,11 +38,11 @@ esac
write_uboot_platform() {
declare ptuboot_cache_dir="${SRC}/cache/phytiumpi-uboot"
mkdir -p "${ptuboot_cache_dir}"
sfdisk --dump "$2" > "${ptuboot_cache_dir}/part.txt" # Backup partition table, command sfdisk is belong to util-linux
dd if="${SRC}/packages/blobs/phytiumpi/fip-all-sd-boot.bin" of="$2" conv=notrunc # Write non-free u-boot file
sfdisk --no-reread "$2" < "${ptuboot_cache_dir}/part.txt" # Recover partition table

sfdisk --dump "$2" > "${ptuboot_cache_dir}/part.txt" # Backup partition table, command sfdisk is belong to util-linux
dd if="${SRC}/packages/blobs/phytiumpi/fip-all-sd-boot.bin" of="$2" conv=notrunc # Write non-free u-boot file
sfdisk --no-reread "$2" < "${ptuboot_cache_dir}/part.txt" # Recover partition table

# Update u-boot env
mkenvimage -s 0x1000 -o "${ptuboot_cache_dir}/env.bin" "${SRC}/packages/blobs/phytiumpi/env.txt"
dd if="${ptuboot_cache_dir}/env.bin" of="$2" bs=1k seek=1472 conv=notrunc
Expand Down
4 changes: 2 additions & 2 deletions config/sources/families/rock-s0.conf
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ IDBLOADER_BLOB=$SRC/packages/blobs/rockchip/rk3308_idbloader_ddr589MHz_uart0_m0_

case $BRANCH in
legacy)
echo "Legacy not supported for rock-s0 board"
exit 99
echo "Legacy not supported for rock-s0 board"
exit 99
;;
esac

Expand Down
10 changes: 5 additions & 5 deletions config/sources/families/rockchip-rk3588.conf
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,24 @@ case $BRANCH in
current)
# Branch based on a stable kernel release (will stay on the next LTS kernel release once released, 6.12? LTS)
LINUXFAMILY=rockchip-rk3588
KERNEL_MAJOR_MINOR="6.8" # Major and minor versions of this kernel.
LINUXCONFIG="linux-rockchip-rk3588-${KERNEL_MAJOR_MINOR}" # Attention: not -${BRANCH} (edge/current/legacy), but -${KERNEL_MAJOR_MINOR} thus 6.6 / 6.12 etc
KERNEL_MAJOR_MINOR="6.8" # Major and minor versions of this kernel.
LINUXCONFIG="linux-rockchip-rk3588-${KERNEL_MAJOR_MINOR}" # Attention: not -${BRANCH} (edge/current/legacy), but -${KERNEL_MAJOR_MINOR} thus 6.6 / 6.12 etc
# No need to set KERNELPATCHDIR, since default is: KERNELPATCHDIR='archive/rockchip-rk3588-${KERNEL_MAJOR_MINOR}'
;;

edge)
# Branch based on the latest kernel release including RC releases, to benefit from the latest RK3588 mainline advancements. Might be unstable!
LINUXFAMILY=rockchip-rk3588
KERNEL_MAJOR_MINOR="6.10" # Major and minor versions of this kernel.
LINUXCONFIG="linux-rockchip-rk3588-${KERNEL_MAJOR_MINOR}" # Attention: not -${BRANCH} (edge/current/legacy), but -${KERNEL_MAJOR_MINOR} thus 6.8 / 6.10 etc
KERNEL_MAJOR_MINOR="6.10" # Major and minor versions of this kernel.
LINUXCONFIG="linux-rockchip-rk3588-${KERNEL_MAJOR_MINOR}" # Attention: not -${BRANCH} (edge/current/legacy), but -${KERNEL_MAJOR_MINOR} thus 6.8 / 6.10 etc
# No need to set KERNELPATCHDIR, since default is: KERNELPATCHDIR='archive/rockchip-rk3588-${KERNEL_MAJOR_MINOR}'
;;

collabora)
# Collabora's rk3588, where the action is these days
LINUXFAMILY=rockchip-rk3588
LINUXCONFIG='linux-rockchip-rk3588-'$BRANCH
KERNEL_MAJOR_MINOR="6.9" # Major and minor versions of this kernel.
KERNEL_MAJOR_MINOR="6.9" # Major and minor versions of this kernel.
KERNELPATCHDIR='rockchip-rk3588-collabora' # Try to keep this as empty as possible. We won't work on top of Collabora's branch, they rebase all the time. New DTs are ok.
KERNELSOURCE='https://gitlab.collabora.com/hardware-enablement/rockchip-3588/linux.git' # Directly from Collabora...
KERNELBRANCH='branch:rk3588-v6.9' # Rolling kernel branch, will be rebased
Expand Down
4 changes: 2 additions & 2 deletions config/sources/families/sm8250.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ enable_extension "image-output-abl"
case $BRANCH in

current)
declare -g KERNEL_MAJOR_MINOR="6.9" # Major and minor versions of this kernel.
declare -g KERNEL_MAJOR_MINOR="6.9" # Major and minor versions of this kernel.
declare -g KERNELBRANCH='branch:linux-6.9.y'
declare -g -i KERNEL_GIT_CACHE_TTL=120 # 2 minutes; this is a high-traffic repo
;;

edge)
declare -g KERNEL_MAJOR_MINOR="6.10" # Major and minor versions of this kernel.
declare -g KERNEL_MAJOR_MINOR="6.10" # Major and minor versions of this kernel.
;;

esac
Expand Down
4 changes: 2 additions & 2 deletions config/sources/families/sun50iw6.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ OVERLAY_PREFIX='sun50i-h6'
GOVERNOR=ondemand
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
add_packages_to_image lightdm-gtk-greeter
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.
# Use gtk greeter instead
if [[ ${BUILD_DESKTOP} == "yes" ]] && [[ ! ${DESKTOP_ENVIRONMENT} =~ ^(kde|gnome)$ ]]; then
Expand Down
1 change: 0 additions & 1 deletion config/sources/families/sun8i.conf
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ fi

[[ -z $CPUMIN ]] && CPUMIN=480000
[[ -z $CPUMAX ]] && CPUMAX=1400000

6 changes: 3 additions & 3 deletions extensions/allwinner-kernel-bump.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function extension_finish_config__prepare_megous_patches() {

if [[ -d ${patch_dir_base} ]]; then
display_alert "allwinner-kernel-bump" "Found existing kernel patch directory" "info"
if [[ "${OVERWRITE_PATCHDIR:-no}" == "yes" ]]; then
if [[ "${OVERWRITE_PATCHDIR:-no}" == "yes" ]]; then
display_alert "allwinner-kernel-bump" "Removing as requested. Any manual changes will get overwritten" "info"
rm -rf ${patch_dir_base}
else
Expand Down Expand Up @@ -69,9 +69,9 @@ function extension_finish_config__prepare_megous_patches() {
run_host_command_logged rm -f ${patch_dir_base}/series.{conf,megous}

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"
"speed" "tbs-a711" "ths" )
"speed" "tbs-a711" "ths")

run_host_command_logged mkdir -p ${patch_dir_megous} ${patch_dir_tmp}

Expand Down
2 changes: 1 addition & 1 deletion extensions/armbian-live-patch.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
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
# Armbian simple patch system service
Expand Down
11 changes: 5 additions & 6 deletions extensions/cloud-init/cloud-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@
# Implementaiton is based on the NoCLoud data source that will use
# the FAT partition with armbi_boot label to source the configuration from

# The Cloud init files in the boot partition are meant to be replaced with user provided ones, they are empty
# The Cloud init files in the boot partition are meant to be replaced with user provided ones, they are empty
# of configurations except for setting hostname and DHCP on ethernet adapters.

# This extension also disables armbian-first-run

# Cloud-Init image marker
function extension_prepare_config__ci_image_suffix() {
# Add to image suffix.
EXTRA_IMAGE_SUFFIXES+=("-ci")
# Add to image suffix.
EXTRA_IMAGE_SUFFIXES+=("-ci")
}

function extension_prepare_config__prepare_ci() {
function extension_prepare_config__prepare_ci() {
# Cloud Init related packages selected from Ubuntu RPI distirbution
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.
if [[ -z "${BOOTFS_TYPE}" ]]; then
declare -g BOOTFS_TYPE="fat"
Expand All @@ -53,7 +53,6 @@ function pre_customize_image__inject_cloud_init_config() {
return 0
}


# @TODO: would be better to have "armbian first run" as an extension that can be disabled
function pre_customize_image__disable_armbian_first_run() {
display_alert "Disabling" "armbian first run" "info"
Expand Down
4 changes: 2 additions & 2 deletions extensions/fs-cryptroot-support.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ function add_host_dependencies__add_cryptroot_tooling() {
fi
}

function extension_prepare_config__prepare_cryptroot() {
function extension_prepare_config__prepare_cryptroot() {
# Config for cryptroot, a boot partition is required.
declare -g BOOTPART_REQUIRED=yes
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
check_loop_device "$rootdevice"
display_alert "Encrypting root partition with LUKS..." "cryptsetup luksFormat $rootdevice" ""
Expand Down
21 changes: 10 additions & 11 deletions extensions/lvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,33 @@
#

# This extension will place the root partition on an LVM volume.
# It is possible to customise the volume group name and the image is extended to allow
# It is possible to customise the volume group name and the image is extended to allow
# for LVM headers

# In case of failed builds check for leaked logical volumes with "dmsetup list" and
# In case of failed builds check for leaked logical volumes with "dmsetup list" and
# remove them with "dmsetup remove"

# 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
function add_host_dependencies__lvm_host_deps() {
declare -g EXTRA_BUILD_DEPS="${EXTRA_BUILD_DEPS} lvm2"
}

function extension_prepare_config__lvm_image_suffix() {
# Add to image suffix.
EXTRA_IMAGE_SUFFIXES+=("-lvm")
# Add to image suffix.
EXTRA_IMAGE_SUFFIXES+=("-lvm")
}

function extension_prepare_config__prepare_lvm() {
function extension_prepare_config__prepare_lvm() {
# Config for lvm, boot partition is required, many bootloaders do not support LVM.
declare -g BOOTPART_REQUIRED=yes
declare -g LVM_VG_NAME="${LVM_VG_NAME:-armbivg}"
declare -g EXTRA_ROOTFS_MIB_SIZE=256
add_packages_to_image lvm2
}

function post_create_partitions__setup_lvm(){
function post_create_partitions__setup_lvm() {

LOOP=$(losetup -f)
[[ -z $LOOP ]] && exit_with_error "Unable to find free loop device"
Expand Down Expand Up @@ -71,7 +70,7 @@ function post_create_partitions__setup_lvm(){
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"
vgscan
vgchange -a y ${LVM_VG_NAME}
Expand All @@ -80,15 +79,15 @@ function prepare_root_device__create_volume_group(){
display_alert "Root device is ${rootdevice}" "${EXTENSION}" "info"
}

function format_partitions__format_lvm(){
function format_partitions__format_lvm() {
# Label the root volume
e2label /dev/mapper/${LVM_VG_NAME}-root armbi_root
blkid | grep ${LVM_VG_NAME} >> "${DEST}"/${LOG_SUBPATH}/lvm.log 2>&1
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
vgchange -a n ${LVM_VG_NAME}
display_alert "LVM deactivated volume group" "${EXTENSION}" "info"
}
}
Loading

0 comments on commit 75ce67f

Please sign in to comment.