[OpenWrt-Devel] [PATCH 1/3] treewide: drop DEVICE_TYPE when used as device variable

Christian Lamparter chunkeey at gmail.com
Fri May 29 16:25:41 EDT 2020


On Friday, 29 May 2020 21:32:59 CEST Matthias Schiffer wrote:
> On 5/29/20 7:45 PM, mail at adrianschmutzler.de wrote:
> >>> Consequently, having it set anyway is misleading, so this drops all
> >>> cases.
> >>
> >> Well, I can tell you where it matters for devices.
> >>
> >> You'll have to look at this:
> >>
> >> <https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=include/target.
> >> mk;h=9bd4c14936c1438df2be87e5697f5f5568699d2b;hb=HEAD#l54>
> >>
> >> |# Add device specific packages (here below to allow device type set
> >> |from subtarget) DEFAULT_PACKAGES +=
> >> $(DEFAULT_PACKAGES.$(DEVICE_TYPE))
> >>
> >> So, the MBL gets "DEFAULT_PACKAGES.nas" (block-mount fdisk lsblk
> >> mdadm) over "DEFAULT_PACKAGES.router" (dnsmasq iptables ip6tables ppp
> >> ppp-mod-pppoe firewall odhcpd-ipv6only odhcp6c kmod-ipt-offload) which
> >> makes much more sense for other devices as well.
> > 
> > Hi Christian,
> > 
> > that's exactly my point. Since this is target.mk as far as I can tell this selection does not work when DEVICE_TYPE is set within the device definition, but only when it's set in the (sub)target Makefile. As I understand it (and tested with make menuconfig), DEFAULT_PACKAGES is a per-target variable, and thus the DEVICE_TYPE from within the device definition will never be applied, and DEFAULT_PACKAGES.router will be used anyway for these devices.
> > 
> > Or am I completely misled here?
> 
> I believe you are right, it seems DEVICE_TYPE is not evaluated when set in
> a device definition.
True, question is then, should this really be called "DEVICE"_TYPE?
It's not like other DEVICE_* variables (DEVICE_NAME, DEVICE_PACKAGES or DEVICE_DTS).
Because the "targets" of ath79/ipq40xx/etc... wouldn't work if they all had to share
a single, common DEVICE_NAME/_DTS/_PACKAGE.

As for the MBLs, if I got this all correctly, that DEVICE_TYPE could be simply moved
to the apm821xx/sata target.mk
---
--- a/target/linux/apm821xx/image/Makefile
+++ b/target/linux/apm821xx/image/Makefile
@@ -251,7 +251,6 @@ define Device/wd_mybooklive
   DEVICE_VENDOR := Western Digital
   DEVICE_MODEL := My Book Live Series (Single + Duo)
   DEVICE_PACKAGES := kmod-usb-dwc2 kmod-usb-ledtrig-usbport kmod-usb-storage kmod-fs-vfat wpad-basic
-  DEVICE_TYPE := nas
   DEVICE_DTS := wd-mybooklive
   SUPPORTED_DEVICES += mbl wd,mybooklive-duo
   BLOCKSIZE := 1k
--- a/target/linux/apm821xx/sata/target.mk
+++ b/target/linux/apm821xx/sata/target.mk
@@ -1,5 +1,6 @@
 BOARDNAME := Devices which boot from SATA (NAS)
 FEATURES += ext4 usb ramdisk squashfs rootfs-part boot-part
+DEVICE_TYPE := nas
 DEFAULT_PACKAGES += badblocks block-mount e2fsprogs kmod-hwmon-drivetemp \
 		    kmod-dm kmod-md-mod partx-utils mkf2fs f2fsck
 
---
And it would work as expected, right?

Cheers,
Christian



_______________________________________________
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