[PATCH] treewide: extend DEFAULT_PACKAGES before target.mk

Paul Spooren mail at aparcar.org
Mon Mar 8 23:14:52 GMT 2021


The DEFAULT_PACKAGES are found in every target Makefile and define
packages that should be installed on devices. Appending these packages
after including target.mk results in duplicate package addition.

Without this patch, the target specific DEFAULT_PACKAGES are added
twice, see example below:

    TOPDIR=$(pwd) make --no-print-directory -C target/linux/mvebu/ \
    val.DEFAULT_PACKAGES
    base-files ca-bundle dropbear fstools libc libgcc libustream-wolfssl
    logd mtd netifd opkg uci uclient-fetch urandom-seed urngd busybox
    procd uboot-envtools kmod-gpio-button-hotplug dnsmasq firewall
    ip6tables iptables kmod-ipt-offload odhcp6c odhcpd-ipv6only ppp
    ppp-mod-pppoe uboot-envtools kmod-gpio-button-hotplug

After applying this patch, the two duplicate packages are no longer
added, see below:

    TOPDIR=$(pwd) make --no-print-directory -C target/linux/mvebu/ \
    val.DEFAULT_PACKAGES
    base-files ca-bundle dropbear fstools libc libgcc libustream-wolfssl
    logd mtd netifd opkg uci uclient-fetch urandom-seed urngd busybox
    procd uboot-envtools kmod-gpio-button-hotplug dnsmasq firewall
    ip6tables iptables kmod-ipt-offload odhcp6c odhcpd-ipv6only ppp
    ppp-mod-pppoe

Signed-off-by: Paul Spooren <mail at aparcar.org>
---
This behaviour also results in duplicates in produced JSON files:
https://downloads.openwrt.org/snapshots/targets/mvebu/cortexa9/profiles.json

The package kmod-gpio-button-hotplug is added twice to the
default_packages array.

 target/linux/apm821xx/Makefile   | 4 ++--
 target/linux/bcm47xx/Makefile    | 4 ++--
 target/linux/bcm4908/Makefile    | 4 ++--
 target/linux/bcm53xx/Makefile    | 8 ++++----
 target/linux/bcm63xx/Makefile    | 4 ++--
 target/linux/bmips/Makefile      | 4 ++--
 target/linux/gemini/Makefile     | 4 ++--
 target/linux/imx6/Makefile       | 4 ++--
 target/linux/ipq40xx/Makefile    | 3 ++-
 target/linux/ipq806x/Makefile    | 3 ++-
 target/linux/kirkwood/Makefile   | 4 ++--
 target/linux/layerscape/Makefile | 4 ++--
 target/linux/malta/Makefile      | 4 ++--
 target/linux/mediatek/Makefile   | 3 ++-
 target/linux/mpc85xx/Makefile    | 4 ++--
 target/linux/mvebu/Makefile      | 4 ++--
 target/linux/octeon/Makefile     | 4 ++--
 target/linux/omap/Makefile       | 4 ++--
 target/linux/oxnas/Makefile      | 4 ++--
 target/linux/pistachio/Makefile  | 8 ++++----
 target/linux/ramips/Makefile     | 3 ++-
 target/linux/realtek/Makefile    | 8 ++++----
 target/linux/rockchip/Makefile   | 4 ++--
 target/linux/sunxi/Makefile      | 6 +++---
 target/linux/tegra/Makefile      | 4 ++--
 target/linux/uml/Makefile        | 4 ++--
 target/linux/x86/Makefile        | 4 ++--
 target/linux/zynq/Makefile       | 6 +++---
 28 files changed, 64 insertions(+), 60 deletions(-)

diff --git a/target/linux/apm821xx/Makefile b/target/linux/apm821xx/Makefile
index 9c7f276dc0..891db08b72 100644
--- a/target/linux/apm821xx/Makefile
+++ b/target/linux/apm821xx/Makefile
@@ -16,11 +16,11 @@ define Target/Description
 	Build images for AppliedMicro APM821xx based boards.
 endef
 
-include $(INCLUDE_DIR)/target.mk
-
 KERNELNAME:=uImage
 
 DEFAULT_PACKAGES += \
 	kmod-leds-gpio kmod-i2c-core kmod-gpio-button-hotplug
 
+include $(INCLUDE_DIR)/target.mk
+
 $(eval $(call BuildTarget))
diff --git a/target/linux/bcm47xx/Makefile b/target/linux/bcm47xx/Makefile
index 9ffd4f3f29..ef6b807e3b 100644
--- a/target/linux/bcm47xx/Makefile
+++ b/target/linux/bcm47xx/Makefile
@@ -17,9 +17,9 @@ define Target/Description
 	Build firmware images for Broadcom based BCM47xx/53xx routers with MIPS CPU, *not* ARM.
 endef
 
-include $(INCLUDE_DIR)/target.mk
-
 DEFAULT_PACKAGES += swconfig nvram otrx \
 	kmod-leds-gpio kmod-gpio-button-hotplug
 
+include $(INCLUDE_DIR)/target.mk
+
 $(eval $(call BuildTarget))
diff --git a/target/linux/bcm4908/Makefile b/target/linux/bcm4908/Makefile
index 5bee66fe2b..f028aed86d 100644
--- a/target/linux/bcm4908/Makefile
+++ b/target/linux/bcm4908/Makefile
@@ -16,10 +16,10 @@ define Target/Description
 	Build firmware images for Broadcom BCM4908 SoC family routers.
 endef
 
+DEFAULT_PACKAGES += kmod-usb-ohci kmod-usb2 kmod-usb3
+
 include $(INCLUDE_DIR)/target.mk
 
 KERNELNAME:=Image dtbs
 
-DEFAULT_PACKAGES += kmod-usb-ohci kmod-usb2 kmod-usb3
-
 $(eval $(call BuildTarget))
diff --git a/target/linux/bcm53xx/Makefile b/target/linux/bcm53xx/Makefile
index bb356ff244..a45f41661c 100644
--- a/target/linux/bcm53xx/Makefile
+++ b/target/linux/bcm53xx/Makefile
@@ -18,13 +18,13 @@ define Target/Description
 	Build firmware images for Broadcom based BCM47xx/53xx routers with ARM CPU, *not* MIPS.
 endef
 
-include $(INCLUDE_DIR)/target.mk
-
-KERNELNAME:=zImage dtbs
-
 DEFAULT_PACKAGES += swconfig nvram \
 	osafeloader oseama otrx \
 	kmod-gpio-button-hotplug \
 	kmod-leds-gpio
 
+include $(INCLUDE_DIR)/target.mk
+
+KERNELNAME:=zImage dtbs
+
 $(eval $(call BuildTarget))
diff --git a/target/linux/bcm63xx/Makefile b/target/linux/bcm63xx/Makefile
index 23e43f601a..9d6a9a0aee 100644
--- a/target/linux/bcm63xx/Makefile
+++ b/target/linux/bcm63xx/Makefile
@@ -19,8 +19,8 @@ define Target/Description
 	(e.g. Inventel Livebox, Siemens SE515, Neufbox 4)
 endef
 
-include $(INCLUDE_DIR)/target.mk
-
 DEFAULT_PACKAGES += swconfig kmod-gpio-button-hotplug
 
+include $(INCLUDE_DIR)/target.mk
+
 $(eval $(call BuildTarget))
diff --git a/target/linux/bmips/Makefile b/target/linux/bmips/Makefile
index 0adc8cd97e..251e2062ec 100644
--- a/target/linux/bmips/Makefile
+++ b/target/linux/bmips/Makefile
@@ -16,8 +16,8 @@ define Target/Description
 	BCM63xx DSL chips and BCM7xxx set-top box chips.
 endef
 
-include $(INCLUDE_DIR)/target.mk
-
 DEFAULT_PACKAGES += kmod-gpio-button-hotplug
 
+include $(INCLUDE_DIR)/target.mk
+
 $(eval $(call BuildTarget))
diff --git a/target/linux/gemini/Makefile b/target/linux/gemini/Makefile
index d2acb52fac..0f197019d2 100644
--- a/target/linux/gemini/Makefile
+++ b/target/linux/gemini/Makefile
@@ -18,12 +18,12 @@ endef
 
 KERNELNAME:=zImage dtbs
 
-include $(INCLUDE_DIR)/target.mk
-
 DEFAULT_PACKAGES += \
 	kmod-usb-fotg210 \
 	kmod-usb-ledtrig-usbport \
 	kmod-leds-gpio \
 	kmod-gpio-button-hotplug
 
+include $(INCLUDE_DIR)/target.mk
+
 $(eval $(call BuildTarget))
diff --git a/target/linux/imx6/Makefile b/target/linux/imx6/Makefile
index 6582c83869..9aec8bf258 100644
--- a/target/linux/imx6/Makefile
+++ b/target/linux/imx6/Makefile
@@ -14,10 +14,10 @@ CPU_SUBTYPE:=neon
 KERNEL_PATCHVER:=5.4
 KERNEL_TESTING_PATCHVER:=5.10
 
+DEFAULT_PACKAGES += uboot-envtools mkf2fs e2fsprogs blkid
+
 include $(INCLUDE_DIR)/target.mk
 
 KERNELNAME:=zImage dtbs
 
-DEFAULT_PACKAGES += uboot-envtools mkf2fs e2fsprogs blkid
-
 $(eval $(call BuildTarget))
diff --git a/target/linux/ipq40xx/Makefile b/target/linux/ipq40xx/Makefile
index 43b1fcb0f9..72913f375a 100644
--- a/target/linux/ipq40xx/Makefile
+++ b/target/linux/ipq40xx/Makefile
@@ -13,11 +13,12 @@ KERNEL_TESTING_PATCHVER:=5.4
 
 KERNELNAME:=zImage Image dtbs
 
-include $(INCLUDE_DIR)/target.mk
 DEFAULT_PACKAGES += \
 	kmod-usb-dwc3-qcom \
 	kmod-leds-gpio kmod-gpio-button-hotplug swconfig \
 	kmod-ath10k-ct wpad-basic-wolfssl \
 	kmod-usb3 kmod-usb-dwc3 ath10k-firmware-qca4019-ct
 
+include $(INCLUDE_DIR)/target.mk
+
 $(eval $(call BuildTarget))
diff --git a/target/linux/ipq806x/Makefile b/target/linux/ipq806x/Makefile
index 69d3aa1e56..a707b5276b 100644
--- a/target/linux/ipq806x/Makefile
+++ b/target/linux/ipq806x/Makefile
@@ -14,7 +14,6 @@ KERNEL_PATCHVER:=5.4
 
 KERNELNAME:=zImage Image dtbs
 
-include $(INCLUDE_DIR)/target.mk
 DEFAULT_PACKAGES += \
 	kmod-leds-gpio kmod-gpio-button-hotplug swconfig \
 	kmod-ata-ahci kmod-ata-ahci-platform \
@@ -23,4 +22,6 @@ DEFAULT_PACKAGES += \
 	kmod-ath10k-ct wpad-basic-wolfssl \
 	uboot-envtools
 
+include $(INCLUDE_DIR)/target.mk
+
 $(eval $(call BuildTarget))
diff --git a/target/linux/kirkwood/Makefile b/target/linux/kirkwood/Makefile
index 1f5159e444..4a6bfc360a 100644
--- a/target/linux/kirkwood/Makefile
+++ b/target/linux/kirkwood/Makefile
@@ -13,10 +13,10 @@ CPU_TYPE:=xscale
 KERNEL_PATCHVER:=5.4
 KERNEL_TESTING_PATCHVER:=5.10
 
+DEFAULT_PACKAGES += uboot-envtools kmod-usb2
+
 include $(INCLUDE_DIR)/target.mk
 
 KERNELNAME:=zImage dtbs
 
-DEFAULT_PACKAGES += uboot-envtools kmod-usb2
-
 $(eval $(call BuildTarget))
diff --git a/target/linux/layerscape/Makefile b/target/linux/layerscape/Makefile
index 71034224ab..395605d55f 100644
--- a/target/linux/layerscape/Makefile
+++ b/target/linux/layerscape/Makefile
@@ -14,9 +14,9 @@ define Target/Description
 	Build firmware images for NXP Layerscape based boards.
 endef
 
-include $(INCLUDE_DIR)/target.mk
-
 DEFAULT_PACKAGES += kmod-usb3 kmod-usb-dwc3 kmod-usb-storage \
   mkf2fs e2fsprogs partx-utils
 
+include $(INCLUDE_DIR)/target.mk
+
 $(eval $(call BuildTarget))
diff --git a/target/linux/malta/Makefile b/target/linux/malta/Makefile
index 18b463f1ea..531b4d076e 100644
--- a/target/linux/malta/Makefile
+++ b/target/linux/malta/Makefile
@@ -12,8 +12,8 @@ FEATURES:=cpiogz ext4 ramdisk squashfs targz
 
 KERNEL_PATCHVER:=5.4
 
-include $(INCLUDE_DIR)/target.mk
-
 DEFAULT_PACKAGES += wpad-basic-wolfssl kmod-mac80211-hwsim kmod-pcnet32 mkf2fs e2fsprogs
 
+include $(INCLUDE_DIR)/target.mk
+
 $(eval $(call BuildTarget))
diff --git a/target/linux/mediatek/Makefile b/target/linux/mediatek/Makefile
index 2ee00e5d17..357ca9f733 100644
--- a/target/linux/mediatek/Makefile
+++ b/target/linux/mediatek/Makefile
@@ -11,8 +11,9 @@ FEATURES:=squashfs nand separate_ramdisk fpu
 KERNEL_PATCHVER:=5.4
 KERNEL_TESTING_PATCHVER:=5.10
 
-include $(INCLUDE_DIR)/target.mk
 DEFAULT_PACKAGES += \
 	kmod-leds-gpio kmod-gpio-button-hotplug
 
+include $(INCLUDE_DIR)/target.mk
+
 $(eval $(call BuildTarget))
diff --git a/target/linux/mpc85xx/Makefile b/target/linux/mpc85xx/Makefile
index 5e3ffb8b3c..8bb2b194c3 100644
--- a/target/linux/mpc85xx/Makefile
+++ b/target/linux/mpc85xx/Makefile
@@ -16,10 +16,10 @@ KERNEL_TESTING_PATCHVER:=5.10
 
 KERNELNAME:=zImage
 
-include $(INCLUDE_DIR)/target.mk
-
 DEFAULT_PACKAGES += \
 	kmod-input-core kmod-input-gpio-keys kmod-button-hotplug \
 	kmod-leds-gpio swconfig kmod-ath9k wpad-basic-wolfssl kmod-usb2
 
+include $(INCLUDE_DIR)/target.mk
+
 $(eval $(call BuildTarget))
diff --git a/target/linux/mvebu/Makefile b/target/linux/mvebu/Makefile
index 1550309a92..afdb653302 100644
--- a/target/linux/mvebu/Makefile
+++ b/target/linux/mvebu/Makefile
@@ -12,8 +12,8 @@ SUBTARGETS:=cortexa9 cortexa53 cortexa72
 KERNEL_PATCHVER:=5.4
 KERNEL_TESTING_PATCHVER:=5.10
 
-include $(INCLUDE_DIR)/target.mk
-
 DEFAULT_PACKAGES += uboot-envtools kmod-gpio-button-hotplug
 
+include $(INCLUDE_DIR)/target.mk
+
 $(eval $(call BuildTarget))
diff --git a/target/linux/octeon/Makefile b/target/linux/octeon/Makefile
index 5c4c12a4ef..e9964da53b 100644
--- a/target/linux/octeon/Makefile
+++ b/target/linux/octeon/Makefile
@@ -17,8 +17,8 @@ define Target/Description
 	Build firmware images for Cavium Networks Octeon-based boards.
 endef
 
-include $(INCLUDE_DIR)/target.mk
-
 DEFAULT_PACKAGES += mkf2fs e2fsprogs
 
+include $(INCLUDE_DIR)/target.mk
+
 $(eval $(call BuildTarget))
diff --git a/target/linux/omap/Makefile b/target/linux/omap/Makefile
index 0643d3ad84..05a185d348 100644
--- a/target/linux/omap/Makefile
+++ b/target/linux/omap/Makefile
@@ -19,8 +19,8 @@ define Target/Description
 	TI OMAP boards
 endef
 
-include $(INCLUDE_DIR)/target.mk
-
 DEFAULT_PACKAGES += partx-utils mkf2fs e2fsprogs
 
+include $(INCLUDE_DIR)/target.mk
+
 $(eval $(call BuildTarget))
diff --git a/target/linux/oxnas/Makefile b/target/linux/oxnas/Makefile
index 003ed6ecd6..3b2aab763f 100644
--- a/target/linux/oxnas/Makefile
+++ b/target/linux/oxnas/Makefile
@@ -10,12 +10,12 @@ DEVICE_TYPE:=nas
 KERNEL_PATCHVER:=5.4
 KERNEL_TESTING_PATCHVER:=5.10
 
-include $(INCLUDE_DIR)/target.mk
-
 DEFAULT_PACKAGES += \
 	kmod-button-hotplug kmod-input-gpio-keys-polled \
 	kmod-leds-gpio uboot-envtools
 
+include $(INCLUDE_DIR)/target.mk
+
 KERNELNAME:=zImage dtbs
 
 $(eval $(call BuildTarget))
diff --git a/target/linux/pistachio/Makefile b/target/linux/pistachio/Makefile
index 962871af13..ccedadb6aa 100644
--- a/target/linux/pistachio/Makefile
+++ b/target/linux/pistachio/Makefile
@@ -13,12 +13,12 @@ CPU_SUBTYPE:=24kf
 
 KERNEL_PATCHVER:=5.4
 
-include $(INCLUDE_DIR)/target.mk
-
-KERNELNAME:=vmlinux dtbs
-
 DEFAULT_PACKAGES += \
 	kmod-gpio-button-hotplug \
 	uboot-envtools
 
+include $(INCLUDE_DIR)/target.mk
+
+KERNELNAME:=vmlinux dtbs
+
 $(eval $(call BuildTarget))
diff --git a/target/linux/ramips/Makefile b/target/linux/ramips/Makefile
index d3f2d4b8fc..1738948a90 100644
--- a/target/linux/ramips/Makefile
+++ b/target/linux/ramips/Makefile
@@ -17,7 +17,8 @@ define Target/Description
 	Build firmware images for Ralink RT288x/RT3xxx based boards.
 endef
 
-include $(INCLUDE_DIR)/target.mk
 DEFAULT_PACKAGES += kmod-leds-gpio kmod-gpio-button-hotplug
 
+include $(INCLUDE_DIR)/target.mk
+
 $(eval $(call BuildTarget))
diff --git a/target/linux/realtek/Makefile b/target/linux/realtek/Makefile
index 5159a40c4c..ee3cbcef2b 100644
--- a/target/linux/realtek/Makefile
+++ b/target/linux/realtek/Makefile
@@ -16,12 +16,12 @@ define Target/Description
 	Build firmware images for Realtek RTL83xx based boards.
 endef
 
-include $(INCLUDE_DIR)/target.mk
-
-FEATURES := $(filter-out mips16,$(FEATURES))
-
 DEFAULT_PACKAGES += uboot-envtools ethtool kmod-gpio-button-hotplug \
 	dnsmasq firewall ip6tables iptables odhcp6c odhcpd-ipv6only \
 	ip-full ip-bridge tc
 
+include $(INCLUDE_DIR)/target.mk
+
+FEATURES := $(filter-out mips16,$(FEATURES))
+
 $(eval $(call BuildTarget))
diff --git a/target/linux/rockchip/Makefile b/target/linux/rockchip/Makefile
index 7aeb0a3d55..342cb46b02 100644
--- a/target/linux/rockchip/Makefile
+++ b/target/linux/rockchip/Makefile
@@ -14,10 +14,10 @@ define Target/Description
 	Build firmware image for Rockchip SoC devices.
 endef
 
-include $(INCLUDE_DIR)/target.mk
-
 DEFAULT_PACKAGES += uboot-envtools partx-utils e2fsprogs mkf2fs kmod-gpio-button-hotplug
 
+include $(INCLUDE_DIR)/target.mk
+
 KERNELNAME:=Image dtbs
 
 $(eval $(call BuildTarget))
diff --git a/target/linux/sunxi/Makefile b/target/linux/sunxi/Makefile
index 1e07520db8..b2bf9a9f55 100644
--- a/target/linux/sunxi/Makefile
+++ b/target/linux/sunxi/Makefile
@@ -22,9 +22,9 @@ KERNELNAME:=zImage dtbs
 # H3: quad Cortex-A7
 # R40: quad Cortex-A7
 
-include $(INCLUDE_DIR)/target.mk
+DEFAULT_PACKAGES += uboot-envtools \
+	partx-utils mkf2fs e2fsprogs
 
-DEFAULT_PACKAGES += uboot-envtools
-DEFAULT_PACKAGES += partx-utils mkf2fs e2fsprogs
+include $(INCLUDE_DIR)/target.mk
 
 $(eval $(call BuildTarget))
diff --git a/target/linux/tegra/Makefile b/target/linux/tegra/Makefile
index 4d4b0e5ea4..87a008bb4d 100644
--- a/target/linux/tegra/Makefile
+++ b/target/linux/tegra/Makefile
@@ -14,12 +14,12 @@ CPU_SUBTYPE := vfpv3-d16
 KERNEL_PATCHVER := 5.4
 KERNEL_TESTING_PATCHVER := 5.4
 
+DEFAULT_PACKAGES += e2fsprogs mkf2fs partx-utils
+
 include $(INCLUDE_DIR)/target.mk
 
 KERNELNAME := zImage dtbs
 
-DEFAULT_PACKAGES += e2fsprogs mkf2fs partx-utils
-
 define Target/Description
 	Build firmware image for NVIDIA Tegra SoC devices.
 endef
diff --git a/target/linux/uml/Makefile b/target/linux/uml/Makefile
index ae8ea5d309..ea44f1bb27 100644
--- a/target/linux/uml/Makefile
+++ b/target/linux/uml/Makefile
@@ -21,12 +21,12 @@ FEATURES:=squashfs ext4 audio source-only
 
 KERNEL_PATCHVER:=5.4
 
+DEFAULT_PACKAGES += wpad-basic-wolfssl kmod-mac80211-hwsim mkf2fs e2fsprogs
+
 include $(INCLUDE_DIR)/target.mk
 
 LINUX_TARGET_CONFIG:=$(CURDIR)/config/$(ARCH)
 
-DEFAULT_PACKAGES += wpad-basic-wolfssl kmod-mac80211-hwsim mkf2fs e2fsprogs
-
 endif
 
 $(eval $(call BuildTarget))
diff --git a/target/linux/x86/Makefile b/target/linux/x86/Makefile
index c78eac0094..6661315766 100644
--- a/target/linux/x86/Makefile
+++ b/target/linux/x86/Makefile
@@ -15,10 +15,10 @@ KERNEL_TESTING_PATCHVER:=5.4
 
 KERNELNAME:=bzImage
 
-include $(INCLUDE_DIR)/target.mk
-
 DEFAULT_PACKAGES += partx-utils mkf2fs e2fsprogs kmod-button-hotplug
 
+include $(INCLUDE_DIR)/target.mk
+
 $(eval $(call BuildTarget))
 
 $(eval $(call $(if $(CONFIG_ISO_IMAGES),SetupHostCommand,Ignore),mkisofs, \
diff --git a/target/linux/zynq/Makefile b/target/linux/zynq/Makefile
index b5988c9e05..38b38d0eb8 100644
--- a/target/linux/zynq/Makefile
+++ b/target/linux/zynq/Makefile
@@ -19,11 +19,11 @@ endef
 
 KERNEL_PATCHVER:=5.4
 
+DEFAULT_PACKAGES += uboot-envtools mkf2fs e2fsprogs \
+	kmod-usb-storage kmod-fs-msdos
+
 include $(INCLUDE_DIR)/target.mk
 
 KERNELNAME:=Image dtbs
 
-DEFAULT_PACKAGES += uboot-envtools mkf2fs e2fsprogs \
-	kmod-usb-storage kmod-fs-msdos
-
 $(eval $(call BuildTarget))
-- 
2.30.1




More information about the openwrt-devel mailing list