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

2020-05-29 Thread Raylynn Knight via openwrt-devel
The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.--- Begin Message ---


> On May 29, 2020, at 5:12 PM, Matthias Schiffer 
>  wrote:
> 
> Meanwhile I've found another target-specific config setting in the busybox
> package: BUSYBOX_DEFAULT_TRUNCATE is enabled for TARGET_bcm53xx only.
> 
> I assume "truncate" is tiny enough that it doesn't really justify making
> busybox non-shared, we could just build in truncate unconditionally. I
> don't know how contrained some of the "nas" targets are, but maybe we
> should just replace the busybox hack with a full-featured hdparm on these
> targets?
> 
> Matthias

Two of NAS type targets that want hdparm are the kirkwood devices and oxnas 
devices.  Most of the kirkwood and oxnas devices have at least 128MB NAND 
flash, those that don’t usually use the disk drive for storage.

Ray



--- End Message ---
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 2/2] procd: allow optional watchdog instance parameter

2020-05-29 Thread Daniel Bailey
From: Daniel Bailey 
Date: Thu, 28 May 2020 20:39:35 -0700
Subject: [PATCH] procd: allow optional watchdog instance parameter

Optional instance watchdog timeout and watchdog mode be set by adding
procd_set_param $mode $timeout

$mode is an integer [0-2] representing instance watchdog mode of
operation:
0 = disabled
1 = passive mode, e.g. client must poke watchdog via ubus
2 = active mode, e.g. client must provide watchdog endpoint

Signed-off-by: Daniel Bailey 
---
 package/system/procd/files/procd.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/package/system/procd/files/procd.sh
b/package/system/procd/files/procd.sh
index dd6dc1c58d..3a1f413f85 100644
--- a/package/system/procd/files/procd.sh
+++ b/package/system/procd/files/procd.sh
@@ -186,7 +186,7 @@ _procd_add_jail() {
  json_add_string name "$1"

  shift
-
+
  for a in $@; do
  case $a in
  log) json_add_boolean "log" "1";;
@@ -247,7 +247,7 @@ _procd_set_param() {
  env|data|limits)
  _procd_add_table "$type" "$@"
  ;;
- command|netdev|file|respawn|watch)
+ command|netdev|file|respawn|watch|watchdog)
  _procd_add_array "$type" "$@"
  ;;
  error)
@@ -378,7 +378,7 @@ _procd_append_param() {
  env|data|limits)
  _procd_add_table_data "$@"
  ;;
- command|netdev|file|respawn|watch)
+ command|netdev|file|respawn|watch|watchdog)
  _procd_add_array_data "$@"
  ;;
  error)
--
2.25.1
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 1/2] procd: add service instance watchdog

2020-05-29 Thread Daniel Bailey
From: Daniel Bailey 
Date: Fri, 29 May 2020 17:37:25 -0700
Subject: [PATCH] procd: add service instance watchdog

Added instance watchdog which will eventually either terminate
or respawn an instance depending on the instance respawn setting.

Added service ubus method 'watchdog' which services the watchdog
timer and allows update of the instance watchdog mode instance.

Three modes: disabled, passive, active. Presently, only disabled
and passive modes are implemented.

Disabled: cancels watchdog timer set for a given instance.

Passive: sets a instance timer which must be serviced or the
instance will be stopped/restarted depending upon the instance
respawn value when the timer expires.

Active (to be implemented): requires an additional service 'endpoint'
parameter. Upon watchdog timer expiry, procd will query the endpoint
to determine whether the instance is alive. If the instance does not
answer, procd will terminate or respawn the instance depending on
the instance respawn setting.

Signed-off-by: Daniel Bailey 
---
 service/instance.c | 68 ++
 service/instance.h | 15 ++
 service/service.c  | 68 ++
 3 files changed, 151 insertions(+)

diff --git a/service/instance.c b/service/instance.c
index 142208a..8560a95 100644
--- a/service/instance.c
+++ b/service/instance.c
@@ -65,6 +65,7 @@ enum {
  INSTANCE_ATTR_EXTROOT,
  INSTANCE_ATTR_OVERLAYDIR,
  INSTANCE_ATTR_TMPOVERLAYSIZE,
+ INSTANCE_ATTR_WATCHDOG,
  __INSTANCE_ATTR_MAX
 };

@@ -95,6 +96,7 @@ static const struct blobmsg_policy
instance_attr[__INSTANCE_ATTR_MAX] = {
  [INSTANCE_ATTR_EXTROOT] = { "extroot", BLOBMSG_TYPE_STRING },
  [INSTANCE_ATTR_OVERLAYDIR] = { "overlaydir", BLOBMSG_TYPE_STRING },
  [INSTANCE_ATTR_TMPOVERLAYSIZE] = { "tmpoverlaysize", BLOBMSG_TYPE_STRING
},
+ [INSTANCE_ATTR_WATCHDOG] = { "watchdog", BLOBMSG_TYPE_ARRAY },
 };

 enum {
@@ -546,6 +548,11 @@ instance_start(struct service_instance *in)
  fcntl(epipe[0], F_SETFD, FD_CLOEXEC);
  }

+ if (in->watchdog.mode != INSTANCE_WATCHDOG_MODE_DISABLED) {
+ uloop_timeout_set(&in->watchdog.timeout, in->watchdog.freq * 1000);
+ DEBUG(2, "Started instance %s::%s watchdog timer : timeout = %d\n",
in->srv->name, in->name, in->watchdog.freq);
+ }
+
  service_event("instance.start", in->srv->name, in->name);
 }

@@ -693,6 +700,7 @@ instance_exit(struct uloop_process *p, int ret)

  in->exit_code = instance_exit_code(ret);
  uloop_timeout_cancel(&in->timeout);
+ uloop_timeout_cancel(&in->watchdog.timeout);
  service_event("instance.stop", in->srv->name, in->name);

  if (in->halt) {
@@ -752,6 +760,19 @@ instance_restart(struct service_instance *in)
  uloop_timeout_set(&in->timeout, in->term_timeout * 1000);
 }

+static void
+instance_watchdog(struct uloop_timeout *t)
+{
+ struct service_instance *in = container_of(t, struct service_instance,
watchdog.timeout);
+
+ DEBUG(3, "instance %s::%s watchdog timer expired\n", in->srv->name,
in->name);
+
+ if (in->respawn)
+ instance_restart(in);
+ else
+ instance_stop(in, true);
+}
+
 static bool string_changed(const char *a, const char *b)
 {
  return !((!a && !b) || (a && b && !strcmp(a, b)));
@@ -817,6 +838,12 @@ instance_config_changed(struct service_instance *in,
struct service_instance *in
  if (!blobmsg_list_equal(&in->errors, &in_new->errors))
  return true;

+ if (in->watchdog.mode != in_new->watchdog.mode)
+ return true;
+
+ if (in->watchdog.freq != in_new->watchdog.freq)
+ return true;
+
  return false;
 }

@@ -1170,6 +1197,36 @@ instance_config_parse(struct service_instance *in)
  DEBUG(3, "unknown syslog facility '%s' given, using default
(LOG_DAEMON)\n", blobmsg_get_string(tb[INSTANCE_ATTR_FACILITY]));
  }

+ if (tb[INSTANCE_ATTR_WATCHDOG]) {
+ int i = 0;
+ uint32_t vals[2] = { 0, 30 };
+
+ blobmsg_for_each_attr(cur2, tb[INSTANCE_ATTR_WATCHDOG], rem) {
+ if (i >= 2)
+ break;
+
+ vals[i] = atoi(blobmsg_get_string(cur2));
+ i++;
+ }
+
+ // TODO(danielb): change mode integers to strings (0 = disabled, 1 =
passive, 2 = active)
+ if (vals[0] >= 0 && vals[0] < __INSTANCE_WATCHDOG_MODE_MAX) {
+ in->watchdog.mode = vals[0];
+ DEBUG(3, "setting watchdog mode (%d)\n", vals[0]);
+ } else {
+ in->watchdog.mode = 0;
+ DEBUG(3, "unknown watchdog mode (%d) given, using default (0)\n",
vals[0]);
+ }
+
+ if (vals[1] > 0) {
+ in->watchdog.freq = vals[1];
+ DEBUG(3, "setting watchdog timeout (%d)\n", vals[0]);
+ } else {
+ in->watchdog.freq = 30;
+ DEBUG(3, "invalid watchdog timeout (%d) given, using default (30)\n",
vals[1]);
+ }
+ }
+
  return true;
 }

@@ -1255,6 +1312,7 @@ instance_free(struct service_instance *in)
  instance_free_stdio(in);
  uloop_process_delete(&in->proc);
  uloop_timeout_cancel(&in->timeout);
+ uloop_timeout_cancel(&in->watchdog.timeout);
  trigger_del(in);
  watch_del(in);
  instance_config_cleanup(in);
@@ -1308,6 +1366,9 @@ instance_init(struct service_instance *in, struct
service *s, struct blob_attr *
  blobmsg_list_simple_init(&in->limit

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

2020-05-29 Thread Matthias Schiffer
On 5/30/20 1:04 AM, m...@adrianschmutzler.de wrote:
>> 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... 
> 
> Maybe just DEFAULT_PACKAGES_TYPE?
> 

Hmm, at a glance, I still find this very ambiguous. Rather than "the type
(of what?) for the default packages", someone who doesn't know the build
system might interpret it as "the default type of the packages" (What would
that even mean? RPM vs. DEB vs. OPKG like OE supports?)

Matthias



signature.asc
Description: OpenPGP digital signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


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

2020-05-29 Thread mail
> 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... 

Maybe just DEFAULT_PACKAGES_TYPE?


openpgp-digital-signature.asc
Description: PGP signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


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

2020-05-29 Thread Christian Lamparter
On Friday, 29 May 2020 22:32:10 CEST m...@adrianschmutzler.de wrote:
> > > > 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
> > 
> 
> Yes, in this case this would work as expected after change. Of course, this 
> assumes that future additions to the subtarget would be "NAS-devices" as well.
> 
> > True, question is then, should this really be called "DEVICE"_TYPE?
> 
> That's exactly the question we are discussing in 3/3 of this series which 
> went to the openwrt-devel, I only Cc-ed you for the 1/3.

Ah ok, that might explain more than you think. I got hit by a bug interaction
with debian's cyrus-imap in my mail setup: Well, thankfully it's fixed now:
. I know that I
got sliently dropped from various MLs, since the mailsystem generated a ton
of bounces all at once. Sorry!

> I personally tend towards dropping DEVICE_TYPE entirely and separate the
> selection of different subsets for DEFAULT_PACKAGES from providing a config
> option for packages like busybox.

Ok, I guess it's time to say farewell to DEVICE_TYPE then...

The nice thing about DEVICE_TYPE was that it automatically included
a bunch of generally useful packages. On the other hand, if these would all
become default, then there will be more "-$package" showing up in
DEVICE_PACKAGES variables and possibly heated commit wars about whenever a
package should be included or dropped (but that's already happening right
now too).

I liked the idea of the DEVICE_TYPE variable though. But yes, it doesn't
really work the way its named. For this to have any merrit, DEVICE_TYPE
would need to stop meddling with DEFAULT_PACKAGES and add the selected
packages with something like a second "DEVICE_PACKAGES"... and hope that
TARGET_PER_DEVICE_ROOTFS can enforce the barriers between the devices
(well, sadly it can't do that 100%).

Cheers,
Christian



___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


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

2020-05-29 Thread Matthias Schiffer
On 5/29/20 10:52 PM, m...@adrianschmutzler.de wrote:
>> Or we just drop the variable at all, and do 
>> DEFAULT_PACKAGES := DEFAULT_PACKAGES.basic DEFAULT_PACKAGES.router 
>> at the beginning (!) of target.mk, so targets (effectively just 3 of them) 
>> can just overwrite it with 
>> DEFAULT_PACKAGES := DEFAULT_PACKAGES.basic DEFAULT_PACKAGES.nas 
>> directly in the few cases where that is necessary (I'd rather use 
>> DEFAULT_PACKAGES_BASIC etc. as names then). 
> 
> I've pushed a quick draft of this approach here:
> 
> https://git.openwrt.org/?p=openwrt/staging/adrian.git;a=shortlog;h=refs/heads/devicetypedrop
> 
> Only the most topmost patch is relevant. From "make menuconfig" it seems to 
> work as expected.

I would prefer to find a solution that doesn't require adding
$(DEFAULT_PACKAGES_BASIC) to the other default package lists. I'll have to
ponder over this a bit more. Posting the patch - possibly marked as [RFC] -
would make discussing this easier.


> 
> The if/else in busybox is not considered in this patch.
> 

Meanwhile I've found another target-specific config setting in the busybox
package: BUSYBOX_DEFAULT_TRUNCATE is enabled for TARGET_bcm53xx only.

I assume "truncate" is tiny enough that it doesn't really justify making
busybox non-shared, we could just build in truncate unconditionally. I
don't know how contrained some of the "nas" targets are, but maybe we
should just replace the busybox hack with a full-featured hdparm on these
targets?

Matthias



signature.asc
Description: OpenPGP digital signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


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

2020-05-29 Thread mail
> Or we just drop the variable at all, and do 
> DEFAULT_PACKAGES := DEFAULT_PACKAGES.basic DEFAULT_PACKAGES.router 
> at the beginning (!) of target.mk, so targets (effectively just 3 of them) 
> can just overwrite it with 
> DEFAULT_PACKAGES := DEFAULT_PACKAGES.basic DEFAULT_PACKAGES.nas 
> directly in the few cases where that is necessary (I'd rather use 
> DEFAULT_PACKAGES_BASIC etc. as names then). 

I've pushed a quick draft of this approach here:

https://git.openwrt.org/?p=openwrt/staging/adrian.git;a=shortlog;h=refs/heads/devicetypedrop

Only the most topmost patch is relevant. From "make menuconfig" it seems to 
work as expected.

The if/else in busybox is not considered in this patch.


openpgp-digital-signature.asc
Description: PGP signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


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

2020-05-29 Thread mail
> > > 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
> 

Yes, in this case this would work as expected after change. Of course, this 
assumes that future additions to the subtarget would be "NAS-devices" as well.

> True, question is then, should this really be called "DEVICE"_TYPE?

That's exactly the question we are discussing in 3/3 of this series which went 
to the openwrt-devel, I only Cc-ed you for the 1/3.

I personally tend towards dropping DEVICE_TYPE entirely and separate the 
selection of different subsets for DEFAULT_PACKAGES from providing a config 
option for packages like busybox.

I will convert my patch so your solution proposed here will be included.

Best

Adrian


openpgp-digital-signature.asc
Description: PGP signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


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

2020-05-29 Thread Christian Lamparter
On Friday, 29 May 2020 21:32:59 CEST Matthias Schiffer wrote:
> On 5/29/20 7:45 PM, m...@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:
> >>
> >>  >> 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@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


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

2020-05-29 Thread mail
> > 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  
> > Signed-off-by: Adrian Schmutzler  
> > --- 
> 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 

TARGET_DEVICE_TYPE also was my "second-best" idea, and in contrast to our 
recent similar discussion I can well live with this alternative :-)

> (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... 

After all, I personally think that this DEVICE_TYPE/TARGET_DEVICE_TYPE variable 
should be removed entirely.
What remains would be the concept of different predefined sets of 
DEFAULT_PACKAGES, which could be indeed solved by something like
TARGET_PACKAGEGROUP := nas

Or we just drop the variable at all, and do
DEFAULT_PACKAGES := DEFAULT_PACKAGES.basic DEFAULT_PACKAGES.router

at the beginning (!) of target.mk, so targets (effectively just 3 of them) can 
just overwrite it with

DEFAULT_PACKAGES := DEFAULT_PACKAGES.basic DEFAULT_PACKAGES.nas

directly in the few cases where that is necessary (I'd rather use 
DEFAULT_PACKAGES_BASIC etc. as names then).

The switch of busybox could then be implemented separately, which would most 
probably follow a simpler attempt of Linus' separate patch or something 
completely different ...
If I understood Linus' commit message correctly, the current solution there 
doesn't work properly anyway.

Personally, I'd prefer one of the latter options, with DEFAULT_PACKAGES 
selection separated from any config symbols.

Best

Adrian


openpgp-digital-signature.asc
Description: PGP signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


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

2020-05-29 Thread Matthias Schiffer
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 
> Signed-off-by: Adrian Schmutzler 
> ---

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
>  
> 




signature.asc
Description: OpenPGP digital signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


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

2020-05-29 Thread Matthias Schiffer
On 5/29/20 7:45 PM, m...@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:
>>
>> > 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.

Matthias


> 
> Best
> 
> Adrian
> 
>>
>> If you want to revert these changes and make this transparent, you'll
>> probably want to amend each device package list with the appropriate -
>> package (i.e -ppp -firewall -dnsmasq ...) all around.
>>
>> Cheers,
>> Christian
>>
>>
>>
>>
>> ___
>> openwrt-devel mailing list
>> openwrt-devel@lists.openwrt.org
>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>>
>> ___
>> openwrt-devel mailing list
>> openwrt-devel@lists.openwrt.org
>> https://lists.openwrt.org/mailman/listinfo/openwrt-devel




signature.asc
Description: OpenPGP digital signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH v2 4/4] build: use zstd for SDK and ImageBuilder tarballs

2020-05-29 Thread Matthias Schiffer
On 5/17/20 1:51 PM, Matthias Schiffer wrote:
> Comression level -19 was chosen as it provides a very good tradeoff
> between compression ratio and performance, especially in multithreaded
> operation.
> 
> Signed-off-by: Matthias Schiffer 

Jow, do you have any opinion on this? I assume this will also require
changes to the phase2 builtbot config - at least the SDK download pattern,
and installation of zstd in the build environment. Anything else?


> ---
>  target/imagebuilder/Makefile | 8 
>  target/sdk/Makefile  | 8 
>  2 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/target/imagebuilder/Makefile b/target/imagebuilder/Makefile
> index b463feb456ee..5c09109150a8 100644
> --- a/target/imagebuilder/Makefile
> +++ b/target/imagebuilder/Makefile
> @@ -21,7 +21,7 @@ IB_IDIR:=$(patsubst 
> $(TOPDIR)/%,$(PKG_BUILD_DIR)/%,$(STAGING_DIR_IMAGE))
>  
>  all: compile
>  
> -$(BIN_DIR)/$(IB_NAME).tar.xz: clean
> +$(BIN_DIR)/$(IB_NAME).tar.zst: clean
>   rm -rf $(PKG_BUILD_DIR)
>   mkdir -p $(IB_KDIR) $(IB_LDIR) $(PKG_BUILD_DIR)/staging_dir/host/lib \
>   $(PKG_BUILD_DIR)/target $(PKG_BUILD_DIR)/scripts $(IB_DTSDIR)
> @@ -86,12 +86,12 @@ endif
>   (cd $(PKG_BUILD_DIR); find staging_dir/host/bin/ 
> $(IB_LDIR)/scripts/dtc/ -type f | \
>   $(XARGS) $(SCRIPT_DIR)/bundle-libraries.sh 
> $(PKG_BUILD_DIR)/staging_dir/host)
>   STRIP=sstrip $(SCRIPT_DIR)/rstrip.sh 
> $(PKG_BUILD_DIR)/staging_dir/host/bin/
> - $(TAR) -cf - -C $(BUILD_DIR) $(IB_NAME) | xz -T$(if $(filter 
> 1,$(NPROC)),2,0) -zc -7e > $@
> + $(TAR) -cf - -C $(BUILD_DIR) $(IB_NAME) | zstd -T0 -19 -f -o $@
>  
>  download:
>  prepare:
> -compile: $(BIN_DIR)/$(IB_NAME).tar.xz
> +compile: $(BIN_DIR)/$(IB_NAME).tar.zst
>  install: compile
>  
>  clean: FORCE
> - rm -rf $(PKG_BUILD_DIR) $(BIN_DIR)/$(IB_NAME).tar.xz
> + rm -rf $(PKG_BUILD_DIR) $(BIN_DIR)/$(IB_NAME).tar.zst
> diff --git a/target/sdk/Makefile b/target/sdk/Makefile
> index 6d818347204a..13389c849958 100644
> --- a/target/sdk/Makefile
> +++ b/target/sdk/Makefile
> @@ -81,7 +81,7 @@ KERNEL_FILES := $(patsubst $(TOPDIR)/%,%,$(wildcard 
> $(addprefix $(LINUX_DIR)/,$(
>  
>  all: compile
>  
> -$(BIN_DIR)/$(SDK_NAME).tar.xz: clean
> +$(BIN_DIR)/$(SDK_NAME).tar.zst: clean
>   mkdir -p $(SDK_BUILD_DIR)/dl $(SDK_BUILD_DIR)/package
>   $(CP) -L $(INCLUDE_DIR) $(SCRIPT_DIR) $(SDK_BUILD_DIR)/
>   $(TAR) -cf - -C $(TOPDIR) \
> @@ -156,13 +156,13 @@ $(BIN_DIR)/$(SDK_NAME).tar.xz: clean
>   find $(SDK_BUILD_DIR) -name CVS | $(XARGS) rm -rf
>   -make -C $(SDK_BUILD_DIR)/scripts/config clean
>   (cd $(BUILD_DIR); \
> - tar -I 'xz -7e' -cf $@ $(SDK_NAME); \
> + tar -I 'zstd -T0 -19' -cf $@ $(SDK_NAME); \
>   )
>  
>  download:
>  prepare:
> -compile: $(BIN_DIR)/$(SDK_NAME).tar.xz
> +compile: $(BIN_DIR)/$(SDK_NAME).tar.zst
>  install: compile
>  
>  clean:
> - rm -rf $(SDK_BUILD_DIR) $(BIN_DIR)/$(SDK_NAME).tar.xz
> + rm -rf $(SDK_BUILD_DIR) $(BIN_DIR)/$(SDK_NAME).tar.zst
> 




signature.asc
Description: OpenPGP digital signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


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

2020-05-29 Thread mail
> > 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:
> 
>  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?

Best

Adrian

> 
> If you want to revert these changes and make this transparent, you'll
> probably want to amend each device package list with the appropriate -
> package (i.e -ppp -firewall -dnsmasq ...) all around.
> 
> Cheers,
> Christian
> 
> 
> 
> 
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel


openpgp-digital-signature.asc
Description: PGP signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] build: reflect DEVICE_TYPE to top level config

2020-05-29 Thread mail
> -Original Message-
> From: openwrt-devel [mailto:openwrt-devel-boun...@lists.openwrt.org]
> On Behalf Of Linus Walleij
> Sent: Freitag, 29. Mai 2020 14:21
> To: openwrt-devel@lists.openwrt.org
> Cc: Linus Walleij 
> Subject: [OpenWrt-Devel] [PATCH] build: reflect DEVICE_TYPE to top level
> config

Hi again,

sorry for intruding into this subject, but this has annoyed me for a long time 
already.

I've just sent a small patchset to tidy up the existing situation.

> 
> I made a patch to select a tool inside busybox by default on NAS type boxes,
> but this does not properly work because the package and image build
> processes are cleanly separate entities.
> 
> I also noticed that this becomes a problem if you build multiple profiles:
> maybe one of them is NAS and one of them is a router. You still want the
> least common denominator to decide: if you selected both NAS:es and
> routers, build packages that will be suitable for both NAS and routers.
> 
> To achieve this I reflect the DEVICE_TYPE up to the Kconfig level and define
> two Kconfig symbols:
> 
> config DEVICE_TYPE_ROUTER
>bool
> 
> config DEVICE_TYPE_NAS
>bool
> 
> These will be set from the DEVICE_TYPE of each profile and it is possible to
> select both.

Unfortunately, this doesn't seem to work like (at least) I would expect it to:

For the "Default Profile", the CONFIG_DEVICE_TYPE_* is set based on the 
target/subtarget Makefile.
If you select an individual device as target profile, the setting in the 
(sub)target Makefile is ignored (!), and the default ("router") is used. If the 
device has a DEVICE_TYPE in the device definition (which is wrong based on the 
initial concept, see my patch 1/3), then this value will be used.
If you select "Multiple devices", then CONFIG_DEVICE_TYPE_* won't be set at all.

As you stated earlier, it's just not so easy to connect the target and device 
scopes with each other. At the moment, I see two ways out of this:

1. We just live with the fact that the switch between router/nas/basic is per 
subtarget and adjust the code based on that.
2. We make the DEVICE_TYPE a real device-dependent variable and move it from 
target.mk to image.mk. Then, we could still set default values per target, but 
would have to adjust DEVICE_PACKAGES instead of DEFAULT_PACKAGES, which would 
lead to problems when building the Default Profile, but would make it much 
easier to deal with the individual devices.

Anyway, thanks for stirring this topic up again. Unfortunately, I don't think 
this will come cheap.

Best

Adrian

> 
> I then modify the busybox config to take this into account and conditionally
> build hdparm for CONFIG_DEVICE_TYPE_NAS.
> 
> Signed-off-by: Linus Walleij 
> ---
>  include/image.mk   |  1 +
>  include/target.mk  |  1 +
>  package/utils/busybox/Makefile |  2 +-
>  scripts/metadata.pm|  2 ++
>  scripts/target-metadata.pl | 12 
>  5 files changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/include/image.mk b/include/image.mk index
> 984b64fb9c73..8104c040a1f7 100644
> --- a/include/image.mk
> +++ b/include/image.mk
> @@ -634,6 +634,7 @@ endef
>  define Device/DumpInfo
>  Target-Profile: DEVICE_$(1)
>  Target-Profile-Name: $(DEVICE_DISPLAY)
> +Target-Profile-Devicetype: $(DEVICE_TYPE)
>  Target-Profile-Packages: $(DEVICE_PACKAGES)
>  Target-Profile-hasImageMetadata: $(if $(foreach
> image,$(IMAGES),$(findstring append-metadata,$(IMAGE/$(image,1,0)
>  Target-Profile-SupportedDevices: $(SUPPORTED_DEVICES) diff --git
> a/include/target.mk b/include/target.mk index 9bd4c14936c1..e6f26cbfdf3d
> 100644
> --- a/include/target.mk
> +++ b/include/target.mk
> @@ -73,6 +73,7 @@ define Profile
>   echo "Target-Profile: $(1)"; \
>   $(if $(PRIORITY), echo "Target-Profile-Priority: $(PRIORITY)"; ) \
>   echo "Target-Profile-Name: $(NAME)"; \
> + echo "Target-Profile-Devicetype: $(DEVICE_TYPE)"; \
>   echo "Target-Profile-Packages: $(PACKAGES) $(call
> extra_packages,$(DEFAULT_PACKAGES) $(PACKAGES))"; \
>   echo "Target-Profile-Description:"; \
>   echo "$(call shvar,Profile/$(1)/Description)"; \ diff --git
> a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile index
> 01441d1e87d1..f504117f60f3 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 ($(CONFIG_DEVICE_TYPE_NAS),y)
>   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/scripts/metadata.pm
> b/scripts/metadata.pm index 1826a040a116..5062dba37ec0 100644
> --- a/scripts/metadata.pm
> +++ b/scripts/metadata.pm
> @@ -140,6 +140,7 @@ sub parse_

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

2020-05-29 Thread Christian Lamparter
On Friday, 29 May 2020 19:22:36 CEST Adrian Schmutzler wrote:
> DEVICE_TYPE is a target/subtarget variable, and it does not have
> any effect when set in a device definition. It can only be set
> in a target's or subtarget's Makefile.
> 
> 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:



|# 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.

If you want to revert these changes and make this transparent,
you'll probably want to amend each device package list
with the appropriate -package (i.e -ppp -firewall -dnsmasq ...)
all around.

Cheers,
Christian 




___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


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

2020-05-29 Thread Adrian Schmutzler
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 
Signed-off-by: Adrian Schmutzler 
---
 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
 
-- 
2.20.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 2/3] treewide: provide consistent basic DEVICE_TYPE

2020-05-29 Thread Adrian Schmutzler
While the effective "default" based on frequent use is "router", the
DEVICE_TYPE variable actually provides a "basic" configuration without
selecting any additional packages.

This is currently set up with the identifier "bootloader", which seems
to be not used at all. However, the only targets not using "router" or
"nas" are actually archs38 and arc770, which use their own value
"developerboard" for DEVICE_TYPE which seems to have been invented when
these targets where added. The latter is not implemented in target.mk,
though, and will fall back to the "basic" set of packages then.

So, to clean this up and make it more readable, let's just define a
DEVICE_TYPE "basic" and use it for the aforementioned cases.

Cc: Linus Walleij 
Signed-off-by: Adrian Schmutzler 
---
 include/target.mk | 3 ++-
 target/linux/arc770/Makefile  | 2 +-
 target/linux/archs38/Makefile | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/target.mk b/include/target.mk
index 9bd4c14936..a2ceb7f783 100644
--- a/include/target.mk
+++ b/include/target.mk
@@ -14,11 +14,12 @@ DEVICE_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
+# For the basic set
+DEFAULT_PACKAGES.basic:=
 # For nas targets
 DEFAULT_PACKAGES.nas:=block-mount fdisk lsblk mdadm
 # For router targets
 DEFAULT_PACKAGES.router:=dnsmasq iptables ip6tables ppp ppp-mod-pppoe firewall 
odhcpd-ipv6only odhcp6c kmod-ipt-offload
-DEFAULT_PACKAGES.bootloader:=
 
 ifneq ($(DUMP),)
   all: dumpinfo
diff --git a/target/linux/arc770/Makefile b/target/linux/arc770/Makefile
index 8150f147c5..018d6e5448 100644
--- a/target/linux/arc770/Makefile
+++ b/target/linux/arc770/Makefile
@@ -13,7 +13,7 @@ SUBTARGETS:=generic
 
 KERNEL_PATCHVER:=4.14
 
-DEVICE_TYPE:=developerboard
+DEVICE_TYPE:=basic
 
 define Target/Description
Synopsys DesignWare boards
diff --git a/target/linux/archs38/Makefile b/target/linux/archs38/Makefile
index 55708a09b0..5b3650ef8d 100644
--- a/target/linux/archs38/Makefile
+++ b/target/linux/archs38/Makefile
@@ -14,7 +14,7 @@ SUBTARGETS:=generic
 
 KERNEL_PATCHVER:=5.4
 
-DEVICE_TYPE:=developerboard
+DEVICE_TYPE:=basic
 
 define Target/Description
Synopsys DesignWare boards
-- 
2.20.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


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

2020-05-29 Thread Adrian Schmutzler
DEVICE_TYPE is a target/subtarget variable, and it does not have
any effect when set in a device definition. It can only be set
in a target's or subtarget's Makefile.

Consequently, having it set anyway is misleading, so this drops
all cases.

This effectively reverts the following commits:
7a1497fd601d ("apm821xx: MBL: set DEVICE_TYPE to NAS")
5b4765c93a1b ("gemini: Classify Raidsonic NAS IB-4220-B as a NAS")
cdc6de460bb4 ("gemini: D-Link DNS-313 is a NAS")

For the following commit, the variable was set when adding device
support:
27b2f0fc0fc5 ("kirkwood: add support for Iomega Storcenter ix2-200")

Cc: Christian Lamparter 
Cc: Sungbo Eo 
Cc: Linus Walleij 
Signed-off-by: Adrian Schmutzler 
---
 target/linux/apm821xx/image/Makefile | 1 -
 target/linux/gemini/image/Makefile   | 2 --
 target/linux/kirkwood/image/Makefile | 1 -
 3 files changed, 4 deletions(-)

diff --git a/target/linux/apm821xx/image/Makefile 
b/target/linux/apm821xx/image/Makefile
index d732141c8f..c26c015751 100644
--- a/target/linux/apm821xx/image/Makefile
+++ b/target/linux/apm821xx/image/Makefile
@@ -230,7 +230,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
diff --git a/target/linux/gemini/image/Makefile 
b/target/linux/gemini/image/Makefile
index a155939b8c..83f3d222d9 100644
--- a/target/linux/gemini/image/Makefile
+++ b/target/linux/gemini/image/Makefile
@@ -171,7 +171,6 @@ define Device/dlink_dns-313
DEVICE_VENDOR := D-Link
DEVICE_MODEL := DNS-313 1-Bay Network Storage Enclosure
DEVICE_DTS := gemini-dlink-dns-313
-   DEVICE_TYPE := nas
DEVICE_PACKAGES := $(GEMINI_NAS_PACKAGES)
BLOCKSIZE := 1k
FILESYSTEMS := ext4
@@ -204,7 +203,6 @@ define Device/raidsonic_ib-4220-b
DEVICE_VENDOR := Raidsonic
DEVICE_MODEL := NAS IB-4220-B
DEVICE_DTS := gemini-nas4220b
-   DEVICE_TYPE := nas
 endef
 TARGET_DEVICES += raidsonic_ib-4220-b
 
diff --git a/target/linux/kirkwood/image/Makefile 
b/target/linux/kirkwood/image/Makefile
index e69e3f125d..552ee44ee4 100644
--- a/target/linux/kirkwood/image/Makefile
+++ b/target/linux/kirkwood/image/Makefile
@@ -66,7 +66,6 @@ define Device/iom_ix2-200
   DEVICE_MODEL := StorCenter ix2-200
   DEVICE_DTS := kirkwood-iomega_ix2_200
   DEVICE_PACKAGES := kmod-gpio-button-hotplug kmod-hwmon-lm63
-  DEVICE_TYPE:=nas
   PAGESIZE := 512
   SUBPAGESIZE := 256
   BLOCKSIZE := 16k
-- 
2.20.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH 0/3] treewide: tidy up use of DEVICE_TYPE

2020-05-29 Thread Adrian Schmutzler
Trigger by the recent patch from Linus Walleij, I take up the
problem of inconsistent use of DEVICE_TYPE in OpenWrt. This
has already been partially discussed here:
http://lists.infradead.org/pipermail/openwrt-devel/2020-February/021809.html

Effectively, DEVICE_TYPE currently is a per-target variable, but for
some devices it's incorrectly used as if it was a per-device variable
(which seems to not have any effect on the package selection and
has unclear effect on the switch in busybox package).

This patchset tries to solve the problem by
1. removing the misleading per-device variable assignments
2. consolidating the available options: router, nas, basic
3. renaming the variable to prevent similar inconsistencies in the future

Adrian Schmutzler (3):
  treewide: drop DEVICE_TYPE when used as device variable
  treewide: provide consistent basic DEVICE_TYPE
  treewide: rename DEVICE_TYPE to DEFAULT_TYPE

 include/target.mk| 7 ---
 package/utils/busybox/Makefile   | 2 +-
 target/linux/apm821xx/image/Makefile | 1 -
 target/linux/arc770/Makefile | 2 +-
 target/linux/archs38/Makefile| 2 +-
 target/linux/gemini/image/Makefile   | 2 --
 target/linux/kirkwood/image/Makefile | 1 -
 target/linux/oxnas/Makefile  | 2 +-
 8 files changed, 8 insertions(+), 11 deletions(-)

-- 
2.20.1


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH v13] ath10k: add LED and GPIO controlling support for various chipsets

2020-05-29 Thread Kalle Valo
Sven Eckelmann  writes:

> On Monday, 25 May 2020 11:22:13 CEST Sven Eckelmann wrote:
> [...]
>> And it still can with this OpenWrt version. But it doesn't seem to happen 
>> with 
>> the most recent OpenWrt reboot-13353-gb1604b744b. But there are nearly 4000 
>> commits inbetween. So no idea what changed (just a timing thing or an actual 
>> fix - no idea).
>
> Seems like there is a fix which solves some lost interrupt problems for 
> IPQ40xx. Without this change, I see the reported problem. And with the patch, 
> it is gone. Or in commits:
>
> * creates timeout problems: 46b949a067e5 ("ipq40xx: enlarge PCIe BAR size")
> * works fine: 18e942b6c4e5 ("ipq40xx: fix pcie msi IRQ trigger level")
>
> If you look in the git logs [1], you can see that the working commit is a 
> child of the broken one. So at least from my point of view, my initial report 
> is no blocker anymore for Sebastian's patch (or Kalle's version of it).

Great. If the patch is good to take can someone rebase the latest
version and resubmit, please?

-- 
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] build: reflect DEVICE_TYPE to top level config

2020-05-29 Thread mail
> -Original Message-
> From: openwrt-devel [mailto:openwrt-devel-boun...@lists.openwrt.org]
> On Behalf Of Linus Walleij
> Sent: Freitag, 29. Mai 2020 14:21
> To: openwrt-devel@lists.openwrt.org
> Cc: Linus Walleij 
> Subject: [OpenWrt-Devel] [PATCH] build: reflect DEVICE_TYPE to top level
> config
> 
> I made a patch to select a tool inside busybox by default on NAS type boxes,
> but this does not properly work because the package and image build
> processes are cleanly separate entities.
> 
> I also noticed that this becomes a problem if you build multiple profiles:
> maybe one of them is NAS and one of them is a router. You still want the
> least common denominator to decide: if you selected both NAS:es and
> routers, build packages that will be suitable for both NAS and routers.
> 
> To achieve this I reflect the DEVICE_TYPE up to the Kconfig level and define
> two Kconfig symbols:

Hi,

that might be irrelevant for your patch in its current state, but note that 
DEVICE_TYPE is not properly implemented at the moment.

A partial discussion about that can be found here:
http://lists.infradead.org/pipermail/openwrt-devel/2020-February/021809.html

Effectively, DEVICE_TYPE currently is a per-target variable, but for some 
devices it's incorrectly used as if it was a per-device variable. (by that, 
effectively using the last value of the variable for the entire target.)

Therefore, the configuration for individual devices might be different than 
what's expected from the unaware observer.

This should be fixed by properly setting up DEVICE_TYPE as a per-device 
variable, which itself is not a problem. However, it might need some effort to 
correctly adjust the current cases where it is used as per-target variable by 
intention.

I will try to have another look at this myself soon.

Best

Adrian

> 
> config DEVICE_TYPE_ROUTER
>bool
> 
> config DEVICE_TYPE_NAS
>bool
> 
> These will be set from the DEVICE_TYPE of each profile and it is possible to
> select both.
> 
> I then modify the busybox config to take this into account and conditionally
> build hdparm for CONFIG_DEVICE_TYPE_NAS.
> 
> Signed-off-by: Linus Walleij 
> ---
>  include/image.mk   |  1 +
>  include/target.mk  |  1 +
>  package/utils/busybox/Makefile |  2 +-
>  scripts/metadata.pm|  2 ++
>  scripts/target-metadata.pl | 12 
>  5 files changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/include/image.mk b/include/image.mk index
> 984b64fb9c73..8104c040a1f7 100644
> --- a/include/image.mk
> +++ b/include/image.mk
> @@ -634,6 +634,7 @@ endef
>  define Device/DumpInfo
>  Target-Profile: DEVICE_$(1)
>  Target-Profile-Name: $(DEVICE_DISPLAY)
> +Target-Profile-Devicetype: $(DEVICE_TYPE)
>  Target-Profile-Packages: $(DEVICE_PACKAGES)
>  Target-Profile-hasImageMetadata: $(if $(foreach
> image,$(IMAGES),$(findstring append-metadata,$(IMAGE/$(image,1,0)
>  Target-Profile-SupportedDevices: $(SUPPORTED_DEVICES) diff --git
> a/include/target.mk b/include/target.mk index 9bd4c14936c1..e6f26cbfdf3d
> 100644
> --- a/include/target.mk
> +++ b/include/target.mk
> @@ -73,6 +73,7 @@ define Profile
>   echo "Target-Profile: $(1)"; \
>   $(if $(PRIORITY), echo "Target-Profile-Priority: $(PRIORITY)"; ) \
>   echo "Target-Profile-Name: $(NAME)"; \
> + echo "Target-Profile-Devicetype: $(DEVICE_TYPE)"; \
>   echo "Target-Profile-Packages: $(PACKAGES) $(call
> extra_packages,$(DEFAULT_PACKAGES) $(PACKAGES))"; \
>   echo "Target-Profile-Description:"; \
>   echo "$(call shvar,Profile/$(1)/Description)"; \ diff --git
> a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile index
> 01441d1e87d1..f504117f60f3 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 ($(CONFIG_DEVICE_TYPE_NAS),y)
>   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/scripts/metadata.pm
> b/scripts/metadata.pm index 1826a040a116..5062dba37ec0 100644
> --- a/scripts/metadata.pm
> +++ b/scripts/metadata.pm
> @@ -140,6 +140,7 @@ sub parse_target_metadata($) {
>   $profile = {
>   id => $1,
>   name => $1,
> + device_type => "router",
>   has_image_metadata => 0,
>   supported_devices => [],
>   priority => 999,
> @@ -150,6 +151,7 @@ sub parse_target_metadata($) {
>   push @{$target->{profiles}}, $profile;
>   };
>   /^Target-Profile-Name:\s*(.+)\s*$/ an

[OpenWrt-Devel] [PATCH] build: reflect DEVICE_TYPE to top level config

2020-05-29 Thread Linus Walleij
I made a patch to select a tool inside busybox by
default on NAS type boxes, but this does not properly
work because the package and image build processes are
cleanly separate entities.

I also noticed that this becomes a problem if you
build multiple profiles: maybe one of them is NAS
and one of them is a router. You still want the least
common denominator to decide: if you selected both
NAS:es and routers, build packages that will be
suitable for both NAS and routers.

To achieve this I reflect the DEVICE_TYPE up to the
Kconfig level and define two Kconfig symbols:

config DEVICE_TYPE_ROUTER
   bool

config DEVICE_TYPE_NAS
   bool

These will be set from the DEVICE_TYPE of each
profile and it is possible to select both.

I then modify the busybox config to take this into
account and conditionally build hdparm for
CONFIG_DEVICE_TYPE_NAS.

Signed-off-by: Linus Walleij 
---
 include/image.mk   |  1 +
 include/target.mk  |  1 +
 package/utils/busybox/Makefile |  2 +-
 scripts/metadata.pm|  2 ++
 scripts/target-metadata.pl | 12 
 5 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/include/image.mk b/include/image.mk
index 984b64fb9c73..8104c040a1f7 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -634,6 +634,7 @@ endef
 define Device/DumpInfo
 Target-Profile: DEVICE_$(1)
 Target-Profile-Name: $(DEVICE_DISPLAY)
+Target-Profile-Devicetype: $(DEVICE_TYPE)
 Target-Profile-Packages: $(DEVICE_PACKAGES)
 Target-Profile-hasImageMetadata: $(if $(foreach image,$(IMAGES),$(findstring 
append-metadata,$(IMAGE/$(image,1,0)
 Target-Profile-SupportedDevices: $(SUPPORTED_DEVICES)
diff --git a/include/target.mk b/include/target.mk
index 9bd4c14936c1..e6f26cbfdf3d 100644
--- a/include/target.mk
+++ b/include/target.mk
@@ -73,6 +73,7 @@ define Profile
echo "Target-Profile: $(1)"; \
$(if $(PRIORITY), echo "Target-Profile-Priority: $(PRIORITY)"; ) \
echo "Target-Profile-Name: $(NAME)"; \
+   echo "Target-Profile-Devicetype: $(DEVICE_TYPE)"; \
echo "Target-Profile-Packages: $(PACKAGES) $(call 
extra_packages,$(DEFAULT_PACKAGES) $(PACKAGES))"; \
echo "Target-Profile-Description:"; \
echo "$(call shvar,Profile/$(1)/Description)"; \
diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile
index 01441d1e87d1..f504117f60f3 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 ($(CONFIG_DEVICE_TYPE_NAS),y)
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/scripts/metadata.pm b/scripts/metadata.pm
index 1826a040a116..5062dba37ec0 100644
--- a/scripts/metadata.pm
+++ b/scripts/metadata.pm
@@ -140,6 +140,7 @@ sub parse_target_metadata($) {
$profile = {
id => $1,
name => $1,
+   device_type => "router",
has_image_metadata => 0,
supported_devices => [],
priority => 999,
@@ -150,6 +151,7 @@ sub parse_target_metadata($) {
push @{$target->{profiles}}, $profile;
};
/^Target-Profile-Name:\s*(.+)\s*$/ and $profile->{name} = $1;
+   /^Target-Profile-Devicetype:\s*(.+)\s*$/ and 
$profile->{device_type} = $1;
/^Target-Profile-hasImageMetadata:\s*(\d+)\s*$/ and 
$profile->{has_image_metadata} = $1;
/^Target-Profile-SupportedDevices:\s*(.+)\s*$/ and 
$profile->{supported_devices} = [ split(/\s+/, $1) ];
/^Target-Profile-Priority:\s*(\d+)\s*$/ and do {
diff --git a/scripts/target-metadata.pl b/scripts/target-metadata.pl
index ee0ab5a71811..fbd9fa70c08b 100755
--- a/scripts/target-metadata.pl
+++ b/scripts/target-metadata.pl
@@ -244,6 +244,12 @@ EOF
print "\tselect DEFAULT_$pkg\n";
$defaults{$pkg} = 1;
}
+   if ($profile->{device_type} =~ "router") {
+   print "\tselect DEVICE_TYPE_ROUTER\n";
+   }
+   if ($profile->{device_type} =~ "nas") {
+   print "\tselect DEVICE_TYPE_NAS\n";
+   }
my $help = $profile->{desc};
if ($help =~ /\w+/) {
$help =~ s/^\s*/\t  /mg;
@@ -328,6 +334,12 @@ config HAS_SUBTARGETS
 config HAS_DEVICES
bool
 
+config DEVICE_TYPE_ROUTER
+   bool
+
+config DEVICE_TYP

[OpenWrt-Devel] Reset button on TL-WR802N v1

2020-05-29 Thread mail
Hi,

we suspect that the Reset button on the old TL-WR802N v1 is configured to the 
wrong GPIO [1].

If somebody owns this device, it would be helpful to report whether
1. reset works ouf the box
2. if not, it works with GPIO 12 active_low

[1] https://github.com/openwrt/openwrt/pull/3058

Best

Adrian


openpgp-digital-signature.asc
Description: PGP signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] add support for netgear R6020

2020-05-29 Thread mail
Hi,

> -Original Message-
> From: openwrt-devel [mailto:openwrt-devel-boun...@lists.openwrt.org]
> On Behalf Of Evan Jobling
> Sent: Freitag, 29. Mai 2020 06:45
> To: openwrt-devel@lists.openwrt.org
> Subject: [OpenWrt-Devel] add support for netgear R6020
> 
> Hi All.
> 
> Apologies if this isn't the correct method of submitting a patch.
> 
> There was a patch on github for adding the R6020?
> 
> Didn't look like it went anywhere.
> I recall issues with the LED naming on that one?
> 
> Just so it doesn't get lost to time, I figured i'd email my modifications.
> 
> Please find patch attached.

in addition to what Stijn stated, a had a quick look and can give you some 
pointers right away:

- Please add an SPDX license identifier to the DTS

> memory@0

Drop this node, memory is auto-detected.

>   gpio-keys-polled {
>   compatible = "gpio-keys-polled";
>   poll-interval = <20>;

Node should be called "keys". Please use "gpio-keys" for the compatible instead 
and drop poll-interval.

> gpio-leds

Node should be called "leds".

> spi-max-frequency = <1000>;

Typically, frequency can be raised with substantial gains in read speed.

> mediatek,mtd-eeprom = <&factory 0x2>;

The partition is only 0x2 big. I assume the default 0x0 from the DTSI will 
work here?

> mtd-mac-address = <&nvram 0x100b0>;

Are these necessary, or will the address be correct if you just drop them?

Despite, can you please check whether there are addresses in factory 0x28, 
0x2e, 0xe000, 0xe006, 0x4, 0x8004?

Which addresses are assigned on OEM firmware (lan, wan, 2g, 5g)?

> define Device/netgear_r6020

Please insert so alphabetic sorting is maintained.

> DEVICE_TITLE := Netgear AC750 R6020

Please use DEVICE_VENDOR/DEVICE_MODEL.

I assume proper naming would be "Netgear R6020 (AC750)"? One could also use the 
DEVICE_ALT0_MODEL syntax here ...

> check-size (IMAGE_SIZE)

check-size works without argument now.

> ucidef_set_led_wlan "wlan2g" "WiFi 2.4GHz" "$boardname:green:wlan2g" "phy0tpt"

Please use a DTS trigger instead (for both 2g and 5g).

> In 02_network

The case can be merged with the subsequent one.

> Stijn: If you'd like, you can create a new PR on Github (no idea how devs 
> feel if the original PR is still open and languishing) - see [1].

The old PR has been closed quite some time ago due to inactivity. If there is 
new progress now, it would be fine to just open a new PR by the "new author".

Best

Adrian


openpgp-digital-signature.asc
Description: PGP signature
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel