Package: u-boot Version: 2020.10+dfsg-1 Severity: minor Tags: patch Hello.
When unexpected contents are found in /sys/firmware/devicetree/base/model, * debian/bin/u-boot-install-rockchip reports 'ERROR: Unknown system: /sys/firmware/devicetree/base/model'. This is probably not the intention of the script author. * debian/bin/u-boot-install-sunxi64 selects pine64_plus. An error would be safer than a risk of later boot failure. A patch is attached.
>From 2ee04a2eae64db925a62543d19ddd038bb0b594d Mon Sep 17 00:00:00 2001 From: Nicolas Boulenguez <nico...@debian.org> Date: Tue, 1 Dec 2020 19:12:25 +0100 Subject: Change behaviour of debian/bin/u-boot-install-* for an unknown device tree When unexpected contents are found in /sys/firmware/devicetree/base/model, * debian/bin/u-boot-install-rockchip reports 'ERROR: Unknown system: /sys/firmware/devicetree/base/model'. This is probably not the intention of the script author. * debian/bin/u-boot-install-sunxi64 selects pine64_plus. An error would be safer than a risk of later boot failure. Let both scripts report an error message including the unknown system description instead. Describe the TARGET environment variable in the manual page. diff --git a/debian/bin/u-boot-install-rockchip b/debian/bin/u-boot-install-rockchip index 60c7b56dd6..22973d231b 100755 --- a/debian/bin/u-boot-install-rockchip +++ b/debian/bin/u-boot-install-rockchip @@ -3,7 +3,8 @@ set -e dtmodel="/sys/firmware/devicetree/base/model" if [ -z "$TARGET" ] && [ -f "${dtmodel}" ]; then - case $(cat "${dtmodel}") in + dtmodel=$(cat $dtmodel) + case "$dtmodel" in Firefly-RK3288) TARGET="/usr/lib/u-boot/firefly-rk3288" UBOOT_IMAGE="u-boot.img" diff --git a/debian/bin/u-boot-install-sunxi64 b/debian/bin/u-boot-install-sunxi64 index 32bf8f6360..2d7c41f1a9 100755 --- a/debian/bin/u-boot-install-sunxi64 +++ b/debian/bin/u-boot-install-sunxi64 @@ -3,7 +3,8 @@ set -e dtmodel="/sys/firmware/devicetree/base/model" if [ -z "$TARGET" ] && [ -f "${dtmodel}" ]; then - case $(cat "${dtmodel}") in + dtmodel=$(cat $dtmodel) + case "$dtmodel" in Pinebook) TARGET="/usr/lib/u-boot/pinebook" ;; Pine64+) TARGET="/usr/lib/u-boot/pine64_plus" ;; "Pine64 LTS") TARGET="/usr/lib/u-boot/pine64-lts" ;; @@ -13,6 +14,11 @@ if [ -z "$TARGET" ] && [ -f "${dtmodel}" ]; then "OrangePi Zero Plus2") TARGET="/usr/lib/u-boot/orangepi_zero_plus2/" ;; "FriendlyARM NanoPi NEO 2") TARGET="/usr/lib/u-boot/nanopi_neo2/" ;; "FriendlyARM NanoPi NEO Plus2") TARGET="/usr/lib/u-boot/nanopi_neo_plus2/" ;; + *) + echo >&2 "ERROR: Unknown system: ${dtmodel}" + echo >&2 "Specify target: TARGET=/usr/lib/u-boot/UBOOT" + exit 1 + ;; esac fi @@ -21,7 +27,6 @@ if [ -z "$BL31" ] && [ -f "${atf}" ]; then BL31="${atf}" fi -TARGET=${TARGET:-"/usr/lib/u-boot/pine64_plus"} BL31=${BL31:-"/usr/lib/atf/sun50iw1p1/bl31.bin"} FIT_GENERATOR=${FIT_GENERATOR:-"mksunxi_fit_atf"} diff --git a/debian/manpages/u-boot-install-sunxi64.8 b/debian/manpages/u-boot-install-sunxi64.8 index 49464a5a7b..e06596a00a 100644 --- a/debian/manpages/u-boot-install-sunxi64.8 +++ b/debian/manpages/u-boot-install-sunxi64.8 @@ -19,6 +19,16 @@ for SD card, for eMMC, .I /dev/sdX for USB SD card readers (be careful wrt your other disks!). +.PP +By default, the path where +.I .dtb +and +.I .bin +files are copied from is a subdirectory of +.I /usr/lib/u-boot +deduced from the current running system, but if the +.RB $ TARGET +environment variable is set, its contents are used instead. .SH OPTIONS .TP -f | --force