From b2c8b4cffecc3ed20553204e6371fad9b264c92c Mon Sep 17 00:00:00 2001 From: Igor Pecovnik Date: Tue, 1 Sep 2026 09:07:44 +0200 Subject: [PATCH] Support Ubuntu 26.04 and every interim release Replace the hardcoded release substring lists with a numeric version comparison, so future Ubuntu releases work without another patch. rk-flash-tool/INSTALL and tone-dfu-tool/INSTALL stopped at 24 and hit "Ubuntu XX haven't been verified!" + exit 1 on anything newer. Since the top-level INSTALL runs the tools in sequence, that aborted the install after the Amlogic tool had already been set up. Behaviour on 12.04, 14.04, 16.04, 18.04, 18.10, 20.04, 22.04 and 24.04 is unchanged. Interim releases (15.10, 17.10, 19.04, 19.10, 21.04, 21.10, 23.04, 23.10, 25.04, 25.10) previously failed the check and now work too. Also pair libncurses5/6 with lib32ncurses5/6 in the same branch instead of hardcoding libncurses5 for every release. Signed-off-by: Igor Pecovnik --- INSTALL | 11 +++++++---- aml-flash-tool/INSTALL | 4 +++- aml-flash-tool/UNINSTALL | 4 +++- rk-flash-tool/INSTALL | 4 +++- tone-dfu-tool/INSTALL | 4 +++- 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/INSTALL b/INSTALL index e1e63ae..9641b69 100755 --- a/INSTALL +++ b/INSTALL @@ -9,6 +9,8 @@ if [ "$(uname -s)" = "Darwin" ]; then else DISTRIB=$(cat /etc/lsb-release | grep "DISTRIB_ID" | awk -F "=" '{print $2}') DISTRIB_RELEASE=$(cat /etc/lsb-release | grep "DISTRIB_RELEASE" | awk -F "=" '{print $2}') + # Numeric form of the release for comparisons: 26.04 -> 2604, 18.10 -> 1810 + DISTRIB_VER=$(awk -F. '{ printf "%d%02d", $1, $2 }' <<< "$DISTRIB_RELEASE") fi AML_FLASH_TOOL_DIR="$BASE/aml-flash-tool" @@ -28,14 +30,15 @@ error_msg() { } setup_ubuntu_host() { - local hostdeps="libusb-dev git parted lib32z1 lib32stdc++6 libusb-0.1-4 libusb-1.0-0-dev libusb-1.0-0 ccache libncurses5 pv base-files linux-base xz-utils" + local hostdeps="libusb-dev git parted lib32z1 lib32stdc++6 libusb-0.1-4 libusb-1.0-0-dev libusb-1.0-0 ccache pv base-files linux-base xz-utils" local deps=() local installed=$(dpkg-query -W -f '${db:Status-Abbrev}|${binary:Package}\n' '*' 2>/dev/null | grep '^ii' | awk -F '|' '{print $2}' | cut -d ':' -f 1) - if [[ "$DISTRIB" == "Ubuntu" ]] && [[ "$DISTRIB_RELEASE" == "18.10" || "$DISTRIB_RELEASE" =~ "20" || "$DISTRIB_RELEASE" =~ "22" || "$DISTRIB_RELEASE" =~ "24" ]]; then - hostdeps="$hostdeps lib32ncurses6" + # ncurses5 was dropped after 18.04; 18.10 and newer carry the ncurses6 packages + if (( DISTRIB_VER >= 1810 )); then + hostdeps="$hostdeps libncurses6 lib32ncurses6" else - hostdeps="$hostdeps lib32ncurses5" + hostdeps="$hostdeps libncurses5 lib32ncurses5" fi for packet in $hostdeps; do diff --git a/aml-flash-tool/INSTALL b/aml-flash-tool/INSTALL index 666db62..89884b9 100755 --- a/aml-flash-tool/INSTALL +++ b/aml-flash-tool/INSTALL @@ -9,6 +9,8 @@ if [ "$(uname -s)" = "Darwin" ]; then else DISTRIB=$(cat /etc/lsb-release | grep "DISTRIB_ID" | awk -F "=" '{print $2}') DISTRIB_RELEASE=$(cat /etc/lsb-release | grep "DISTRIB_RELEASE" | awk -F "=" '{print $2}') + # Numeric form of the release for comparisons: 26.04 -> 2604, 18.10 -> 1810 + DISTRIB_VER=$(awk -F. '{ printf "%d%02d", $1, $2 }' <<< "$DISTRIB_RELEASE") fi FLASH_TOOL="$BASE/flash-tool" @@ -56,7 +58,7 @@ if [ "$DISTRIB" != "macOS" ]; then RULE="$RULES_DIR/70-persistent-usb-ubuntu12.rules" sudo cp $RULE /etc/udev/rules.d sudo sed -i s/OWNER=\"amlogic\"/OWNER=\"`whoami`\"/g /etc/udev/rules.d/$(basename $RULE) - elif [[ "$IGNORE_CHECK" == "yes" || "$DISTRIB_RELEASE" =~ "14" || "$DISTRIB_RELEASE" =~ "16" || "$DISTRIB_RELEASE" =~ "18" || "$DISTRIB_RELEASE" =~ "19" || "$DISTRIB_RELEASE" =~ "20" || "$DISTRIB_RELEASE" =~ "22" || "$DISTRIB_RELEASE" =~ "24" ]]; then + elif [[ "$IGNORE_CHECK" == "yes" ]] || (( DISTRIB_VER >= 1400 )); then RULE="$RULES_DIR/70-persistent-usb-ubuntu14.rules" sudo cp $RULE /etc/udev/rules.d else diff --git a/aml-flash-tool/UNINSTALL b/aml-flash-tool/UNINSTALL index 9591357..a563b24 100755 --- a/aml-flash-tool/UNINSTALL +++ b/aml-flash-tool/UNINSTALL @@ -9,6 +9,8 @@ if [ "$(uname -s)" = "Darwin" ]; then else DISTRIB=$(cat /etc/lsb-release | grep "DISTRIB_ID" | awk -F "=" '{print $2}') DISTRIB_RELEASE=$(cat /etc/lsb-release | grep "DISTRIB_RELEASE" | awk -F "=" '{print $2}') + # Numeric form of the release for comparisons: 26.04 -> 2604, 18.10 -> 1810 + DISTRIB_VER=$(awk -F. '{ printf "%d%02d", $1, $2 }' <<< "$DISTRIB_RELEASE") fi KHADAS_TOOL_NAME="aml-burn-tool" @@ -37,7 +39,7 @@ if [[ "$DISTRIB" != "macOS" ]]; then if [[ "$DISTRIB_RELEASE" =~ "12" ]]; then RULE="/etc/udev/rules.d/70-persistent-usb-ubuntu12.rules" - elif [[ "$DISTRIB_RELEASE" =~ "14" || "$DISTRIB_RELEASE" =~ "16" || "$DISTRIB_RELEASE" =~ "18" || "$DISTRIB_RELEASE" =~ "20" ]]; then + elif (( DISTRIB_VER >= 1400 )); then RULE="/etc/udev/rules.d/70-persistent-usb-ubuntu14.rules" else # error_msg "Ubuntu $DISTRIB_RELEASE haven't been verified!" diff --git a/rk-flash-tool/INSTALL b/rk-flash-tool/INSTALL index 48dc905..64a09b5 100755 --- a/rk-flash-tool/INSTALL +++ b/rk-flash-tool/INSTALL @@ -11,6 +11,8 @@ else ANDROID_TOOL_CONFIG="$BASE/tools/Linux_Upgrade_Tool/config.ini" DISTRIB=$(cat /etc/lsb-release | grep "DISTRIB_ID" | awk -F "=" '{print $2}') DISTRIB_RELEASE=$(cat /etc/lsb-release | grep "DISTRIB_RELEASE" | awk -F "=" '{print $2}') + # Numeric form of the release for comparisons: 26.04 -> 2604, 18.10 -> 1810 + DISTRIB_VER=$(awk -F. '{ printf "%d%02d", $1, $2 }' <<< "$DISTRIB_RELEASE") fi FLASH_TOOL="$BASE/flash-tool" @@ -54,7 +56,7 @@ fi if [ "$DISTRIB" != "macOS" ]; then echo "Installing USB rules..." - if [[ "$IGNORE_CHECK" == "yes" || "$DISTRIB_RELEASE" =~ "16" || "$DISTRIB_RELEASE" =~ "18" || "$DISTRIB_RELEASE" =~ "20" || "$DISTRIB_RELEASE" =~ "22" || "$DISTRIB_RELEASE" =~ "24" ]]; then + if [[ "$IGNORE_CHECK" == "yes" ]] || (( DISTRIB_VER >= 1600 )); then RULE="$RULES_DIR/80-rockchip-usb.rules" sudo cp $RULE /etc/udev/rules.d else diff --git a/tone-dfu-tool/INSTALL b/tone-dfu-tool/INSTALL index 8d52fba..5bad86a 100755 --- a/tone-dfu-tool/INSTALL +++ b/tone-dfu-tool/INSTALL @@ -9,6 +9,8 @@ if [ "$(uname -s)" = "Darwin" ] ; then else DISTRIB=$(cat /etc/lsb-release | grep "DISTRIB_ID" | awk -F "=" '{print $2}') DISTRIB_RELEASE=$(cat /etc/lsb-release | grep "DISTRIB_RELEASE" | awk -F "=" '{print $2}') + # Numeric form of the release for comparisons: 26.04 -> 2604, 18.10 -> 1810 + DISTRIB_VER=$(awk -F. '{ printf "%d%02d", $1, $2 }' <<< "$DISTRIB_RELEASE") fi KHADAS_TOOL="$BASE/tone-burn-tool" @@ -51,7 +53,7 @@ fi if [ "$DISTRIB" != "macOS" ]; then echo "Installing USB rules..." - if [[ "$IGNORE_CHECK" == "yes" || "$DISTRIB_RELEASE" =~ "16" || "$DISTRIB_RELEASE" =~ "18" || "$DISTRIB_RELEASE" =~ "20" || "$DISTRIB_RELEASE" =~ "22" || "$DISTRIB_RELEASE" =~ "24" ]]; then + if [[ "$IGNORE_CHECK" == "yes" ]] || (( DISTRIB_VER >= 1600 )); then RULE="$RULES_DIR/80-tone-usb.rules" sudo cp $RULE /etc/udev/rules.d else