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

Hello.
The suggested style changes do not make sense in unstable during the
freeze, but may in experimental.
The diffs attached to intermediate steps
  980236 980360 980362 980359 980358 980361 980363
apply to 2021.04-rc3+dfsg-1.
The attached rebased diffs then apply on the result.
The changes are tightly connected, but order matters because they
modify the same parts.
>From efd022aa8b27fa317653dc6f3c036a20c8984a8f Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <nico...@debian.org>
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 | 101 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 101 insertions(+)
 create mode 100644 debian/targets.py

diff --git a/debian/targets.py b/debian/targets.py
new file mode 100644
index 0000000000..69355efd58
--- /dev/null
+++ b/debian/targets.py
@@ -0,0 +1,101 @@
+#!/usr/bin/python3
+
+# 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.')
+
+def format_targets (platform : str,
+                    targets  : list):
+    s = f'  {platform}_targets :='
+    print (s, end='')
+    col = len (s)
+    for t in sorted (targets):
+        if 75 < col + len (t):
+            print (' \\')
+            print ('    ', end='')
+            col = 4
+        s = f' {t}'
+        print (s, end='')
+        col += len (s)
+    print ('')
+
+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]
+    for package in sorted (packages.keys ()):
+        print ('')
+        print (f'# {package}')
+        platforms = packages [package]
+        for platform in sorted (platforms.keys ()):
+            targets, maintainers = platforms [platform]
+            print ('')
+            for maintainer in maintainers:
+                print (f'  {maintainer}')
+            print (f'  {package}_platforms += {platform}')
+            if targets [0].startswith ('/usr/lib/arm-trusted-firmware/'):
+                print (f'  {platform}_assigns := BL31={targets.pop (0)}')
+            if platform != 'novena-rawsd':
+                targets.append ('uboot.elf')
+            format_targets (platform, targets)
+
+print ('')
+print ('endif')
+
+print ('')
+print ('# u-boot-qemu (Architecture: all)')
+for platform in sorted (qemu.keys ()):
+    arch, targets = qemu [platform]
+    print ('')
+    print (f'  u-boot-qemu_platforms += {platform}')
+    gnu_type = arch[4:]
+    print (f'  {platform}_CROSS_COMPILE := {gnu_type}-')
+    targets.append ('uboot.elf')
+    format_targets (platform, targets)
-- 
2.30.2

>From ef0310e2b488ad2042abf1ec0965ae162ff9296a Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <nico...@debian.org>
Date: Mon, 18 Jan 2021 08:25:05 +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    | 284 -------------------------
 debian/targets.mk | 513 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 513 insertions(+), 284 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 01263b6541..0000000000
--- a/debian/targets
+++ /dev/null
@@ -1,284 +0,0 @@
-# ARCH	subarch		platform	target
-# --------------------------------------------
-armel	-		dockstar	u-boot.kwb
-
-# Ian Campbell <i...@debian.org>
-armel	-		dreamplug	u-boot.kwb
-
-# drEagle <drea...@doukki.net>
-armel	-		guruplug	u-boot.kwb
-
-# Vagrant Cascadian <vagr...@debian.org>, rpi B 256M
-armel	rpi		rpi		u-boot.bin
-
-# Romain Perier <romain.per...@gmail.com>, rpi zero w
-armel	rpi		rpi_0_w		u-boot.bin
-
-# drEagle <drea...@doukki.net>
-# Rick Thomas <rbtho...@rcthomas.org>
-armel	-		sheevaplug	u-boot.kwb
-
-armhf	exynos		arndale		u-boot.bin spl/arndale-spl.bin
-
-# Joost van Zwieten <joostvanzwie...@gmail.com>, Odroid-U3
-armhf	exynos		odroid		u-boot.bin
-
-# Vagrant Cascadian <vagr...@debian.org>, Odroid-XU4
-armhf	exynos		odroid-xu3	u-boot.bin
-
-# Marek Vasut <ma...@denx.de>
-armhf	imx		dh_imx6		u-boot-with-spl.imx
-
-# Robert Nelson <robertcnel...@gmail.com>
-armhf	imx		mx53loco	u-boot.imx
-
-# Steve Langasek <vor...@debian.org>, CuBox-i4
-# Vagrant Cascadian <vagr...@debian.org>, CuBox-i4pro, Cubox-i4x4, hummingboard-i1, hummingboard-i2ex
-# Rainer Dorsch <m...@bokomoko.de>, CuBox-i2u (i2u-300-d)
-# Rick Thomas <rbtho...@pobox.com>, Cubox-i4x4, Cubox-i4PRO
-armhf	imx		mx6cuboxi	u-boot.img SPL
-
-# Martyn Welch <martyn.we...@collabora.com>
-armhf	imx		mx6qsabrelite	u-boot-dtb.imx
-
-# Hector Oron <zu...@debian.org>
-armhf	imx		nitrogen6q	u-boot-dtb.imx
-
-# Vagrant Cascadian <vagr...@debian.org>
-armhf	imx		novena		u-boot.img SPL
-armhf	imx		novena-rawsd SPL
-
-# Michael Fladischer <mich...@fladi.at>
-armhf	imx		udoo		u-boot.img SPL
-
-# Vagrant Cascadian <vagr...@debian.org>
-armhf	imx		usbarmory	u-boot.imx
-
-# Vagrant Cascadian <vagr...@debian.org>
-# Robert Nelson <robertcnel...@gmail.com>
-armhf	imx		wandboard	u-boot.img SPL
-
-# Vagrant Cascadian <vagr...@debian.org>
-# Andrew M.A. Cater <amaca...@galactic.demon.co.uk>
-armhf	omap		am335x_boneblack u-boot.img MLO
-armhf	omap		am335x_evm u-boot.img MLO
-
-# Vagrant Cascadian <vagr...@debian.org>
-armhf	omap		am57xx_evm	u-boot.img MLO
-
-armhf 	omap		dra7xx_evm	u-boot.img MLO
-
-# Robert Nelson <robertcnel...@gmail.com>
-armhf	omap		igep00x0	u-boot.img MLO
-
-armhf	omap		nokia_rx51	u-boot.bin
-
-# Robert Nelson <robertcnel...@gmail.com>
-armhf	omap		omap3_beagle	u-boot.img MLO
-
-# Robert Nelson <robertcnel...@gmail.com>
-armhf	omap		omap4_panda	u-boot.img MLO
-
-# Vagrant Cascadian <vagr...@debian.org>, 2GB and 4GB variants
-armhf	rockchip	firefly-rk3288		u-boot.bin u-boot.img spl/u-boot-spl.bin idbloader.img
-
-# Vagrant Cascadian <vagr...@debian.org>, Raspberry PI 2B
-armhf	rpi		rpi_2		u-boot.bin
-
-# Ryan Finnie <r...@finnie.org>
-armhf	rpi		rpi_3_32b	u-boot.bin
-
-# Lucas Nussbaum <lu...@debian.org>
-# Andreas Henriksson <andr...@fatal.se>
-armhf	rpi		rpi_4_32b	u-boot.bin
-
-# Christian Kastner <deb...@kvr.at>
-armhf	sunxi		A10-OLinuXino-Lime	u-boot-sunxi-with-spl.bin
-
-# Benedikt Wildenhain <espera...@benedikt-wildenhain.de>
-armhf	sunxi		A10s-OLinuXino-M	u-boot-sunxi-with-spl.bin
-
-# Karsten Merker <mer...@debian.org>
-armhf	sunxi		A20-Olimex-SOM-EVB	u-boot-sunxi-with-spl.bin
-
-# Christian Kastner <deb...@kvr.at>
-armhf	sunxi		A20-OLinuXino-Lime	u-boot-sunxi-with-spl.bin
-
-# Karsten Merker <mer...@debian.org>
-armhf	sunxi		A20-OLinuXino-Lime2	u-boot-sunxi-with-spl.bin
-
-# Andreas B. Mundt <a...@debian.org>
-armhf	sunxi		A20-OLinuXino-Lime2-eMMC	u-boot-sunxi-with-spl.bin
-
-# Arne Ploese <aplo...@gmx.de>
-armhf  sunxi		A20-OLinuXino_MICRO	u-boot-sunxi-with-spl.bin
-
-# Ian Campbell <i...@debian.org>
-# Vagrant Cascadian <vagr...@debian.org>
-armhf	sunxi		Bananapi	u-boot-sunxi-with-spl.bin
-
-# Karsten Merker <mer...@debian.org>
-armhf	sunxi		Bananapro	u-boot-sunxi-with-spl.bin
-
-# Lucas Nussbaum <lu...@debian.org>
-armhf   sunxi           bananapi_m2_berry u-boot-sunxi-with-spl.bin
-
-# Bernhard Wörner <bewoe...@gmail.com>
-armhf   sunxi           Bananapi_M2_Ultra u-boot-sunxi-with-spl.bin
-
-# Vagrant Cascadian <vagr...@debian.org>
-armhf	sunxi		CHIP		u-boot-sunxi-with-spl.bin
-
-# Vagrant Cascadian <vagr...@debian.org>
-armhf	sunxi		Cubieboard	u-boot-sunxi-with-spl.bin
-
-# Ian Campbell <i...@debian.org>
-# Karsten Merker <mer...@debian.org>
-armhf	sunxi		Cubieboard2	u-boot-sunxi-with-spl.bin
-
-# Vagrant Cascadian <vagr...@debian.org>
-armhf	sunxi		Cubieboard4	u-boot-sunxi-with-spl.bin
-
-# Ian Campbell <i...@debian.org>
-# Robert Nelson <robertcnel...@gmail.com>
-# Karsten Merker <mer...@debian.org>
-armhf	sunxi		Cubietruck	u-boot-sunxi-with-spl.bin
-
-# Vagrant Cascadian <vagr...@debian.org>
-armhf	sunxi		Cubietruck_plus	u-boot-sunxi-with-spl.bin
-
-# Vagrant Cascadian <vagr...@debian.org>
-armhf	sunxi		Lamobo_R1	u-boot-sunxi-with-spl.bin
-
-# Robert Hegner <rheg...@hsr.ch>
-armhf	sunxi		Linksprite_pcDuino	u-boot-sunxi-with-spl.bin
-
-# Patrice Go <patgsios...@gmail.com>
-armhf	sunxi		Linksprite_pcDuino3	u-boot-sunxi-with-spl.bin
-
-# Jochen Sprickerhof <deb...@jochen.sprickerhof.de>
-armhf	sunxi		Mini-X	u-boot-sunxi-with-spl.bin
-
-# Paul Tagliamonte <paul...@debian.org>
-armhf	sunxi		nanopi_neo	u-boot-sunxi-with-spl.bin
-
-# Philip Hands <p...@hands.com>
-armhf	sunxi		nanopi_neo_air	u-boot-sunxi-with-spl.bin
-
-# Vagrant Cascadian <vagr...@debian.org>, Orange PI Plus2
-armhf	sunxi		orangepi_plus	u-boot-sunxi-with-spl.bin
-
-# Mateusz Łukasik <mat...@linuxmint.pl>, Orange PI Zero
-armhf	sunxi		orangepi_zero	u-boot-sunxi-with-spl.bin
-
-# Bernhard <bewoe...@gmail.com>
-armhf	sunxi		Sinovoip_BPI_M3	u-boot-sunxi-with-spl.bin
-
-# Ian Campbell <i...@debian.org>
-armhf	tegra		jetson-tk1	u-boot-tegra.bin
-
-# Neil Armstrong <narmstr...@baylibre.com>
-arm64	amlogic		khadas-vim	u-boot.bin
-arm64	amlogic		khadas-vim2	u-boot.bin
-
-# Frederic Danis <frederic.da...@collabora.com>
-arm64	amlogic		libretech-cc	u-boot.bin
-
-# Neil Armstrong <narmstr...@baylibre.com>
-arm64	amlogic		nanopi-k2	u-boot.bin
-
-# Vagrant Cascadian <vagr...@debian.org>
-arm64	amlogic		odroid-c2	u-boot.bin
-
-# Reco <b...@enotuniq.net>
-arm64	amlogic		odroid-n2	u-boot.bin
-
-# Vagrant Cascadian <vagr...@debian.org>
-arm64	  mvebu		mvebu_espressobin-88f3720	u-boot.bin arch/arm/dts/armada-3720-espressobin.dtb
-
-# Riku Voipio <riku.voi...@linaro.org>
-arm64	qcom		dragonboard410c	u-boot.bin
-arm64	qcom		dragonboard820c	u-boot.bin
-
-# Vagrant Cascadian <vagr...@debian.org>
-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 <vagr...@debian.org>
-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 <vagr...@debian.org>
-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 <vagr...@debian.org>
-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 <vagr...@debian.org>
-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 u-boot.itb idbloader.img
-
-# Walter Lozano <walter.loz...@collabora.com>
-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 <r...@finnie.org>
-arm64	rpi		rpi_3		u-boot.bin
-
-# Lucas Nussbaum <lu...@debian.org>
-# Andreas Henriksson <andr...@fatal.se>
-arm64	rpi		rpi_4		u-boot.bin
-
-# Denis Pynkin <denis.pyn...@collabora.com>
-arm64	rpi		rpi_arm64	u-boot.bin
-
-# Rodrigo Exterckötter Tjäder <rodr...@tjader.xyz>
-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 <ri...@inventati.org>
-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 <ca...@debian.org>
-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 <st...@kali.org>
-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 <frederic.da...@collabora.com>
-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
-
-# harr...@gmx.ph
-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 <vagr...@debian.org>
-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 <su...@medhas.org>
-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 <vagr...@debian.org>
-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 <benoit.delc...@gmail.com> (1.2)
-# Arnaud Ferraris <arnaud.ferra...@collabora.com> (1.1, 1.2)
-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.1.dtb arch/arm/dts/sun50i-a64-pinephone-1.2.dtb u-boot-sunxi-with-spl.fit.itb
-
-# Arnaud Ferraris <arnaud.ferra...@collabora.com>
-arm64	sunxi		pinetab		/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-pinetab.dtb u-boot-sunxi-with-spl.fit.itb
-
-# Jonas Smedegaard <d...@jones.dk>
-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 <vagr...@debian.org>
-arm64	tegra		p2371-2180	u-boot.bin
-
-avr32	-		hammerhead	u-boot.img
-
-# Hector Oron <zu...@debian.org>
-riscv64	sifive	sifive_fu540	u-boot.bin
-
-sh4	-		r2dplus		u-boot.bin
-
-all:x86_64-linux-gnu	qemu	qemu-x86_64	u-boot.bin u-boot.rom
-all:arm-linux-gnueabihf	qemu	qemu_arm	u-boot.bin
-all:aarch64-linux-gnu	qemu	qemu_arm64	u-boot.bin
-all:i686-linux-gnu	qemu	qemu-x86	u-boot.bin u-boot.rom
-all:powerpc-linux-gnu	qemu	qemu-ppce500	u-boot.bin
-all:riscv64-linux-gnu	qemu	qemu-riscv64	u-boot.bin
-all:riscv64-linux-gnu	qemu	qemu-riscv64_smode	u-boot.bin
diff --git a/debian/targets.mk b/debian/targets.mk
new file mode 100644
index 0000000000..bb48f19913
--- /dev/null
+++ b/debian/targets.mk
@@ -0,0 +1,513 @@
+# Target architectures supported by u-boot in Debian.
+# debian/rules includes this Makefile snippet.
+
+ifeq (${DEB_HOST_ARCH},arm64)
+
+# u-boot-amlogic
+
+  # Neil Armstrong <narmstr...@baylibre.com>
+  u-boot-amlogic_platforms += khadas-vim
+  khadas-vim_targets := u-boot.bin uboot.elf
+
+  # Neil Armstrong <narmstr...@baylibre.com>
+  u-boot-amlogic_platforms += khadas-vim2
+  khadas-vim2_targets := u-boot.bin uboot.elf
+
+  # Frederic Danis <frederic.da...@collabora.com>
+  u-boot-amlogic_platforms += libretech-cc
+  libretech-cc_targets := u-boot.bin uboot.elf
+
+  # Neil Armstrong <narmstr...@baylibre.com>
+  u-boot-amlogic_platforms += nanopi-k2
+  nanopi-k2_targets := u-boot.bin uboot.elf
+
+  # Vagrant Cascadian <vagr...@debian.org>
+  u-boot-amlogic_platforms += odroid-c2
+  odroid-c2_targets := u-boot.bin uboot.elf
+
+  # Reco <b...@enotuniq.net>
+  u-boot-amlogic_platforms += odroid-n2
+  odroid-n2_targets := u-boot.bin uboot.elf
+
+# u-boot-mvebu
+
+  # Vagrant Cascadian <vagr...@debian.org>
+  u-boot-mvebu_platforms += mvebu_espressobin-88f3720
+  mvebu_espressobin-88f3720_targets := \
+     arch/arm/dts/armada-3720-espressobin.dtb u-boot.bin uboot.elf
+
+# u-boot-qcom
+
+  # Riku Voipio <riku.voi...@linaro.org>
+  u-boot-qcom_platforms += dragonboard410c
+  dragonboard410c_targets := u-boot.bin uboot.elf
+
+  # Riku Voipio <riku.voi...@linaro.org>
+  u-boot-qcom_platforms += dragonboard820c
+  dragonboard820c_targets := u-boot.bin uboot.elf
+
+# u-boot-rockchip
+
+  # Vagrant Cascadian <vagr...@debian.org>
+  u-boot-rockchip_platforms += firefly-rk3399
+  firefly-rk3399_assigns := 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 <vagr...@debian.org>
+  u-boot-rockchip_platforms += pinebook-pro-rk3399
+  pinebook-pro-rk3399_assigns := 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 <vagr...@debian.org>
+  u-boot-rockchip_platforms += puma-rk3399
+  puma-rk3399_assigns := 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 u-boot.itb \
+     uboot.elf
+
+  # Walter Lozano <walter.loz...@collabora.com>
+  u-boot-rockchip_platforms += rock-pi-4-rk3399
+  rock-pi-4-rk3399_assigns := 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 <vagr...@debian.org>
+  u-boot-rockchip_platforms += rock64-rk3328
+  rock64-rk3328_assigns := 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 <vagr...@debian.org>
+  u-boot-rockchip_platforms += rockpro64-rk3399
+  rockpro64-rk3399_assigns := 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
+
+  # Ryan Finnie <r...@finnie.org>
+  u-boot-rpi_platforms += rpi_3
+  rpi_3_targets := u-boot.bin uboot.elf
+
+  # Lucas Nussbaum <lu...@debian.org>
+  # Andreas Henriksson <andr...@fatal.se>
+  u-boot-rpi_platforms += rpi_4
+  rpi_4_targets := u-boot.bin uboot.elf
+
+  # Denis Pynkin <denis.pyn...@collabora.com>
+  u-boot-rpi_platforms += rpi_arm64
+  rpi_arm64_targets := u-boot.bin uboot.elf
+
+# u-boot-sunxi
+
+  # Rodrigo Exterckötter Tjäder <rodr...@tjader.xyz>
+  u-boot-sunxi_platforms += a64-olinuxino
+  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
+
+  # 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
+
+  # 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
+
+  # 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
+
+  # harr...@gmx.ph
+  u-boot-sunxi_platforms += orangepi_one_plus
+  orangepi_one_plus_assigns := 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 <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 := \
+     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 <su...@medhas.org>
+  u-boot-sunxi_platforms += pine64-lts
+  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
+
+  # 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
+
+  # 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
+
+  # Benoit Delcour <benoit.delc...@gmail.com> (1.2)
+  # Arnaud Ferraris <arnaud.ferra...@collabora.com> (1.1, 1.2)
+  u-boot-sunxi_platforms += pinephone
+  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
+
+  # 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
+
+  # Jonas Smedegaard <d...@jones.dk>
+  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-tegra
+
+  # Vagrant Cascadian <vagr...@debian.org>
+  u-boot-tegra_platforms += p2371-2180
+  p2371-2180_targets := u-boot.bin uboot.elf
+
+else ifeq (${DEB_HOST_ARCH},armel)
+
+# u-boot
+
+  u-boot_platforms += dockstar
+  dockstar_targets := u-boot.kwb uboot.elf
+
+  # Ian Campbell <i...@debian.org>
+  u-boot_platforms += dreamplug
+  dreamplug_targets := u-boot.kwb uboot.elf
+
+  # drEagle <drea...@doukki.net>
+  u-boot_platforms += guruplug
+  guruplug_targets := u-boot.kwb uboot.elf
+
+  # drEagle <drea...@doukki.net>
+  # Rick Thomas <rbtho...@rcthomas.org>
+  u-boot_platforms += sheevaplug
+  sheevaplug_targets := u-boot.kwb uboot.elf
+
+# u-boot-rpi
+
+  # Vagrant Cascadian <vagr...@debian.org>, rpi B 256M
+  u-boot-rpi_platforms += rpi
+  rpi_targets := u-boot.bin uboot.elf
+
+  # Romain Perier <romain.per...@gmail.com>, rpi zero w
+  u-boot-rpi_platforms += rpi_0_w
+  rpi_0_w_targets := u-boot.bin uboot.elf
+
+else ifeq (${DEB_HOST_ARCH},armhf)
+
+# u-boot-exynos
+
+  u-boot-exynos_platforms += arndale
+  arndale_targets := spl/arndale-spl.bin u-boot.bin uboot.elf
+
+  # Joost van Zwieten <joostvanzwie...@gmail.com>, Odroid-U3
+  u-boot-exynos_platforms += odroid
+  odroid_targets := u-boot.bin uboot.elf
+
+  # Vagrant Cascadian <vagr...@debian.org>, Odroid-XU4
+  u-boot-exynos_platforms += odroid-xu3
+  odroid-xu3_targets := u-boot.bin uboot.elf
+
+# u-boot-imx
+
+  # Marek Vasut <ma...@denx.de>
+  u-boot-imx_platforms += dh_imx6
+  dh_imx6_targets := u-boot-with-spl.imx uboot.elf
+
+  # Robert Nelson <robertcnel...@gmail.com>
+  u-boot-imx_platforms += mx53loco
+  mx53loco_targets := u-boot.imx uboot.elf
+
+  # Steve Langasek <vor...@debian.org>, CuBox-i4
+  # Vagrant Cascadian <vagr...@debian.org>, CuBox-i4pro, Cubox-i4x4, hummingboard-i1, hummingboard-i2ex
+  # Rainer Dorsch <m...@bokomoko.de>, CuBox-i2u (i2u-300-d)
+  # Rick Thomas <rbtho...@pobox.com>, Cubox-i4x4, Cubox-i4PRO
+  u-boot-imx_platforms += mx6cuboxi
+  mx6cuboxi_targets := SPL u-boot.img uboot.elf
+
+  # Martyn Welch <martyn.we...@collabora.com>
+  u-boot-imx_platforms += mx6qsabrelite
+  mx6qsabrelite_targets := u-boot-dtb.imx uboot.elf
+
+  # Hector Oron <zu...@debian.org>
+  u-boot-imx_platforms += nitrogen6q
+  nitrogen6q_targets := u-boot-dtb.imx uboot.elf
+
+  # Vagrant Cascadian <vagr...@debian.org>
+  u-boot-imx_platforms += novena
+  novena_targets := SPL u-boot.img uboot.elf
+
+  # Vagrant Cascadian <vagr...@debian.org>
+  u-boot-imx_platforms += novena-rawsd
+  novena-rawsd_targets := SPL
+
+  # Michael Fladischer <mich...@fladi.at>
+  u-boot-imx_platforms += udoo
+  udoo_targets := SPL u-boot.img uboot.elf
+
+  # Vagrant Cascadian <vagr...@debian.org>
+  u-boot-imx_platforms += usbarmory
+  usbarmory_targets := u-boot.imx uboot.elf
+
+  # Vagrant Cascadian <vagr...@debian.org>
+  # Robert Nelson <robertcnel...@gmail.com>
+  u-boot-imx_platforms += wandboard
+  wandboard_targets := SPL u-boot.img uboot.elf
+
+# u-boot-omap
+
+  # Vagrant Cascadian <vagr...@debian.org>
+  # Andrew M.A. Cater <amaca...@galactic.demon.co.uk>
+  u-boot-omap_platforms += am335x_boneblack
+  am335x_boneblack_targets := MLO u-boot.img uboot.elf
+
+  # Vagrant Cascadian <vagr...@debian.org>
+  # Andrew M.A. Cater <amaca...@galactic.demon.co.uk>
+  u-boot-omap_platforms += am335x_evm
+  am335x_evm_targets := MLO u-boot.img uboot.elf
+
+  # Vagrant Cascadian <vagr...@debian.org>
+  u-boot-omap_platforms += am57xx_evm
+  am57xx_evm_targets := MLO u-boot.img uboot.elf
+
+  u-boot-omap_platforms += dra7xx_evm
+  dra7xx_evm_targets := MLO u-boot.img uboot.elf
+
+  # Robert Nelson <robertcnel...@gmail.com>
+  u-boot-omap_platforms += igep00x0
+  igep00x0_targets := MLO u-boot.img uboot.elf
+
+  u-boot-omap_platforms += nokia_rx51
+  nokia_rx51_targets := u-boot.bin uboot.elf
+
+  # Robert Nelson <robertcnel...@gmail.com>
+  u-boot-omap_platforms += omap3_beagle
+  omap3_beagle_targets := MLO u-boot.img uboot.elf
+
+  # Robert Nelson <robertcnel...@gmail.com>
+  u-boot-omap_platforms += omap4_panda
+  omap4_panda_targets := MLO u-boot.img uboot.elf
+
+# u-boot-rockchip
+
+  # Vagrant Cascadian <vagr...@debian.org>, 2GB and 4GB variants
+  u-boot-rockchip_platforms += firefly-rk3288
+  firefly-rk3288_targets := idbloader.img spl/u-boot-spl.bin u-boot.bin \
+     u-boot.img uboot.elf
+
+# u-boot-rpi
+
+  # Vagrant Cascadian <vagr...@debian.org>, Raspberry PI 2B
+  u-boot-rpi_platforms += rpi_2
+  rpi_2_targets := u-boot.bin uboot.elf
+
+  # Ryan Finnie <r...@finnie.org>
+  u-boot-rpi_platforms += rpi_3_32b
+  rpi_3_32b_targets := u-boot.bin uboot.elf
+
+  # Lucas Nussbaum <lu...@debian.org>
+  # Andreas Henriksson <andr...@fatal.se>
+  u-boot-rpi_platforms += rpi_4_32b
+  rpi_4_32b_targets := u-boot.bin uboot.elf
+
+# u-boot-sunxi
+
+  # Christian Kastner <deb...@kvr.at>
+  u-boot-sunxi_platforms += A10-OLinuXino-Lime
+  A10-OLinuXino-Lime_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Benedikt Wildenhain <espera...@benedikt-wildenhain.de>
+  u-boot-sunxi_platforms += A10s-OLinuXino-M
+  A10s-OLinuXino-M_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Christian Kastner <deb...@kvr.at>
+  u-boot-sunxi_platforms += A20-OLinuXino-Lime
+  A20-OLinuXino-Lime_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Karsten Merker <mer...@debian.org>
+  u-boot-sunxi_platforms += A20-OLinuXino-Lime2
+  A20-OLinuXino-Lime2_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Andreas B. Mundt <a...@debian.org>
+  u-boot-sunxi_platforms += A20-OLinuXino-Lime2-eMMC
+  A20-OLinuXino-Lime2-eMMC_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Arne Ploese <aplo...@gmx.de>
+  u-boot-sunxi_platforms += A20-OLinuXino_MICRO
+  A20-OLinuXino_MICRO_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Karsten Merker <mer...@debian.org>
+  u-boot-sunxi_platforms += A20-Olimex-SOM-EVB
+  A20-Olimex-SOM-EVB_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Ian Campbell <i...@debian.org>
+  # Vagrant Cascadian <vagr...@debian.org>
+  u-boot-sunxi_platforms += Bananapi
+  Bananapi_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Bernhard Wörner <bewoe...@gmail.com>
+  u-boot-sunxi_platforms += Bananapi_M2_Ultra
+  Bananapi_M2_Ultra_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Karsten Merker <mer...@debian.org>
+  u-boot-sunxi_platforms += Bananapro
+  Bananapro_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Vagrant Cascadian <vagr...@debian.org>
+  u-boot-sunxi_platforms += CHIP
+  CHIP_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Vagrant Cascadian <vagr...@debian.org>
+  u-boot-sunxi_platforms += Cubieboard
+  Cubieboard_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Ian Campbell <i...@debian.org>
+  # Karsten Merker <mer...@debian.org>
+  u-boot-sunxi_platforms += Cubieboard2
+  Cubieboard2_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Vagrant Cascadian <vagr...@debian.org>
+  u-boot-sunxi_platforms += Cubieboard4
+  Cubieboard4_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Ian Campbell <i...@debian.org>
+  # Robert Nelson <robertcnel...@gmail.com>
+  # Karsten Merker <mer...@debian.org>
+  u-boot-sunxi_platforms += Cubietruck
+  Cubietruck_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Vagrant Cascadian <vagr...@debian.org>
+  u-boot-sunxi_platforms += Cubietruck_plus
+  Cubietruck_plus_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Vagrant Cascadian <vagr...@debian.org>
+  u-boot-sunxi_platforms += Lamobo_R1
+  Lamobo_R1_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Robert Hegner <rheg...@hsr.ch>
+  u-boot-sunxi_platforms += Linksprite_pcDuino
+  Linksprite_pcDuino_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Patrice Go <patgsios...@gmail.com>
+  u-boot-sunxi_platforms += Linksprite_pcDuino3
+  Linksprite_pcDuino3_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Jochen Sprickerhof <deb...@jochen.sprickerhof.de>
+  u-boot-sunxi_platforms += Mini-X
+  Mini-X_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Bernhard <bewoe...@gmail.com>
+  u-boot-sunxi_platforms += Sinovoip_BPI_M3
+  Sinovoip_BPI_M3_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Lucas Nussbaum <lu...@debian.org>
+  u-boot-sunxi_platforms += bananapi_m2_berry
+  bananapi_m2_berry_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Paul Tagliamonte <paul...@debian.org>
+  u-boot-sunxi_platforms += nanopi_neo
+  nanopi_neo_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Philip Hands <p...@hands.com>
+  u-boot-sunxi_platforms += nanopi_neo_air
+  nanopi_neo_air_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Vagrant Cascadian <vagr...@debian.org>, Orange PI Plus2
+  u-boot-sunxi_platforms += orangepi_plus
+  orangepi_plus_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+  # Mateusz Łukasik <mat...@linuxmint.pl>, Orange PI Zero
+  u-boot-sunxi_platforms += orangepi_zero
+  orangepi_zero_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+# u-boot-tegra
+
+  # Ian Campbell <i...@debian.org>
+  u-boot-tegra_platforms += jetson-tk1
+  jetson-tk1_targets := u-boot-tegra.bin uboot.elf
+
+else ifeq (${DEB_HOST_ARCH},avr32)
+
+# u-boot
+
+  u-boot_platforms += hammerhead
+  hammerhead_targets := u-boot.img uboot.elf
+
+else ifeq (${DEB_HOST_ARCH},riscv64)
+
+# u-boot-sifive
+
+  # Hector Oron <zu...@debian.org>
+  u-boot-sifive_platforms += sifive_fu540
+  sifive_fu540_targets := u-boot.bin uboot.elf
+
+else ifeq (${DEB_HOST_ARCH},sh4)
+
+# u-boot
+
+  u-boot_platforms += r2dplus
+  r2dplus_targets := u-boot.bin uboot.elf
+
+endif
+
+# u-boot-qemu (Architecture: all)
+
+  u-boot-qemu_platforms += qemu-ppce500
+  qemu-ppce500_CROSS_COMPILE := powerpc-linux-gnu-
+  qemu-ppce500_targets := u-boot.bin uboot.elf
+
+  u-boot-qemu_platforms += qemu-riscv64
+  qemu-riscv64_CROSS_COMPILE := riscv64-linux-gnu-
+  qemu-riscv64_targets := u-boot.bin uboot.elf
+
+  u-boot-qemu_platforms += qemu-riscv64_smode
+  qemu-riscv64_smode_CROSS_COMPILE := riscv64-linux-gnu-
+  qemu-riscv64_smode_targets := u-boot.bin uboot.elf
+
+  u-boot-qemu_platforms += qemu-x86
+  qemu-x86_CROSS_COMPILE := i686-linux-gnu-
+  qemu-x86_targets := u-boot.bin u-boot.rom uboot.elf
+
+  u-boot-qemu_platforms += qemu-x86_64
+  qemu-x86_64_CROSS_COMPILE := x86_64-linux-gnu-
+  qemu-x86_64_targets := u-boot.bin u-boot.rom uboot.elf
+
+  u-boot-qemu_platforms += qemu_arm
+  qemu_arm_CROSS_COMPILE := arm-linux-gnueabihf-
+  qemu_arm_targets := u-boot.bin uboot.elf
+
+  u-boot-qemu_platforms += qemu_arm64
+  qemu_arm64_CROSS_COMPILE := aarch64-linux-gnu-
+  qemu_arm64_targets := u-boot.bin uboot.elf
-- 
2.30.2

>From cfd86d808db372dff154ca6b163edbf67ec38e6d Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <nico...@debian.org>
Date: Sat, 9 Jan 2021 15:40:19 +0100
Subject: [PATCH 3/4] Replace many shell constructs with Make constructs

so that each actually executed command is visible in logs, and errors
are reported immediately.

Delegate selection of host packages to dh_listpackages, and allow the
caller 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.
---
 debian/bin/update-substvars    |  12 ---
 debian/rules                   | 146 +++++++++++++++------------------
 debian/targets.mk              |  43 ++++++++++
 debian/u-boot-rockchip.install |   7 +-
 4 files changed, 112 insertions(+), 96 deletions(-)
 delete mode 100755 debian/bin/update-substvars
 mode change 100755 => 100644 debian/u-boot-rockchip.install

diff --git a/debian/bin/update-substvars b/debian/bin/update-substvars
deleted file mode 100755
index eaaaefcd1b..0000000000
--- a/debian/bin/update-substvars
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-for file in debian/build/platforms.* ; do
-    package=${file#debian/build/platforms.}
-    echo -n $(LC_ALL=C sort -u ${file}) | \
-	sed -e 's, ,${Newline},g' \
-	  -e 's,^,'-V$package':platforms=,' -e 's,$,\x0,'
-	case $package in
-		u-boot-rockchip|u-boot-sunxi)
-			printf -- "-V$package:Built-Using=$(dpkg-query -f '${source:Package} (= ${source:Version}) [arm64]' -W arm-trusted-firmware)\0"\
-			;;
-	esac
-done
diff --git a/debian/rules b/debian/rules
index 040e46b482..1ceb0170ac 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,9 +1,19 @@
 #!/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 \
+#   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,13 +34,12 @@ LDFLAGS := $(patsubst -Wl$(comma)%,%,$(LDFLAGS))
 
 notools := $(filter pkg.uboot.notools,$(DEB_BUILD_PROFILES))
 
+# 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 = .
-else
-TARGETSUBARCH = $(patsubst pkg.uboot.subarch.%,%,$(filter pkg.uboot.subarch.%,$(DEB_BUILD_PROFILES)))
-endif
+subarchs := $(or $(patsubst pkg.uboot.subarch.%,u-boot-%,\
+                   $(filter pkg.uboot.subarch.%,$(DEB_BUILD_PROFILES))),\
+                 $(shell dh_listpackages --arch --no-package=u-boot-tools))
 
 # Enable debugging symbols and remove build paths
 export HOSTCFLAGS = -g -ffile-prefix-map=$(CURDIR)=.
@@ -38,72 +47,54 @@ export HOSTCFLAGS = -g -ffile-prefix-map=$(CURDIR)=.
 %:
 	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
-
-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: $(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; \
-		assigns=; \
-		case $$bl31 in \
-			/usr/lib/arm-trusted-firmware/*) assigns="$$assigns 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:*) CROSS_COMPILE=$${arch#all:}- ;;\
-			*) CROSS_COMPILE=$(CROSS_COMPILE) ;; \
-		esac;\
-		case $$subarch in \
-			sunxi) assigns="$$assigns SCP=/dev/null" ;;\
-		esac;\
-		mkdir -p $$builddir; \
-		dh_auto_build -- V=$(VERBOSE) O=$$builddir CROSS_COMPILE=$${CROSS_COMPILE} $${platform}_defconfig $$assigns; \
-		sed -i -e 's,CONFIG_FIT_SIGNATURE=y,# CONFIG_FIT_SIGNATURE is not set,g' $$builddir/.config; \
-		dh_auto_build -- V=$(VERBOSE) O=$$builddir CROSS_COMPILE=$${CROSS_COMPILE} $$assigns; \
-		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 dh_install -p$$subpackage $$builddir/$$target /usr/lib/u-boot/$$platform/ \
-				>> debian/build/targets; \
-			echo $$platform >> debian/build/platforms.$$subpackage; \
-		done ; \
-	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 $(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)
+
+	dh_auto_build -- V=$(VERBOSE) O=debian/build/$(platform) \
+	  CROSS_COMPILE=$(or $($(platform)_CROSS_COMPILE),$(CROSS_COMPILE)) \
+	  $($(package)_assigns) $($(platform)_assigns) \
+	  $(platform)_defconfig
+	sed -i 's,CONFIG_FIT_SIGNATURE=y,# CONFIG_FIT_SIGNATURE is not set,' debian/build/$(platform)/.config
+	dh_auto_build -- V=$(VERBOSE) O=debian/build/$(platform) \
+	  CROSS_COMPILE=$(or $($(platform)_CROSS_COMPILE),$(CROSS_COMPILE)) \
+	  $($(package)_assigns) $($(platform)_assigns)
+
+    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 $(subarchs),\
+  $(foreach platform, $($(package)_platforms),\
+    $(eval $(build_template))))
 
 TOOLSDIR := debian/build/tools
 build-tools:
@@ -127,30 +118,27 @@ override_dh_auto_test-indep:
 override_dh_auto_install:
 
 # override_ would require to test notools, which is unrelated.
-# The file may not exist (-arch build on amd64 for example)
-execute_after_dh_install:
-	if [ -e debian/build/targets ]; then \
-	  sh -ev debian/build/targets; \
-	fi
+execute_after_dh_install-indep: $(addprefix install-,$(u-boot-qemu_platforms))
+execute_after_dh_install-arch: $(addprefix install-,$(foreach package,$(subarchs),$($(package)_platforms)))
 
 # override_ would require to test notools, which is unrelated.
 .PHONY: execute_after_dh_installdocs
-execute_after_dh_installdocs: $(patsubst debian/build/platforms.%,installdocs-%,\
-                              $(wildcard debian/build/platforms.*))
+execute_after_dh_installdocs-indep: installdocs-u-boot-qemu
+execute_after_dh_installdocs-arch: $(addprefix installdocs-,$(subarchs))
 installdocs-%:
 	mkdir -p debian/build/$*/configs
-	for platform in $$(sort -u debian/build/platforms.$*); do \
+	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 | xargs -0 dh_gencontrol --
+	dh_gencontrol -- $(dpkg-gencontrol_args) $(foreach package,\
+	  u-boot-qemu $(subarchs),\
+	  '-V$(package):platforms=$(subst $() ,$${Newline},$($(package)_platforms))')
diff --git a/debian/targets.mk b/debian/targets.mk
index bb48f19913..085da6d1b3 100644
--- a/debian/targets.mk
+++ b/debian/targets.mk
@@ -48,6 +48,16 @@ ifeq (${DEB_HOST_ARCH},arm64)
 
 # u-boot-rockchip
 
+  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 <vagr...@debian.org>
   u-boot-rockchip_platforms += firefly-rk3399
   firefly-rk3399_assigns := BL31=/usr/lib/arm-trusted-firmware/rk3399/bl31.elf
@@ -107,6 +117,11 @@ ifeq (${DEB_HOST_ARCH},arm64)
 
 # u-boot-sunxi
 
+  u-boot-sunxi_assigns := 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 <rodr...@tjader.xyz>
   u-boot-sunxi_platforms += a64-olinuxino
   a64-olinuxino_assigns := BL31=/usr/lib/arm-trusted-firmware/sun50i_a64/bl31.bin
@@ -273,6 +288,12 @@ else ifeq (${DEB_HOST_ARCH},armhf)
   u-boot-imx_platforms += novena-rawsd
   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 <mich...@fladi.at>
   u-boot-imx_platforms += udoo
   udoo_targets := SPL u-boot.img uboot.elf
@@ -293,6 +314,12 @@ else ifeq (${DEB_HOST_ARCH},armhf)
   u-boot-omap_platforms += am335x_boneblack
   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 <vagr...@debian.org>
   # Andrew M.A. Cater <amaca...@galactic.demon.co.uk>
   u-boot-omap_platforms += am335x_evm
@@ -322,6 +349,17 @@ else ifeq (${DEB_HOST_ARCH},armhf)
 
 # u-boot-rockchip
 
+  # 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 <vagr...@debian.org>, 2GB and 4GB variants
   u-boot-rockchip_platforms += firefly-rk3288
   firefly-rk3288_targets := idbloader.img spl/u-boot-spl.bin u-boot.bin \
@@ -344,6 +382,11 @@ else ifeq (${DEB_HOST_ARCH},armhf)
 
 # u-boot-sunxi
 
+  u-boot-sunxi_assigns := SCP=/dev/null
+
+  # Silent a debhelper warning about an unused substvar.
+  dpkg-gencontrol_args += -Vu-boot-sunxi:Built-Using=
+
   # Christian Kastner <deb...@kvr.at>
   u-boot-sunxi_platforms += A10-OLinuXino-Lime
   A10-OLinuXino-Lime_targets := u-boot-sunxi-with-spl.bin uboot.elf
diff --git a/debian/u-boot-rockchip.install b/debian/u-boot-rockchip.install
old mode 100755
new mode 100644
index 5c3ae10859..11988d2d4d
--- a/debian/u-boot-rockchip.install
+++ b/debian/u-boot-rockchip.install
@@ -1,5 +1,2 @@
-#!/bin/sh
-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
-- 
2.30.2

>From c6084c7ddeb33d5ea92a86e651b215c4b8c0517b Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <nico...@debian.org>
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 | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/debian/rules b/debian/rules
index 1ceb0170ac..e099024d4f 100755
--- a/debian/rules
+++ b/debian/rules
@@ -34,12 +34,7 @@ LDFLAGS := $(patsubst -Wl$(comma)%,%,$(LDFLAGS))
 
 notools := $(filter pkg.uboot.notools,$(DEB_BUILD_PROFILES))
 
-# 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.
-subarchs := $(or $(patsubst pkg.uboot.subarch.%,u-boot-%,\
-                   $(filter pkg.uboot.subarch.%,$(DEB_BUILD_PROFILES))),\
-                 $(shell dh_listpackages --arch --no-package=u-boot-tools))
+subarchs := $(shell dh_listpackages --arch --no-package=u-boot-tools)
 
 # Enable debugging symbols and remove build paths
 export HOSTCFLAGS = -g -ffile-prefix-map=$(CURDIR)=.
-- 
2.30.2

Reply via email to