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

The attached patches replace the previous version.
Several issues are now reported in separate bugs.
The script translating debian/targets to debian/*.mk is provided in
order to make review and rebase easyer.
Various changes simplify the intent or reduce the global patch size.
>From c22b986b2c4040752463048fbcdbc6d4321dff86 Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Wed, 6 Jan 2021 18:44:58 +0100
Subject: [PATCH 09/11] Replace debian/targets with makefile snippets

They should be easyer to maintain manually, but for now this separate
generation step helps figuring the changes and rebasing.
---
 debian/targets.py               |  77 ++++++++++++++++++++++
 debian/u-boot-amlogic_arm64.mk  |  25 ++++++++
 debian/u-boot-exynos_armhf.mk   |  12 ++++
 debian/u-boot-imx_armhf.mk      |  45 +++++++++++++
 debian/u-boot-mvebu_arm64.mk    |   5 ++
 debian/u-boot-omap_armhf.mk     |  33 ++++++++++
 debian/u-boot-qcom_arm64.mk     |   9 +++
 debian/u-boot-qemu.mk           |  29 +++++++++
 debian/u-boot-rockchip_arm64.mk |  31 +++++++++
 debian/u-boot-rockchip_armhf.mk |   5 ++
 debian/u-boot-rpi_arm64.mk      |  14 ++++
 debian/u-boot-rpi_armel.mk      |   9 +++
 debian/u-boot-rpi_armhf.mk      |  14 ++++
 debian/u-boot-sifive_riscv64.mk |   5 ++
 debian/u-boot-sunxi_arm64.mk    |  56 ++++++++++++++++
 debian/u-boot-sunxi_armhf.mk    | 109 ++++++++++++++++++++++++++++++++
 debian/u-boot-tegra_arm64.mk    |   5 ++
 debian/u-boot-tegra_armhf.mk    |   5 ++
 debian/u-boot_armel.mk          |  17 +++++
 debian/u-boot_avr32.mk          |   4 ++
 debian/u-boot_sh4.mk            |   4 ++
 21 files changed, 513 insertions(+)
 create mode 100644 debian/targets.py
 create mode 100644 debian/u-boot-amlogic_arm64.mk
 create mode 100644 debian/u-boot-exynos_armhf.mk
 create mode 100644 debian/u-boot-imx_armhf.mk
 create mode 100644 debian/u-boot-mvebu_arm64.mk
 create mode 100644 debian/u-boot-omap_armhf.mk
 create mode 100644 debian/u-boot-qcom_arm64.mk
 create mode 100644 debian/u-boot-qemu.mk
 create mode 100644 debian/u-boot-rockchip_arm64.mk
 create mode 100644 debian/u-boot-rockchip_armhf.mk
 create mode 100644 debian/u-boot-rpi_arm64.mk
 create mode 100644 debian/u-boot-rpi_armel.mk
 create mode 100644 debian/u-boot-rpi_armhf.mk
 create mode 100644 debian/u-boot-sifive_riscv64.mk
 create mode 100644 debian/u-boot-sunxi_arm64.mk
 create mode 100644 debian/u-boot-sunxi_armhf.mk
 create mode 100644 debian/u-boot-tegra_arm64.mk
 create mode 100644 debian/u-boot-tegra_armhf.mk
 create mode 100644 debian/u-boot_armel.mk
 create mode 100644 debian/u-boot_avr32.mk
 create mode 100644 debian/u-boot_sh4.mk

diff --git a/debian/targets.py b/debian/targets.py
new file mode 100644
index 0000000000..b3ed87f90c
--- /dev/null
+++ b/debian/targets.py
@@ -0,0 +1,77 @@
+#!/usr/bin/python3
+
+import subprocess
+
+# Convert debian/targets to a Makefile snippet included by
+# debian/rules.
+
+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)
+            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)
+
+for arch in sorted (architectures.keys ()):
+    packages = architectures [arch]
+    sorted_packages = sorted (packages.keys ())
+    for package in sorted_packages:
+        with open (f'debian/{package}_{arch}.mk', 'w') as outfile:
+            platforms = packages [package]
+            sorted_platforms = sorted (platforms.keys ())
+
+            outfile.write ('# Helper for debian/rules\n')
+            for platform in sorted_platforms:
+                targets, maintainers = platforms [platform]
+                outfile.write ('\n')
+                outfile.write (''.join (maintainers))
+                outfile.write (f'{package}_platforms += {platform}\n')
+                if targets [0].startswith ('/usr/lib/arm-trusted-firmware/'):
+                    outfile.write (f'{platform}: export BL31 := {targets [0]}\n')
+                    targets = targets [1:]
+                if platform != 'novena-rawsd':
+                    targets.append ('uboot.elf')
+                targets.sort ()
+                outfile.write (f'{platform}_targets := {" ".join (targets)}\n')
+
+sorted_platforms = sorted (qemu.keys ())
+with open (f'debian/u-boot-qemu.mk', 'w') as outfile:
+    outfile.write ('# Helper for debian/rules\n')
+    for platform in sorted_platforms:
+        arch, targets = qemu [platform]
+        outfile.write ('\n')
+        outfile.write (f'u-boot-qemu_platforms += {platform}\n')
+        gnu_type = subprocess.check_output(('dpkg-architecture', '-f', '-a', arch[4:], '-qDEB_HOST_GNU_TYPE')).rstrip ().decode ()
+        outfile.write (f'{platform}_CROSS_COMPILE := {gnu_type}-\n')
+        targets.append ('uboot.elf')
+        targets.sort ()
+        outfile.write (f'{platform}_targets := {" ".join (targets)}\n')
diff --git a/debian/u-boot-amlogic_arm64.mk b/debian/u-boot-amlogic_arm64.mk
new file mode 100644
index 0000000000..18c538a9ea
--- /dev/null
+++ b/debian/u-boot-amlogic_arm64.mk
@@ -0,0 +1,25 @@
+# Helper for debian/rules
+
+# Neil Armstrong <[email protected]>
+u-boot-amlogic_platforms += khadas-vim
+khadas-vim_targets := u-boot.bin uboot.elf
+
+# Neil Armstrong <[email protected]>
+u-boot-amlogic_platforms += khadas-vim2
+khadas-vim2_targets := u-boot.bin uboot.elf
+
+# Frederic Danis <[email protected]>
+u-boot-amlogic_platforms += libretech-cc
+libretech-cc_targets := u-boot.bin uboot.elf
+
+# Neil Armstrong <[email protected]>
+u-boot-amlogic_platforms += nanopi-k2
+nanopi-k2_targets := u-boot.bin uboot.elf
+
+# Vagrant Cascadian <[email protected]>
+u-boot-amlogic_platforms += odroid-c2
+odroid-c2_targets := u-boot.bin uboot.elf
+
+# Reco <[email protected]>
+u-boot-amlogic_platforms += odroid-n2
+odroid-n2_targets := u-boot.bin uboot.elf
diff --git a/debian/u-boot-exynos_armhf.mk b/debian/u-boot-exynos_armhf.mk
new file mode 100644
index 0000000000..9e4b2b924e
--- /dev/null
+++ b/debian/u-boot-exynos_armhf.mk
@@ -0,0 +1,12 @@
+# Helper for debian/rules
+
+u-boot-exynos_platforms += arndale
+arndale_targets := spl/arndale-spl.bin u-boot.bin uboot.elf
+
+# Joost van Zwieten <[email protected]>, Odroid-U3
+u-boot-exynos_platforms += odroid
+odroid_targets := u-boot.bin uboot.elf
+
+# Vagrant Cascadian <[email protected]>, Odroid-XU4
+u-boot-exynos_platforms += odroid-xu3
+odroid-xu3_targets := u-boot.bin uboot.elf
diff --git a/debian/u-boot-imx_armhf.mk b/debian/u-boot-imx_armhf.mk
new file mode 100644
index 0000000000..ddd31bec30
--- /dev/null
+++ b/debian/u-boot-imx_armhf.mk
@@ -0,0 +1,45 @@
+# Helper for debian/rules
+
+# Marek Vasut <[email protected]>
+u-boot-imx_platforms += dh_imx6
+dh_imx6_targets := u-boot-with-spl.imx uboot.elf
+
+# Robert Nelson <[email protected]>
+u-boot-imx_platforms += mx53loco
+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
+u-boot-imx_platforms += mx6cuboxi
+mx6cuboxi_targets := SPL u-boot.img uboot.elf
+
+# Martyn Welch <[email protected]>
+u-boot-imx_platforms += mx6qsabrelite
+mx6qsabrelite_targets := u-boot-dtb.imx uboot.elf
+
+# Hector Oron <[email protected]>
+u-boot-imx_platforms += nitrogen6q
+nitrogen6q_targets := u-boot-dtb.imx uboot.elf
+
+# Vagrant Cascadian <[email protected]>
+u-boot-imx_platforms += novena
+novena_targets := SPL u-boot.img uboot.elf
+
+# Vagrant Cascadian <[email protected]>
+u-boot-imx_platforms += novena-rawsd
+novena-rawsd_targets := SPL
+
+# Michael Fladischer <[email protected]>
+u-boot-imx_platforms += udoo
+udoo_targets := SPL u-boot.img uboot.elf
+
+# Vagrant Cascadian <[email protected]>
+u-boot-imx_platforms += usbarmory
+usbarmory_targets := u-boot.imx uboot.elf
+
+# Vagrant Cascadian <[email protected]>
+# Robert Nelson <[email protected]>
+u-boot-imx_platforms += wandboard
+wandboard_targets := SPL u-boot.img uboot.elf
diff --git a/debian/u-boot-mvebu_arm64.mk b/debian/u-boot-mvebu_arm64.mk
new file mode 100644
index 0000000000..b70a89845b
--- /dev/null
+++ b/debian/u-boot-mvebu_arm64.mk
@@ -0,0 +1,5 @@
+# Helper for debian/rules
+
+# Vagrant Cascadian <[email protected]>
+u-boot-mvebu_platforms += mvebu_espressobin-88f3720
+mvebu_espressobin-88f3720_targets := arch/arm/dts/armada-3720-espressobin.dtb u-boot.bin uboot.elf
diff --git a/debian/u-boot-omap_armhf.mk b/debian/u-boot-omap_armhf.mk
new file mode 100644
index 0000000000..5e4a67913b
--- /dev/null
+++ b/debian/u-boot-omap_armhf.mk
@@ -0,0 +1,33 @@
+# Helper for debian/rules
+
+# Vagrant Cascadian <[email protected]>
+# Andrew M.A. Cater <[email protected]>
+u-boot-omap_platforms += am335x_boneblack
+am335x_boneblack_targets := MLO u-boot.img uboot.elf
+
+# Vagrant Cascadian <[email protected]>
+# Andrew M.A. Cater <[email protected]>
+u-boot-omap_platforms += am335x_evm
+am335x_evm_targets := MLO u-boot.img uboot.elf
+
+# Vagrant Cascadian <[email protected]>
+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 <[email protected]>
+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 <[email protected]>
+u-boot-omap_platforms += omap3_beagle
+omap3_beagle_targets := MLO u-boot.img uboot.elf
+
+# Robert Nelson <[email protected]>
+u-boot-omap_platforms += omap4_panda
+omap4_panda_targets := MLO u-boot.img uboot.elf
diff --git a/debian/u-boot-qcom_arm64.mk b/debian/u-boot-qcom_arm64.mk
new file mode 100644
index 0000000000..eaf746614b
--- /dev/null
+++ b/debian/u-boot-qcom_arm64.mk
@@ -0,0 +1,9 @@
+# Helper for debian/rules
+
+# Riku Voipio <[email protected]>
+u-boot-qcom_platforms += dragonboard410c
+dragonboard410c_targets := u-boot.bin uboot.elf
+
+# Riku Voipio <[email protected]>
+u-boot-qcom_platforms += dragonboard820c
+dragonboard820c_targets := u-boot.bin uboot.elf
diff --git a/debian/u-boot-qemu.mk b/debian/u-boot-qemu.mk
new file mode 100644
index 0000000000..2079089039
--- /dev/null
+++ b/debian/u-boot-qemu.mk
@@ -0,0 +1,29 @@
+# Helper for debian/rules
+
+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
diff --git a/debian/u-boot-rockchip_arm64.mk b/debian/u-boot-rockchip_arm64.mk
new file mode 100644
index 0000000000..d2db8e55c7
--- /dev/null
+++ b/debian/u-boot-rockchip_arm64.mk
@@ -0,0 +1,31 @@
+# Helper for debian/rules
+
+# Vagrant Cascadian <[email protected]>
+u-boot-rockchip_platforms += firefly-rk3399
+firefly-rk3399: export 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]>
+u-boot-rockchip_platforms += pinebook-pro-rk3399
+pinebook-pro-rk3399: export 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]>
+u-boot-rockchip_platforms += puma-rk3399
+puma-rk3399: export 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]>
+u-boot-rockchip_platforms += rock-pi-4-rk3399
+rock-pi-4-rk3399: export 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]>
+u-boot-rockchip_platforms += rock64-rk3328
+rock64-rk3328: export 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]>
+u-boot-rockchip_platforms += rockpro64-rk3399
+rockpro64-rk3399: export 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
diff --git a/debian/u-boot-rockchip_armhf.mk b/debian/u-boot-rockchip_armhf.mk
new file mode 100644
index 0000000000..91ae8233de
--- /dev/null
+++ b/debian/u-boot-rockchip_armhf.mk
@@ -0,0 +1,5 @@
+# Helper for debian/rules
+
+# Vagrant Cascadian <[email protected]>, 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
diff --git a/debian/u-boot-rpi_arm64.mk b/debian/u-boot-rpi_arm64.mk
new file mode 100644
index 0000000000..2101f66125
--- /dev/null
+++ b/debian/u-boot-rpi_arm64.mk
@@ -0,0 +1,14 @@
+# Helper for debian/rules
+
+# Ryan Finnie <[email protected]>
+u-boot-rpi_platforms += rpi_3
+rpi_3_targets := u-boot.bin uboot.elf
+
+# Lucas Nussbaum <[email protected]>
+# Andreas Henriksson <[email protected]>
+u-boot-rpi_platforms += rpi_4
+rpi_4_targets := u-boot.bin uboot.elf
+
+# Denis Pynkin <[email protected]>
+u-boot-rpi_platforms += rpi_arm64
+rpi_arm64_targets := u-boot.bin uboot.elf
diff --git a/debian/u-boot-rpi_armel.mk b/debian/u-boot-rpi_armel.mk
new file mode 100644
index 0000000000..9c34a1cc32
--- /dev/null
+++ b/debian/u-boot-rpi_armel.mk
@@ -0,0 +1,9 @@
+# Helper for debian/rules
+
+# Vagrant Cascadian <[email protected]>, rpi B 256M
+u-boot-rpi_platforms += rpi
+rpi_targets := u-boot.bin uboot.elf
+
+# Romain Perier <[email protected]>, rpi zero w
+u-boot-rpi_platforms += rpi_0_w
+rpi_0_w_targets := u-boot.bin uboot.elf
diff --git a/debian/u-boot-rpi_armhf.mk b/debian/u-boot-rpi_armhf.mk
new file mode 100644
index 0000000000..ef1770981e
--- /dev/null
+++ b/debian/u-boot-rpi_armhf.mk
@@ -0,0 +1,14 @@
+# Helper for debian/rules
+
+# Vagrant Cascadian <[email protected]>, Raspberry PI 2B
+u-boot-rpi_platforms += rpi_2
+rpi_2_targets := u-boot.bin uboot.elf
+
+# Ryan Finnie <[email protected]>
+u-boot-rpi_platforms += rpi_3_32b
+rpi_3_32b_targets := u-boot.bin uboot.elf
+
+# Lucas Nussbaum <[email protected]>
+# Andreas Henriksson <[email protected]>
+u-boot-rpi_platforms += rpi_4_32b
+rpi_4_32b_targets := u-boot.bin uboot.elf
diff --git a/debian/u-boot-sifive_riscv64.mk b/debian/u-boot-sifive_riscv64.mk
new file mode 100644
index 0000000000..c2812b72f5
--- /dev/null
+++ b/debian/u-boot-sifive_riscv64.mk
@@ -0,0 +1,5 @@
+# Helper for debian/rules
+
+# Hector Oron <[email protected]>
+u-boot-sifive_platforms += sifive_fu540
+sifive_fu540_targets := u-boot.bin uboot.elf
diff --git a/debian/u-boot-sunxi_arm64.mk b/debian/u-boot-sunxi_arm64.mk
new file mode 100644
index 0000000000..8c083ab599
--- /dev/null
+++ b/debian/u-boot-sunxi_arm64.mk
@@ -0,0 +1,56 @@
+# Helper for debian/rules
+
+# Rodrigo Exterckötter Tjäder <[email protected]>
+u-boot-sunxi_platforms += a64-olinuxino
+a64-olinuxino: export 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]>
+u-boot-sunxi_platforms += a64-olinuxino-emmc
+a64-olinuxino-emmc: export 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]>
+u-boot-sunxi_platforms += nanopi_neo2
+nanopi_neo2: export 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]>
+u-boot-sunxi_platforms += nanopi_neo_plus2
+nanopi_neo_plus2: export 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]
+u-boot-sunxi_platforms += orangepi_one_plus
+orangepi_one_plus: export 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]>
+u-boot-sunxi_platforms += orangepi_zero_plus2
+orangepi_zero_plus2: export 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]>
+u-boot-sunxi_platforms += pine64-lts
+pine64-lts: export 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]>
+u-boot-sunxi_platforms += pine64_plus
+pine64_plus: export 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]>
+u-boot-sunxi_platforms += pinebook
+pinebook: export 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]>
+u-boot-sunxi_platforms += pinephone
+pinephone: export 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]>
+u-boot-sunxi_platforms += teres_i
+teres_i: export 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
diff --git a/debian/u-boot-sunxi_armhf.mk b/debian/u-boot-sunxi_armhf.mk
new file mode 100644
index 0000000000..47cdcc111b
--- /dev/null
+++ b/debian/u-boot-sunxi_armhf.mk
@@ -0,0 +1,109 @@
+# Helper for debian/rules
+
+# Christian Kastner <[email protected]>
+u-boot-sunxi_platforms += A10-OLinuXino-Lime
+A10-OLinuXino-Lime_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+# Benedikt Wildenhain <[email protected]>
+u-boot-sunxi_platforms += A10s-OLinuXino-M
+A10s-OLinuXino-M_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+# Christian Kastner <[email protected]>
+u-boot-sunxi_platforms += A20-OLinuXino-Lime
+A20-OLinuXino-Lime_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+# Karsten Merker <[email protected]>
+u-boot-sunxi_platforms += A20-OLinuXino-Lime2
+A20-OLinuXino-Lime2_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+# Andreas B. Mundt <[email protected]>
+u-boot-sunxi_platforms += A20-OLinuXino-Lime2-eMMC
+A20-OLinuXino-Lime2-eMMC_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+# Arne Ploese <[email protected]>
+u-boot-sunxi_platforms += A20-OLinuXino_MICRO
+A20-OLinuXino_MICRO_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+# Karsten Merker <[email protected]>
+u-boot-sunxi_platforms += A20-Olimex-SOM-EVB
+A20-Olimex-SOM-EVB_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+# Ian Campbell <[email protected]>
+# Vagrant Cascadian <[email protected]>
+u-boot-sunxi_platforms += Bananapi
+Bananapi_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+# Bernhard Wörner <[email protected]>
+u-boot-sunxi_platforms += Bananapi_M2_Ultra
+Bananapi_M2_Ultra_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+# Karsten Merker <[email protected]>
+u-boot-sunxi_platforms += Bananapro
+Bananapro_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+# Vagrant Cascadian <[email protected]>
+u-boot-sunxi_platforms += CHIP
+CHIP_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+# Vagrant Cascadian <[email protected]>
+u-boot-sunxi_platforms += Cubieboard
+Cubieboard_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+# Ian Campbell <[email protected]>
+# Karsten Merker <[email protected]>
+u-boot-sunxi_platforms += Cubieboard2
+Cubieboard2_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+# Vagrant Cascadian <[email protected]>
+u-boot-sunxi_platforms += Cubieboard4
+Cubieboard4_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+# Ian Campbell <[email protected]>
+# Robert Nelson <[email protected]>
+# Karsten Merker <[email protected]>
+u-boot-sunxi_platforms += Cubietruck
+Cubietruck_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+# Vagrant Cascadian <[email protected]>
+u-boot-sunxi_platforms += Cubietruck_plus
+Cubietruck_plus_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+# Vagrant Cascadian <[email protected]>
+u-boot-sunxi_platforms += Lamobo_R1
+Lamobo_R1_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+# Robert Hegner <[email protected]>
+u-boot-sunxi_platforms += Linksprite_pcDuino
+Linksprite_pcDuino_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+# Patrice Go <[email protected]>
+u-boot-sunxi_platforms += Linksprite_pcDuino3
+Linksprite_pcDuino3_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+# Jochen Sprickerhof <[email protected]>
+u-boot-sunxi_platforms += Mini-X
+Mini-X_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+# Bernhard <[email protected]>
+u-boot-sunxi_platforms += Sinovoip_BPI_M3
+Sinovoip_BPI_M3_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+# Lucas Nussbaum <[email protected]>
+u-boot-sunxi_platforms += bananapi_m2_berry
+bananapi_m2_berry_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+# Paul Tagliamonte <[email protected]>
+u-boot-sunxi_platforms += nanopi_neo
+nanopi_neo_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+# Philip Hands <[email protected]>
+u-boot-sunxi_platforms += nanopi_neo_air
+nanopi_neo_air_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+# Vagrant Cascadian <[email protected]>, Orange PI Plus2
+u-boot-sunxi_platforms += orangepi_plus
+orangepi_plus_targets := u-boot-sunxi-with-spl.bin uboot.elf
+
+# Mateusz Łukasik <[email protected]>, Orange PI Zero
+u-boot-sunxi_platforms += orangepi_zero
+orangepi_zero_targets := u-boot-sunxi-with-spl.bin uboot.elf
diff --git a/debian/u-boot-tegra_arm64.mk b/debian/u-boot-tegra_arm64.mk
new file mode 100644
index 0000000000..8244dc479f
--- /dev/null
+++ b/debian/u-boot-tegra_arm64.mk
@@ -0,0 +1,5 @@
+# Helper for debian/rules
+
+# Vagrant Cascadian <[email protected]>
+u-boot-tegra_platforms += p2371-2180
+p2371-2180_targets := u-boot.bin uboot.elf
diff --git a/debian/u-boot-tegra_armhf.mk b/debian/u-boot-tegra_armhf.mk
new file mode 100644
index 0000000000..63a53cf6c4
--- /dev/null
+++ b/debian/u-boot-tegra_armhf.mk
@@ -0,0 +1,5 @@
+# Helper for debian/rules
+
+# Ian Campbell <[email protected]>
+u-boot-tegra_platforms += jetson-tk1
+jetson-tk1_targets := u-boot-tegra.bin uboot.elf
diff --git a/debian/u-boot_armel.mk b/debian/u-boot_armel.mk
new file mode 100644
index 0000000000..3283f81bab
--- /dev/null
+++ b/debian/u-boot_armel.mk
@@ -0,0 +1,17 @@
+# Helper for debian/rules
+
+u-boot_platforms += dockstar
+dockstar_targets := u-boot.kwb uboot.elf
+
+# Ian Campbell <[email protected]>
+u-boot_platforms += dreamplug
+dreamplug_targets := u-boot.kwb uboot.elf
+
+# drEagle <[email protected]>
+u-boot_platforms += guruplug
+guruplug_targets := u-boot.kwb uboot.elf
+
+# drEagle <[email protected]>
+# Rick Thomas <[email protected]>
+u-boot_platforms += sheevaplug
+sheevaplug_targets := u-boot.kwb uboot.elf
diff --git a/debian/u-boot_avr32.mk b/debian/u-boot_avr32.mk
new file mode 100644
index 0000000000..fe4ea1b13e
--- /dev/null
+++ b/debian/u-boot_avr32.mk
@@ -0,0 +1,4 @@
+# Helper for debian/rules
+
+u-boot_platforms += hammerhead
+hammerhead_targets := u-boot.img uboot.elf
diff --git a/debian/u-boot_sh4.mk b/debian/u-boot_sh4.mk
new file mode 100644
index 0000000000..38841ff08d
--- /dev/null
+++ b/debian/u-boot_sh4.mk
@@ -0,0 +1,4 @@
+# Helper for debian/rules
+
+u-boot_platforms += r2dplus
+r2dplus_targets := u-boot.bin uboot.elf
-- 
2.20.1

>From 9ffe459710865389afe1c5e56284fe6ab7708579 Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Wed, 6 Jan 2021 23:33:43 +0100
Subject: [PATCH 10/11] Remove source and generator

---
 debian/targets    | 280 ----------------------------------------------
 debian/targets.py |  77 -------------
 2 files changed, 357 deletions(-)
 delete mode 100644 debian/targets
 delete mode 100644 debian/targets.py

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.py b/debian/targets.py
deleted file mode 100644
index b3ed87f90c..0000000000
--- a/debian/targets.py
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/usr/bin/python3
-
-import subprocess
-
-# Convert debian/targets to a Makefile snippet included by
-# debian/rules.
-
-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)
-            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)
-
-for arch in sorted (architectures.keys ()):
-    packages = architectures [arch]
-    sorted_packages = sorted (packages.keys ())
-    for package in sorted_packages:
-        with open (f'debian/{package}_{arch}.mk', 'w') as outfile:
-            platforms = packages [package]
-            sorted_platforms = sorted (platforms.keys ())
-
-            outfile.write ('# Helper for debian/rules\n')
-            for platform in sorted_platforms:
-                targets, maintainers = platforms [platform]
-                outfile.write ('\n')
-                outfile.write (''.join (maintainers))
-                outfile.write (f'{package}_platforms += {platform}\n')
-                if targets [0].startswith ('/usr/lib/arm-trusted-firmware/'):
-                    outfile.write (f'{platform}: export BL31 := {targets [0]}\n')
-                    targets = targets [1:]
-                if platform != 'novena-rawsd':
-                    targets.append ('uboot.elf')
-                targets.sort ()
-                outfile.write (f'{platform}_targets := {" ".join (targets)}\n')
-
-sorted_platforms = sorted (qemu.keys ())
-with open (f'debian/u-boot-qemu.mk', 'w') as outfile:
-    outfile.write ('# Helper for debian/rules\n')
-    for platform in sorted_platforms:
-        arch, targets = qemu [platform]
-        outfile.write ('\n')
-        outfile.write (f'u-boot-qemu_platforms += {platform}\n')
-        gnu_type = subprocess.check_output(('dpkg-architecture', '-f', '-a', arch[4:], '-qDEB_HOST_GNU_TYPE')).rstrip ().decode ()
-        outfile.write (f'{platform}_CROSS_COMPILE := {gnu_type}-\n')
-        targets.append ('uboot.elf')
-        targets.sort ()
-        outfile.write (f'{platform}_targets := {" ".join (targets)}\n')
-- 
2.20.1

>From 704fd7c7936cc6ae28f8518ecc517bef2b019a51 Mon Sep 17 00:00:00 2001
From: Nicolas Boulenguez <[email protected]>
Date: Wed, 6 Jan 2021 22:42:27 +0100
Subject: [PATCH 11/11] Restructure the packaging

Replace targets list and platform-specific parts of debian/rules with
separate files for each platform.

Replace shell loops and variables, executable debhelper files and
temporary files with Make structures, so that actually executed
command lines are visible in logs.

Delegate more things to debhelper:
DEB_BUILD_OPTIONS=parallel=N        -> dh_auto_make
native strip                        -> dh_strip
selection of packages for this arch -> dh_listpackages
DEB_BUILD_OPTIONS=nodoc             -> dh_installdocs
---
 debian/bin/u-boot-install-targets    |   6 -
 debian/bin/update-substvars          |  18 --
 debian/control                       |  26 +++
 debian/rules                         | 269 +++++++++++++++------------
 debian/u-boot-amlogic.install        |   2 -
 debian/u-boot-exynos.install         |   2 -
 debian/u-boot-imx.install            |   2 -
 debian/u-boot-imx_armhf.mk           |   5 +
 debian/u-boot-mvebu.install          |   2 -
 debian/u-boot-omap.install           |   2 -
 debian/u-boot-omap_armhf.mk          |   5 +
 debian/u-boot-qcom.install           |   2 -
 debian/u-boot-qemu.install           |   2 -
 debian/u-boot-rockchip.install.arm64 |   8 +-
 debian/u-boot-rockchip.install.armhf |   4 +-
 debian/u-boot-rockchip_arm64.mk      |  10 +
 debian/u-boot-rockchip_armhf.mk      |   3 +
 debian/u-boot-rpi.install            |   2 -
 debian/u-boot-sifive.install         |   2 -
 debian/u-boot-sunxi.install.arm64    |   5 +-
 debian/u-boot-sunxi.install.armhf    |   2 -
 debian/u-boot-sunxi_arm64.mk         |   7 +
 debian/u-boot-sunxi_armhf.mk         |   3 +
 debian/u-boot-tegra.install          |   2 -
 debian/u-boot-tools.install          |   3 -
 debian/u-boot.install                |   2 -
 26 files changed, 214 insertions(+), 182 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.arm64
 mode change 100755 => 100644 debian/u-boot-rockchip.install.armhf
 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.arm64
 delete mode 100755 debian/u-boot-sunxi.install.armhf
 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..b5e7316e2d 100644
--- a/debian/control
+++ b/debian/control
@@ -47,6 +47,8 @@ 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.
+ .
+ Included platforms:
  ${uboot:platforms}
 
 Package: u-boot-amlogic
@@ -62,6 +64,8 @@ Description: A boot loader for amlogic systems
  NIOS, and Microblaze.
  .
  This package includes boot loaders for various amlogic platforms.
+ .
+ Included platforms:
  ${uboot:platforms}
 
 Package: u-boot-imx
@@ -78,6 +82,8 @@ Description: A boot loader for imx systems
  NIOS, and Microblaze.
  .
  This package includes boot loaders for various imx platforms.
+ .
+ Included platforms:
  ${uboot:platforms}
 
 Package: u-boot-qemu
@@ -94,6 +100,8 @@ Description: A boot loader for qemu
  NIOS, and Microblaze.
  .
  This package includes boot loaders for qemu/kvm.
+ .
+ Included platforms:
  ${uboot:platforms}
 
 Package: u-boot-qcom
@@ -108,6 +116,8 @@ Description: A boot loader for qcom systems
  NIOS, and Microblaze.
  .
  This package includes boot loaders for various qcom platforms.
+ .
+ Included platforms:
  ${uboot:platforms}
 
 Package: u-boot-tegra
@@ -124,6 +134,8 @@ Description: A boot loader for NVIDIA Tegra systems
  NIOS, and Microblaze.
  .
  This package includes boot loaders for various NVIDIA Tegra platforms.
+ .
+ Included platforms:
  ${uboot:platforms}
 
 Package: u-boot-omap
@@ -141,6 +153,8 @@ Description: A boot loader for omap systems
  .
  This package includes boot loaders for various omap and related
  platforms.
+ .
+ Included platforms:
  ${uboot:platforms}
 
 Package: u-boot-sunxi
@@ -160,6 +174,8 @@ Description: A boot loader for sunxi systems
  .
  This package includes boot loaders for various Allwinner/sunxi
  platforms.
+ .
+ Included platforms:
  ${uboot:platforms}
 
 Package: u-boot-exynos
@@ -174,6 +190,8 @@ Description: A boot loader for exynos systems
  NIOS, and Microblaze.
  .
  This package includes boot loaders for various Exynos platforms.
+ .
+ Included platforms:
  ${uboot:platforms}
 
 Package: u-boot-mvebu
@@ -188,6 +206,8 @@ Description: A boot loader for marvell systems
  NIOS, and Microblaze.
  .
  This package includes boot loaders for various Marvell platforms.
+ .
+ Included platforms:
  ${uboot:platforms}
 
 Package: u-boot-rockchip
@@ -204,6 +224,8 @@ Description: A boot loader for rockchip systems
  NIOS, and Microblaze.
  .
  This package includes boot loaders for various Rockchip platforms.
+ .
+ Included platforms:
  ${uboot:platforms}
 
 Package: u-boot-rpi
@@ -219,6 +241,8 @@ Description: A boot loader for Raspberry PI systems
  .
  This package includes boot loaders for various Raspberry PI
  platforms.
+ .
+ Included platforms:
  ${uboot:platforms}
 
 Package: u-boot-sifive
@@ -234,6 +258,8 @@ Description: A boot loader for SiFive systems
  .
  This package includes boot loaders for various SiFive
  platforms.
+ .
+ Included platforms:
  ${uboot:platforms}
 
 Package: u-boot-tools
diff --git a/debian/rules b/debian/rules
index 19a61e3cb7..93bd16882c 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,5 +1,13 @@
 #!/usr/bin/make -f
 
+# The usual Debian targets are of course available, but you may also:
+# check the build of a platform:
+#   dpkg-buildpackage -aarm64 --build=any -Ppkg.uboot.notools -T puma-rk3399
+# check the build of a package:
+#   dpkg-buildpackage -aarm64 --build=any -Ppkg.uboot.notools -T u-boot-rockchip
+# fully build a specific .deb package:
+#   dpkg-buildpackage -aarm64 --build=any -Ppkg.uboot.notools,pkg.uboot.subarch.rockchip
+
 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,')
@@ -9,11 +17,6 @@ export CROSS_COMPILE ?= $(DEB_HOST_GNU_TYPE)-
 cross_build_tools ?= y
 endif
 
-# support parallel build using DEB_BUILD_OPTIONS=parallel=N
-ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
-  DEB_UBOOT_FLAGS += -j$(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
-endif
-
 # Enable verbose build by default, disable when terse is specified.
 ifneq (,$(filter terse,$(DEB_BUILD_OPTIONS)))
 VERBOSE=0
@@ -27,134 +30,164 @@ endif
 comma := ,
 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 = .
+subarch_profile := $(filter pkg.uboot.subarch.%,$(DEB_BUILD_PROFILES))
+ifeq ($(subarch_profile),)
+  built_subarchs := $(all_subarchs)
+  ignored_subarchs :=
 else
-TARGETSUBARCH = $(patsubst pkg.uboot.subarch.%,%,$(filter pkg.uboot.subarch.%,$(DEB_BUILD_PROFILES)))
+  built_subarchs := $(patsubst pkg.uboot.subarch.%,u-boot-%,$(subarch_profile))
+  ifeq ($(filter $(built_subarchs),$(all_subarchs)),)
+    $(error DEB_BUILD_PROFILES=$(DEB_BUILD_PROFILES) DEB_HOST_ARCH=$(DEB_HOST_ARCH))
+  endif
+  ignored_subarchs := $(filter-out $(built_subarchs),$(all_subarchs))
 endif
 
-%:
-	dh $@
+# Load instructions for the built platforms.
+include debian/u-boot-qemu.mk
+$(foreach subarch,$(built_subarchs),\
+  $(eval include debian/$(subarch)_$(DEB_HOST_ARCH).mk))
 
-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
+## Debian policy targets
 
-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
+# The -N options prevents a lots of warnings about obviously missing files.
+%:
+	dh $@ $(addprefix -N,$(ignored_subarchs))
 
-override_dh_auto_build-arch: TOOLSDIR := debian/build/tools
-override_dh_auto_build-arch: TARGETARCH := $(DEB_HOST_ARCH)
-ifeq (,$(filter pkg.uboot.notools,$(DEB_BUILD_PROFILES)))
-override_dh_auto_build-arch: build-targets build-tools
-else
-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: TOOLSDIR := debian/build/tools
-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;\
-			maketargets="all" ;\
-		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; \
-		$(MAKE) V=$(VERBOSE) O=$$builddir $${platform}_defconfig; \
-		sed -i -e 's,CONFIG_FIT_SIGNATURE=y,# CONFIG_FIT_SIGNATURE is not set,g' $$builddir/.config; \
-		$(MAKE) V=$(VERBOSE) $(DEB_UBOOT_FLAGS) O=$$builddir $${maketargets}; \
-		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 allow to export a variable
+# for all platforms within a subarch, but they are empty by default so
+# we need to tell Make that the default %: recipe above does not
+# apply.
+.PHONY: u-boot-qemu $(built_subarchs)
+
+## Platforms
+
+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)) \
+	  $(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)) all
+endef
+$(foreach package, u-boot-qemu $(built_subarchs),\
+  $(foreach platform, $($(package)_platforms),\
+    $(eval $(build_template))))
+
+## tools
+
+TOOLSDIR := debian/build/tools
 build-tools:
-	$(MAKE) V=$(VERBOSE) O=$(TOOLSDIR) CROSS_COMPILE=$(CROSS_COMPILE) tools-only_defconfig
-	cp $(TOOLSDIR)/.config $(TOOLSDIR)/config
+	# debian/rules: building tools
+	dh_auto_build -- V=$(VERBOSE) O=$(TOOLSDIR) CROSS_COMPILE=$(CROSS_COMPILE) tools-only_defconfig
 	# board-independent tools
-	$(MAKE) V=$(VERBOSE) O=$(TOOLSDIR) $(DEB_UBOOT_FLAGS) \
+	dh_auto_build -- V=$(VERBOSE) O=$(TOOLSDIR) \
 		CROSS_COMPILE=$(CROSS_COMPILE) \
 		CROSS_BUILD_TOOLS=$(cross_build_tools) \
 		NO_SDL=1 \
 	    tools-only
-	$(CROSS_COMPILE)strip --strip-unneeded --remove-section=.comment --remove-section=.note $(TOOLSDIR)/tools/mkimage
-	$(CROSS_COMPILE)strip --strip-unneeded --remove-section=.comment --remove-section=.note $(TOOLSDIR)/tools/mkenvimage
-	$(CROSS_COMPILE)strip --strip-unneeded --remove-section=.comment --remove-section=.note $(TOOLSDIR)/tools/kwboot
-	$(CROSS_COMPILE)strip --strip-unneeded --remove-section=.comment --remove-section=.note $(TOOLSDIR)/tools/mksunxiboot
-	$(CROSS_COMPILE)strip --strip-unneeded --remove-section=.comment --remove-section=.note $(TOOLSDIR)/tools/dumpimage
-
-override_dh_auto_test:
-ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
-	# only run tests on native builds
-	if [ -e debian/build/tools/tools/mkimage ] ; then \
-		BASEDIR=debian/build/tools test/image/test-imagetools.sh ;\
-	fi
-endif
-
-override_dh_strip:
-	# dh_strip tries to strip the cross compiled qemu images, which doesn't
-	# work
-	dh_strip -X qemu
 
+## auto_install
+
+# Do not spend time searching for an install target in Makefile.
+override_dh_auto_install:
+
+## auto_test
+
+# Only test when tools are built and native.
+override_dh_auto_test-arch:
+  ifeq ($(notools)$(cross_build_tools),)
+	BASEDIR=$(TOOLSDIR) test/image/test-imagetools.sh
+  endif
+override_dh_auto_test-indep:
+
+## install
+
+# override_dh_install would interfer with tools/notools.
+execute_after_dh_install-indep: install-u-boot-qemu
+execute_after_dh_install-arch: $(addprefix install-,$(built_subarchs))
+define install_template
+  install-$(package)::
+	cp -u debian/build/$(platform)/u-boot debian/build/$(platform)/uboot.elf
+	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 $(install_template))))
+
+## installdocs
+
+# Rename the configurations and install them as documentation.
+override_dh_installdocs-indep: installdocs-u-boot-qemu
+override_dh_installdocs-arch: $(addprefix installdocs-,$(built_subarchs))
+  ifeq ($(notools),)
+	cp -u $(TOOLSDIR)/.config $(TOOLSDIR)/config
+	dh_installdocs -pu-boot-tools $(TOOLSDIR)/config
+  endif
+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
+
+## fixperms
+
+# Upstream generates executable targets (last checked with 2020-10).
+# It is easyer and consistent with debhelper to fix this after installation.
+# override_dh_fixperms would interfer with tools/notools.
+# Split per-package targets because the debian/*/usr/lib/u-boot/*/*
+# global pattern would not match when building native tools on amd64.
+execute_after_dh_fixperms-indep: fixperms-u-boot-qemu
+execute_after_dh_fixperms-arch: $(addprefix fixperms-,$(built_subarchs))
+fixperms-%:
+	chmod -x debian/$*/usr/lib/u-boot/*/*
+
+## strip
+
+# dh_strip uses the host toolchain, and is not called for arch:all
+# packages, so we cannot override_dh_strip-indep.
+execute_after_dh_fixperms-indep: $(addprefix strip-,$(u-boot-qemu_platforms))
+strip-%:
+  # TODO: --strip-unneeded as policy recommends? If not, why?
+	$($*_CROSS_COMPILE)strip --remove-section=.comment --remove-section=.note \
+	  debian/u-boot-qemu/usr/lib/u-boot/$*/uboot.elf
+
+## gencontrol
+
+# Allow *.mk to:    PACKAGE_substvars := -Vuboot:NAME=VALUE
+override_dh_gencontrol-indep: gencontrol-u-boot-qemu
+override_dh_gencontrol-arch: $(addprefix gencontrol-,$(built_subarchs))
+  ifeq ($(notools),)
+	dh_gencontrol -pu-boot-tools
+  endif
+gencontrol-%:
+	dh_gencontrol -p$* -- $($*_substvars) \
+	  "-Vuboot:platforms=$$(echo $($*_platforms) | sed 's, ,$${Newline},g')"
+
+## clean
+
+# Allow .mk to:     dh_clean_args += FILE DIRECTORY/
 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
-
-override_dh_gencontrol:
-	debian/bin/update-substvars
-	dh_gencontrol
+	dh_clean debian/build/ linux.itb linux.its $(dh_clean_args)
+	find . -type d -name __pycache__ -delete
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-imx_armhf.mk b/debian/u-boot-imx_armhf.mk
index ddd31bec30..b8ce82a72a 100644
--- a/debian/u-boot-imx_armhf.mk
+++ b/debian/u-boot-imx_armhf.mk
@@ -30,6 +30,11 @@ novena_targets := SPL u-boot.img uboot.elf
 # Vagrant Cascadian <[email protected]>
 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 <[email protected]>
 u-boot-imx_platforms += udoo
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-omap_armhf.mk b/debian/u-boot-omap_armhf.mk
index 5e4a67913b..6efc0618b6 100644
--- a/debian/u-boot-omap_armhf.mk
+++ b/debian/u-boot-omap_armhf.mk
@@ -4,6 +4,11 @@
 # Andrew M.A. Cater <[email protected]>
 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 <[email protected]>
 # Andrew M.A. Cater <[email protected]>
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.arm64 b/debian/u-boot-rockchip.install.arm64
old mode 100755
new mode 100644
index 89856b7c6c..11988d2d4d
--- a/debian/u-boot-rockchip.install.arm64
+++ b/debian/u-boot-rockchip.install.arm64
@@ -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-rockchip.install.armhf b/debian/u-boot-rockchip.install.armhf
old mode 100755
new mode 100644
index 8142144146..ba778444cf
--- a/debian/u-boot-rockchip.install.armhf
+++ b/debian/u-boot-rockchip.install.armhf
@@ -1,3 +1 @@
-#!/bin/sh
-debian/bin/u-boot-install-targets rockchip
-echo debian/bin/u-boot-install-rockchip /usr/bin/
+debian/bin/u-boot-install-rockchip      usr/bin
diff --git a/debian/u-boot-rockchip_arm64.mk b/debian/u-boot-rockchip_arm64.mk
index d2db8e55c7..7adb95542a 100644
--- a/debian/u-boot-rockchip_arm64.mk
+++ b/debian/u-boot-rockchip_arm64.mk
@@ -1,5 +1,15 @@
 # Helper for debian/rules
 
+u-boot-rockchip_substvars := "-Vuboot:Built-Using=$$(dpkg-query \
+  -f '$${source:Package} (= $${source:Version}) [arm64]' -W 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]>
 u-boot-rockchip_platforms += firefly-rk3399
 firefly-rk3399: export BL31 := /usr/lib/arm-trusted-firmware/rk3399/bl31.elf
diff --git a/debian/u-boot-rockchip_armhf.mk b/debian/u-boot-rockchip_armhf.mk
index 91ae8233de..d5022ba824 100644
--- a/debian/u-boot-rockchip_armhf.mk
+++ b/debian/u-boot-rockchip_armhf.mk
@@ -1,5 +1,8 @@
 # Helper for debian/rules
 
+# Silent a debhelper warning about an unused substvar.
+u-boot-rockchip_substvars := -Vuboot:Built-Using=
+
 # Vagrant Cascadian <[email protected]>, 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
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.arm64 b/debian/u-boot-sunxi.install.arm64
old mode 100755
new mode 100644
index e0b6edecf5..fa3e744652
--- a/debian/u-boot-sunxi.install.arm64
+++ b/debian/u-boot-sunxi.install.arm64
@@ -1,4 +1 @@
-#!/bin/sh
-debian/bin/u-boot-install-targets sunxi
-
-echo debian/bin/u-boot-install-sunxi64 /usr/bin/
+debian/bin/u-boot-install-sunxi64       usr/bin
diff --git a/debian/u-boot-sunxi.install.armhf b/debian/u-boot-sunxi.install.armhf
deleted file mode 100755
index 014df87412..0000000000
--- a/debian/u-boot-sunxi.install.armhf
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-debian/bin/u-boot-install-targets sunxi
diff --git a/debian/u-boot-sunxi_arm64.mk b/debian/u-boot-sunxi_arm64.mk
index 8c083ab599..bdfa8c1b0b 100644
--- a/debian/u-boot-sunxi_arm64.mk
+++ b/debian/u-boot-sunxi_arm64.mk
@@ -1,5 +1,12 @@
 # Helper for debian/rules
 
+# Debian does not yet provide the optional SCP firmware described in
+# README.sunxi64.
+u-boot-sunxi: export SCP := /dev/null
+
+u-boot-sunxi_substvars := "-Vuboot:Built-Using=$$(dpkg-query \
+  -f '$${source:Package} (= $${source:Version}) [arm64]' -W arm-trusted-firmware)"
+
 # Rodrigo Exterckötter Tjäder <[email protected]>
 u-boot-sunxi_platforms += a64-olinuxino
 a64-olinuxino: export BL31 := /usr/lib/arm-trusted-firmware/sun50i_a64/bl31.bin
diff --git a/debian/u-boot-sunxi_armhf.mk b/debian/u-boot-sunxi_armhf.mk
index 47cdcc111b..5611b983ec 100644
--- a/debian/u-boot-sunxi_armhf.mk
+++ b/debian/u-boot-sunxi_armhf.mk
@@ -1,5 +1,8 @@
 # Helper for debian/rules
 
+# Silent a debhelper warning about an unused substvar.
+u-boot-sunxi_substvars := -Vuboot:Built-Using=
+
 # Christian Kastner <[email protected]>
 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-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-tools.install b/debian/u-boot-tools.install
index efa9af7d79..0f60ddec67 100644
--- a/debian/u-boot-tools.install
+++ b/debian/u-boot-tools.install
@@ -3,6 +3,3 @@ debian/build/tools/tools/kwboot         usr/bin
 debian/build/tools/tools/mkenvimage     usr/bin
 debian/build/tools/tools/mkimage        usr/bin
 debian/build/tools/tools/mksunxiboot    usr/bin
-
-# install config
-debian/build/tools/config               usr/share/doc/u-boot-tools
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

Reply via email to