Source: u-boot
Followup-For: Bug #979296

Please only consider this version, rebased on 96b110eb.
32296e74 is of little interest by itself, but documents 1f3d5824.
6125bcad only applies on top, so I am submitting it here for now.

Nothing seems unexpected in the output of the following commands (with
patches from bugs 979482 979660 980234 980235 980237 applied).


VERSION=2021.01~rc4+dfsg

rm -f ../*.{buildinfo,changes,deb,dsc,gz,xz} && debian/rules clean
(cd .. && tar -caf u-boot_VERSION.orig.tar.gz --exclude=debian git)
DEB_BUILD_OPTIONS='terse noopt parallel=2' dpkg-buildpackage -uc -us 
--build=source
lintian -EiIv --color auto --pedantic ../*.dsc

rm -f ../*.{buildinfo,changes,deb,dsc,gz,xz} && debian/rules clean
DEB_BUILD_OPTIONS='terse noopt parallel=2' fakeroot debian/rules binary-indep 
u-boot-qemu_platforms='qemu-ppce500 qemu-riscv64'
lintian -EiIv --color auto --pedantic ../*.deb
(cd ../old && wget $MIRROR/u-boot-qemu_VERSION-2_all.deb)
debdiff ../u-boot-qemu_*.deb ../old/u-boot-qemu_*.deb

rm -f ../*.{buildinfo,changes,deb,dsc,gz,xz} && debian/rules clean
DEB_BUILD_OPTIONS='terse noopt parallel=2' fakeroot debian/rules binary-arch
lintian -EiIv --color auto --pedantic ../*.deb
(cd ../old && wget $MIRROR/u-boot-tools_VERSION-2_amd64.deb)
debdiff ../u-boot-tools_*.deb ../old/u-boot-tools_*.deb

rm -f ../*.{buildinfo,changes,deb,dsc,gz,xz} && debian/rules clean
DEB_BUILD_OPTIONS='terse noopt parallel=2' fakeroot dpkg-architecture -aarmel 
-c debian/rules binary-arch
lintian -EiIv --color auto --pedantic ../*.deb
(cd ../old && wget $MIRROR/u-boot_VERSION-2_armel.deb)
(cd ../old && wget $MIRROR/u-boot-rpi_VERSION-2_armel.deb)
(cd ../old && wget $MIRROR/u-boot-tools_VERSION-2_armel.deb)
for p in u-boot u-boot-rpi u-boot-tools; do debdiff ../${p}_*.deb 
../old/${p}_*_armel.deb; done

rm -f ../*.{buildinfo,changes,deb,dsc,gz,xz} && debian/rules clean
DEB_BUILD_OPTIONS='terse noopt parallel=2' DEB_BUILD_PROFILES=pkg.uboot.notools 
fakeroot dpkg-architecture -aarmhf -c debian/rules binary-arch 
built_subarchs='u-boot-imx u-boot-omap u-boot-rockchip u-boot-sunxi' 
u-boot-imx_platforms=novena-rawsd u-boot-omap_platforms=am335x_boneblack 
u-boot-sunxi_platforms=A10-OLinuXino-Lime
lintian -EiIv --color auto --pedantic ../*.deb
(cd ../old && wget $MIRROR/u-boot-imx_VERSION-2_armhf.deb)
(cd ../old && wget $MIRROR/u-boot-omap_VERSION-2_armhf.deb)
(cd ../old && wget $MIRROR/u-boot-rockchip_VERSION-2_armhf.deb)
(cd ../old && wget $MIRROR/u-boot-sunxi_VERSION-2_armhf.deb)
for p in u-boot-imx u-boot-omap u-boot-rockchip u-boot-sunxi; do debdiff 
../${p}_*.deb ../old/${p}_*_armhf.deb; done

rm -f ../*.{buildinfo,changes,deb,dsc,gz,xz} && debian/rules clean
DEB_BUILD_OPTIONS='terse noopt parallel=2' DEB_BUILD_PROFILES=pkg.uboot.notools 
fakeroot dpkg-architecture -aarm64 -c debian/rules binary-arch 
built_subarchs='u-boot-rockchip u-boot-sunxi' 
u-boot-rockchip_platforms=firefly-rk3399 u-boot-sunxi_platforms=pinephone
lintian -EiIv --color auto --pedantic ../*.deb
(cd ../old && wget $MIRROR/u-boot-rockchip_VERSION-2_arm64.deb)
(cd ../old && wget $MIRROR/u-boot-sunxi_VERSION-2_arm64.deb)
for p in u-boot-rockchip u-boot-sunxi; do debdiff ../${p}_*.deb 
../old/${p}_*_arm64.deb; done
>From 32296e74c8659fe3b978a9aaa635d38020bbdf1a Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Sat, 9 Jan 2021 15:39:20 +0100
Subject: [PATCH 1/4] Temporary translator for debian/targets

This commit adds the translator in order to help figuring the changes
and rebasing, but should not be part of the eventual history.
---
 debian/targets.py | 94 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 94 insertions(+)
 create mode 100644 debian/targets.py

diff --git a/debian/targets.py b/debian/targets.py
new file mode 100644
index 0000000000..faf09ccfd0
--- /dev/null
+++ b/debian/targets.py
@@ -0,0 +1,94 @@
+#!/usr/bin/python3
+
+import subprocess
+
+# Convert debian/targets to a Makefile snippet included by
+# debian/rules.
+
+# python3 debian/targets.py < debian/targets > debian/targets.mk
+
+qemu = {}
+architectures = {}
+maintainers = []
+
+with open ('debian/targets') as i:
+    assert i.readline () == '# ARCH	subarch		platform	target\n'
+    assert i.readline () == '# --------------------------------------------\n'
+    for line in i:
+        if line == '\n':
+            maintainers = []
+            continue
+        if line.startswith('#'):
+            maintainers.append (line.rstrip ())
+            continue
+        fields = line.rstrip ().split ()
+        arch, subarch, platform = fields [:3]
+        targets                 = fields [3:]
+
+        if arch.startswith ('all'):
+            assert subarch == 'qemu'
+            qemu [platform] = (arch, targets)
+        else:
+            if arch not in architectures:
+                architectures [arch] = {}
+            packages = architectures [arch]
+
+            if subarch == '-':
+                package = 'u-boot'
+            else:
+                package = f'u-boot-{subarch}'
+            if package not in packages:
+                packages [package] = {}
+            platforms = packages [package]
+
+            platforms [platform] = (targets, maintainers)
+
+print ('# Target architectures supported by u-boot in Debian.')
+print ('# debian/rules includes this Makefile snippet.')
+
+else_ifeq = False
+
+for arch in sorted (architectures.keys ()):
+    print ('')
+    if else_ifeq:
+        print ('else ', end='')
+    else:
+        else_ifeq = True
+    print ('ifeq (${DEB_HOST_ARCH},' + arch + ')')
+
+    packages = architectures [arch]
+    sorted_packages = sorted (packages.keys ())
+    for package in sorted_packages:
+        platforms = packages [package]
+        sorted_platforms = sorted (platforms.keys ())
+
+        print ('')
+        print (f'{package}_platforms := {" ".join (platforms)}')
+
+        for platform in sorted_platforms:
+            targets, maintainers = platforms [platform]
+
+            print ('')
+            for maintainer in maintainers:
+                print (f'  {maintainer}')
+            if targets [0].startswith ('/usr/lib/arm-trusted-firmware/'):
+                print (f'  {platform}_exports := BL31={targets.pop (0)}')
+            if platform != 'novena-rawsd':
+                targets.append ('uboot.elf')
+            targets.sort ()
+            print (f'  {platform}_targets := {" ".join (targets)}')
+
+print ('')
+print ('endif')
+
+print ('')
+sorted_platforms = sorted (qemu.keys ())
+print (f'u-boot-qemu_platforms := {" ".join(sorted_platforms)}')
+for platform in sorted_platforms:
+    arch, targets = qemu [platform]
+    print ('')
+    gnu_type = subprocess.check_output(('dpkg-architecture', '-f', '-a', arch[4:], '-qDEB_HOST_GNU_TYPE')).rstrip ().decode ()
+    print (f'  {platform}_CROSS_COMPILE := {gnu_type}-')
+    targets.append ('uboot.elf')
+    targets.sort ()
+    print (f'  {platform}_targets := {" ".join (targets)}')
-- 
2.20.1

>From 1f3d582431356f447c446d88c34d4d8ae17a1d7c Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Sat, 16 Jan 2021 15:13:47 +0100
Subject: [PATCH 2/4] Reformat debian/targets to debian/targets.mk

This commit does only the conversion, in order to help figuring the
changes and rebasing.
---
 debian/targets    | 280 ----------------------------------
 debian/targets.mk | 374 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 374 insertions(+), 280 deletions(-)
 delete mode 100644 debian/targets
 create mode 100644 debian/targets.mk

diff --git a/debian/targets b/debian/targets
deleted file mode 100644
index 7fa7c8b8cc..0000000000
--- a/debian/targets
+++ /dev/null
@@ -1,280 +0,0 @@
-# ARCH	subarch		platform	target
-# --------------------------------------------
-armel	-		dockstar	u-boot.kwb
-
-# Ian Campbell <[email protected]>
-armel	-		dreamplug	u-boot.kwb
-
-# drEagle <[email protected]>
-armel	-		guruplug	u-boot.kwb
-
-# Vagrant Cascadian <[email protected]>, rpi B 256M
-armel	rpi		rpi		u-boot.bin
-
-# Romain Perier <[email protected]>, rpi zero w
-armel	rpi		rpi_0_w		u-boot.bin
-
-# drEagle <[email protected]>
-# Rick Thomas <[email protected]>
-armel	-		sheevaplug	u-boot.kwb
-
-armhf	exynos		arndale		u-boot.bin spl/arndale-spl.bin
-
-# Joost van Zwieten <[email protected]>, Odroid-U3
-armhf	exynos		odroid		u-boot.bin
-
-# Vagrant Cascadian <[email protected]>, Odroid-XU4
-armhf	exynos		odroid-xu3	u-boot.bin
-
-# Marek Vasut <[email protected]>
-armhf	imx		dh_imx6		u-boot-with-spl.imx
-
-# Robert Nelson <[email protected]>
-armhf	imx		mx53loco	u-boot.imx
-
-# Steve Langasek <[email protected]>, CuBox-i4
-# Vagrant Cascadian <[email protected]>, CuBox-i4pro, Cubox-i4x4, hummingboard-i1, hummingboard-i2ex
-# Rainer Dorsch <[email protected]>, CuBox-i2u (i2u-300-d)
-# Rick Thomas <[email protected]>, Cubox-i4x4, Cubox-i4PRO
-armhf	imx		mx6cuboxi	u-boot.img SPL
-
-# Martyn Welch <[email protected]>
-armhf	imx		mx6qsabrelite	u-boot-dtb.imx
-
-# Hector Oron <[email protected]>
-armhf	imx		nitrogen6q	u-boot-dtb.imx
-
-# Vagrant Cascadian <[email protected]>
-armhf	imx		novena		u-boot.img SPL
-armhf	imx		novena-rawsd SPL
-
-# Michael Fladischer <[email protected]>
-armhf	imx		udoo		u-boot.img SPL
-
-# Vagrant Cascadian <[email protected]>
-armhf	imx		usbarmory	u-boot.imx
-
-# Vagrant Cascadian <[email protected]>
-# Robert Nelson <[email protected]>
-armhf	imx		wandboard	u-boot.img SPL
-
-# Vagrant Cascadian <[email protected]>
-# Andrew M.A. Cater <[email protected]>
-armhf	omap		am335x_boneblack u-boot.img MLO
-armhf	omap		am335x_evm u-boot.img MLO
-
-# Vagrant Cascadian <[email protected]>
-armhf	omap		am57xx_evm	u-boot.img MLO
-
-armhf 	omap		dra7xx_evm	u-boot.img MLO
-
-# Robert Nelson <[email protected]>
-armhf	omap		igep00x0	u-boot.img MLO
-
-armhf	omap		nokia_rx51	u-boot.bin
-
-# Robert Nelson <[email protected]>
-armhf	omap		omap3_beagle	u-boot.img MLO
-
-# Robert Nelson <[email protected]>
-armhf	omap		omap4_panda	u-boot.img MLO
-
-# Vagrant Cascadian <[email protected]>, 2GB and 4GB variants
-armhf	rockchip	firefly-rk3288		u-boot.bin u-boot.img spl/u-boot-spl.bin idbloader.img
-
-# Vagrant Cascadian <[email protected]>, Raspberry PI 2B
-armhf	rpi		rpi_2		u-boot.bin
-
-# Ryan Finnie <[email protected]>
-armhf	rpi		rpi_3_32b	u-boot.bin
-
-# Lucas Nussbaum <[email protected]>
-# Andreas Henriksson <[email protected]>
-armhf	rpi		rpi_4_32b	u-boot.bin
-
-# Christian Kastner <[email protected]>
-armhf	sunxi		A10-OLinuXino-Lime	u-boot-sunxi-with-spl.bin
-
-# Benedikt Wildenhain <[email protected]>
-armhf	sunxi		A10s-OLinuXino-M	u-boot-sunxi-with-spl.bin
-
-# Karsten Merker <[email protected]>
-armhf	sunxi		A20-Olimex-SOM-EVB	u-boot-sunxi-with-spl.bin
-
-# Christian Kastner <[email protected]>
-armhf	sunxi		A20-OLinuXino-Lime	u-boot-sunxi-with-spl.bin
-
-# Karsten Merker <[email protected]>
-armhf	sunxi		A20-OLinuXino-Lime2	u-boot-sunxi-with-spl.bin
-
-# Andreas B. Mundt <[email protected]>
-armhf	sunxi		A20-OLinuXino-Lime2-eMMC	u-boot-sunxi-with-spl.bin
-
-# Arne Ploese <[email protected]>
-armhf  sunxi		A20-OLinuXino_MICRO	u-boot-sunxi-with-spl.bin
-
-# Ian Campbell <[email protected]>
-# Vagrant Cascadian <[email protected]>
-armhf	sunxi		Bananapi	u-boot-sunxi-with-spl.bin
-
-# Karsten Merker <[email protected]>
-armhf	sunxi		Bananapro	u-boot-sunxi-with-spl.bin
-
-# Lucas Nussbaum <[email protected]>
-armhf   sunxi           bananapi_m2_berry u-boot-sunxi-with-spl.bin
-
-# Bernhard Wörner <[email protected]>
-armhf   sunxi           Bananapi_M2_Ultra u-boot-sunxi-with-spl.bin
-
-# Vagrant Cascadian <[email protected]>
-armhf	sunxi		CHIP		u-boot-sunxi-with-spl.bin
-
-# Vagrant Cascadian <[email protected]>
-armhf	sunxi		Cubieboard	u-boot-sunxi-with-spl.bin
-
-# Ian Campbell <[email protected]>
-# Karsten Merker <[email protected]>
-armhf	sunxi		Cubieboard2	u-boot-sunxi-with-spl.bin
-
-# Vagrant Cascadian <[email protected]>
-armhf	sunxi		Cubieboard4	u-boot-sunxi-with-spl.bin
-
-# Ian Campbell <[email protected]>
-# Robert Nelson <[email protected]>
-# Karsten Merker <[email protected]>
-armhf	sunxi		Cubietruck	u-boot-sunxi-with-spl.bin
-
-# Vagrant Cascadian <[email protected]>
-armhf	sunxi		Cubietruck_plus	u-boot-sunxi-with-spl.bin
-
-# Vagrant Cascadian <[email protected]>
-armhf	sunxi		Lamobo_R1	u-boot-sunxi-with-spl.bin
-
-# Robert Hegner <[email protected]>
-armhf	sunxi		Linksprite_pcDuino	u-boot-sunxi-with-spl.bin
-
-# Patrice Go <[email protected]>
-armhf	sunxi		Linksprite_pcDuino3	u-boot-sunxi-with-spl.bin
-
-# Jochen Sprickerhof <[email protected]>
-armhf	sunxi		Mini-X	u-boot-sunxi-with-spl.bin
-
-# Paul Tagliamonte <[email protected]>
-armhf	sunxi		nanopi_neo	u-boot-sunxi-with-spl.bin
-
-# Philip Hands <[email protected]>
-armhf	sunxi		nanopi_neo_air	u-boot-sunxi-with-spl.bin
-
-# Vagrant Cascadian <[email protected]>, Orange PI Plus2
-armhf	sunxi		orangepi_plus	u-boot-sunxi-with-spl.bin
-
-# Mateusz Łukasik <[email protected]>, Orange PI Zero
-armhf	sunxi		orangepi_zero	u-boot-sunxi-with-spl.bin
-
-# Bernhard <[email protected]>
-armhf	sunxi		Sinovoip_BPI_M3	u-boot-sunxi-with-spl.bin
-
-# Ian Campbell <[email protected]>
-armhf	tegra		jetson-tk1	u-boot-tegra.bin
-
-# Neil Armstrong <[email protected]>
-arm64	amlogic		khadas-vim	u-boot.bin
-arm64	amlogic		khadas-vim2	u-boot.bin
-
-# Frederic Danis <[email protected]>
-arm64	amlogic		libretech-cc	u-boot.bin
-
-# Neil Armstrong <[email protected]>
-arm64	amlogic		nanopi-k2	u-boot.bin
-
-# Vagrant Cascadian <[email protected]>
-arm64	amlogic		odroid-c2	u-boot.bin
-
-# Reco <[email protected]>
-arm64	amlogic		odroid-n2	u-boot.bin
-
-# Vagrant Cascadian <[email protected]>
-arm64	  mvebu		mvebu_espressobin-88f3720	u-boot.bin arch/arm/dts/armada-3720-espressobin.dtb
-
-# Riku Voipio <[email protected]>
-arm64	qcom		dragonboard410c	u-boot.bin
-arm64	qcom		dragonboard820c	u-boot.bin
-
-# Vagrant Cascadian <[email protected]>
-arm64  rockchip        firefly-rk3399  /usr/lib/arm-trusted-firmware/rk3399/bl31.elf u-boot.img u-boot.bin u-boot-nodtb.bin spl/u-boot-spl.bin arch/arm/dts/rk3399-firefly.dtb u-boot.itb idbloader.img
-
-# Vagrant Cascadian <[email protected]>
-arm64  rockchip        pinebook-pro-rk3399  /usr/lib/arm-trusted-firmware/rk3399/bl31.elf u-boot.img u-boot.bin u-boot-nodtb.bin spl/u-boot-spl.bin arch/arm/dts/rk3399-pinebook-pro.dtb u-boot.itb idbloader.img
-
-# Vagrant Cascadian <[email protected]>
-arm64  rockchip        rockpro64-rk3399  /usr/lib/arm-trusted-firmware/rk3399/bl31.elf u-boot.img u-boot.bin u-boot-nodtb.bin spl/u-boot-spl.bin arch/arm/dts/rk3399-rockpro64.dtb u-boot.itb idbloader.img
-
-# Vagrant Cascadian <[email protected]>
-arm64  rockchip        rock64-rk3328  /usr/lib/arm-trusted-firmware/rk3328/bl31.elf u-boot.img u-boot.bin u-boot-nodtb.bin spl/u-boot-spl.bin tpl/u-boot-tpl.bin arch/arm/dts/rk3328-rock64.dtb u-boot.itb idbloader.img
-
-# Vagrant Cascadian <[email protected]>
-arm64  rockchip        puma-rk3399 /usr/lib/arm-trusted-firmware/rk3399/bl31.elf u-boot.img u-boot.bin u-boot-nodtb.bin spl/u-boot-spl.bin arch/arm/dts/rk3399-puma-haikou.dtb idbloader.img
-
-# Walter Lozano <[email protected]>
-arm64  rockchip        rock-pi-4-rk3399 /usr/lib/arm-trusted-firmware/rk3399/bl31.elf u-boot.img u-boot.bin u-boot-nodtb.bin spl/u-boot-spl.bin arch/arm/dts/rk3399-rock-pi-4a.dtb arch/arm/dts/rk3399-rock-pi-4b.dtb u-boot.itb idbloader.img
-
-# Ryan Finnie <[email protected]>
-arm64	rpi		rpi_3		u-boot.bin
-
-# Lucas Nussbaum <[email protected]>
-# Andreas Henriksson <[email protected]>
-arm64	rpi		rpi_4		u-boot.bin
-
-# Denis Pynkin <[email protected]>
-arm64	rpi		rpi_arm64	u-boot.bin
-
-# Rodrigo Exterckötter Tjäder <[email protected]>
-arm64	sunxi		a64-olinuxino	/usr/lib/arm-trusted-firmware/sun50i_a64/bl31.bin u-boot.bin spl/sunxi-spl.bin u-boot-nodtb.bin arch/arm/dts/sun50i-a64-olinuxino.dtb u-boot-sunxi-with-spl.fit.itb
-
-# Philip Rinn <[email protected]>
-arm64	sunxi		a64-olinuxino-emmc	/usr/lib/arm-trusted-firmware/sun50i_a64/bl31.bin u-boot.bin spl/sunxi-spl.bin u-boot-nodtb.bin arch/arm/dts/sun50i-a64-olinuxino-emmc.dtb u-boot-sunxi-with-spl.fit.itb
-
-# Domenico Andreoli <[email protected]>
-arm64	sunxi		nanopi_neo2	/usr/lib/arm-trusted-firmware/sun50i_a64/bl31.bin u-boot.bin spl/sunxi-spl.bin u-boot-nodtb.bin arch/arm/dts/sun50i-h5-nanopi-neo2.dtb u-boot-sunxi-with-spl.fit.itb
-
-# Steev Klimaszewski <[email protected]>
-arm64	sunxi		nanopi_neo_plus2	/usr/lib/arm-trusted-firmware/sun50i_a64/bl31.bin u-boot.bin spl/sunxi-spl.bin u-boot-nodtb.bin arch/arm/dts/sun50i-h5-nanopi-neo-plus2.dtb u-boot-sunxi-with-spl.fit.itb
-
-# Frederic Danis <[email protected]>
-arm64	sunxi		orangepi_zero_plus2	/usr/lib/arm-trusted-firmware/sun50i_a64/bl31.bin u-boot.bin spl/sunxi-spl.bin u-boot-nodtb.bin arch/arm/dts/sun50i-h5-orangepi-zero-plus2.dtb u-boot-sunxi-with-spl.fit.itb
-
-# [email protected]
-arm64	sunxi		orangepi_one_plus	/usr/lib/arm-trusted-firmware/sun50i_h6/bl31.bin u-boot.bin spl/sunxi-spl.bin u-boot-nodtb.bin arch/arm/dts/sun50i-h6-orangepi-one-plus.dtb u-boot-sunxi-with-spl.fit.itb
-
-# Vagrant Cascadian <[email protected]>
-arm64	sunxi		pine64_plus	/usr/lib/arm-trusted-firmware/sun50i_a64/bl31.bin u-boot.bin spl/sunxi-spl.bin u-boot-nodtb.bin arch/arm/dts/sun50i-a64-pine64-plus.dtb arch/arm/dts/sun50i-a64-pine64.dtb u-boot-sunxi-with-spl.fit.itb
-
-# Sunil Mohan Adapa <[email protected]>
-arm64	sunxi		pine64-lts	/usr/lib/arm-trusted-firmware/sun50i_a64/bl31.bin u-boot.bin spl/sunxi-spl.bin u-boot-nodtb.bin arch/arm/dts/sun50i-a64-pine64-lts.dtb arch/arm/dts/sun50i-a64-pine64.dtb u-boot-sunxi-with-spl.fit.itb
-
-# Vagrant Cascadian <[email protected]>
-arm64	sunxi		pinebook	/usr/lib/arm-trusted-firmware/sun50i_a64/bl31.bin u-boot.bin spl/sunxi-spl.bin u-boot-nodtb.bin arch/arm/dts/sun50i-a64-pinebook.dtb u-boot-sunxi-with-spl.fit.itb
-
-# Benoit Delcour <[email protected]>
-arm64	sunxi		pinephone	/usr/lib/arm-trusted-firmware/sun50i_a64/bl31.bin u-boot.bin spl/sunxi-spl.bin u-boot-nodtb.bin arch/arm/dts/sun50i-a64-pinephone-1.2.dtb u-boot-sunxi-with-spl.fit.itb
-
-# Jonas Smedegaard <[email protected]>
-arm64	sunxi		teres_i		/usr/lib/arm-trusted-firmware/sun50i_a64/bl31.bin u-boot.bin spl/sunxi-spl.bin u-boot-nodtb.bin arch/arm/dts/sun50i-a64-teres-i.dtb u-boot-sunxi-with-spl.fit.itb
-
-# Vagrant Cascadian <[email protected]>
-arm64	tegra		p2371-2180	u-boot.bin
-
-avr32	-		hammerhead	u-boot.img
-
-# Hector Oron <[email protected]>
-riscv64	sifive	sifive_fu540	u-boot.bin
-
-sh4	-		r2dplus		u-boot.bin
-
-all:amd64	qemu	qemu-x86_64	u-boot.bin u-boot.rom
-all:armhf	qemu	qemu_arm	u-boot.bin
-all:arm64	qemu	qemu_arm64	u-boot.bin
-all:i386	qemu	qemu-x86	u-boot.bin u-boot.rom
-all:powerpc	qemu	qemu-ppce500	u-boot.bin
-all:riscv64	qemu	qemu-riscv64	u-boot.bin
-all:riscv64	qemu	qemu-riscv64_smode	u-boot.bin
diff --git a/debian/targets.mk b/debian/targets.mk
new file mode 100644
index 0000000000..f76086b8c0
--- /dev/null
+++ b/debian/targets.mk
@@ -0,0 +1,374 @@
+# Target architectures supported by u-boot in Debian.
+# debian/rules includes this Makefile snippet.
+
+ifeq (${DEB_HOST_ARCH},arm64)
+
+u-boot-amlogic_platforms := khadas-vim khadas-vim2 libretech-cc nanopi-k2 odroid-c2 odroid-n2
+
+  # Neil Armstrong <[email protected]>
+  khadas-vim_targets := u-boot.bin uboot.elf
+
+  # Neil Armstrong <[email protected]>
+  khadas-vim2_targets := u-boot.bin uboot.elf
+
+  # Frederic Danis <[email protected]>
+  libretech-cc_targets := u-boot.bin uboot.elf
+
+  # Neil Armstrong <[email protected]>
+  nanopi-k2_targets := u-boot.bin uboot.elf
+
+  # Vagrant Cascadian <[email protected]>
+  odroid-c2_targets := u-boot.bin uboot.elf
+
+  # Reco <[email protected]>
+  odroid-n2_targets := u-boot.bin uboot.elf
+
+u-boot-mvebu_platforms := mvebu_espressobin-88f3720
+
+  # Vagrant Cascadian <[email protected]>
+  mvebu_espressobin-88f3720_targets := arch/arm/dts/armada-3720-espressobin.dtb u-boot.bin uboot.elf
+
+u-boot-qcom_platforms := dragonboard410c dragonboard820c
+
+  # Riku Voipio <[email protected]>
+  dragonboard410c_targets := u-boot.bin uboot.elf
+
+  # Riku Voipio <[email protected]>
+  dragonboard820c_targets := u-boot.bin uboot.elf
+
+u-boot-rockchip_platforms := firefly-rk3399 pinebook-pro-rk3399 rockpro64-rk3399 rock64-rk3328 puma-rk3399 rock-pi-4-rk3399
+
+  # Vagrant Cascadian <[email protected]>
+  firefly-rk3399_exports := BL31=/usr/lib/arm-trusted-firmware/rk3399/bl31.elf
+  firefly-rk3399_targets := arch/arm/dts/rk3399-firefly.dtb idbloader.img spl/u-boot-spl.bin u-boot-nodtb.bin u-boot.bin u-boot.img u-boot.itb uboot.elf
+
+  # Vagrant Cascadian <[email protected]>
+  pinebook-pro-rk3399_exports := BL31=/usr/lib/arm-trusted-firmware/rk3399/bl31.elf
+  pinebook-pro-rk3399_targets := arch/arm/dts/rk3399-pinebook-pro.dtb idbloader.img spl/u-boot-spl.bin u-boot-nodtb.bin u-boot.bin u-boot.img u-boot.itb uboot.elf
+
+  # Vagrant Cascadian <[email protected]>
+  puma-rk3399_exports := BL31=/usr/lib/arm-trusted-firmware/rk3399/bl31.elf
+  puma-rk3399_targets := arch/arm/dts/rk3399-puma-haikou.dtb idbloader.img spl/u-boot-spl.bin u-boot-nodtb.bin u-boot.bin u-boot.img uboot.elf
+
+  # Walter Lozano <[email protected]>
+  rock-pi-4-rk3399_exports := BL31=/usr/lib/arm-trusted-firmware/rk3399/bl31.elf
+  rock-pi-4-rk3399_targets := arch/arm/dts/rk3399-rock-pi-4a.dtb arch/arm/dts/rk3399-rock-pi-4b.dtb idbloader.img spl/u-boot-spl.bin u-boot-nodtb.bin u-boot.bin u-boot.img u-boot.itb uboot.elf
+
+  # Vagrant Cascadian <[email protected]>
+  rock64-rk3328_exports := BL31=/usr/lib/arm-trusted-firmware/rk3328/bl31.elf
+  rock64-rk3328_targets := arch/arm/dts/rk3328-rock64.dtb idbloader.img spl/u-boot-spl.bin tpl/u-boot-tpl.bin u-boot-nodtb.bin u-boot.bin u-boot.img u-boot.itb uboot.elf
+
+  # Vagrant Cascadian <[email protected]>
+  rockpro64-rk3399_exports := BL31=/usr/lib/arm-trusted-firmware/rk3399/bl31.elf
+  rockpro64-rk3399_targets := arch/arm/dts/rk3399-rockpro64.dtb idbloader.img spl/u-boot-spl.bin u-boot-nodtb.bin u-boot.bin u-boot.img u-boot.itb uboot.elf
+
+u-boot-rpi_platforms := rpi_3 rpi_4 rpi_arm64
+
+  # Ryan Finnie <[email protected]>
+  rpi_3_targets := u-boot.bin uboot.elf
+
+  # Lucas Nussbaum <[email protected]>
+  # Andreas Henriksson <[email protected]>
+  rpi_4_targets := u-boot.bin uboot.elf
+
+  # Denis Pynkin <[email protected]>
+  rpi_arm64_targets := u-boot.bin uboot.elf
+
+u-boot-sunxi_platforms := a64-olinuxino a64-olinuxino-emmc nanopi_neo2 nanopi_neo_plus2 orangepi_zero_plus2 orangepi_one_plus pine64_plus pine64-lts pinebook pinephone teres_i
+
+  # Rodrigo Exterckötter Tjäder <[email protected]>
+  a64-olinuxino_exports := 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
+
+  # Philip Rinn <[email protected]>
+  a64-olinuxino-emmc_exports := 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
+
+  # Domenico Andreoli <[email protected]>
+  nanopi_neo2_exports := 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
+
+  # Steev Klimaszewski <[email protected]>
+  nanopi_neo_plus2_exports := 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
+
+  # [email protected]
+  orangepi_one_plus_exports := BL31=/usr/lib/arm-trusted-firmware/sun50i_h6/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
+
+  # Frederic Danis <[email protected]>
+  orangepi_zero_plus2_exports := BL31=/usr/lib/arm-trusted-firmware/sun50i_a64/bl31.bin
+  orangepi_zero_plus2_targets := 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
+
+  # Sunil Mohan Adapa <[email protected]>
+  pine64-lts_exports := 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
+
+  # Vagrant Cascadian <[email protected]>
+  pine64_plus_exports := 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
+
+  # Vagrant Cascadian <[email protected]>
+  pinebook_exports := 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
+
+  # Benoit Delcour <[email protected]>
+  pinephone_exports := BL31=/usr/lib/arm-trusted-firmware/sun50i_a64/bl31.bin
+  pinephone_targets := 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
+
+  # Jonas Smedegaard <[email protected]>
+  teres_i_exports := 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-tegra_platforms := p2371-2180
+
+  # Vagrant Cascadian <[email protected]>
+  p2371-2180_targets := u-boot.bin uboot.elf
+
+else ifeq (${DEB_HOST_ARCH},armel)
+
+u-boot_platforms := dockstar dreamplug guruplug sheevaplug
+
+  dockstar_targets := u-boot.kwb uboot.elf
+
+  # Ian Campbell <[email protected]>
+  dreamplug_targets := u-boot.kwb uboot.elf
+
+  # drEagle <[email protected]>
+  guruplug_targets := u-boot.kwb uboot.elf
+
+  # drEagle <[email protected]>
+  # Rick Thomas <[email protected]>
+  sheevaplug_targets := u-boot.kwb uboot.elf
+
+u-boot-rpi_platforms := rpi rpi_0_w
+
+  # Vagrant Cascadian <[email protected]>, rpi B 256M
+  rpi_targets := u-boot.bin uboot.elf
+
+  # Romain Perier <[email protected]>, rpi zero w
+  rpi_0_w_targets := u-boot.bin uboot.elf
+
+else ifeq (${DEB_HOST_ARCH},armhf)
+
+u-boot-exynos_platforms := arndale odroid odroid-xu3
+
+  arndale_targets := spl/arndale-spl.bin u-boot.bin uboot.elf
+
+  # Joost van Zwieten <[email protected]>, Odroid-U3
+  odroid_targets := u-boot.bin uboot.elf
+
+  # Vagrant Cascadian <[email protected]>, Odroid-XU4
+  odroid-xu3_targets := u-boot.bin uboot.elf
+
+u-boot-imx_platforms := dh_imx6 mx53loco mx6cuboxi mx6qsabrelite nitrogen6q novena novena-rawsd udoo usbarmory wandboard
+
+  # Marek Vasut <[email protected]>
+  dh_imx6_targets := u-boot-with-spl.imx uboot.elf
+
+  # Robert Nelson <[email protected]>
+  mx53loco_targets := u-boot.imx uboot.elf
+
+  # Steve Langasek <[email protected]>, CuBox-i4
+  # Vagrant Cascadian <[email protected]>, CuBox-i4pro, Cubox-i4x4, hummingboard-i1, hummingboard-i2ex
+  # Rainer Dorsch <[email protected]>, CuBox-i2u (i2u-300-d)
+  # Rick Thomas <[email protected]>, Cubox-i4x4, Cubox-i4PRO
+  mx6cuboxi_targets := SPL u-boot.img uboot.elf
+
+  # Martyn Welch <[email protected]>
+  mx6qsabrelite_targets := u-boot-dtb.imx uboot.elf
+
+  # Hector Oron <[email protected]>
+  nitrogen6q_targets := u-boot-dtb.imx uboot.elf
+
+  # Vagrant Cascadian <[email protected]>
+  novena_targets := SPL u-boot.img uboot.elf
+
+  # Vagrant Cascadian <[email protected]>
+  novena-rawsd_targets := SPL
+
+  # Michael Fladischer <[email protected]>
+  udoo_targets := SPL u-boot.img uboot.elf
+
+  # Vagrant Cascadian <[email protected]>
+  usbarmory_targets := u-boot.imx uboot.elf
+
+  # Vagrant Cascadian <[email protected]>
+  # Robert Nelson <[email protected]>
+  wandboard_targets := SPL u-boot.img uboot.elf
+
+u-boot-omap_platforms := am335x_boneblack am335x_evm am57xx_evm dra7xx_evm igep00x0 nokia_rx51 omap3_beagle omap4_panda
+
+  # Vagrant Cascadian <[email protected]>
+  # Andrew M.A. Cater <[email protected]>
+  am335x_boneblack_targets := MLO u-boot.img uboot.elf
+
+  # Vagrant Cascadian <[email protected]>
+  # Andrew M.A. Cater <[email protected]>
+  am335x_evm_targets := MLO u-boot.img uboot.elf
+
+  # Vagrant Cascadian <[email protected]>
+  am57xx_evm_targets := MLO u-boot.img uboot.elf
+
+  dra7xx_evm_targets := MLO u-boot.img uboot.elf
+
+  # Robert Nelson <[email protected]>
+  igep00x0_targets := MLO u-boot.img uboot.elf
+
+  nokia_rx51_targets := u-boot.bin uboot.elf
+
+  # Robert Nelson <[email protected]>
+  omap3_beagle_targets := MLO u-boot.img uboot.elf
+
+  # Robert Nelson <[email protected]>
+  omap4_panda_targets := MLO u-boot.img uboot.elf
+
+u-boot-rockchip_platforms := firefly-rk3288
+
+  # Vagrant Cascadian <[email protected]>, 2GB and 4GB variants
+  firefly-rk3288_targets := idbloader.img spl/u-boot-spl.bin u-boot.bin u-boot.img uboot.elf
+
+u-boot-rpi_platforms := rpi_2 rpi_3_32b rpi_4_32b
+
+  # Vagrant Cascadian <[email protected]>, Raspberry PI 2B
+  rpi_2_targets := u-boot.bin uboot.elf
+
+  # Ryan Finnie <[email protected]>
+  rpi_3_32b_targets := u-boot.bin uboot.elf
+
+  # Lucas Nussbaum <[email protected]>
+  # Andreas Henriksson <[email protected]>
+  rpi_4_32b_targets := u-boot.bin uboot.elf
+
+u-boot-sunxi_platforms := A10-OLinuXino-Lime A10s-OLinuXino-M A20-Olimex-SOM-EVB A20-OLinuXino-Lime A20-OLinuXino-Lime2 A20-OLinuXino-Lime2-eMMC A20-OLinuXino_MICRO Bananapi Bananapro bananapi_m2_berry Bananapi_M2_Ultra CHIP Cubieboard Cubieboard2 Cubieboard4 Cubietruck Cubietruck_plus Lamobo_R1 Linksprite_pcDuino Linksprite_pcDuino3 Mini-X nanopi_neo nanopi_neo_air orangepi_plus orangepi_zero Sinovoip_BPI_M3
+
+  # Christian Kastner <[email protected]>
+  A10-OLinuXino-Lime_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Benedikt Wildenhain <[email protected]>
+  A10s-OLinuXino-M_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Christian Kastner <[email protected]>
+  A20-OLinuXino-Lime_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Karsten Merker <[email protected]>
+  A20-OLinuXino-Lime2_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Andreas B. Mundt <[email protected]>
+  A20-OLinuXino-Lime2-eMMC_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Arne Ploese <[email protected]>
+  A20-OLinuXino_MICRO_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Karsten Merker <[email protected]>
+  A20-Olimex-SOM-EVB_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Ian Campbell <[email protected]>
+  # Vagrant Cascadian <[email protected]>
+  Bananapi_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Bernhard Wörner <[email protected]>
+  Bananapi_M2_Ultra_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Karsten Merker <[email protected]>
+  Bananapro_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Vagrant Cascadian <[email protected]>
+  CHIP_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Vagrant Cascadian <[email protected]>
+  Cubieboard_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Ian Campbell <[email protected]>
+  # Karsten Merker <[email protected]>
+  Cubieboard2_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Vagrant Cascadian <[email protected]>
+  Cubieboard4_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Ian Campbell <[email protected]>
+  # Robert Nelson <[email protected]>
+  # Karsten Merker <[email protected]>
+  Cubietruck_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Vagrant Cascadian <[email protected]>
+  Cubietruck_plus_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Vagrant Cascadian <[email protected]>
+  Lamobo_R1_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Robert Hegner <[email protected]>
+  Linksprite_pcDuino_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Patrice Go <[email protected]>
+  Linksprite_pcDuino3_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Jochen Sprickerhof <[email protected]>
+  Mini-X_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Bernhard <[email protected]>
+  Sinovoip_BPI_M3_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Lucas Nussbaum <[email protected]>
+  bananapi_m2_berry_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Paul Tagliamonte <[email protected]>
+  nanopi_neo_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Philip Hands <[email protected]>
+  nanopi_neo_air_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Vagrant Cascadian <[email protected]>, Orange PI Plus2
+  orangepi_plus_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Mateusz Łukasik <[email protected]>, Orange PI Zero
+  orangepi_zero_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+u-boot-tegra_platforms := jetson-tk1
+
+  # Ian Campbell <[email protected]>
+  jetson-tk1_targets := u-boot-tegra.bin uboot.elf
+
+else ifeq (${DEB_HOST_ARCH},avr32)
+
+u-boot_platforms := hammerhead
+
+  hammerhead_targets := u-boot.img uboot.elf
+
+else ifeq (${DEB_HOST_ARCH},riscv64)
+
+u-boot-sifive_platforms := sifive_fu540
+
+  # Hector Oron <[email protected]>
+  sifive_fu540_targets := u-boot.bin uboot.elf
+
+else ifeq (${DEB_HOST_ARCH},sh4)
+
+u-boot_platforms := r2dplus
+
+  r2dplus_targets := u-boot.bin uboot.elf
+
+endif
+
+u-boot-qemu_platforms := qemu-ppce500 qemu-riscv64 qemu-riscv64_smode qemu-x86 qemu-x86_64 qemu_arm qemu_arm64
+
+  qemu-ppce500_CROSS_COMPILE := powerpc-linux-gnu-
+  qemu-ppce500_targets := u-boot.bin uboot.elf
+
+  qemu-riscv64_CROSS_COMPILE := riscv64-linux-gnu-
+  qemu-riscv64_targets := u-boot.bin uboot.elf
+
+  qemu-riscv64_smode_CROSS_COMPILE := riscv64-linux-gnu-
+  qemu-riscv64_smode_targets := u-boot.bin uboot.elf
+
+  qemu-x86_CROSS_COMPILE := i686-linux-gnu-
+  qemu-x86_targets := u-boot.bin u-boot.rom uboot.elf
+
+  qemu-x86_64_CROSS_COMPILE := x86_64-linux-gnu-
+  qemu-x86_64_targets := u-boot.bin u-boot.rom uboot.elf
+
+  qemu_arm_CROSS_COMPILE := arm-linux-gnueabihf-
+  qemu_arm_targets := u-boot.bin uboot.elf
+
+  qemu_arm64_CROSS_COMPILE := aarch64-linux-gnu-
+  qemu_arm64_targets := u-boot.bin uboot.elf
-- 
2.20.1

>From 15f15f92d23708fb194eeb7a07dd3fd65166f290 Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Sat, 9 Jan 2021 15:40:19 +0100
Subject: [PATCH 3/4] Restructure the packaging

Reformat free-form target list as Make assignments.

Replace many shell constructs with Make constructs, so that each
*executed* command is visible in logs.

It is now easy to build any combination of .debs and platforms by
setting Make variables on the command line.  For example,
DEB_BUILD_PROFILES=pkg.uboot.subarch.foo debian/rules build
is equivalent to
debian/rules build built_subarchs=u-boot-foo.

Delegate selection of host packages to dh_listpackages.

Make exports visible in logs, and temporary in order to avoid issues
like 979482.

Construct the per subarch configs directory right before
dh_installdocs.  These temporary directories only exist because of the
dh_installdocs interface.

Give package-specific names to debhelper substitution variables, so
that dh_gencontrol runs only once despite receiving the values on the
command line.
---
 debian/bin/u-boot-install-targets |   6 --
 debian/bin/update-substvars       |  18 ----
 debian/control                    |  56 ++++++++---
 debian/rules                      | 161 +++++++++++++++---------------
 debian/targets.mk                 |  43 ++++++++
 debian/u-boot-amlogic.install     |   2 -
 debian/u-boot-exynos.install      |   2 -
 debian/u-boot-imx.install         |   2 -
 debian/u-boot-mvebu.install       |   2 -
 debian/u-boot-omap.install        |   2 -
 debian/u-boot-qcom.install        |   2 -
 debian/u-boot-qemu.install        |   2 -
 debian/u-boot-rockchip.install    |   8 +-
 debian/u-boot-rpi.install         |   2 -
 debian/u-boot-sifive.install      |   2 -
 debian/u-boot-sunxi.install       |   5 +-
 debian/u-boot-tegra.install       |   2 -
 debian/u-boot.install             |   2 -
 18 files changed, 167 insertions(+), 152 deletions(-)
 delete mode 100755 debian/bin/u-boot-install-targets
 delete mode 100755 debian/bin/update-substvars
 delete mode 100755 debian/u-boot-amlogic.install
 delete mode 100755 debian/u-boot-exynos.install
 delete mode 100755 debian/u-boot-imx.install
 delete mode 100755 debian/u-boot-mvebu.install
 delete mode 100755 debian/u-boot-omap.install
 delete mode 100755 debian/u-boot-qcom.install
 delete mode 100755 debian/u-boot-qemu.install
 mode change 100755 => 100644 debian/u-boot-rockchip.install
 delete mode 100755 debian/u-boot-rpi.install
 delete mode 100755 debian/u-boot-sifive.install
 mode change 100755 => 100644 debian/u-boot-sunxi.install
 delete mode 100755 debian/u-boot-tegra.install
 delete mode 100755 debian/u-boot.install

diff --git a/debian/bin/u-boot-install-targets b/debian/bin/u-boot-install-targets
deleted file mode 100755
index 2eee8e76f8..0000000000
--- a/debian/bin/u-boot-install-targets
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-target=$1
-subarch_install_file="debian/build/targets.${target}"
-if [ -f "${subarch_install_file}" ]; then
-    cat "${subarch_install_file}"
-fi
diff --git a/debian/bin/update-substvars b/debian/bin/update-substvars
deleted file mode 100755
index 667ebda7bd..0000000000
--- a/debian/bin/update-substvars
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-for file in debian/build/platforms.* ; do
-    subarch=$(echo ${file} | sed -e 's,.*platforms.,,g')
-    case "${subarch}" in
-	-) package=u-boot ;;
-	*) package=u-boot-${subarch} ;;
-    esac
-    echo $(LC_ALL=C sort -u ${file}) | \
-	sed -e 's, ,${Newline},g' \
-	-e 's,^,uboot:platforms=${Newline}Included platforms:${Newline},g' \
-	>> debian/${package}.substvars
-	case "${subarch}" in
-		rockchip|sunxi)
-			printf "uboot:Built-Using=$(dpkg-query -f '${source:Package} (= ${source:Version}) [arm64]' -W arm-trusted-firmware)\n"\
-				   >> debian/${package}.substvars
-			;;
-	esac
-done
diff --git a/debian/control b/debian/control
index 6f4cc17906..ff3e528e50 100644
--- a/debian/control
+++ b/debian/control
@@ -47,7 +47,9 @@ Description: A boot loader for embedded systems
  intended to be easy to port and to debug, and runs on many
  supported architectures, including PPC, ARM, MIPS, x86, m68k,
  NIOS, and Microblaze.
- ${uboot:platforms}
+ .
+ Included platforms:
+ ${u-boot:platforms}
 
 Package: u-boot-amlogic
 Architecture: arm64
@@ -62,7 +64,9 @@ Description: A boot loader for amlogic systems
  NIOS, and Microblaze.
  .
  This package includes boot loaders for various amlogic platforms.
- ${uboot:platforms}
+ .
+ Included platforms:
+ ${u-boot-amlogic:platforms}
 
 Package: u-boot-imx
 Architecture: armhf
@@ -78,7 +82,9 @@ Description: A boot loader for imx systems
  NIOS, and Microblaze.
  .
  This package includes boot loaders for various imx platforms.
- ${uboot:platforms}
+ .
+ Included platforms:
+ ${u-boot-imx:platforms}
 
 Package: u-boot-qemu
 Architecture: all
@@ -94,7 +100,9 @@ Description: A boot loader for qemu
  NIOS, and Microblaze.
  .
  This package includes boot loaders for qemu/kvm.
- ${uboot:platforms}
+ .
+ Included platforms:
+ ${u-boot-qemu:platforms}
 
 Package: u-boot-qcom
 Architecture: arm64
@@ -108,7 +116,9 @@ Description: A boot loader for qcom systems
  NIOS, and Microblaze.
  .
  This package includes boot loaders for various qcom platforms.
- ${uboot:platforms}
+ .
+ Included platforms:
+ ${u-boot-qcom:platforms}
 
 Package: u-boot-tegra
 Architecture: armhf arm64
@@ -124,7 +134,9 @@ Description: A boot loader for NVIDIA Tegra systems
  NIOS, and Microblaze.
  .
  This package includes boot loaders for various NVIDIA Tegra platforms.
- ${uboot:platforms}
+ .
+ Included platforms:
+ ${u-boot-tegra:platforms}
 
 Package: u-boot-omap
 Architecture: armhf
@@ -141,12 +153,14 @@ Description: A boot loader for omap systems
  .
  This package includes boot loaders for various omap and related
  platforms.
- ${uboot:platforms}
+ .
+ Included platforms:
+ ${u-boot-omap:platforms}
 
 Package: u-boot-sunxi
 Architecture: armhf arm64
 Multi-Arch: same
-Built-Using: ${uboot:Built-Using}
+Built-Using: ${u-boot-sunxi:Built-Using}
 Depends: ${misc:Depends}
 Recommends: arm-trusted-firmware [arm64], u-boot-tools [arm64]
 Breaks: u-boot (<< 2014.10~rc2+dfsg1-2~)
@@ -160,7 +174,9 @@ Description: A boot loader for sunxi systems
  .
  This package includes boot loaders for various Allwinner/sunxi
  platforms.
- ${uboot:platforms}
+ .
+ Included platforms:
+ ${u-boot-sunxi:platforms}
 
 Package: u-boot-exynos
 Architecture: armhf
@@ -174,7 +190,9 @@ Description: A boot loader for exynos systems
  NIOS, and Microblaze.
  .
  This package includes boot loaders for various Exynos platforms.
- ${uboot:platforms}
+ .
+ Included platforms:
+ ${u-boot-exynos:platforms}
 
 Package: u-boot-mvebu
 Architecture: arm64
@@ -188,12 +206,14 @@ Description: A boot loader for marvell systems
  NIOS, and Microblaze.
  .
  This package includes boot loaders for various Marvell platforms.
- ${uboot:platforms}
+ .
+ Included platforms:
+ ${u-boot-mvebu:platforms}
 
 Package: u-boot-rockchip
 Architecture: armhf arm64
 Multi-Arch: same
-Built-Using: ${uboot:Built-Using}
+Built-Using: ${u-boot-rockchip:Built-Using}
 Depends: ${misc:Depends}
 Recommends: python3, arm-trusted-firmware [arm64], u-boot-tools [arm64]
 Description: A boot loader for rockchip systems
@@ -204,7 +224,9 @@ Description: A boot loader for rockchip systems
  NIOS, and Microblaze.
  .
  This package includes boot loaders for various Rockchip platforms.
- ${uboot:platforms}
+ .
+ Included platforms:
+ ${u-boot-rockchip:platforms}
 
 Package: u-boot-rpi
 Architecture: armel armhf arm64
@@ -219,7 +241,9 @@ Description: A boot loader for Raspberry PI systems
  .
  This package includes boot loaders for various Raspberry PI
  platforms.
- ${uboot:platforms}
+ .
+ Included platforms:
+ ${u-boot-rpi:platforms}
 
 Package: u-boot-sifive
 Architecture: riscv64
@@ -234,7 +258,9 @@ Description: A boot loader for SiFive systems
  .
  This package includes boot loaders for various SiFive
  platforms.
- ${uboot:platforms}
+ .
+ Included platforms:
+ ${u-boot-sifive:platforms}
 
 Package: u-boot-tools
 Architecture: linux-any
diff --git a/debian/rules b/debian/rules
index 96453a5611..b207c032f1 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,9 +1,20 @@
 #!/usr/bin/make -f
 
+# Compile specific platforms:
+#   dpkg-architecture -aarmhf -c debian/rules novena u-boot-imx ..
+
+# Build local .debs restricted to specific platforms:
+#   DEB_BUILD_PROFILES=pkg.u-boot.notools fakeroot \
+#   dpkg-architecture -aarmhf -c debian/rules binary-arch \
+#   built_subarchs='u-boot-rockchip ..' \
+#   u-boot-rockchip_platforms='puma-rk3399 ..'
+
 include /usr/share/dpkg/architecture.mk
 include /usr/share/dpkg/pkg-info.mk
 export DEBIAN_REVISION ?= $(shell echo $(DEB_VERSION) | sed -e 's,.*+dfsg,+dfsg,')
 
+include debian/targets.mk
+
 ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
 CROSS_COMPILE ?= $(DEB_HOST_GNU_TYPE)-
 cross_build_tools ?= y
@@ -24,94 +35,69 @@ LDFLAGS := $(patsubst -Wl$(comma)%,%,$(LDFLAGS))
 
 notools := $(filter pkg.uboot.notools,$(DEB_BUILD_PROFILES))
 
+# Select the subarchs for DEB_HOST_ARCH
+all_subarchs := $(shell dh_listpackages --arch --no-package=u-boot-tools)
+# DEB_BUILD_PROFILES=pkg.uboot.subarch.SUBARCH may
 # limit builds to only certain subarchitectures
 # e.g. pkg.uboot.subarch.rockchip will only build rockchip targets.
 ifeq (,$(filter pkg.uboot.subarch.%,$(DEB_BUILD_PROFILES)))
-TARGETSUBARCH = .
+  built_subarchs := $(all_subarchs)
 else
-TARGETSUBARCH = $(patsubst pkg.uboot.subarch.%,%,$(filter pkg.uboot.subarch.%,$(DEB_BUILD_PROFILES)))
+  built_subarchs := $(patsubst pkg.uboot.subarch.%,u-boot-%,$(filter pkg.uboot.subarch.%,$(DEB_BUILD_PROFILES)))
 endif
 
 %:
-	dh $@
-
-configs/novena-rawsd_defconfig: configs/novena_defconfig
-	sed -e 's,CONFIG_SPL_FS_FAT=y,# CONFIG_SPL_FS_FAT is not set,' \
-		configs/novena_defconfig > configs/novena-rawsd_defconfig
+  # The -N options prevents a lots of warnings about obviously missing files.
+	dh $@ $(addprefix -N,$(filter-out $(built_subarchs),$(all_subarchs)))
 
-configs/am335x_boneblack_defconfig: configs/am335x_evm_defconfig
-	sed -e 's,CONFIG_OF_LIST=.*,CONFIG_OF_LIST="am335x-evm am335x-boneblack",g' \
-		configs/am335x_evm_defconfig > configs/am335x_boneblack_defconfig
-
-override_dh_auto_build-arch: TARGETARCH := $(DEB_HOST_ARCH)
-override_dh_auto_build-arch: build-targets
+override_dh_auto_build-indep: u-boot-qemu
+override_dh_auto_build-arch: $(built_subarchs)
 ifeq ($(notools),)
   override_dh_auto_build-arch: build-tools
 endif
 
-override_dh_auto_build-indep: TARGETARCH := all
-override_dh_auto_build-indep: build-targets
-
-build-targets: configs/novena-rawsd_defconfig configs/am335x_boneblack_defconfig
-	echo run build-targets for $(TARGETARCH)
-	set -e; grep ^$(TARGETARCH)[^a-z0-9] debian/targets \
-	    | grep $(TARGETSUBARCH) \
-	    | while read arch subarch platform bl31 targets; do \
-	        builddir=debian/build/$$platform; \
-		case $$bl31 in \
-			/usr/lib/arm-trusted-firmware/*) export BL31=$$bl31 ;; \
-			*) targets="$$bl31 $$targets" ;; \
-		esac; \
-		case $$platform in \
-			novena-rawsd) targets="$$targets" ;\
-				;; \
-			*) targets="$$targets uboot.elf" ;\
-				;; \
-		esac;\
-		case $$subarch in \
-			-) subpackage="u-boot" ;\
-				;; \
-			*) subpackage="u-boot-$$subarch" ;\
-				;; \
-		esac;\
-		case $$arch in \
-			all:armhf) export CROSS_COMPILE=arm-linux-gnueabihf- ;;\
-			all:arm64) export CROSS_COMPILE=aarch64-linux-gnu- ;;\
-			all:mips) export CROSS_COMPILE=mips-linux-gnu- ;;\
-			all:mipsel) export CROSS_COMPILE=mipsel-linux-gnu- ;;\
-			all:mips64el) export CROSS_COMPILE=mips64el-linux-gnuabi64- ;;\
-			all:powerpc) export CROSS_COMPILE=powerpc-linux-gnu- ;;\
-			all:riscv64) export CROSS_COMPILE=riscv64-linux-gnu- ;;\
-			all:i386) export CROSS_COMPILE=i686-linux-gnu- ;;\
-			all:amd64) export CROSS_COMPILE=x86_64-linux-gnu- ;;\
-			*) ;; \
-		esac;\
-		case $$subarch in \
-			sunxi) export SCP=/dev/null ;;\
-			*) unset SCP ;;\
-		esac;\
-		mkdir -p $$builddir; \
-		dh_auto_build -- V=$(VERBOSE) O=$$builddir $${platform}_defconfig; \
-		sed -i -e 's,CONFIG_FIT_SIGNATURE=y,# CONFIG_FIT_SIGNATURE is not set,g' $$builddir/.config; \
-		dh_auto_build -- V=$(VERBOSE) O=$$builddir; \
-		case "$$targets" in \
-			*uboot.elf*) \
-				install -m 644 $$builddir/u-boot $$builddir/uboot.elf; \
-				$${CROSS_COMPILE}strip --remove-section=.comment \
-					--remove-section=.note \
-					$$builddir/uboot.elf; \
-				;; \
-		esac; \
-		for target in $$targets; do \
-			chmod -x $$builddir/$$target; \
-			echo $$builddir/$$target /usr/lib/u-boot/$$platform/ \
-				>> debian/build/targets.$$subarch; \
-			echo $$platform >> debian/build/platforms.$$subarch; \
-		done ; \
-		cp $$builddir/.config $$builddir/config.$$platform; \
-		echo $$builddir/config.$$platform /usr/share/doc/$$subpackage/configs/ \
-			>> debian/build/targets.$$subarch; \
-	done
+# These intermediate per-package targets are convenient to add
+# prerequisites to a subarch, but they are empty by default so we need
+# to prevent Make applying the default %: recipe above.
+.PHONY: u-boot-qemu $(built_subarchs)
+
+define build_template
+
+  # Tell Make to build the platform as part of the package.
+  $(package): $(platform)
+
+  # Qemu platforms set $(platform)_CROSS_COMPILE.
+  $(platform):
+	# debian/rules: building platform: $(platform)
+	mkdir -p debian/build/$(platform)
+
+	$($(package)_exports) $($(platform)_exports) \
+	dh_auto_build -- V=$(VERBOSE) O=debian/build/$(platform) \
+	  CROSS_COMPILE=$(or $($(platform)_CROSS_COMPILE),$(CROSS_COMPILE)) \
+	  $(platform)_defconfig
+	sed -i 's,CONFIG_FIT_SIGNATURE=y,# CONFIG_FIT_SIGNATURE is not set,' debian/build/$(platform)/.config
+	$($(package)_exports) $($(platform)_exports) \
+	dh_auto_build -- V=$(VERBOSE) O=debian/build/$(platform) \
+	  CROSS_COMPILE=$(or $($(platform)_CROSS_COMPILE),$(CROSS_COMPILE)) all
+
+    ifneq (,$(filter uboot.elf,$($(platform)_targets)))
+	cp -u debian/build/$(platform)/u-boot debian/build/$(platform)/uboot.elf
+    endif
+    ifeq ($(package),u-boot-qemu)
+      # TODO: --strip-unneeded as policy recommends? If not, why?
+	$($(platform)_CROSS_COMPILE)strip --remove-section=.comment --remove-section=.note \
+	  debian/build/$(platform)/uboot.elf
+    endif
+    # Upstream generates executable targets (last checked with 2020-10).
+	chmod -x $(addprefix debian/build/$(platform)/,$($(platform)_targets))
+
+  install-$(platform):
+	dh_install -p$(package) $(addprefix debian/build/$(platform)/,$($(platform)_targets)) usr/lib/u-boot/$(platform)
+
+endef
+$(foreach package, u-boot-qemu $(built_subarchs),\
+  $(foreach platform, $($(package)_platforms),\
+    $(eval $(build_template))))
 
 TOOLSDIR := debian/build/tools
 build-tools:
@@ -134,14 +120,27 @@ override_dh_auto_test-indep:
 # Do not spend time searching for an install target in Makefile.
 override_dh_auto_install:
 
+# override_ would require to test notools, which is unrelated.
+execute_after_dh_install-indep: $(addprefix install-,$(u-boot-qemu_platforms))
+execute_after_dh_install-arch: $(addprefix install-,$(foreach package,$(built_subarchs),$($(package)_platforms)))
+
+# override_ would require to test notools, which is unrelated.
+execute_after_dh_installdocs-indep: installdocs-u-boot-qemu
+execute_after_dh_installdocs-arch: $(addprefix installdocs-,$(built_subarchs))
+installdocs-%:
+	mkdir -p debian/build/$*/configs
+	for platform in $($*_platforms); do \
+	  cp -u debian/build/$$platform/.config debian/build/$*/configs/config.$$platform; \
+	done
+	dh_installdocs -p$* debian/build/$*/configs
+
 override_dh_clean:
 	rm -rf debian/build/
-	rm -f configs/novena-rawsd_defconfig
-	rm -f configs/am335x_boneblack_defconfig
 	rm -f linux.itb linux.its
-	dh_clean
+	dh_clean $(dh_clean_args)
 	find . -type d -name __pycache__ -delete
 
 override_dh_gencontrol:
-	debian/bin/update-substvars
-	dh_gencontrol
+	dh_gencontrol -- $(dpkg-gencontrol_args) $(foreach package,\
+	  u-boot-qemu $(built_subarchs),\
+	  '-V$(package):platforms=$(subst $() ,$${Newline},$($(package)_platforms))')
diff --git a/debian/targets.mk b/debian/targets.mk
index f76086b8c0..b28ba252f5 100644
--- a/debian/targets.mk
+++ b/debian/targets.mk
@@ -38,6 +38,16 @@ u-boot-qcom_platforms := dragonboard410c dragonboard820c
 
 u-boot-rockchip_platforms := firefly-rk3399 pinebook-pro-rk3399 rockpro64-rk3399 rock64-rk3328 puma-rk3399 rock-pi-4-rk3399
 
+  dpkg-gencontrol_args += "-Vu-boot-rockchip:Built-Using=$(shell dpkg-query -Wf \
+    '$${source:Package} (= $${source:Version})' arm-trusted-firmware)"
+
+  u-boot-rockchip: debian/build/rockchip_make_fit_atf
+  debian/build/rockchip_make_fit_atf: arch/arm/mach-rockchip/make_fit_atf.py
+	mkdir -p debian/build
+	sed '1 s,/usr/bin/env python.*,/usr/bin/python3,' \
+	  arch/arm/mach-rockchip/make_fit_atf.py > debian/build/rockchip_make_fit_atf
+	chmod +x debian/build/rockchip_make_fit_atf
+
   # Vagrant Cascadian <[email protected]>
   firefly-rk3399_exports := BL31=/usr/lib/arm-trusted-firmware/rk3399/bl31.elf
   firefly-rk3399_targets := arch/arm/dts/rk3399-firefly.dtb idbloader.img spl/u-boot-spl.bin u-boot-nodtb.bin u-boot.bin u-boot.img u-boot.itb uboot.elf
@@ -76,6 +86,11 @@ u-boot-rpi_platforms := rpi_3 rpi_4 rpi_arm64
 
 u-boot-sunxi_platforms := a64-olinuxino a64-olinuxino-emmc nanopi_neo2 nanopi_neo_plus2 orangepi_zero_plus2 orangepi_one_plus pine64_plus pine64-lts pinebook pinephone teres_i
 
+  u-boot-sunxi_exports := SCP=/dev/null
+
+  dpkg-gencontrol_args += "-Vu-boot-sunxi:Built-Using=$(shell dpkg-query -Wf \
+    '$${source:Package} (= $${source:Version})' arm-trusted-firmware)"
+
   # Rodrigo Exterckötter Tjäder <[email protected]>
   a64-olinuxino_exports := 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
@@ -187,6 +202,12 @@ u-boot-imx_platforms := dh_imx6 mx53loco mx6cuboxi mx6qsabrelite nitrogen6q nove
   # Vagrant Cascadian <[email protected]>
   novena-rawsd_targets := SPL
 
+  novena-rawsd: configs/novena-rawsd_defconfig
+  configs/novena-rawsd_defconfig: configs/novena_defconfig
+	sed -e 's,CONFIG_SPL_FS_FAT=y,# CONFIG_SPL_FS_FAT is not set,' \
+		configs/novena_defconfig > configs/novena-rawsd_defconfig
+  dh_clean_args += configs/novena-rawsd_defconfig
+
   # Michael Fladischer <[email protected]>
   udoo_targets := SPL u-boot.img uboot.elf
 
@@ -203,6 +224,12 @@ u-boot-omap_platforms := am335x_boneblack am335x_evm am57xx_evm dra7xx_evm igep0
   # Andrew M.A. Cater <[email protected]>
   am335x_boneblack_targets := MLO u-boot.img uboot.elf
 
+  am335x_boneblack: configs/am335x_boneblack_defconfig
+  configs/am335x_boneblack_defconfig: configs/am335x_evm_defconfig
+	sed -e 's,CONFIG_OF_LIST=.*,CONFIG_OF_LIST="am335x-evm am335x-boneblack",g' \
+		configs/am335x_evm_defconfig > configs/am335x_boneblack_defconfig
+  dh_clean_args += configs/am335x_boneblack_defconfig
+
   # Vagrant Cascadian <[email protected]>
   # Andrew M.A. Cater <[email protected]>
   am335x_evm_targets := MLO u-boot.img uboot.elf
@@ -225,6 +252,17 @@ u-boot-omap_platforms := am335x_boneblack am335x_evm am57xx_evm dra7xx_evm igep0
 
 u-boot-rockchip_platforms := firefly-rk3288
 
+  # Silent a debhelper warning about an unused substvar.
+  dpkg-gencontrol_args += -Vu-boot-rockchip:Built-Using=
+
+  # https://bugs.debian.org/cgi-bin/bugreport.cgi?att=0;bug=979483;msg=22
+  u-boot-rockchip: debian/build/rockchip_make_fit_atf
+  debian/build/rockchip_make_fit_atf: arch/arm/mach-rockchip/make_fit_atf.py
+	mkdir -p debian/build
+	sed '1 s,/usr/bin/env python.*,/usr/bin/python3,' \
+	  arch/arm/mach-rockchip/make_fit_atf.py > debian/build/rockchip_make_fit_atf
+	chmod +x debian/build/rockchip_make_fit_atf
+
   # Vagrant Cascadian <[email protected]>, 2GB and 4GB variants
   firefly-rk3288_targets := idbloader.img spl/u-boot-spl.bin u-boot.bin u-boot.img uboot.elf
 
@@ -242,6 +280,11 @@ u-boot-rpi_platforms := rpi_2 rpi_3_32b rpi_4_32b
 
 u-boot-sunxi_platforms := A10-OLinuXino-Lime A10s-OLinuXino-M A20-Olimex-SOM-EVB A20-OLinuXino-Lime A20-OLinuXino-Lime2 A20-OLinuXino-Lime2-eMMC A20-OLinuXino_MICRO Bananapi Bananapro bananapi_m2_berry Bananapi_M2_Ultra CHIP Cubieboard Cubieboard2 Cubieboard4 Cubietruck Cubietruck_plus Lamobo_R1 Linksprite_pcDuino Linksprite_pcDuino3 Mini-X nanopi_neo nanopi_neo_air orangepi_plus orangepi_zero Sinovoip_BPI_M3
 
+  u-boot-sunxi_exports := SCP=/dev/null
+
+  # Silent a debhelper warning about an unused substvar.
+  dpkg-gencontrol_args += -Vu-boot-sunxi:Built-Using=
+
   # Christian Kastner <[email protected]>
   A10-OLinuXino-Lime_targets := u-boot-sunxi-with-spl.bin uboot.elf
 
diff --git a/debian/u-boot-amlogic.install b/debian/u-boot-amlogic.install
deleted file mode 100755
index 17ec78ee51..0000000000
--- a/debian/u-boot-amlogic.install
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-debian/bin/u-boot-install-targets amlogic
diff --git a/debian/u-boot-exynos.install b/debian/u-boot-exynos.install
deleted file mode 100755
index e4408cf003..0000000000
--- a/debian/u-boot-exynos.install
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-debian/bin/u-boot-install-targets exynos
diff --git a/debian/u-boot-imx.install b/debian/u-boot-imx.install
deleted file mode 100755
index cc4eb34ec3..0000000000
--- a/debian/u-boot-imx.install
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-debian/bin/u-boot-install-targets imx
diff --git a/debian/u-boot-mvebu.install b/debian/u-boot-mvebu.install
deleted file mode 100755
index 96c98cef78..0000000000
--- a/debian/u-boot-mvebu.install
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-debian/bin/u-boot-install-targets mvebu
diff --git a/debian/u-boot-omap.install b/debian/u-boot-omap.install
deleted file mode 100755
index 8a9873e043..0000000000
--- a/debian/u-boot-omap.install
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-debian/bin/u-boot-install-targets omap
diff --git a/debian/u-boot-qcom.install b/debian/u-boot-qcom.install
deleted file mode 100755
index 0ff7e5bfac..0000000000
--- a/debian/u-boot-qcom.install
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-debian/bin/u-boot-install-targets qcom
diff --git a/debian/u-boot-qemu.install b/debian/u-boot-qemu.install
deleted file mode 100755
index 5dca5d720e..0000000000
--- a/debian/u-boot-qemu.install
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-debian/bin/u-boot-install-targets qemu
diff --git a/debian/u-boot-rockchip.install b/debian/u-boot-rockchip.install
old mode 100755
new mode 100644
index 89856b7c6c..11988d2d4d
--- a/debian/u-boot-rockchip.install
+++ b/debian/u-boot-rockchip.install
@@ -1,6 +1,2 @@
-#!/bin/sh
-debian/bin/u-boot-install-targets rockchip
-cp arch/arm/mach-rockchip/make_fit_atf.py debian/build/rockchip_make_fit_atf
-sed -i -e 's,/usr/bin/env python.*,/usr/bin/python3,g' debian/build/rockchip_make_fit_atf
-echo debian/build/rockchip_make_fit_atf /usr/bin/
-echo debian/bin/u-boot-install-rockchip /usr/bin/
+debian/bin/u-boot-install-rockchip      usr/bin
+debian/build/rockchip_make_fit_atf      usr/bin
diff --git a/debian/u-boot-rpi.install b/debian/u-boot-rpi.install
deleted file mode 100755
index 36cbec1358..0000000000
--- a/debian/u-boot-rpi.install
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-debian/bin/u-boot-install-targets rpi
diff --git a/debian/u-boot-sifive.install b/debian/u-boot-sifive.install
deleted file mode 100755
index 5b20c3f900..0000000000
--- a/debian/u-boot-sifive.install
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-debian/bin/u-boot-install-targets sifive
diff --git a/debian/u-boot-sunxi.install b/debian/u-boot-sunxi.install
old mode 100755
new mode 100644
index ad5a39aa6f..c739d234d1
--- a/debian/u-boot-sunxi.install
+++ b/debian/u-boot-sunxi.install
@@ -1,4 +1 @@
-#!/bin/sh
-debian/bin/u-boot-install-targets sunxi
-
-echo debian/bin/u-boot-install-sunxi /usr/bin/
+debian/bin/u-boot-install-sunxi         usr/bin
diff --git a/debian/u-boot-tegra.install b/debian/u-boot-tegra.install
deleted file mode 100755
index 15b8ab96d9..0000000000
--- a/debian/u-boot-tegra.install
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-debian/bin/u-boot-install-targets tegra
diff --git a/debian/u-boot.install b/debian/u-boot.install
deleted file mode 100755
index aff6d5de57..0000000000
--- a/debian/u-boot.install
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-debian/bin/u-boot-install-targets -
-- 
2.20.1

>From 6125bcad5ed1b8111780d42962a4de1cbef34e82 Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Thu, 14 Jan 2021 09:47:43 +0100
Subject: [PATCH 4/4] Remove the pkg.u-boot.subarch.* profiles

The new packaging is more flexible.
---
 debian/rules | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/debian/rules b/debian/rules
index b207c032f1..3331ebffe5 100755
--- a/debian/rules
+++ b/debian/rules
@@ -37,14 +37,8 @@ notools := $(filter pkg.uboot.notools,$(DEB_BUILD_PROFILES))
 
 # Select the subarchs for DEB_HOST_ARCH
 all_subarchs := $(shell dh_listpackages --arch --no-package=u-boot-tools)
-# DEB_BUILD_PROFILES=pkg.uboot.subarch.SUBARCH may
-# limit builds to only certain subarchitectures
-# e.g. pkg.uboot.subarch.rockchip will only build rockchip targets.
-ifeq (,$(filter pkg.uboot.subarch.%,$(DEB_BUILD_PROFILES)))
-  built_subarchs := $(all_subarchs)
-else
-  built_subarchs := $(patsubst pkg.uboot.subarch.%,u-boot-%,$(filter pkg.uboot.subarch.%,$(DEB_BUILD_PROFILES)))
-endif
+# This variable is intended for command line override:
+built_subarchs := $(all_subarchs)
 
 %:
   # The -N options prevents a lots of warnings about obviously missing files.
-- 
2.20.1

Reply via email to