On 25/07/2023 17:39, Vagrant Cascadian wrote:
> On 2023-07-25, Dave Jones wrote:
>> Heinrich Schuchardt and I were just having a look at this area for the
>> ubuntu packaging, specifically whether to include
>> u-boot-sunxi-with-spl.bin in the u-boot-sunxi build [...]
>>
> [...]
> I am also a bit inclined to adding u-boot-sunxi-with-spl.bin [...]


Hi Dave and Vagrant,

Thanks for taking an interest in this. I would like to see
u-boot-sunxi-with-spl.bin included for all boards in the u-boot-sunxi
binary package, for several reasons:

- it's the documented way to install U-Boot on all sunxi platforms (in
upstream's doc/board/allwinner/sunxi.rst and Debian's
debian/u-boot-sunxi.README.Debian)

- working with that single file is simpler than working with two files

- it works whatever the size of the SPL, whereas the current approach
assumes the SPL fits in 32K, which has not been guaranteed since commit
c0b417b2 (the SPL for H616 platforms needs about 36K)

- it's already there for all the 32-bit sunxi boards, so including it
for 64-bit boards too would be more consistent

- the currently used u-boot-sunxi-with-spl.fit.itb seems not to be a
documented file, but rather just an intermediate file produced when
binman is run (and for what it's worth, it doesn't conform to the FIT
specification in doc/usage/fit/source_file_format.rst because it lacks a
timestamp)

If u-boot-sunxi-with-spl.bin did end up being included for all boards,
then the u-boot-install-sunxi script could simply write that one file,
so its "splfiles" and "itbfiles" lists would no longer be needed. I've
suggested a patch below.

Best wishes,
Harold.


diff --git a/debian/bin/u-boot-install-sunxi b/debian/bin/u-boot-install-sunxi
index b3af2c0b80..4a041652e9 100755
--- a/debian/bin/u-boot-install-sunxi
+++ b/debian/bin/u-boot-install-sunxi
@@ -1,9 +1,6 @@
 #!/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)
@@ -97,35 +94,11 @@ if [ -z "$FORCE" ]; then
     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}"
+imfile="${TARGET}/u-boot-sunxi-with-spl.bin"
+if [ ! -f "$imfile" ]; then
+    echo >&2 "$0: no image file at ${imfile}"
     exit 1
 fi

-if [ -n "$itbfiles" ]; then
-    itb=
-    for i in $itbfiles ; do
-        i=${TARGET}/$i
-        if [ -f "$i" ]; then
-            itb=$i
-        fi
-    done
-fi
-
-echo "Writing u-boot SPL image"
-dd conv=notrunc if=${spl} of="$DEV" bs=8k seek=1
-
-if [ -n "$itb" ]; then
-    echo "Writing u-boot FIT image"
-    dd conv=notrunc if=${itb} of="$DEV" bs=8k seek=5
-fi
-
-sync "$DEV"
+echo "Writing U-Boot image ${imfile} to ${DEV}"
+dd conv=fsync,notrunc if="$imfile" of="$DEV" bs=8K seek=1
diff --git a/debian/targets.mk b/debian/targets.mk
index 8ef27133d7..ffc5da62bb 100644
--- a/debian/targets.mk
+++ b/debian/targets.mk
@@ -146,40 +146,40 @@ ifeq (${DEB_HOST_ARCH},arm64)
   a64-olinuxino_assigns := 
BL31=/usr/lib/arm-trusted-firmware/sun50i_a64/bl31.bin
   a64-olinuxino_targets := arch/arm/dts/sun50i-a64-olinuxino.dtb \
     spl/sunxi-spl.bin u-boot-nodtb.bin u-boot-sunxi-with-spl.fit.itb \
-    u-boot.bin uboot.elf
+    u-boot.bin uboot.elf u-boot-sunxi-with-spl.bin

   # Philip Rinn <ri...@inventati.org>
   u-boot-sunxi_platforms += a64-olinuxino-emmc
   a64-olinuxino-emmc_assigns := 
BL31=/usr/lib/arm-trusted-firmware/sun50i_a64/bl31.bin
   a64-olinuxino-emmc_targets := arch/arm/dts/sun50i-a64-olinuxino-emmc.dtb \
     spl/sunxi-spl.bin u-boot-nodtb.bin u-boot-sunxi-with-spl.fit.itb \
-    u-boot.bin uboot.elf
+    u-boot.bin uboot.elf u-boot-sunxi-with-spl.bin

   # Domenico Andreoli <ca...@debian.org>
   u-boot-sunxi_platforms += nanopi_neo2
   nanopi_neo2_assigns := BL31=/usr/lib/arm-trusted-firmware/sun50i_a64/bl31.bin
   nanopi_neo2_targets := arch/arm/dts/sun50i-h5-nanopi-neo2.dtb \
     spl/sunxi-spl.bin u-boot-nodtb.bin u-boot-sunxi-with-spl.fit.itb \
-    u-boot.bin uboot.elf
+    u-boot.bin uboot.elf u-boot-sunxi-with-spl.bin

   # Steev Klimaszewski <st...@kali.org>
   u-boot-sunxi_platforms += nanopi_neo_plus2
   nanopi_neo_plus2_assigns := 
BL31=/usr/lib/arm-trusted-firmware/sun50i_a64/bl31.bin
   nanopi_neo_plus2_targets := arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dtb \
     spl/sunxi-spl.bin u-boot-nodtb.bin u-boot-sunxi-with-spl.fit.itb \
-    u-boot.bin uboot.elf
+    u-boot.bin uboot.elf u-boot-sunxi-with-spl.bin

   # harr...@gmx.ph
   u-boot-sunxi_platforms += orangepi_one_plus
   orangepi_one_plus_assigns := 
BL31=/usr/lib/arm-trusted-firmware/sun50i_h6_no_pmic/bl31.bin
   orangepi_one_plus_targets := arch/arm/dts/sun50i-h6-orangepi-one-plus.dtb \
     spl/sunxi-spl.bin u-boot-nodtb.bin u-boot-sunxi-with-spl.fit.itb \
-    u-boot.bin uboot.elf
+    u-boot.bin uboot.elf u-boot-sunxi-with-spl.bin

   # Frederic Danis <frederic.da...@collabora.com>
   u-boot-sunxi_platforms += orangepi_zero_plus2
   orangepi_zero_plus2_assigns := 
BL31=/usr/lib/arm-trusted-firmware/sun50i_a64/bl31.bin
-  orangepi_zero_plus2_targets := \
+  orangepi_zero_plus2_targets := u-boot-sunxi-with-spl.bin \
     arch/arm/dts/sun50i-h5-orangepi-zero-plus2.dtb spl/sunxi-spl.bin \
     u-boot-nodtb.bin u-boot-sunxi-with-spl.fit.itb u-boot.bin uboot.elf

@@ -188,20 +188,23 @@ ifeq (${DEB_HOST_ARCH},arm64)
   pine64-lts_assigns := BL31=/usr/lib/arm-trusted-firmware/sun50i_a64/bl31.bin
   pine64-lts_targets := arch/arm/dts/sun50i-a64-pine64-lts.dtb \
     arch/arm/dts/sun50i-a64-pine64.dtb spl/sunxi-spl.bin u-boot-nodtb.bin \
-    u-boot-sunxi-with-spl.fit.itb u-boot.bin uboot.elf
+    u-boot-sunxi-with-spl.fit.itb u-boot.bin uboot.elf \
+    u-boot-sunxi-with-spl.bin

   # Vagrant Cascadian <vagr...@debian.org>
   u-boot-sunxi_platforms += pine64_plus
   pine64_plus_assigns := BL31=/usr/lib/arm-trusted-firmware/sun50i_a64/bl31.bin
   pine64_plus_targets := arch/arm/dts/sun50i-a64-pine64-plus.dtb \
     arch/arm/dts/sun50i-a64-pine64.dtb spl/sunxi-spl.bin u-boot-nodtb.bin \
-    u-boot-sunxi-with-spl.fit.itb u-boot.bin uboot.elf
+    u-boot-sunxi-with-spl.fit.itb u-boot.bin uboot.elf \
+    u-boot-sunxi-with-spl.bin

   # Vagrant Cascadian <vagr...@debian.org>
   u-boot-sunxi_platforms += pinebook
   pinebook_assigns := BL31=/usr/lib/arm-trusted-firmware/sun50i_a64/bl31.bin
   pinebook_targets := arch/arm/dts/sun50i-a64-pinebook.dtb spl/sunxi-spl.bin \
-    u-boot-nodtb.bin u-boot-sunxi-with-spl.fit.itb u-boot.bin uboot.elf
+    u-boot-nodtb.bin u-boot-sunxi-with-spl.fit.itb u-boot.bin uboot.elf \
+    u-boot-sunxi-with-spl.bin

   # Benoit Delcour <benoit.delc...@gmail.com> (1.2)
   # Arnaud Ferraris <arnaud.ferra...@collabora.com> (1.1, 1.2)
@@ -209,24 +212,28 @@ ifeq (${DEB_HOST_ARCH},arm64)
   pinephone_assigns := BL31=/usr/lib/arm-trusted-firmware/sun50i_a64/bl31.bin
   pinephone_targets := arch/arm/dts/sun50i-a64-pinephone-1.1.dtb \
     arch/arm/dts/sun50i-a64-pinephone-1.2.dtb spl/sunxi-spl.bin \
-    u-boot-nodtb.bin u-boot-sunxi-with-spl.fit.itb u-boot.bin uboot.elf
+    u-boot-nodtb.bin u-boot-sunxi-with-spl.fit.itb u-boot.bin uboot.elf \
+    u-boot-sunxi-with-spl.bin

   # Arnaud Ferraris <arnaud.ferra...@collabora.com>
   u-boot-sunxi_platforms += pinetab
   pinetab_assigns := BL31=/usr/lib/arm-trusted-firmware/sun50i_a64/bl31.bin
   pinetab_targets := arch/arm/dts/sun50i-a64-pinetab.dtb spl/sunxi-spl.bin \
-    u-boot-nodtb.bin u-boot-sunxi-with-spl.fit.itb u-boot.bin uboot.elf
+    u-boot-nodtb.bin u-boot-sunxi-with-spl.fit.itb u-boot.bin uboot.elf \
+    u-boot-sunxi-with-spl.bin

   # amarpr...@minhas.io
   u-boot-sunxi_platforms += sopine_baseboard
   sopine_baseboard_assigns := 
BL31=/usr/lib/arm-trusted-firmware/sun50i_a64/bl31.bin
   sopine_baseboard_targets := arch/arm/dts/sun50i-a64-sopine-baseboard.dtb 
spl/sunxi-spl.bin \
-    u-boot-nodtb.bin u-boot-sunxi-with-spl.fit.itb u-boot.bin uboot.elf
+    u-boot-nodtb.bin u-boot-sunxi-with-spl.fit.itb u-boot.bin uboot.elf \
+    u-boot-sunxi-with-spl.bin

   u-boot-sunxi_platforms += teres_i
   teres_i_assigns := BL31=/usr/lib/arm-trusted-firmware/sun50i_a64/bl31.bin
   teres_i_targets := arch/arm/dts/sun50i-a64-teres-i.dtb spl/sunxi-spl.bin \
-    u-boot-nodtb.bin u-boot-sunxi-with-spl.fit.itb u-boot.bin uboot.elf
+    u-boot-nodtb.bin u-boot-sunxi-with-spl.fit.itb u-boot.bin uboot.elf \
+    u-boot-sunxi-with-spl.bin

 # u-boot-tegra

Reply via email to