[OpenWrt-Devel] [PATCH 2/2] sunxi: construct DTS name from device node name and SOC

Tomasz Maciej Nowak tomek_n at o2.pl
Tue Dec 10 08:38:59 EST 2019


Hi Adrian.

W dniu 07.12.2019 o 23:28, Adrian Schmutzler pisze:
> The device part in the SUNXI_DTS variable always corresponds to
> device node name. This is another redundancy that can be removed
> by calculating the DTS name from a newly introduced SUNXI_SOC
> variable and the node name.
> 
> Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
> ---
>  target/linux/sunxi/image/Makefile      |  5 ++-
>  target/linux/sunxi/image/cortex-a53.mk | 18 +++++++----
>  target/linux/sunxi/image/cortex-a7.mk  | 44 +++++++++++++-------------
>  target/linux/sunxi/image/cortex-a8.mk  | 13 ++++----
>  4 files changed, 45 insertions(+), 35 deletions(-)
> 
> diff --git a/target/linux/sunxi/image/Makefile b/target/linux/sunxi/image/Makefile
> index 04e0abee49..929f4c70f9 100644
> --- a/target/linux/sunxi/image/Makefile
> +++ b/target/linux/sunxi/image/Makefile
> @@ -32,12 +32,15 @@ endef
>  # why \x00\x00\x00\x00 for zImage-initramfs
>  define Device/Default
>    PROFILES := Default
> -  DEVICE_VARS := SUNXI_DTS SUNXI_UBOOT
> +  DEVICE_VARS := SUNXI_SOC SUNXI_DTS SUNXI_DTS_DIR SUNXI_UBOOT

Instead of adding new target speciffic variables, wouldn't using already
specified ones be better? We have DEVICE_DTS and DEVICE_DTS_DIR. Also the
SUNXI_SOC feels bit redundant since it needs to be specified for each device
and it could be replaced with DEVICE_DTS := sun50i-h5-$(1) or simply full dts name.

>    KERNEL_NAME := zImage
>    KERNEL := kernel-bin | uImage none
>    IMAGES := sdcard.img.gz
>    IMAGE/sdcard.img.gz := sunxi-sdcard | append-metadata | gzip
>    SUPPORTED_DEVICES := $(subst _,$(comma),$(1))
> +  SUNXI_SOC :=
> +  SUNXI_DTS_DIR :=
> +  SUNXI_DTS = $$(SUNXI_DTS_DIR)$$(SUNXI_SOC)-$(lastword $(subst _, ,$(1)))
>  endef
>  
>  include cortex-a7.mk
> diff --git a/target/linux/sunxi/image/cortex-a53.mk b/target/linux/sunxi/image/cortex-a53.mk
> index d6c17d95ff..b0d087b9b1 100644
> --- a/target/linux/sunxi/image/cortex-a53.mk
> +++ b/target/linux/sunxi/image/cortex-a53.mk
> @@ -11,7 +11,8 @@ define Device/friendlyarm_nanopi-neo-plus2
>    DEVICE_VENDOR := FriendlyARM
>    DEVICE_MODEL := NanoPi NEO Plus2
>    SUPPORTED_DEVICES:=nanopi-neo-plus2
> -  SUNXI_DTS:=allwinner/sun50i-h5-nanopi-neo-plus2
> +  SUNXI_DTS_DIR := allwinner/
> +  SUNXI_SOC := sun50i-h5
>    KERNEL_NAME := Image
>    KERNEL := kernel-bin
>  endef
> @@ -22,7 +23,8 @@ define Device/friendlyarm_nanopi-neo2
>    DEVICE_VENDOR := FriendlyARM
>    DEVICE_MODEL := NanoPi NEO2
>    SUPPORTED_DEVICES:=nanopi-neo2
> -  SUNXI_DTS:=allwinner/sun50i-h5-nanopi-neo2
> +  SUNXI_DTS_DIR := allwinner/
> +  SUNXI_SOC := sun50i-h5
>    KERNEL_NAME := Image
>    KERNEL := kernel-bin
>  endef
> @@ -32,7 +34,8 @@ TARGET_DEVICES += friendlyarm_nanopi-neo2
>  define Device/pine64_pine64-plus
>    DEVICE_VENDOR := Pine64
>    DEVICE_MODEL := Pine64+
> -  SUNXI_DTS:=allwinner/sun50i-a64-pine64-plus
> +  SUNXI_DTS_DIR := allwinner/
> +  SUNXI_SOC := sun50i-a64
>    KERNEL_NAME := Image
>    KERNEL := kernel-bin
>  endef
> @@ -42,7 +45,8 @@ TARGET_DEVICES += pine64_pine64-plus
>  define Device/pine64_sopine-baseboard
>    DEVICE_VENDOR := Pine64
>    DEVICE_MODEL := SoPine
> -  SUNXI_DTS:=allwinner/sun50i-a64-sopine-baseboard
> +  SUNXI_DTS_DIR := allwinner/
> +  SUNXI_SOC := sun50i-a64
>    KERNEL_NAME := Image
>    KERNEL := kernel-bin
>  endef
> @@ -53,7 +57,8 @@ TARGET_DEVICES += pine64_sopine-baseboard
>  define Device/xunlong_orangepi-zero-plus
>    DEVICE_VENDOR := Xunlong
>    DEVICE_MODEL := Orange Pi Zero Plus
> -  SUNXI_DTS:=allwinner/sun50i-h5-orangepi-zero-plus
> +  SUNXI_DTS_DIR := allwinner/
> +  SUNXI_SOC := sun50i-h5
>    KERNEL_NAME := Image
>    KERNEL := kernel-bin
>  endef
> @@ -63,7 +68,8 @@ TARGET_DEVICES += xunlong_orangepi-zero-plus
>  define Device/xunlong_orangepi-pc2
>    DEVICE_VENDOR := Xunlong
>    DEVICE_MODEL := Orange Pi PC 2
> -  SUNXI_DTS:=allwinner/sun50i-h5-orangepi-pc2
> +  SUNXI_DTS_DIR := allwinner/
> +  SUNXI_SOC := sun50i-h5
>    KERNEL_NAME := Image
>    KERNEL := kernel-bin
>  endef
> diff --git a/target/linux/sunxi/image/cortex-a7.mk b/target/linux/sunxi/image/cortex-a7.mk
> index 32e094efb8..0465c2ba9a 100644
> --- a/target/linux/sunxi/image/cortex-a7.mk
> +++ b/target/linux/sunxi/image/cortex-a7.mk
> @@ -12,7 +12,7 @@ define Device/olimex_a20-olinuxino-lime
>    DEVICE_VENDOR := Olimex
>    DEVICE_MODEL := A20-OLinuXino-LIME
>    DEVICE_PACKAGES:=kmod-ata-core kmod-ata-sunxi kmod-rtc-sunxi
> -  SUNXI_DTS:=sun7i-a20-olinuxino-lime
> +  SUNXI_SOC := sun7i
>  endef
>  
>  TARGET_DEVICES += olimex_a20-olinuxino-lime
> @@ -22,7 +22,7 @@ define Device/olimex_a20-olinuxino-lime2
>    DEVICE_VENDOR := Olimex
>    DEVICE_MODEL := A20-OLinuXino-LIME2
>    DEVICE_PACKAGES:=kmod-ata-core kmod-ata-sunxi kmod-rtc-sunxi kmod-usb-hid
> -  SUNXI_DTS:=sun7i-a20-olinuxino-lime2
> +  SUNXI_SOC := sun7i
>  endef
>  
>  TARGET_DEVICES += olimex_a20-olinuxino-lime2
> @@ -33,7 +33,7 @@ define Device/olimex_a20-olinuxino-lime2-emmc
>    DEVICE_MODEL := A20-OLinuXino-LIME2
>    DEVICE_VARIANT := eMMC
>    DEVICE_PACKAGES:=kmod-ata-core kmod-ata-sunxi kmod-rtc-sunxi kmod-usb-hid
> -  SUNXI_DTS:=sun7i-a20-olinuxino-lime2-emmc
> +  SUNXI_SOC := sun7i
>  endef
>  
>  TARGET_DEVICES += olimex_a20-olinuxino-lime2-emmc
> @@ -43,7 +43,7 @@ define Device/olimex_a20-olinuxino-micro
>    DEVICE_VENDOR := Olimex
>    DEVICE_MODEL := A20-OLinuXino-MICRO
>    DEVICE_PACKAGES:=kmod-ata-core kmod-ata-sunxi kmod-sun4i-emac kmod-rtc-sunxi
> -  SUNXI_DTS:=sun7i-a20-olinuxino-micro
> +  SUNXI_SOC := =sun7i
>  endef
>  
>  TARGET_DEVICES += olimex_a20-olinuxino-micro
> @@ -53,7 +53,7 @@ define Device/lemaker_bananapi
>    DEVICE_VENDOR := LeMaker
>    DEVICE_MODEL := Banana Pi
>    DEVICE_PACKAGES:=kmod-rtc-sunxi kmod-ata-core kmod-ata-sunxi
> -  SUNXI_DTS:=sun7i-a20-bananapi
> +  SUNXI_SOC := sun7i-a20
>  endef
>  
>  TARGET_DEVICES += lemaker_bananapi
> @@ -63,7 +63,7 @@ define Device/lemaker_bananapro
>    DEVICE_VENDOR := LeMaker
>    DEVICE_MODEL := Banana Pro
>    DEVICE_PACKAGES:=kmod-rtc-sunxi kmod-ata-core kmod-ata-sunxi kmod-brcmfmac
> -  SUNXI_DTS:=sun7i-a20-bananapro
> +  SUNXI_SOC := sun7i-a20
>  endef
>  
>  TARGET_DEVICES += lemaker_bananapro
> @@ -73,7 +73,7 @@ define Device/cubietech_cubieboard2
>    DEVICE_VENDOR := Cubietech
>    DEVICE_MODEL := Cubieboard2
>    DEVICE_PACKAGES:=kmod-ata-core kmod-ata-sunxi kmod-sun4i-emac kmod-rtc-sunxi
> -  SUNXI_DTS:=sun7i-a20-cubieboard2
> +  SUNXI_SOC := sun7i-a20
>  endef
>  
>  TARGET_DEVICES += cubietech_cubieboard2
> @@ -83,7 +83,7 @@ define Device/cubietech_cubietruck
>    DEVICE_VENDOR := Cubietech
>    DEVICE_MODEL := Cubietruck
>    DEVICE_PACKAGES:=kmod-ata-core kmod-ata-sunxi kmod-rtc-sunxi kmod-brcmfmac
> -  SUNXI_DTS:=sun7i-a20-cubietruck
> +  SUNXI_SOC := sun7i-a20
>  endef
>  
>  TARGET_DEVICES += cubietech_cubietruck
> @@ -93,7 +93,7 @@ define Device/lamobo_lamobo-r1
>    DEVICE_VENDOR := Lamobo
>    DEVICE_MODEL := Lamobo R1
>    DEVICE_PACKAGES:=kmod-ata-sunxi kmod-rtl8192cu swconfig wpad-basic
> -  SUNXI_DTS:=sun7i-a20-lamobo-r1
> +  SUNXI_SOC := sun7i-a20
>  endef
>  
>  TARGET_DEVICES += lamobo_lamobo-r1
> @@ -103,7 +103,7 @@ define Device/mele_m9
>    DEVICE_VENDOR := Mele
>    DEVICE_MODEL := M9
>    DEVICE_PACKAGES:=kmod-sun4i-emac kmod-rtc-sunxi kmod-rtl8192cu
> -  SUNXI_DTS:=sun6i-a31-m9
> +  SUNXI_SOC := sun6i-a31
>  endef
>  
>  TARGET_DEVICES += mele_m9
> @@ -113,7 +113,7 @@ define Device/xunlong_orangepi-zero
>    DEVICE_VENDOR := Xunlong
>    DEVICE_MODEL := Orange Pi Zero
>    DEVICE_PACKAGES:=kmod-rtc-sunxi
> -  SUNXI_DTS:=sun8i-h2-plus-orangepi-zero
> +  SUNXI_SOC := sun8i-h2-plus
>  endef
>  
>  TARGET_DEVICES += xunlong_orangepi-zero
> @@ -123,7 +123,7 @@ define Device/xunlong_orangepi-r1
>    DEVICE_VENDOR := Xunlong
>    DEVICE_MODEL := Orange Pi R1
>    DEVICE_PACKAGES:=kmod-rtc-sunxi kmod-usb-net kmod-usb-net-rtl8152
> -  SUNXI_DTS:=sun8i-h2-plus-orangepi-r1
> +  SUNXI_SOC := sun8i-h2-plus
>  endef
>  
>  TARGET_DEVICES += xunlong_orangepi-r1
> @@ -134,7 +134,7 @@ define Device/sinovoip_bananapi-m2-plus
>    DEVICE_PACKAGES:=kmod-rtc-sunxi \
>  	kmod-leds-gpio kmod-ledtrig-heartbeat \
>  	kmod-brcmfmac brcmfmac-firmware-43430a0-sdio wpad-basic
> -  SUNXI_DTS:=sun8i-h3-bananapi-m2-plus
> +  SUNXI_SOC := sun8i-h3
>  endef
>  
>  TARGET_DEVICES += sinovoip_bananapi-m2-plus
> @@ -145,7 +145,7 @@ define Device/friendlyarm_nanopi-m1-plus
>    DEVICE_PACKAGES:=kmod-rtc-sunxi \
>  	kmod-leds-gpio kmod-ledtrig-heartbeat \
>  	kmod-brcmfmac brcmfmac-firmware-43430-sdio wpad-basic
> -  SUNXI_DTS:=sun8i-h3-nanopi-m1-plus
> +  SUNXI_SOC := sun8i-h3
>  endef
>  
>  TARGET_DEVICES += friendlyarm_nanopi-m1-plus
> @@ -154,7 +154,7 @@ TARGET_DEVICES += friendlyarm_nanopi-m1-plus
>  define Device/friendlyarm_nanopi-neo
>    DEVICE_VENDOR := FriendlyARM
>    DEVICE_MODEL := NanoPi NEO
> -  SUNXI_DTS:=sun8i-h3-nanopi-neo
> +  SUNXI_SOC := sun8i-h3
>  endef
>  
>  TARGET_DEVICES += friendlyarm_nanopi-neo
> @@ -164,7 +164,7 @@ define Device/xunlong_orangepi-one
>    DEVICE_VENDOR := Xunlong
>    DEVICE_MODEL := Orange Pi One
>    DEVICE_PACKAGES:=kmod-rtc-sunxi
> -  SUNXI_DTS:=sun8i-h3-orangepi-one
> +  SUNXI_SOC := sun8i-h3
>  endef
>  
>  TARGET_DEVICES += xunlong_orangepi-one
> @@ -174,7 +174,7 @@ define Device/xunlong_orangepi-pc
>    DEVICE_VENDOR := Xunlong
>    DEVICE_MODEL := Orange Pi PC
>    DEVICE_PACKAGES:=kmod-rtc-sunxi kmod-gpio-button-hotplug
> -  SUNXI_DTS:=sun8i-h3-orangepi-pc
> +  SUNXI_SOC := sun8i-h3
>  endef
>  
>  TARGET_DEVICES += xunlong_orangepi-pc
> @@ -184,7 +184,7 @@ define Device/xunlong_orangepi-pc-plus
>    DEVICE_VENDOR := Xunlong
>    DEVICE_MODEL := Orange Pi PC Plus
>    DEVICE_PACKAGES:=kmod-rtc-sunxi kmod-gpio-button-hotplug
> -  SUNXI_DTS:=sun8i-h3-orangepi-pc-plus
> +  SUNXI_SOC := sun8i-h3
>  endef
>  
>  TARGET_DEVICES += xunlong_orangepi-pc-plus
> @@ -194,7 +194,7 @@ define Device/xunlong_orangepi-plus
>    DEVICE_VENDOR := Xunlong
>    DEVICE_MODEL := Orange Pi Plus
>    DEVICE_PACKAGES:=kmod-rtc-sunxi
> -  SUNXI_DTS:=sun8i-h3-orangepi-plus
> +  SUNXI_SOC := sun8i-h3
>  endef
>  
>  TARGET_DEVICES += xunlong_orangepi-plus
> @@ -203,7 +203,7 @@ define Device/xunlong_orangepi-2
>    DEVICE_VENDOR := Xunlong
>    DEVICE_MODEL := Orange Pi 2
>    DEVICE_PACKAGES:=kmod-rtc-sunxi
> -  SUNXI_DTS:=sun8i-h3-orangepi-2
> +  SUNXI_SOC := sun8i-h3
>  endef
>  
>  TARGET_DEVICES += xunlong_orangepi-2
> @@ -213,7 +213,7 @@ define Device/linksprite_pcduino3
>    DEVICE_VENDOR := LinkSprite
>    DEVICE_MODEL := pcDuino3
>    DEVICE_PACKAGES:=kmod-sun4i-emac kmod-rtc-sunxi kmod-ata-core kmod-ata-sunxi kmod-rtl8xxxu rtl8188eu-firmware
> -  SUNXI_DTS:=sun7i-a20-pcduino3
> +  SUNXI_SOC := sun7i-a20
>  endef
>  
>  TARGET_DEVICES += linksprite_pcduino3
> @@ -222,7 +222,7 @@ define Device/lemaker_bananapi-m2-ultra
>    DEVICE_VENDOR := LeMaker
>    DEVICE_MODEL := Banana Pi M2 Ultra
>    DEVICE_PACKAGES:=kmod-rtc-sunxi kmod-ata-core kmod-ata-sunxi
> -  SUNXI_DTS:=sun8i-r40-bananapi-m2-ultra
> +  SUNXI_SOC := sun8i-r40
>  endef
>  
>  TARGET_DEVICES += lemaker_bananapi-m2-ultra
> diff --git a/target/linux/sunxi/image/cortex-a8.mk b/target/linux/sunxi/image/cortex-a8.mk
> index 073ed8f2d1..d6b5a46a22 100644
> --- a/target/linux/sunxi/image/cortex-a8.mk
> +++ b/target/linux/sunxi/image/cortex-a8.mk
> @@ -11,7 +11,7 @@ define Device/olimex_a10-olinuxino-lime
>    DEVICE_VENDOR := Olimex
>    DEVICE_MODEL := A10-OLinuXino-LIME
>    DEVICE_PACKAGES:=kmod-ata-core kmod-ata-sunxi kmod-sun4i-emac kmod-rtc-sunxi
> -  SUNXI_DTS:=sun4i-a10-olinuxino-lime
> +  SUNXI_SOC := sun4i
>  endef
>  
>  TARGET_DEVICES += olimex_a10-olinuxino-lime
> @@ -22,7 +22,8 @@ define Device/olimex_a13-olimex-som
>    DEVICE_MODEL := A13-SOM
>    DEVICE_PACKAGES:=kmod-rtl8192cu
>    SUPPORTED_DEVICES:=olimex,a13-olinuxino
> -  SUNXI_DTS:=sun5i-a13-olinuxino
> +  SUNXI_SOC := sun5i-a13
> +  SUNXI_DTS := sun5i-a13-olinuxino
>  endef
>  
>  TARGET_DEVICES += olimex_a13-olimex-som
> @@ -32,7 +33,7 @@ define Device/olimex_a13-olinuxino
>    DEVICE_VENDOR := Olimex
>    DEVICE_MODEL := A13-OLinuXino
>    DEVICE_PACKAGES:=kmod-rtl8192cu
> -  SUNXI_DTS:=sun5i-a13-olinuxino
> +  SUNXI_SOC := sun5i
>  endef
>  
>  TARGET_DEVICES += olimex_a13-olinuxino
> @@ -42,7 +43,7 @@ define Device/cubietech_a10-cubieboard
>    DEVICE_VENDOR := Cubietech
>    DEVICE_MODEL := Cubieboard
>    DEVICE_PACKAGES:=kmod-ata-core kmod-ata-sunxi kmod-sun4i-emac kmod-rtc-sunxi
> -  SUNXI_DTS:=sun4i-a10-cubieboard
> +  SUNXI_SOC := sun4i
>  endef
>  
>  TARGET_DEVICES += cubietech_a10-cubieboard
> @@ -52,7 +53,7 @@ define Device/linksprite_a10-pcduino
>    DEVICE_VENDOR := LinkSprite
>    DEVICE_MODEL := pcDuino
>    DEVICE_PACKAGES:=kmod-sun4i-emac kmod-rtc-sunxi kmod-rtl8192cu
> -  SUNXI_DTS:=sun4i-a10-pcduino
> +  SUNXI_SOC := sun4i
>  endef
>  
>  TARGET_DEVICES += linksprite_a10-pcduino
> @@ -62,7 +63,7 @@ define Device/marsboard_a10-marsboard
>    DEVICE_VENDOR := HAOYU Electronics
>    DEVICE_MODEL := MarsBoard A10
>    DEVICE_PACKAGES:=mod-ata-core kmod-ata-sunxi kmod-sun4i-emac kmod-rtc-sunxi sound-soc-sunxi
> -  SUNXI_DTS:=sun4i-a10-marsboard
> +  SUNXI_SOC := sun4i
>  endef
>  
>  TARGET_DEVICES += marsboard_a10-marsboard
> 

Regards

-- 
TMN

_______________________________________________
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