#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
+. /lib/functions/system.sh
. /lib/functions/uci-defaults.sh
-KERNEL_MAJOR=$(uname -r | awk -F '.' '{print $1}')
-KERNEL_MINOR=$(uname -r | awk -F '.' '{print $2}')
-
board_config_update
board=$(board_name)
case "$board" in
traverse,ten64)
- if [ "${KERNEL_MAJOR}" -ge "6" ] && [ "${KERNEL_MINOR}" -ge "6" ]; then
+ if [ "$(get_linux_version)" -ge "606000" ]; then
I2C_GPIO_BASE=640
else
I2C_GPIO_BASE=368
# See https://lists.openwrt.org/pipermail/openwrt-devel/2024-March/042448.html
. /lib/functions.sh
+. /lib/functions/system.sh
ten64_update_gpioswitch_num() {
local section="$1"
exit 0
fi
-KERNEL_MINOR=$(uname -r | awk -F '.' '{print $2}')
-if [ "${KERNEL_MINOR}" -lt "6" ]; then
+if [ "$(get_linux_version)" -lt "60600" ]; then
exit 0
fi
# SPDX-License-Identifier: GPL-2.0-or-later
+. /lib/functions/system.sh
. /lib/functions/uci-defaults.sh
-KERNEL_MAJOR=$(uname -r | awk -F '.' '{print $1}')
-KERNEL_MINOR=$(uname -r | awk -F '.' '{print $2}')
-
board_config_update
-if [ "${KERNEL_MAJOR}" -ge "6" ] && [ "${KERNEL_MINOR}" -ge "12" ]; then
+if [ "$(get_linux_version)" -ge "612000" ]; then
GPIO_BASE=512
else
GPIO_BASE=460
[ "${ACTION}" = "add" ] || return
. /lib/functions.sh
-
-check_kernel()
-{
- local kernel_current=$(uname -r)
- if [ ${kernel_current//./} -lt "6600" ]; then
- return 1
- fi
-}
+. /lib/functions/system.sh
do_migrate_radio()
{
# Checks if kernel version is less than 6.6.0, if it is and the path is using the new format,
# then path should be migrated to the old format. This would allow users on platforms with two partitions,
# to test 6.1 and 6.6.
- check_kernel || to=${path/soc@0\//soc\/}
+ [ "$(get_linux_version)" -lt "606000" ] && to=${path/soc@0\//soc\/}
[ "$path" = "$to" ] || do_migrate_radio "$config" "$path" "$to"
}