[OpenWrt-Devel] [PATCH 3/3] treewide: rename DEVICE_TYPE to DEFAULT_TYPE

Matthias Schiffer mschiffer at universe-factory.net
Fri May 29 15:45:53 EDT 2020


On 5/29/20 7:22 PM, Adrian Schmutzler wrote:
> The prefix "DEVICE_" for Make variables is only used for per-device
> variables with the only exception of DEVICE_TYPE. This is misleading
> as it leads people to incorrectly assume it can be set per device like
> all the other DEVICE_* variables, as has been observed in the past.
> 
> This renames this (rarely used) variable to clearly indicate that
> it's not a device-dependent variable, and stays in line with the
> DEFAULT_PACKAGES variable.
> 
> Note that there is also a (single) package in the packages feed that
> needs to be updated.
> 
> Cc: Linus Walleij <linus.walleij at linaro.org>
> Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> ---

Default type of what? IMO "DEFAULT_TYPE" is significantly worse than
"DEVICE_TYPE": "DEVICE_TYPE" may be slightly misleading, but at least it's
somehow conveying the information that we're talking about types of
devices. The part "DEFAULT" is also misleading in a different way, as I
would expect to be able to override a default value (for example in a
device definiton).

The variable is used rarely enough that we could well make this a bit more
verbose. "TARGET_DEVICE_TYPE"? If it weren't for the busybox config change
(which seems hacky to me at best*), we could also go with something like
TARGET_PACKAGEGROUP, as the package selection would be the only thing
controlled by this variable...

[*] Busybox is missing the "nonshared" flag, so opkg updates of busybox
would gain or lose the CONFIG_HDPARM setting, depending one the target used
to build the busybox package for a given architecture...

Matthias



>  include/target.mk              | 4 ++--
>  package/utils/busybox/Makefile | 2 +-
>  target/linux/arc770/Makefile   | 2 +-
>  target/linux/archs38/Makefile  | 2 +-
>  target/linux/oxnas/Makefile    | 2 +-
>  5 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/include/target.mk b/include/target.mk
> index a2ceb7f783..8374de2ebd 100644
> --- a/include/target.mk
> +++ b/include/target.mk
> @@ -10,7 +10,7 @@ ifneq ($(__target_inc),1)
>  __target_inc=1
>  
>  # default device type
> -DEVICE_TYPE?=router
> +DEFAULT_TYPE?=router
>  
>  # Default packages - the really basic set
>  DEFAULT_PACKAGES:=base-files libc libgcc busybox dropbear mtd uci opkg netifd fstools uclient-fetch logd urandom-seed urngd
> @@ -53,7 +53,7 @@ else
>  endif
>  
>  # Add device specific packages (here below to allow device type set from subtarget)
> -DEFAULT_PACKAGES += $(DEFAULT_PACKAGES.$(DEVICE_TYPE))
> +DEFAULT_PACKAGES += $(DEFAULT_PACKAGES.$(DEFAULT_TYPE))
>  
>  filter_packages = $(filter-out -% $(patsubst -%,%,$(filter -%,$(1))),$(1))
>  extra_packages = $(if $(filter wpad-mini wpad-basic wpad nas,$(1)),iwinfo)
> diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile
> index 01441d1e87..81dde74d0b 100644
> --- a/package/utils/busybox/Makefile
> +++ b/package/utils/busybox/Makefile
> @@ -94,7 +94,7 @@ endif
>  define Build/Configure
>  	rm -f $(PKG_BUILD_DIR)/.config
>  	touch $(PKG_BUILD_DIR)/.config
> -ifeq ($(DEVICE_TYPE),nas)
> +ifeq ($(DEFAULT_TYPE),nas)
>  	echo "CONFIG_HDPARM=y" >> $(PKG_BUILD_DIR)/.config
>  endif
>  	grep 'CONFIG_BUSYBOX_$(BUSYBOX_SYM)' $(TOPDIR)/.config | sed -e "s,\\(# \)\\?CONFIG_BUSYBOX_$(BUSYBOX_SYM)_\\(.*\\),\\1CONFIG_\\2,g" >> $(PKG_BUILD_DIR)/.config
> diff --git a/target/linux/arc770/Makefile b/target/linux/arc770/Makefile
> index 018d6e5448..d1f3e2dc82 100644
> --- a/target/linux/arc770/Makefile
> +++ b/target/linux/arc770/Makefile
> @@ -13,7 +13,7 @@ SUBTARGETS:=generic
>  
>  KERNEL_PATCHVER:=4.14
>  
> -DEVICE_TYPE:=basic
> +DEFAULT_TYPE:=basic
>  
>  define Target/Description
>  	Synopsys DesignWare boards
> diff --git a/target/linux/archs38/Makefile b/target/linux/archs38/Makefile
> index 5b3650ef8d..891583b2d2 100644
> --- a/target/linux/archs38/Makefile
> +++ b/target/linux/archs38/Makefile
> @@ -14,7 +14,7 @@ SUBTARGETS:=generic
>  
>  KERNEL_PATCHVER:=5.4
>  
> -DEVICE_TYPE:=basic
> +DEFAULT_TYPE:=basic
>  
>  define Target/Description
>  	Synopsys DesignWare boards
> diff --git a/target/linux/oxnas/Makefile b/target/linux/oxnas/Makefile
> index 750eddbcbb..10d05e914f 100644
> --- a/target/linux/oxnas/Makefile
> +++ b/target/linux/oxnas/Makefile
> @@ -5,7 +5,7 @@ BOARD:=oxnas
>  BOARDNAME:=PLXTECH/Oxford NAS782x/OX8xx
>  SUBTARGETS:=ox810se ox820
>  FEATURES:=gpio ramdisk rtc squashfs
> -DEVICE_TYPE:=nas
> +DEFAULT_TYPE:=nas
>  
>  KERNEL_PATCHVER:=5.4
>  
> 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20200529/27ba8a8b/attachment.sig>
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list