Hi Vagrant, I noticed that with commit 92f637eda9 we're starting to use the u-boot-install-sunxi script for armhf boards as well as arm64, so I've refreshed my patch to it, below.
I thought I might as well add the remaining 24 armhf boards to it while I was at it, so it now has 26 armhf and 11 arm64 boards, matching what's in debian/targets, sorted by U-Boot board name. I think it would be nice if this simplification could be included in bullseye. What do you think? Best wishes, Harold. diff --git a/debian/bin/u-boot-install-sunxi b/debian/bin/u-boot-install-sunxi index 4f80e01099..4b862fd3ff 100755 --- a/debian/bin/u-boot-install-sunxi +++ b/debian/bin/u-boot-install-sunxi @@ -1,29 +1,50 @@ #!/bin/sh set -e -splfiles="sunxi-spl.bin u-boot-sunxi-with-spl.bin" -itbfiles="u-boot.itb u-boot-sunxi-with-spl.fit.itb" - dtmodel="/sys/firmware/devicetree/base/model" if [ -z "$TARGET" ] && [ -f "${dtmodel}" ]; then dtmodelname=$(cat $dtmodel) case "$dtmodelname" in - Pinebook) TARGET="/usr/lib/u-boot/pinebook" ;; - "Pine64 PinePhone (1.2)") TARGET='/usr/lib/u-boot/pinephone' ;; - Pine64+) TARGET="/usr/lib/u-boot/pine64_plus" ;; - "Pine64 LTS") TARGET="/usr/lib/u-boot/pine64-lts" ;; - "Olimex A20-OLinuXino-LIME2") TARGET="/usr/lib/u-boot/A20-OLinuXino-Lime2"; itbfiles= ;; - "Olimex A64-Olinuxino") TARGET="/usr/lib/u-boot/a64-olinuxino/" ;; + "Olimex A10-OLinuXino-LIME") TARGET="/usr/lib/u-boot/A10-OLinuXino-Lime" ;; + "Olimex A10s-Olinuxino Micro") TARGET="/usr/lib/u-boot/A10s-OLinuXino-M" ;; + "Olimex A20-OLinuXino-LIME") TARGET="/usr/lib/u-boot/A20-OLinuXino-Lime" ;; + "Olimex A20-OLinuXino-LIME2") TARGET="/usr/lib/u-boot/A20-OLinuXino-Lime2" ;; + "Olimex A20-OLinuXino-LIME2-eMMC") TARGET="/usr/lib/u-boot/A20-OLinuXino-Lime2-eMMC" ;; + "Olimex A20-Olinuxino Micro") TARGET="/usr/lib/u-boot/A20-OLinuXino_MICRO" ;; + "Olimex A20-Olimex-SOM-EVB") TARGET="/usr/lib/u-boot/A20-Olimex-SOM-EVB" ;; + "LeMaker Banana Pi") TARGET="/usr/lib/u-boot/Bananapi" ;; + "Banana Pi BPI-M2-Ultra") TARGET="/usr/lib/u-boot/Bananapi_M2_Ultra" ;; + "LeMaker Banana Pro") TARGET="/usr/lib/u-boot/Bananapro" ;; + "NextThing C.H.I.P.") TARGET="/usr/lib/u-boot/CHIP" ;; + "Cubietech Cubieboard") TARGET="/usr/lib/u-boot/Cubieboard" ;; + "Cubietech Cubieboard2") TARGET="/usr/lib/u-boot/Cubieboard2" ;; + "Cubietech Cubieboard4") TARGET="/usr/lib/u-boot/Cubieboard4" ;; + "Cubietech Cubietruck") TARGET="/usr/lib/u-boot/Cubietruck" ;; + "Cubietech Cubietruck Plus") TARGET="/usr/lib/u-boot/Cubietruck_plus" ;; + "Lamobo R1") TARGET="/usr/lib/u-boot/Lamobo_R1" ;; + "LinkSprite pcDuino") TARGET="/usr/lib/u-boot/Linksprite_pcDuino" ;; + "LinkSprite pcDuino3") TARGET="/usr/lib/u-boot/Linksprite_pcDuino3" ;; + "PineRiver Mini X-Plus") TARGET="/usr/lib/u-boot/Mini-X" ;; + "Banana Pi BPI-M3") TARGET="/usr/lib/u-boot/Sinovoip_BPI_M3" ;; "Olimex A64-Olinuxino-eMMC") TARGET="/usr/lib/u-boot/a64-olinuxino-emmc" ;; - "Olimex A64 Teres-I") TARGET="/usr/lib/u-boot/teres_i/" ;; - "OrangePi Zero Plus2") TARGET="/usr/lib/u-boot/orangepi_zero_plus2/" ;; - "OrangePi One Plus") TARGET="/usr/lib/u-boot/orangepi_one_plus/" ;; - "FriendlyARM NanoPi NEO") TARGET="/usr/lib/u-boot/nanopi_neo" ; itbfiles= ;; - "FriendlyARM NanoPi NEO 2") TARGET="/usr/lib/u-boot/nanopi_neo2/" ;; - "FriendlyARM NanoPi NEO Plus2") TARGET="/usr/lib/u-boot/nanopi_neo_plus2/" ;; + "Olimex A64-Olinuxino") TARGET="/usr/lib/u-boot/a64-olinuxino" ;; + "Banana Pi M2 Berry") TARGET="/usr/lib/u-boot/bananapi_m2_berry" ;; + "FriendlyARM NanoPi NEO") TARGET="/usr/lib/u-boot/nanopi_neo" ;; + "FriendlyARM NanoPi NEO 2") TARGET="/usr/lib/u-boot/nanopi_neo2" ;; + "FriendlyARM NanoPi NEO Air") TARGET="/usr/lib/u-boot/nanopi_neo_air" ;; + "FriendlyARM NanoPi NEO Plus2") TARGET="/usr/lib/u-boot/nanopi_neo_plus2" ;; + "OrangePi One Plus") TARGET="/usr/lib/u-boot/orangepi_one_plus" ;; + "Xunlong Orange Pi Plus / Plus 2") TARGET="/usr/lib/u-boot/orangepi_plus" ;; + "Xunlong Orange Pi Zero") TARGET="/usr/lib/u-boot/orangepi_zero" ;; + "OrangePi Zero Plus2") TARGET="/usr/lib/u-boot/orangepi_zero_plus2" ;; + "Pine64 LTS") TARGET="/usr/lib/u-boot/pine64-lts" ;; + "Pine64+") TARGET="/usr/lib/u-boot/pine64_plus" ;; + "Pinebook") TARGET="/usr/lib/u-boot/pinebook" ;; + "Pine64 PinePhone (1.2)") TARGET="/usr/lib/u-boot/pinephone" ;; + "Olimex A64 Teres-I") TARGET="/usr/lib/u-boot/teres_i" ;; *) echo >&2 "ERROR: Unknown system: ${dtmodelname}" - echo >&2 "Specify target: TARGET=/usr/lib/u-boot/UBOOT" + echo >&2 "Specify target: TARGET=/usr/lib/u-boot/<board_name>" exit 1 ;; esac @@ -38,11 +59,6 @@ case "$1" in exit 1;; esac -if [ -z "$(which mkimage)" ]; then - echo >&2 "$0: mkimage: command not found. Please install u-boot-tools." - exit 1 -fi - DEV="$1" if [ -z "$DEV" ] || ! shift || [ -n "$*" ]; then echo >&2 "Usage: $0 /dev/your-sd-or-mmc-or-image" @@ -63,54 +79,24 @@ fi if [ -z "$FORCE" ]; then # A very simple sanity check. GPT mandates a "protective MBR" so this works # even with GPT partitioning. - printf '%b' '\0125\0252' >mbr-sign - if ! cmp -s -i 0:510 -n 2 mbr-sign "$DEV"; then + if ! printf '\125\252' | cmp -s -i 0:510 -n 2 - "$DEV"; then echo >&2 "$0: device/image ($DEV) has no MBR partition table" exit 1 fi # But, on sunxi64, spl will trample upon GPT. - printf "EFI PART" >gpt-sign - if cmp -s -i 0:512 -n 8 gpt-sign "$DEV"; then + if printf 'EFI PART' | cmp -s -i 0:512 -n 8 - "$DEV"; then echo >&2 "$0: device/image ($DEV) uses GPT partition table, unusable on sunxi64" exit 1 fi fi -spl= -for i in $splfiles ; do - i=${TARGET}/$i - if [ -f "$i" ]; then - spl=$i - fi -done - -if [ -z "$spl" ]; then - echo >&2 "$0: no known .spl file in ${TARGET}" - exit 1 -fi - -if [ -n "$itbfiles" ]; then - itb= - for i in $itbfiles ; do - i=${TARGET}/$i - if [ -f "$i" ]; then - itb=$i - fi - done - - if [ -z "$itb" ]; then - echo >&2 "$0: no known .itb file in ${TARGET}" - exit 1 - fi -fi - -echo "Writing u-boot SPL image" -dd conv=notrunc if=${spl} of="$DEV" bs=8k seek=1 +imfile="u-boot-sunxi-with-spl.bin" -if [ -n "$itb" ]; then - echo "Writing u-boot FIT image" - dd conv=notrunc if=${itb} of="$DEV" bs=8k seek=5 +if [ ! -f "${TARGET}/${imfile}" ]; then + echo >&2 "$0: no ${imfile} image file in ${TARGET}" + exit 1 fi -sync "$DEV" +echo "Writing U-Boot image to ${DEV}" +dd conv=fsync,notrunc if="${TARGET}/${imfile}" of="$DEV" bs=8k seek=1