Re: [PATCH] realtek/rtl839x: Edgecore ECS4100-12PH support

2024-04-15 Thread Stijn Tintel

On 4/04/2024 19:42, INAGAKI Hiroshi wrote:

Hi stijn,

Hi Hiroshi,

I have some comments below.

Thanks for reviewing!


On 2024/04/04 23:28, st...@linux-ipv6.be wrote:

+
+    reboot@0 {
+    compatible = "edgecore,reboot";


Isn't this a "gpio-restart"? I can't find any informations about 
"edgecore,reboot".
Changing this to gpio-restart caused the device to reboot early during 
boot. After commenting out the gpio-restart node and testing with 
gpioset, it turns out it needs to be active-low.

+
+ {
+    ext_io: ext-io@e4 {
+    compatible = "realtek,rtl8390-eio", "syscon";


IIRC, a driver for "realtek,rtl8390-eio" is not provided on OpenWrt.
You need to mux sys-led pin as a gpio[1] and define this LED using 
gpio-leds.


[1]: 
https://github.com/openwrt/openwrt/blob/c7d83d4379fb2c08f22e7a4f2852aaf9b37c3790/target/linux/realtek/dts-5.15/rtl839x.dtsi#L289-L292

Done. The diag LED now exhibits the usual OpenWrt LED behaviour.

Thanks,
Stijn


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


Re: [PATCH] realtek/rtl839x: Edgecore ECS4100-12PH support

2024-04-04 Thread Stijn Tintel

On 4/04/2024 17:28, st...@linux-ipv6.be wrote:

Add support for the Edgecore ECS4100-12PH, an 8-port PoE Gigabit
Ethernet switch with 2 combo RJ45/SFP and 2 SFP ports.


FYI: this patch and WIP changes are also available in my staging tree:

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


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


Re: [PATCH] realtek/rtl839x: Edgecore ECS4100-12PH support

2024-04-04 Thread Stijn Tintel

On 4/04/2024 18:00, Paul D wrote:

On 2024-04-04 16:28, st...@linux-ipv6.be wrote:


-netgear,gs110tpp-v1)
-   ucidef_set_poe 130 "$(filter_port_list "$lan_list" "lan9 lan10")"
-   ;;

If adding a device, surely these remove lines should not be there?



Try looking closer. It's called maintaining alphabetical order.


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


Re: A Method of Breaking Git

2023-10-28 Thread Stijn Tintel

On 24/10/2023 15:25, Christian Marangi wrote:

On Tue, Oct 24, 2023 at 02:21:35PM +0200, Bjørn Mork wrote:

Christian Marangi  writes:


Anyway I have also found this [1]... if it does actually works, it might be
THE solution to our specific problem. Wonder if someone can test it on a
sample repository.

[1] https://devblogs.microsoft.com/oldnewthing/20190919-00/?p=102904

Nice!  Seems to work.  Tried this in an almost uptodate OpenWrt main
branch:

git checkout -b dup
git mv target/linux/ramips/mt7621/config-5.15 
target/linux/ramips/mt7621/config-6.1
git commit -s -m 'create config-6.1 based on config-5.15'
git checkout HEAD~  target/linux/ramips/mt7621/config-5.15
git commit -s -m 'restore config-5.15'
git checkout -
git merge --no-ff dup

and ended up with

  bjorn@canardo:/usr/local/src/openwrt$ git log --oneline --follow -n 5 
target/linux/ramips/mt7621/config-5.15
  6e91f43c99a7 (dup) restore config-5.15
  5a742b351365 create config-6.1 based on config-5.15
  cd2b74e01e8d ramips: mt7621: disable highmem support and remove highmem 
offset patch
  39b2251cd972 treewide: remove CONFIG_FRAME_WARN from kernel configs
  dc38199b96ee ramips/mt7621: disable the cpufreq driver

  bjorn@canardo:/usr/local/src/openwrt$ git log --oneline --follow -n 5 
target/linux/ramips/mt7621/config-6.1
  5a742b351365 create config-6.1 based on config-5.15
  cd2b74e01e8d ramips: mt7621: disable highmem support and remove highmem 
offset patch
  39b2251cd972 treewide: remove CONFIG_FRAME_WARN from kernel configs
  dc38199b96ee ramips/mt7621: disable the cpufreq driver
  958fdf36e35c generic: mt7530: backport support for the MT7988 built-in switch


Best solution so far


Yep only drawback is the additional commit and the merge commit but this
might be the only case where we can accept a merge commit. Might be
worth to document this in the wiki if we take a decision on this.

There's another big drawback: it breaks git bisect. In the example 
above, if you end up on commit 5a742b351365, the target will try 
building kernel 5.15, but there will be no config-5.15.


Stijn


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


Re: packages repos: libpcre

2023-10-28 Thread Stijn Tintel

On 28/10/2023 20:03, Paul D wrote:


Hi, maybe some housekeeping process is nececssary, but I got this
immediately after I did the usually recommended checkout procedures, 
and have been even after a git pull, every time I run make.


The prce package was moved from the base repo to the packages, so you 
need to ./scripts/feeds install pcre.


Do these packages need bumping to another libpcre version?


They will need bumping in the near future, but for now pcre (1) still 
exists in the packages feed.

See https://github.com/openwrt/packages/issues/22006.

Stijn


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


Re: Matter integration

2023-07-28 Thread Stijn Tintel

On 28/07/2023 00:11, Karsten Sperling via openwrt-devel wrote:

Hello,

Hi!


I’m part of an effort by the Connectivity Standards Alliance to bring support 
for routers and access points into Matter.  Matter is an open-source 
connectivity standard built to enable developers and device manufacturers to 
build reliable and secure connected home devices [1][2].

In this context we’re working on a reference implementation for Matter-enabled 
routers / access points, which will be taking the form of an OpenWRT feed.  
Development on this has recently started 
athttps://github.com/project-chip/matter-openwrt.  We’re using OpenWRT as a 
platform because of its open nature and great hardware support.  I wanted to 
reach out to make the OpenWRT developer community aware of this effort, and to 
invite you to collaborate with us if you’re interested.
Thanks for letting us know. I, for one, am very interested in Matter 
(and Thread). I will try the matter-openwrt feed soon. Maybe this can 
help me finish the PR to add the OpenThread Border Router to OpenWrt [1].


On a more concrete level, I would also like to ask for support for this small 
PR on OpenWRT I’ve opened here:https://github.com/openwrt/openwrt/pull/13000

The cross-platform nature of the Matter SDK combined with the fact that it uses 
git sub-modules for dependency management results in the repo having a LOT of 
sub-modules (about 70 direct, 130 total), only 4 of which are needed when 
building within OpenWRT. Getting this PR merged would help us to get the Matter 
SDK and related software to build cleanly under OpenWRT.

Thanks!

[1]https://buildwithmatter.com  
[2]https://github.com/project-chip/connectedhomeip


Stijn

[1] https://github.com/openwrt/packages/pull/19218



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


Re: [PATCH firewall4] ruleset: unconditionally allow DNAT traffic

2023-03-09 Thread Stijn Tintel

On 10/03/2023 01:49, st...@linux-ipv6.be wrote:

We currently only accept DNAT traffic if there is at least one DNAT rule
configured in UCI. This leads to a problem for people wanting to use
UPnP, and do not have any DNAT rules configured. In this case, the UPnP
daemon sets up the DNAT rules, but the traffic is not allowed in the
input or forward chain, so the DNAT rules do not work.

Solve this by unconditionally allowing packets with the dnat conntrack
status. One could argue that this makes firewall4 less secure, but for a
packet to have the dnat conntrack status, it must have already matched a
DNAT rule. If there are no DNAT rules, no packets should ever have this
status.
Please disregard, miniupnpd seems to add a forward rule, this is no 
longer needed.


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


[PATCH] Implement Makefile patch by Stijn Tintel and Robert Marko

2022-12-27 Thread Stijn Tintel 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 ---
My associates have approved this excellent patch for the top directory's
Makefile.

1,2c1,137
< ifndef TOPDIR
< TOPDIR = $(shell pwd)
---
> # SPDX-License-Identifier: GPL-2.0-only
> #
> # Copyright (C) 2007 OpenWrt.org
>
> TOPDIR:=${CURDIR}
> LC_ALL:=C
> LANG:=C
> TZ:=UTC
> export TOPDIR LC_ALL LANG TZ
>
> empty:=
> space:= $(empty) $(empty)
> $(if $(findstring $(space),$(TOPDIR)),$(error ERROR: The path to the
OpenWrt directory must not include any spaces))
>
> world:
>
> DISTRO_PKG_CONFIG:=$(shell $(TOPDIR)/scripts/command_all.sh pkg-config |
grep '/usr' -m 1)
> export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH)
>
> ifneq ($(OPENWRT_BUILD),1)
>   _SINGLE=export MAKEFLAGS=$(space);
>
>   override OPENWRT_BUILD=1
>   export OPENWRT_BUILD
>   GREP_OPTIONS=
>   export GREP_OPTIONS
>   CDPATH=
>   export CDPATH
>   include $(TOPDIR)/include/debug.mk
>   include $(TOPDIR)/include/depends.mk
>   include $(TOPDIR)/include/toplevel.mk
> else
>   include rules.mk
>   include $(INCLUDE_DIR)/depends.mk
>   include $(INCLUDE_DIR)/subdir.mk
>   include target/Makefile
>   include package/Makefile
>   include tools/Makefile
>   include toolchain/Makefile
>
> $(toolchain/stamp-compile): $(tools/stamp-compile) $(if
$(CONFIG_BUILDBOT),toolchain_rebuild_check)
> $(target/stamp-compile): $(toolchain/stamp-compile)
$(tools/stamp-compile) $(BUILD_DIR)/.prepared
> $(package/stamp-compile): $(target/stamp-compile) $(package/stamp-cleanup)
> $(package/stamp-install): $(package/stamp-compile)
> $(target/stamp-install): $(package/stamp-compile) $(package/stamp-install)
> check: $(tools/stamp-check) $(toolchain/stamp-check) $(package/stamp-check)
>
> printdb:
>   @true
>
> prepare: $(target/stamp-compile)
>
> _clean: FORCE
>   rm -rf $(BUILD_DIR) $(STAGING_DIR) $(BIN_DIR)
$(OUTPUT_DIR)/packages/$(ARCH_PACKAGES) $(TOPDIR)/staging_dir/packages
>
> clean: _clean
>   rm -rf $(BUILD_LOG_DIR)
>
> targetclean: _clean
>   rm -rf $(TOOLCHAIN_DIR) $(BUILD_DIR_BASE)/hostpkg $(BUILD_DIR_TOOLCHAIN)
>
> dirclean: targetclean clean
>   rm -rf $(STAGING_DIR_HOST) $(STAGING_DIR_HOSTPKG) $(BUILD_DIR_BASE)/host
>   rm -rf $(TMP_DIR)
>   $(MAKE) -C $(TOPDIR)/scripts/config clean
>
> toolchain_rebuild_check:
>   $(SCRIPT_DIR)/check-toolchain-clean.sh
>
> cacheclean:
> ifneq ($(CONFIG_CCACHE),)
>   $(STAGING_DIR_HOST)/bin/ccache -C
> endif
>
> ifndef DUMP_TARGET_DB
> $(BUILD_DIR)/.prepared: Makefile
>   @mkdir -p $$(dirname $@)
>   @touch $@
>
> tmp/.prereq_packages: .config
>   unset ERROR; \
>   for package in $(sort $(prereq-y) $(prereq-m)); do \
>   $(_SINGLE)$(NO_TRACE_MAKE) -s -r -C package/$$package prereq ||
ERROR=1; \
>   done; \
>   if [ -n "$$ERROR" ]; then \
>   echo "Package prerequisite check failed."; \
>   false; \
>   fi
>   touch $@
> endif
>
> # check prerequisites before starting to build
> prereq: $(target/stamp-prereq) tmp/.prereq_packages
>   @if [ ! -f "$(INCLUDE_DIR)/site/$(ARCH)" ]; then \
>   echo 'ERROR: Missing site config for architecture "$(ARCH)" !'; 
> \
>   echo '   The missing file will cause configure scripts to 
> fail
during compilation.'; \
>   echo '   Please provide a "$(INCLUDE_DIR)/site/$(ARCH)" 
> file and
restart the build.'; \
>   exit 1; \
>   fi
>
> $(BIN_DIR)/profiles.json: FORCE
>   $(if $(CONFIG_JSON_OVERVIEW_IMAGE_INFO), \
>   WORK_DIR=$(BUILD_DIR)/json_info_files \
>   $(SCRIPT_DIR)/json_overview_image_info.py $@ \
>   )
>
> json_overview_image_info: $(BIN_DIR)/profiles.json
>
> checksum: FORCE
>   $(call sha256sums,$(BIN_DIR),$(CONFIG_BUILDBOT))
>
> buildversion: FORCE
>   $(SCRIPT_DIR)/getver.sh > $(BIN_DIR)/version.buildinfo
>
> feedsversion: FORCE
>   $(SCRIPT_DIR)/feeds list -fs > $(BIN_DIR)/feeds.buildinfo
>
> diffconfig: FORCE
>   mkdir -p $(BIN_DIR)
>   $(SCRIPT_DIR)/diffconfig.sh > $(BIN_DIR)/config.buildinfo
>
> buildinfo: FORCE
>   $(_SINGLE)$(SUBMAKE) -r diffconfig buildversion feedsversion
>
> prepare: .config $(tools/stamp-compile) $(toolchain/stamp-compile)
>   $(_SINGLE)$(SUBMAKE) -r buildinfo
>
> world: prepare $(target/stamp-compile) $(package/stamp-compile)
$(package/stamp-install) $(target/stamp-install) FORCE
>   $(_SINGLE)$(SUBMAKE) -r package/index
>   $(_SINGLE)$(SUBMAKE) -r json_overview_image_info
>   $(_SINGLE)$(SUBMAKE) -r checksum
> ifneq ($(CONFIG_CCACHE),)
>   $(STAGING_DIR_HOST)/bin/ccache -s
> endif
>
> .PHONY: clean dirclean prereq prepare world package/symlinks
package/symlinks-install package/symlinks-clean
>
4,8d138
< .PHONY: stijn
< all: stijn
< stijn:
<  

Calling all OpenWRT maintainers for an important message

2022-12-27 Thread Stijn Tintel 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 ---
Dear Open(fucking)WRT maintainers,

Suck my dick. OpenWRT is a shitty project, OSS is dead. Dilate & cope, you
will never be real women, tr00ns.

Yours sincerely,

Stijn Tintel and Robert Marko (pls give us corporate jobs, we're starving
in our slavic shitholes)


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


Re: [PATCH] build: always set CONFIG_IPV6

2022-08-18 Thread Stijn Tintel
On 18/08/2022 17:03, Thibaut wrote:
>> Le 18 août 2022 à 15:40, Stijn Tintel  a écrit :
>>
>> On 16/08/2022 20:00, Thibaut VARÈNE wrote:
>>> Disabling this build tunable breaks build and seems unrealistically
>>> likely to be fixed.
>>>
>>> This patch sets the related CONFIG to always true and removes the
>>> config prompt, keeping the change minimal, and, should !CONFIG_IPV6 ever
>>> be fixed, easy to revert.
>> If we're always going to set it to yes, just drop the option entirely and 
>> enable it in the generic kernel configs. Aside from that:
> CONFIG_IPV6 is not a kernel config, it’s a tree-wide one.
>
> My idea was to keep the change as small as possible should we ever want to 
> revert, while preventing further pointless bugreports[1].
>
> Entirely removing the config option requires more invasive changes throughout 
> the tree and the package repositories, which is significantly less trivial 
> than this "first step".
>
> Cheers,
> Thibaut
>
> [1] https://github.com/openwrt/openwrt/issues/9580

OK, in that case, let's await at least one more ACK and we can start
with this.

Thanks,
Stijn


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


Re: [PATCH] build: always set CONFIG_IPV6

2022-08-18 Thread Stijn Tintel

On 16/08/2022 20:00, Thibaut VARÈNE wrote:

Disabling this build tunable breaks build and seems unrealistically
likely to be fixed.

This patch sets the related CONFIG to always true and removes the
config prompt, keeping the change minimal, and, should !CONFIG_IPV6 ever
be fixed, easy to revert.


If we're always going to set it to yes, just drop the option entirely 
and enable it in the generic kernel configs. Aside from that:


Acked-by: Stijn Tintel 


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


[PATCH] hostapd: add mbo flag to get_clients ubus method

2022-08-11 Thread Stijn Tintel
There is no WLAN_STA_MBO flag, but according to the hostapd source code,
when an STA does not support MBO, cell_capa will be 0. Use this to
indicate MBO support in the get_clients ubus method.

Signed-off-by: Stijn Tintel 
---
 package/network/services/hostapd/src/src/ap/ubus.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/package/network/services/hostapd/src/src/ap/ubus.c 
b/package/network/services/hostapd/src/src/ap/ubus.c
index 182aae7d05..622eab8838 100644
--- a/package/network/services/hostapd/src/src/ap/ubus.c
+++ b/package/network/services/hostapd/src/src/ap/ubus.c
@@ -318,6 +318,10 @@ hostapd_bss_get_clients(struct ubus_context *ctx, struct 
ubus_object *obj,
blobmsg_add_u8(, sta_flags[i].name,
   !!(sta->flags & sta_flags[i].flag));
 
+#ifdef CONFIG_MBO
+   blobmsg_add_u8(, "mbo", !!(sta->cell_capa));
+#endif
+
r = blobmsg_open_array(, "rrm");
for (i = 0; i < ARRAY_SIZE(sta->rrm_enabled_capa); i++)
blobmsg_add_u32(, "", sta->rrm_enabled_capa[i]);
-- 
2.35.1


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


[PATCH] kernel: extract kmod-sched-act-ipt from kmod-sched

2022-08-11 Thread Stijn Tintel
There is only one module in kmod-sched that depends on iptables. Move it
to its own kmod package so we can drop the kmod-ipt-core dependency from
kmod-sched. This makes it possible to disable all kmod-ipt-* packages
without having to disable kmod-sched.

Signed-off-by: Stijn Tintel 
---
 package/kernel/linux/modules/netsupport.mk | 21 ++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/package/kernel/linux/modules/netsupport.mk 
b/package/kernel/linux/modules/netsupport.mk
index 5369be201f..be0347527d 100644
--- a/package/kernel/linux/modules/netsupport.mk
+++ b/package/kernel/linux/modules/netsupport.mk
@@ -775,6 +775,22 @@ endef
 $(eval $(call KernelPackage,sched-act-sample))
 
 
+define KernelPackage/sched-act-ipt
+  SUBMENU:=$(NETWORK_SUPPORT_MENU)
+  TITLE:=IPtables targets
+  DEPENDS:=+kmod-ipt-core +kmod-sched-core
+  KCONFIG:=CONFIG_NET_ACT_IPT
+  FILES:=$(LINUX_DIR)/net/sched/act_ipt.ko
+  AUTOLOAD:=$(call AutoProbe, act_ipt)
+endef
+
+define KernelPackage/sched-act-ipt/description
+  Allows to invoke iptables targets after successful classification.
+endef
+
+$(eval $(call KernelPackage,sched-act-ipt))
+
+
 define KernelPackage/sched-act-vlan
   SUBMENU:=$(NETWORK_SUPPORT_MENU)
   TITLE:=Traffic VLAN manipulation
@@ -948,13 +964,13 @@ endef
 $(eval $(call KernelPackage,bpf-test))
 
 
-SCHED_MODULES_EXTRA = sch_codel sch_dsmark sch_gred sch_multiq sch_sfq 
sch_teql sch_fq sch_pie act_ipt act_pedit act_simple act_csum em_cmp em_nbyte 
em_meta em_text
+SCHED_MODULES_EXTRA = sch_codel sch_dsmark sch_gred sch_multiq sch_sfq 
sch_teql sch_fq sch_pie act_pedit act_simple act_csum em_cmp em_nbyte em_meta 
em_text
 SCHED_FILES_EXTRA = $(foreach 
mod,$(SCHED_MODULES_EXTRA),$(LINUX_DIR)/net/sched/$(mod).ko)
 
 define KernelPackage/sched
   SUBMENU:=$(NETWORK_SUPPORT_MENU)
   TITLE:=Extra traffic schedulers
-  DEPENDS:=+kmod-sched-core +kmod-ipt-core +kmod-lib-crc32c 
+kmod-lib-textsearch
+  DEPENDS:=+kmod-sched-core +kmod-lib-crc32c +kmod-lib-textsearch
   KCONFIG:= \
CONFIG_NET_SCH_CODEL \
CONFIG_NET_SCH_DSMARK \
@@ -964,7 +980,6 @@ define KernelPackage/sched
CONFIG_NET_SCH_TEQL \
CONFIG_NET_SCH_FQ \
CONFIG_NET_SCH_PIE \
-   CONFIG_NET_ACT_IPT \
CONFIG_NET_ACT_PEDIT \
CONFIG_NET_ACT_SIMP \
CONFIG_NET_ACT_CSUM \
-- 
2.35.1


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


Re: [PATCH 4/5] kernel: netsupport: Add kmod-sched-act-sample

2022-07-21 Thread Stijn Tintel

Hi,

On 18/07/2022 17:01, Hauke Mehrtens wrote:

From: Thomas Langer 

This adds the act_sample.ko and psample.ko kernel module which allows
traffic sampling.

Signed-off-by: Thomas Langer 
Signed-off-by: Hauke Mehrtens 
---
  package/kernel/linux/modules/netsupport.mk | 18 ++
  1 file changed, 18 insertions(+)

diff --git a/package/kernel/linux/modules/netsupport.mk 
b/package/kernel/linux/modules/netsupport.mk
index 40d304c52f..54c8d2dacd 100644
--- a/package/kernel/linux/modules/netsupport.mk
+++ b/package/kernel/linux/modules/netsupport.mk
@@ -855,6 +855,24 @@ endef
  $(eval $(call KernelPackage,sched-flower))
  
  
+define KernelPackage/sched-act-sample

+  SUBMENU:=$(NETWORK_SUPPORT_MENU)
+  TITLE:=Traffic Sampling
+  DEPENDS:=+kmod-sched-core
+  KCONFIG:=CONFIG_NET_ACT_SAMPLE CONFIG_PSAMPLE
+  FILES:= \
+   $(LINUX_DIR)/net/sched/act_sample.ko \
+   $(LINUX_DIR)/net/psample/psample.ko
+  AUTOLOAD:=$(call AutoProbe, psample act_sample)


We generally try to maintain alphabetical order in lists, so please 
order paths and module names alphabetically.


Thanks,
Stijn



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


Re: [PATCH 1/5] kernel: netsupport: kmod-sched: explicitly define included modules

2022-07-21 Thread Stijn Tintel

Hi,

On 18/07/2022 17:01, Hauke Mehrtens wrote:

From: Thomas Langer 

Change SCHED_MODULES_EXTRA to an explicit list of modules
instead of taking everything that is not filtered out.
This removes the need of updating the filter each time an extra
sch_*, act_* or similar is added with an own kmod definition.

CONFIG_NET_SCH_FQ_CODEL and CONFIG_NET_SCH_FIFO are already compiled
into the kernel using the generic linux configuration.

CONFIG_NET_EMATCH_TEXT depends on the kmod-lib-textsearch package.


Ideally these last 2 changes go in separate commits, as they are 
unrelated to the main changes of this commit.


Thanks,
Stijn


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


Re: [PATCH] kernel/crypto: fix crypto-lib-curve25519 x86_64 build

2022-07-21 Thread Stijn Tintel

On 21/07/2022 15:17, Florian Eckert wrote:

The crypto-lib-curve25519 dependency for x86_64 could not be met,
because the package for for the architecture x86_64 was not added to
crypto-lib-curve package. Also the package arch definition for x86/64
does not exist. It musst be change to x86_64 to get added.


Can you please elaborate why this is needed? My x86/64 image contains 
curve25519_x86_64.ko without this change. It works with x86/64 because 
of [1] and BOARD is x86 for the x86 target.


Thanks,
Stijn

[1] 
https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=include/kernel.mk;h=001718d89d8b77bf7843c5cba77ef519f808e085;hb=HEAD#l213



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


Re: [PATCH 4/4] hostapd: support MBO in bss_transition_request

2022-06-27 Thread Stijn Tintel

On 28/06/2022 02:05, Strontium wrote:

Hi Stijn,

I am wanting to test these patches on an AP.  Is this a case of 
applying this, configure MBO enabled, and it just works?  I ask, 
because it looks like a daemon of some kind needs to manage the MBO 
transitions of the attached STA using UBUS transition requests, is 
that correct?


This patch merely adds support for MBO to the existing ubus method 
bss_transition_request. This method is used by [1] and [2] to steer 
clients between different BSSes in an ESS, but does nothing on its own. 
Once this patch is in OpenWrt, these daemons could be updated to make 
use of the new MBO attributes for improved steering.


Stijn

[1] https://git.openwrt.org/?p=project/usteer.git
[2] https://github.com/berlin-open-wireless-lab/DAWN


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


Re: [PATCH 2/4] hostapd: enable MBO if 802.11ax is enabled

2022-06-24 Thread Stijn Tintel

On 23/06/2022 00:47, David Bauer wrote:

Hi Stijn,

On 6/21/22 15:36, Stijn Tintel wrote:

Multi Band Operation is required for 802.11ax certification, so let's
enable it if 802.11ax support is enabled.


I'd suggest we enable it for the -full build variants unconditionally.


Exclusively or on top of enabling it for 802.11ax devices?

Thanks,
Stijn

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


Re: [PATCH 3/4] hostapd: introduce mbo option

2022-06-22 Thread Stijn Tintel


On 21/06/2022 18:19, Andre Valentin wrote:


Hello Stijn!

Am 21.06.22 um 15:36 schrieb Stijn Tintel:

Introduce a new option mbo to toggle Multi Band Operation aka Agile
Multiband for a BSS. As the specification requires APs to support OTA
when FT is supported, force OTA on when FT is enabled.

Signed-off-by: Stijn Tintel 
---
  package/network/services/hostapd/files/hostapd.sh | 13 +++--
  1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/package/network/services/hostapd/files/hostapd.sh 
b/package/network/services/hostapd/files/hostapd.sh

index fa344bd2dd..59b3128669 100644
--- a/package/network/services/hostapd/files/hostapd.sh
+++ b/package/network/services/hostapd/files/hostapd.sh
@@ -304,7 +304,7 @@ hostapd_common_add_bss_config() {
  config_add_string wps_device_type wps_device_name 
wps_manufacturer wps_pin

  config_add_string multi_ap_backhaul_ssid multi_ap_backhaul_key
  -    config_add_boolean wnm_sleep_mode wnm_sleep_mode_no_keys 
bss_transition
+    config_add_boolean wnm_sleep_mode wnm_sleep_mode_no_keys 
bss_transition mbo

  config_add_int time_advertisement
  config_add_string time_zone
  config_add_string vendor_elements
@@ -825,11 +825,17 @@ hostapd_set_bss_options() {
  append bss_conf "iapp_interface=$ifname" "$N"
  }
  -    json_get_vars time_advertisement time_zone wnm_sleep_mode 
wnm_sleep_mode_no_keys bss_transition
+    json_get_vars time_advertisement time_zone wnm_sleep_mode 
wnm_sleep_mode_no_keys bss_transition mbo

  set_default bss_transition 0
  set_default wnm_sleep_mode 0
  set_default wnm_sleep_mode_no_keys 0
  +    if [ "$enable_ax" -eq 1 ]; then
+    set_default mbo 1
+    else
+    set_default mbo 0
+    fi
+
  [ -n "$time_advertisement" ] && append bss_conf 
"time_advertisement=$time_advertisement" "$N"

  [ -n "$time_zone" ] && append bss_conf "time_zone=$time_zone" "$N"
  if [ "$wnm_sleep_mode" -eq "1" ]; then
@@ -837,6 +843,7 @@ hostapd_set_bss_options() {
  [ "$wnm_sleep_mode_no_keys" -eq "1" ] && append bss_conf 
"wnm_sleep_mode_no_keys=1" "$N"

  fi
  [ "$bss_transition" -eq "1" ] && append bss_conf 
"bss_transition=1" "$N"

+    [ "$mbo" -eq 1 ] && append bss_conf "mbo=1" "$N"
    json_get_vars ieee80211k rrm_neighbor_report rrm_beacon_report
  set_default ieee80211k 0
@@ -883,6 +890,8 @@ hostapd_set_bss_options() {
  ;;
  esac
  +    [ "$mbo" -eq 1 ] && ft_over_ds=1
+
I'm a bit irritated about that. Why does mbo force this. To my 
knowledge, ft_over_ds=1 forces the roaming to go over the backhaul, 
not directly to the new AP.

So if the client can't reach his old AP, he won't roam.
Is that really correct?

Brainfart, I inverted the logic. The specification requires APs and STAs 
that implement FT to implement OTA. We can probably just drop this part.


Thanks,
Stijn


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


[PATCH 1/4] hostapd: add config symbol to enable MBO

2022-06-21 Thread Stijn Tintel
Multi Band Operation aka Agile Multiband introduces new Transition
and Transition Rejection Reason Codes that should improve client
steering. Add a config symbol to enable it.

Signed-off-by: Stijn Tintel 
---
 package/network/services/hostapd/Config.in | 9 +
 package/network/services/hostapd/Makefile  | 1 +
 2 files changed, 10 insertions(+)

diff --git a/package/network/services/hostapd/Config.in 
b/package/network/services/hostapd/Config.in
index 5c00f3e24e..68a78359f6 100644
--- a/package/network/services/hostapd/Config.in
+++ b/package/network/services/hostapd/Config.in
@@ -87,3 +87,12 @@ config WPA_ENABLE_WEP
  for anything anymore. The functionality needed to use WEP is 
available in the
  current hostapd release under this optional build parameter and 
completely
  removed in a future release.
+
+config WPA_MBO_SUPPORT
+   bool "Multi Band Operation (Agile Multiband)"
+   default n
+   help
+ Multi Band Operation aka (Agile Multiband) enables features
+ that facilitate efficient use of multiple frequency bands.
+ Enabling MBO on an AP using RSN requires 802.11w to be enabled.
+ Hostapd will refuse to start if MBO and RSN are enabled without 11w.
diff --git a/package/network/services/hostapd/Makefile 
b/package/network/services/hostapd/Makefile
index a3274c8d4d..c69d2a826b 100644
--- a/package/network/services/hostapd/Makefile
+++ b/package/network/services/hostapd/Makefile
@@ -91,6 +91,7 @@ DRIVER_MAKEOPTS= \
CONFIG_IEEE80211AC=$(HOSTAPD_IEEE80211AC) \
CONFIG_IEEE80211AX=$(HOSTAPD_IEEE80211AX) \
CONFIG_DRIVER_WEXT=$(CONFIG_DRIVER_WEXT_SUPPORT) \
+   CONFIG_MBO=$(CONFIG_WPA_MBO_SUPPORT)
 
 ifeq ($(SSL_VARIANT),openssl)
   DRIVER_MAKEOPTS += CONFIG_TLS=openssl CONFIG_SAE=y
-- 
2.35.1


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


[PATCH 3/4] hostapd: introduce mbo option

2022-06-21 Thread Stijn Tintel
Introduce a new option mbo to toggle Multi Band Operation aka Agile
Multiband for a BSS. As the specification requires APs to support OTA
when FT is supported, force OTA on when FT is enabled.

Signed-off-by: Stijn Tintel 
---
 package/network/services/hostapd/files/hostapd.sh | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/package/network/services/hostapd/files/hostapd.sh 
b/package/network/services/hostapd/files/hostapd.sh
index fa344bd2dd..59b3128669 100644
--- a/package/network/services/hostapd/files/hostapd.sh
+++ b/package/network/services/hostapd/files/hostapd.sh
@@ -304,7 +304,7 @@ hostapd_common_add_bss_config() {
config_add_string wps_device_type wps_device_name wps_manufacturer 
wps_pin
config_add_string multi_ap_backhaul_ssid multi_ap_backhaul_key
 
-   config_add_boolean wnm_sleep_mode wnm_sleep_mode_no_keys bss_transition
+   config_add_boolean wnm_sleep_mode wnm_sleep_mode_no_keys bss_transition 
mbo
config_add_int time_advertisement
config_add_string time_zone
config_add_string vendor_elements
@@ -825,11 +825,17 @@ hostapd_set_bss_options() {
append bss_conf "iapp_interface=$ifname" "$N"
}
 
-   json_get_vars time_advertisement time_zone wnm_sleep_mode 
wnm_sleep_mode_no_keys bss_transition
+   json_get_vars time_advertisement time_zone wnm_sleep_mode 
wnm_sleep_mode_no_keys bss_transition mbo
set_default bss_transition 0
set_default wnm_sleep_mode 0
set_default wnm_sleep_mode_no_keys 0
 
+   if [ "$enable_ax" -eq 1 ]; then
+   set_default mbo 1
+   else
+   set_default mbo 0
+   fi
+
[ -n "$time_advertisement" ] && append bss_conf 
"time_advertisement=$time_advertisement" "$N"
[ -n "$time_zone" ] && append bss_conf "time_zone=$time_zone" "$N"
if [ "$wnm_sleep_mode" -eq "1" ]; then
@@ -837,6 +843,7 @@ hostapd_set_bss_options() {
[ "$wnm_sleep_mode_no_keys" -eq "1" ] && append bss_conf 
"wnm_sleep_mode_no_keys=1" "$N"
fi
[ "$bss_transition" -eq "1" ] && append bss_conf "bss_transition=1" "$N"
+   [ "$mbo" -eq 1 ] && append bss_conf "mbo=1" "$N"
 
json_get_vars ieee80211k rrm_neighbor_report rrm_beacon_report
set_default ieee80211k 0
@@ -883,6 +890,8 @@ hostapd_set_bss_options() {
;;
esac
 
+   [ "$mbo" -eq 1 ] && ft_over_ds=1
+
[ -n "$network_ifname" ] && append bss_conf 
"ft_iface=$network_ifname" "$N"
append bss_conf "mobility_domain=$mobility_domain" "$N"
append bss_conf 
"ft_psk_generate_local=$ft_psk_generate_local" "$N"
-- 
2.35.1


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


[PATCH 2/4] hostapd: enable MBO if 802.11ax is enabled

2022-06-21 Thread Stijn Tintel
Multi Band Operation is required for 802.11ax certification, so let's
enable it if 802.11ax support is enabled.

Signed-off-by: Stijn Tintel 
---
 package/network/services/hostapd/Config.in | 1 +
 1 file changed, 1 insertion(+)

diff --git a/package/network/services/hostapd/Config.in 
b/package/network/services/hostapd/Config.in
index 68a78359f6..3d3e578379 100644
--- a/package/network/services/hostapd/Config.in
+++ b/package/network/services/hostapd/Config.in
@@ -78,6 +78,7 @@ config DRIVER_11AC_SUPPORT
 config DRIVER_11AX_SUPPORT
bool
default n
+   select WPA_MBO_SUPPORT
 
 config WPA_ENABLE_WEP
bool "Enable support for unsecure and obsolete WEP"
-- 
2.35.1


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


[PATCH 4/4] hostapd: support MBO in bss_transition_request

2022-06-21 Thread Stijn Tintel
Support the use of MBO in the bss_transition_request ubus method.

Signed-off-by: Stijn Tintel 
---
 package/network/services/hostapd/README.md|  3 +
 .../services/hostapd/src/src/ap/ubus.c| 61 ++-
 2 files changed, 61 insertions(+), 3 deletions(-)

diff --git a/package/network/services/hostapd/README.md 
b/package/network/services/hostapd/README.md
index bd347c61dd..2150863306 100644
--- a/package/network/services/hostapd/README.md
+++ b/package/network/services/hostapd/README.md
@@ -29,6 +29,9 @@ Initiate an 802.11v transition request.
 | neighbors | array | no | BSS Transition Candidate List |
 | abridged | bool | no | prefer APs in the BSS Transition Candidate List |
 | dialog_token | int32 | no | identifier for the request/report transaction |
+| mbo_reason | int32 | no | MBO Transition Reason Code Attribute |
+| cell_pref | int32 | no | MBO Cellular Data Connection Preference Attribute |
+| reassoc_delay | int32 | no | MBO Re-association retry delay |
 
 ### example
 `ubus call hostapd.wl5-fb bss_transition_request '{ "addr": 
"68:2F:67:8B:98:ED", "disassociation_imminent": false, "disassociation_timer": 
0, "validity_period": 30, "neighbors": 
["b6a7b9cbeebabf598064090603026a00"], "abridged": 1 }'`
diff --git a/package/network/services/hostapd/src/src/ap/ubus.c 
b/package/network/services/hostapd/src/src/ap/ubus.c
index 1199098b1e..182aae7d05 100644
--- a/package/network/services/hostapd/src/src/ap/ubus.c
+++ b/package/network/services/hostapd/src/src/ap/ubus.c
@@ -1454,7 +1454,7 @@ void hostapd_ubus_handle_link_measurement(struct 
hostapd_data *hapd, const u8 *d
 static int
 hostapd_bss_tr_send(struct hostapd_data *hapd, u8 *addr, bool 
disassoc_imminent, bool abridged,
u16 disassoc_timer, u8 validity_period, u8 dialog_token,
-   struct blob_attr *neighbors)
+   struct blob_attr *neighbors, u8 mbo_reason, u8 cell_pref, 
u8 reassoc_delay)
 {
struct blob_attr *cur;
struct sta_info *sta;
@@ -1462,6 +1462,8 @@ hostapd_bss_tr_send(struct hostapd_data *hapd, u8 *addr, 
bool disassoc_imminent,
int rem;
u8 *nr = NULL;
u8 req_mode = 0;
+   u8 mbo[10];
+   size_t mbo_len = 0;
 
sta = ap_get_sta(hapd, addr);
if (!sta)
@@ -1513,8 +1515,37 @@ hostapd_bss_tr_send(struct hostapd_data *hapd, u8 *addr, 
bool disassoc_imminent,
if (disassoc_imminent)
req_mode |= WNM_BSS_TM_REQ_DISASSOC_IMMINENT;
 
+#ifdef CONFIG_MBO
+   u8 *mbo_pos = mbo;
+
+   if (mbo_reason > MBO_TRANSITION_REASON_PREMIUM_AP)
+   return UBUS_STATUS_INVALID_ARGUMENT;
+
+   if (cell_pref != 0 && cell_pref != 1 && cell_pref != 255)
+   return UBUS_STATUS_INVALID_ARGUMENT;
+
+   if (reassoc_delay > 65535 || (reassoc_delay && !disassoc_imminent))
+   return UBUS_STATUS_INVALID_ARGUMENT;
+
+   *mbo_pos++ = MBO_ATTR_ID_TRANSITION_REASON;
+   *mbo_pos++ = 1;
+   *mbo_pos++ = mbo_reason;
+   *mbo_pos++ = MBO_ATTR_ID_CELL_DATA_PREF;
+   *mbo_pos++ = 1;
+   *mbo_pos++ = cell_pref;
+
+   if (reassoc_delay) {
+   *mbo_pos++ = MBO_ATTR_ID_ASSOC_RETRY_DELAY;
+   *mbo_pos++ = 2;
+   WPA_PUT_LE16(mbo_pos, reassoc_delay);
+   mbo_pos += 2;
+   }
+
+   mbo_len = mbo_pos - mbo;
+#endif
+
if (wnm_send_bss_tm_req(hapd, sta, req_mode, disassoc_timer, 
validity_period, NULL,
-   dialog_token, NULL, nr, nr_len, NULL, 0))
+   dialog_token, NULL, nr, nr_len, mbo_len ? mbo : 
NULL, mbo_len))
return UBUS_STATUS_UNKNOWN_ERROR;
 
return 0;
@@ -1528,6 +1559,11 @@ enum {
BSS_TR_NEIGHBORS,
BSS_TR_ABRIDGED,
BSS_TR_DIALOG_TOKEN,
+#ifdef CONFIG_MBO
+   BSS_TR_MBO_REASON,
+   BSS_TR_CELL_PREF,
+   BSS_TR_REASSOC_DELAY,
+#endif
__BSS_TR_DISASSOC_MAX
 };
 
@@ -1539,6 +1575,11 @@ static const struct blobmsg_policy 
bss_tr_policy[__BSS_TR_DISASSOC_MAX] = {
[BSS_TR_NEIGHBORS] = { "neighbors", BLOBMSG_TYPE_ARRAY },
[BSS_TR_ABRIDGED] = { "abridged", BLOBMSG_TYPE_BOOL },
[BSS_TR_DIALOG_TOKEN] = { "dialog_token", BLOBMSG_TYPE_INT32 },
+#ifdef CONFIG_MBO
+   [BSS_TR_MBO_REASON] = { "mbo_reason", BLOBMSG_TYPE_INT32 },
+   [BSS_TR_CELL_PREF] = { "cell_pref", BLOBMSG_TYPE_INT32 },
+   [BSS_TR_REASSOC_DELAY] = { "reassoc_delay", BLOBMSG_TYPE_INT32 },
+#endif
 };
 
 static int
@@ -1555,6 +1596,9 @@ hostapd_bss_transition_request(struct ubus_context *ctx, 
struct ubus_object *obj
u32 dialog_token = 1;
bool abridged;
bool da_imminent;
+   u8 mbo_reason;
+   u8 cell_pref;
+   u8 reassoc_delay;
 
blobmsg_parse(bss_tr_poli

[PATCH 2/2] iw: bump to 5.19

2022-06-06 Thread Stijn Tintel
  7e06706 iw: event: report missing radar events
  5909e73 iw: survey: add support for radio stats
  64bf570 update nl80211.h
  0900996 iw: print Radar background capability if supported
  56c6077 iw: print out assoc comeback event
  a4e5418 iw: support 160MHz frequency command for 6GHz band
  5a71b72 iw: Print local EHT capabilities
  e3287a1 station: print EHT rate information
  ff67fb2 iw: fix double tab in mesh path header
  05a5267 iw: fix 'upto' -> 'up to'
  00a2985 iw: handle VHT extended NSS
  82e0bd1 update nl80211.h
  c95877c info: add missing extended features
  0976378 info: refactor extended features
  79f20cb bump version to 5.19

Sync nl80211.h with our version of mac80211 and remove parts of the iw
code that are not supported by our version of mac80211.

Signed-off-by: Stijn Tintel 
---
 package/network/utils/iw/Makefile |   4 +-
 .../utils/iw/patches/001-nl80211_h_sync.patch | 473 --
 .../utils/iw/patches/200-reduce_size.patch|  30 +-
 3 files changed, 462 insertions(+), 45 deletions(-)

diff --git a/package/network/utils/iw/Makefile 
b/package/network/utils/iw/Makefile
index da2b556416..eb3a9ba091 100644
--- a/package/network/utils/iw/Makefile
+++ b/package/network/utils/iw/Makefile
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=iw
-PKG_VERSION:=5.16
+PKG_VERSION:=5.19
 PKG_RELEASE:=1
  
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=@KERNEL/software/network/iw
-PKG_HASH:=4c44e42762f903f9094ba5a598998c800a97a62afd6fd31ec1e0a799e308659c
+PKG_HASH:=f167bbe947dd53bb9ebc0c1dcef5db6ad73ac1d6084f2c6f9376c5c360cc4d4e
 
 PKG_MAINTAINER:=Felix Fietkau 
 PKG_LICENSE:=GPL-2.0
diff --git a/package/network/utils/iw/patches/001-nl80211_h_sync.patch 
b/package/network/utils/iw/patches/001-nl80211_h_sync.patch
index 3fb5ca255c..49d08d9b01 100644
--- a/package/network/utils/iw/patches/001-nl80211_h_sync.patch
+++ b/package/network/utils/iw/patches/001-nl80211_h_sync.patch
@@ -1,5 +1,14 @@
 --- a/nl80211.h
 +++ b/nl80211.h
+@@ -11,7 +11,7 @@
+  * Copyright 2008 Jouni Malinen 
+  * Copyright 2008 Colin McCabe 
+  * Copyright 2015-2017Intel Deutschland GmbH
+- * Copyright (C) 2018-2022 Intel Corporation
++ * Copyright (C) 2018-2021 Intel Corporation
+  *
+  * Permission to use, copy, modify, and/or distribute this software for any
+  * purpose with or without fee is hereby granted, provided that the above
 @@ -301,29 +301,6 @@
   */
  
@@ -30,7 +39,7 @@
   * enum nl80211_commands - supported nl80211 commands
   *
   * @NL80211_CMD_UNSPEC: unspecified command to catch errors
-@@ -1226,12 +1203,6 @@
+@@ -1226,17 +1203,6 @@
   * @NL80211_CMD_COLOR_CHANGE_COMPLETED: Notify userland that the color change
   *has completed
   *
@@ -39,39 +48,255 @@
 - *_ATTR_FILS_KEK - for KEK
 - *_ATTR_FILS_NONCES - for FILS Nonces
 - *(STA Nonce 16 bytes followed by AP Nonce 16 bytes)
+- *
+- * @NL80211_CMD_ASSOC_COMEBACK: notification about an association
+- *  temporal rejection with comeback. The event includes %NL80211_ATTR_MAC
+- *  to describe the BSSID address of the AP and %NL80211_ATTR_TIMEOUT to
+- *  specify the timeout value.
 - *
   * @NL80211_CMD_MAX: highest used command number
   * @__NL80211_CMD_AFTER_LAST: internal use
   */
-@@ -1472,8 +1443,6 @@ enum nl80211_commands {
+@@ -1477,10 +1443,6 @@ enum nl80211_commands {
NL80211_CMD_COLOR_CHANGE_ABORTED,
NL80211_CMD_COLOR_CHANGE_COMPLETED,
  
 -  NL80211_CMD_SET_FILS_AAD,
+-
+-  NL80211_CMD_ASSOC_COMEBACK,
 -
/* add new commands above here */
  
/* used to define NL80211_CMD_MAX below */
-@@ -2639,6 +2608,9 @@ enum nl80211_commands {
-  *Mandatory parameter for the transmitting interface to enable MBSSID.
-  *Optional for the non-transmitting interfaces.
+@@ -2477,9 +2439,7 @@ enum nl80211_commands {
+  *space supports external authentication. This attribute shall be used
+  *with %NL80211_CMD_CONNECT and %NL80211_CMD_START_AP request. The driver
+  *may offload authentication processing to user space if this capability
+- *is indicated in the respective requests from the user space. (This flag
+- *attribute deprecated for %NL80211_CMD_START_AP, use
+- *%NL80211_ATTR_AP_SETTINGS_FLAGS)
++ *is indicated in the respective requests from the user space.
+  *
+  * @NL80211_ATTR_NSS: Station's New/updated  RX_NSS value notified using this
+  *u8 attribute. This is used with %NL80211_CMD_STA_OPMODE_CHANGED.
+@@ -2655,13 +2615,8 @@ enum nl80211_commands {
+  *switching on a different channel during CAC detection on the selected
+  *radar channel.
   *
+- * @NL80211_ATTR_AP_SETTINGS_FLAGS: u32 attribute contains ap settings flags,
+- *enumerated in  nl80211_ap_settings_flags. This attribute shall be
+- *used with %NL80211_CMD_START_AP request.
+- *
+- * @NL80211_ATTR_EHT_CAPABILITY: EHT Capability information element (from
+- *association request when u

[PATCH 1/2] wireless-regdb: bump to 2022.06.06

2022-06-06 Thread Stijn Tintel
  902b321 wireless-regdb: Update regulatory rules for Israel (IL)
  20f6f34 wireless-regdb: add missing spaces for US S1G rules
  25652b6 wireless-regdb: Update regulatory rules for Australia (AU)
  081873f wireless-regdb: update regulatory database based on preceding changes
  166fbdd wireless-regdb: add db files missing from previous commit
  e3f03f9 Regulatory update for 6 GHz operation in Canada (CA)
  888da5f Regulatory update for 6 GHz operation in United States (US)
  647bcaa Regulatory update for 6 GHz operation in FI
  c6b079d wireless-regdb: update regulatory rules for Bulgaria (BG) on 6GHz
  2ed39be wireless-regdb: Remove AUTO-BW from 6 GHz rules
  7a6ad1a wireless-regdb: Unify 6 GHz rules for EU contries
  68a8f2f wireless-regdb: update regulatory database based on preceding changes

Signed-off-by: Stijn Tintel 
---
 package/firmware/wireless-regdb/Makefile  | 4 ++--
 .../firmware/wireless-regdb/patches/500-world-regd-5GHz.patch | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/package/firmware/wireless-regdb/Makefile 
b/package/firmware/wireless-regdb/Makefile
index 49b1ad5cab..006974b3d1 100644
--- a/package/firmware/wireless-regdb/Makefile
+++ b/package/firmware/wireless-regdb/Makefile
@@ -1,12 +1,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=wireless-regdb
-PKG_VERSION:=2022.02.18
+PKG_VERSION:=2022.06.06
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=@KERNEL/software/network/wireless-regdb/
-PKG_HASH:=8828c25a4ee25020044004f57374bb9deac852809fad70f8d3d01770bf9ac97f
+PKG_HASH:=ac00f97efecce5046ed069d1d93f3365fdf994c7c7854a8fc50831e959537230
 
 PKG_MAINTAINER:=Felix Fietkau 
 
diff --git a/package/firmware/wireless-regdb/patches/500-world-regd-5GHz.patch 
b/package/firmware/wireless-regdb/patches/500-world-regd-5GHz.patch
index ae38f93537..3f6d4c7e8d 100644
--- a/package/firmware/wireless-regdb/patches/500-world-regd-5GHz.patch
+++ b/package/firmware/wireless-regdb/patches/500-world-regd-5GHz.patch
@@ -5,7 +5,7 @@ Signed-off-by: Felix Fietkau 
 ---
 --- a/db.txt
 +++ b/db.txt
-@@ -16,7 +16,7 @@ country 00:
+@@ -19,7 +19,7 @@ country 00:
# Channel 14. Only JP enables this and for 802.11b only
(2474 - 2494 @ 20), (20), NO-IR, NO-OFDM
# Channel 36 - 48
-- 
2.35.1


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


[PATCH] ramips: use hotplug script for EAP615-Wall MACs

2022-05-17 Thread Stijn Tintel
Using nvmem-cells to set the MAC address for a DBDC device results in
both PHY devices using the same MAC address. This in turn will result in
multiple BSSes using the same BSSID, which can cause various problems.

Use the hotplug script for the EAP615-Wall instead to avoid this.

Fixes: a1b8a4d7b3ff ("ramips: support TP-Link EAP615-Wall")
Signed-off-by: Stijn Tintel 
---
 target/linux/ramips/dts/mt7621_tplink_eap615-wall-v1.dts  | 2 --
 .../mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac | 4 
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/target/linux/ramips/dts/mt7621_tplink_eap615-wall-v1.dts 
b/target/linux/ramips/dts/mt7621_tplink_eap615-wall-v1.dts
index a0c3912d8e..0be4af39e8 100644
--- a/target/linux/ramips/dts/mt7621_tplink_eap615-wall-v1.dts
+++ b/target/linux/ramips/dts/mt7621_tplink_eap615-wall-v1.dts
@@ -144,8 +144,6 @@
compatible = "mediatek,mt76";
reg = <0x 0 0 0 0>;
mediatek,mtd-eeprom = < 0x0>;
-   nvmem-cells = <_info_8>;
-   nvmem-cell-names = "mac-address";
};
 };
 
diff --git 
a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac 
b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
index a35e9dcc28..5b12416872 100644
--- 
a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
+++ 
b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac
@@ -90,6 +90,10 @@ case "$board" in
hw_mac_addr="$(mtd_get_mac_binary factory 0x4)"
[ "$PHYNBR" = "1" ] &&  macaddr_add $hw_mac_addr "0x10" > 
/sys${DEVPATH}/macaddress
;;
+   tplink,eap615-wall-v1)
+   hw_mac_addr="$(mtd_get_mac_binary product-info 0x8)"
+   macaddr_add "$hw_mac_addr" "$PHYNBR" > 
"/sys${DEVPATH}/macaddress"
+   ;;
yuncore,ax820)
[ "$PHYNBR" = "1" ] && \
macaddr_setbit_la "$(mtd_get_mac_binary Factory 
0xe000)" > /sys${DEVPATH}/macaddress
-- 
2.35.1


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


[RFC PATCH] hostapd: document ubus methods

2022-05-17 Thread Stijn Tintel
Signed-off-by: Stijn Tintel 
---
An attempt at documenting the ubus methods OpenWrt patches into hostapd.
Adding the people who added those methods in CC, please review all
methods you added and ack or nack with suggested corrections or
improvements.

 package/network/services/hostapd/README.md | 428 +
 1 file changed, 428 insertions(+)
 create mode 100644 package/network/services/hostapd/README.md

diff --git a/package/network/services/hostapd/README.md 
b/package/network/services/hostapd/README.md
new file mode 100644
index 00..440efc539d
--- /dev/null
+++ b/package/network/services/hostapd/README.md
@@ -0,0 +1,428 @@
+# UBUS methods - hostapd
+
+## bss_mgmt_enable
+Enable 802.11k/v features.
+
+### arguments
+| Name | Type | Required | Description |
+|---|---|---|---|
+| neighbor_report | bool | no | enable 802.11k neighbor reports |
+| beacon_report | bool | no | enable 802.11k beacon reports |
+| link_measurements | bool | no | enable 802.11k link measurements |
+| bss_transition | bool | no | enable 802.11v BSS transition support |
+
+### example
+`ubus call hostapd.wl5-fb bss_mgmt_enable '{ "neighbor_report": true, 
"beacon_report": true, "link_measurements": true, "bss_transition": true
+}'`
+
+
+## bss_transition_request
+Initiate an 802.11v transition request.
+
+### arguments
+| Name | Type | Required | Description |
+|---|---|---|---|
+| addr | string | yes | client MAC address |
+| disassociation_imminent | bool | no | set Disassociation Imminent bit |
+| disassociation_timer | int32 | no | disassociate client if it doesn't roam 
after this time |
+| validity_period | int32 | no | validity of the BSS Transition Candiate List |
+| neighbors | array | no | BSS Transition Candidate List |
+| abridged | bool | no | prefer APs in the BSS Transition Candidate List |
+| dialog_token | int32 | no | identifier for the request/report transaction |
+
+### example
+`ubus call hostapd.wl5-fb bss_transition_request '{ "addr": 
"68:2F:67:8B:98:ED", "disassociation_imminent": false, "disassociation_timer": 
0, "validity_period": 30, "neighbors": 
["b6a7b9cbeebabf598064090603026a00"], "abridged": 1 }'`
+
+
+## config_add
+Dynamically load a BSS configuration from a file. This is used by netifd's 
mac80211 support script to configure BSSes on multiple PHYs in a single hostapd 
instance.
+
+### arguments
+| Name | Type | Required | Description |
+|---|---|---|---|
+| iface | string | yes | WiFi interface name |
+| config | string | yes | path to hostapd config file |
+
+
+## config_remove
+Dynamically remove a BSS configuration.
+
+### arguments
+| Name | Type | Required | Description |
+|---|---|---|---|
+| iface | string | yes | WiFi interface name |
+
+
+## del_client
+Kick a client off the network.
+
+### arguments
+| Name | Type | Required | Description |
+|---|---|---|---|
+| addr | string | yes | client MAC address |
+| reason | int32 | no | 802.11 reason code |
+| deauth | bool | no | deauthenticates client instead of disassociating |
+| ban_time | int32 | no | ban client for N milliseconds |
+
+### example
+`ubus call hostapd.wl5-fb del_client '{ "addr": "68:2f:67:8b:98:ed", "reason": 
5, "deauth": true, "ban_time": 1 }'`
+
+
+## get_clients
+Show associated clients.
+
+### example
+`ubus call hostapd.wl5-fb get_clients`
+
+### output
+```json
+{
+"freq": 5260,
+"clients": {
+"68:2f:67:8b:98:ed": {
+"auth": true,
+"assoc": true,
+"authorized": true,
+"preauth": false,
+"wds": false,
+"wmm": true,
+"ht": true,
+"vht": true,
+"he": false,
+"wps": false,
+"mfp": true,
+"rrm": [
+0,
+0,
+0,
+0,
+0
+],
+"extended_capabilities": [
+0,
+0,
+0,
+0,
+0,
+0,
+0,
+64
+],
+"aid": 3,
+"signature": 
"wifi4|probe:0,1,45,127,107,191,221(0017f2,10),221(001018,2),htcap:006f,htagg:1b,htmcs

[PATCH v2 11/11] kernel: add KERNEL_BPF_EVENTS config option

2022-04-03 Thread Stijn Tintel
This is required to use BPF maps of type BPF_MAP_TYPE_PERF_EVENT_ARRAY
for sending data from BPF programs to user-space for post-processing
or logging.

Signed-off-by: Stijn Tintel 
---
 config/Config-kernel.in | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/config/Config-kernel.in b/config/Config-kernel.in
index a5e9ef477b..b77183e8f7 100644
--- a/config/Config-kernel.in
+++ b/config/Config-kernel.in
@@ -450,10 +450,20 @@ config KERNEL_KPROBE_EVENTS
bool
default y if KERNEL_KPROBES
 
+config KERNEL_BPF_EVENTS
+   bool "Compile the kernel with BPF event support"
+   default n
+   select KERNEL_KPROBES
+   help
+ Allows to attach BPF programs to kprobe, uprobe and tracepoint events.
+ This is required to use BPF maps of type BPF_MAP_TYPE_PERF_EVENT_ARRAY
+ for sending data from BPF programs to user-space for post-processing
+ or logging.
+
 config KERNEL_BPF_KPROBE_OVERRIDE
bool
-   depends on KERNEL_KPROBES
default n
+   depends on KERNEL_KPROBES
 
 config KERNEL_AIO
bool "Compile the kernel with asynchronous IO support"
-- 
2.35.1


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


[PATCH v2 07/11] layerscape/armv8_64b: enable DEBUG_INFO_REDUCED

2022-04-03 Thread Stijn Tintel
We currently enable DEBUG_INFO_REDUCED for all targets via the generic
kernel config. There is only one subtarget, layerscape/armv8_64b, that
overrides this setting. As there is no explanation for this in the
commit message that introduced this, and question to its author went
unanswered, let's simply drop this symbol from the subtarget config.
This way, we have consistency across the tree, and we do not have to
introduce a special case when moving this symbol to an OpenWrt kernel
config option.

Signed-off-by: Stijn Tintel 
---
 target/linux/layerscape/armv8_64b/config-5.10 | 1 -
 1 file changed, 1 deletion(-)

diff --git a/target/linux/layerscape/armv8_64b/config-5.10 
b/target/linux/layerscape/armv8_64b/config-5.10
index 03c85a5aef..f16ce7e025 100644
--- a/target/linux/layerscape/armv8_64b/config-5.10
+++ b/target/linux/layerscape/armv8_64b/config-5.10
@@ -196,7 +196,6 @@ CONFIG_CRYPTO_ZSTD=y
 CONFIG_DCACHE_WORD_ACCESS=y
 CONFIG_DEBUG_BUGVERBOSE=y
 CONFIG_DEBUG_INFO=y
-# CONFIG_DEBUG_INFO_REDUCED is not set
 CONFIG_DEBUG_MEMORY_INIT=y
 CONFIG_DECOMPRESS_BZIP2=y
 CONFIG_DECOMPRESS_GZIP=y
-- 
2.35.1


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


[PATCH v2 10/11] config: limit CONFIG_DEBUG_INFO to top-level generic configs

2022-04-03 Thread Stijn Tintel
From: Tony Ambardar 

Remove redundant target-level entries, noting that these settings will be
configured from "Kernel build options" of Kconfig.

Signed-off-by: Tony Ambardar 
Signed-off-by: Felix Fietkau 
[remove from new configs introduced after patch submission]
Signed-off-by: Stijn Tintel 
---
 target/linux/at91/sam9x/config-default| 1 -
 target/linux/at91/sama7/config-default| 1 -
 target/linux/bcm27xx/bcm2708/config-5.10  | 1 -
 target/linux/bcm27xx/bcm2709/config-5.10  | 1 -
 target/linux/bcm27xx/bcm2710/config-5.10  | 1 -
 target/linux/bcm27xx/bcm2711/config-5.10  | 1 -
 target/linux/bcm53xx/config-5.10  | 1 -
 target/linux/bcm53xx/config-5.15  | 1 -
 target/linux/bmips/config-5.10| 1 -
 target/linux/layerscape/armv8_64b/config-5.10 | 1 -
 target/linux/mediatek/mt7623/config-5.10  | 1 -
 target/linux/mediatek/mt7623/config-5.15  | 1 -
 target/linux/mvebu/config-5.10| 1 -
 target/linux/omap/config-5.10 | 1 -
 target/linux/qoriq/config-5.10| 2 --
 target/linux/realtek/rtl838x/config-5.10  | 1 -
 target/linux/realtek/rtl839x/config-5.10  | 1 -
 target/linux/realtek/rtl930x/config-5.10  | 1 -
 target/linux/realtek/rtl931x/config-5.10  | 1 -
 19 files changed, 20 deletions(-)

diff --git a/target/linux/at91/sam9x/config-default 
b/target/linux/at91/sam9x/config-default
index 9f97e7542e..07dfee21b8 100644
--- a/target/linux/at91/sam9x/config-default
+++ b/target/linux/at91/sam9x/config-default
@@ -81,7 +81,6 @@ CONFIG_CRYPTO_HASH_INFO=y
 CONFIG_CRYPTO_LZO=y
 CONFIG_CRYPTO_RNG2=y
 CONFIG_CRYPTO_ZSTD=y
-CONFIG_DEBUG_INFO=y
 CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S"
 CONFIG_DMADEVICES=y
 CONFIG_DMA_ENGINE=y
diff --git a/target/linux/at91/sama7/config-default 
b/target/linux/at91/sama7/config-default
index 8c453659dc..e090b6aa1b 100644
--- a/target/linux/at91/sama7/config-default
+++ b/target/linux/at91/sama7/config-default
@@ -151,7 +151,6 @@ CONFIG_CRYPTO_SHA256=y
 CONFIG_DCACHE_WORD_ACCESS=y
 CONFIG_DEBUG_AT91_SAMA7G5_FLEXCOM3=y
 CONFIG_DEBUG_AT91_UART=y
-CONFIG_DEBUG_INFO=y
 CONFIG_DEBUG_LL=y
 CONFIG_DEBUG_LL_INCLUDE="debug/at91.S"
 CONFIG_DEBUG_UART_PHYS=0xe1824200
diff --git a/target/linux/bcm27xx/bcm2708/config-5.10 
b/target/linux/bcm27xx/bcm2708/config-5.10
index 56e076ba95..f5d9fdd70f 100644
--- a/target/linux/bcm27xx/bcm2708/config-5.10
+++ b/target/linux/bcm27xx/bcm2708/config-5.10
@@ -110,7 +110,6 @@ CONFIG_CRYPTO_CRC32C=y
 CONFIG_CRYPTO_RNG2=y
 CONFIG_DCACHE_WORD_ACCESS=y
 CONFIG_DEBUG_BUGVERBOSE=y
-CONFIG_DEBUG_INFO=y
 CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S"
 CONFIG_DMABUF_HEAPS=y
 CONFIG_DMABUF_HEAPS_CMA=y
diff --git a/target/linux/bcm27xx/bcm2709/config-5.10 
b/target/linux/bcm27xx/bcm2709/config-5.10
index f15f6e3562..0eb4a680bd 100644
--- a/target/linux/bcm27xx/bcm2709/config-5.10
+++ b/target/linux/bcm27xx/bcm2709/config-5.10
@@ -142,7 +142,6 @@ CONFIG_CRYPTO_SHA512=y
 CONFIG_CRYPTO_XTS=y
 CONFIG_DCACHE_WORD_ACCESS=y
 CONFIG_DEBUG_BUGVERBOSE=y
-CONFIG_DEBUG_INFO=y
 CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S"
 CONFIG_DIMLIB=y
 CONFIG_DMABUF_HEAPS=y
diff --git a/target/linux/bcm27xx/bcm2710/config-5.10 
b/target/linux/bcm27xx/bcm2710/config-5.10
index 6e26891070..0b6e42289a 100644
--- a/target/linux/bcm27xx/bcm2710/config-5.10
+++ b/target/linux/bcm27xx/bcm2710/config-5.10
@@ -141,7 +141,6 @@ CONFIG_CRYPTO_SHA512=y
 CONFIG_CRYPTO_XTS=y
 CONFIG_DCACHE_WORD_ACCESS=y
 CONFIG_DEBUG_BUGVERBOSE=y
-CONFIG_DEBUG_INFO=y
 CONFIG_DMABUF_HEAPS=y
 CONFIG_DMABUF_HEAPS_CMA=y
 CONFIG_DMABUF_HEAPS_SYSTEM=y
diff --git a/target/linux/bcm27xx/bcm2711/config-5.10 
b/target/linux/bcm27xx/bcm2711/config-5.10
index 03d84378b3..12dbf5205f 100644
--- a/target/linux/bcm27xx/bcm2711/config-5.10
+++ b/target/linux/bcm27xx/bcm2711/config-5.10
@@ -145,7 +145,6 @@ CONFIG_CRYPTO_SHA512=y
 CONFIG_CRYPTO_XTS=y
 CONFIG_DCACHE_WORD_ACCESS=y
 CONFIG_DEBUG_BUGVERBOSE=y
-CONFIG_DEBUG_INFO=y
 CONFIG_DIMLIB=y
 CONFIG_DMABUF_HEAPS=y
 CONFIG_DMABUF_HEAPS_CMA=y
diff --git a/target/linux/bcm53xx/config-5.10 b/target/linux/bcm53xx/config-5.10
index 6049641898..c522d7c902 100644
--- a/target/linux/bcm53xx/config-5.10
+++ b/target/linux/bcm53xx/config-5.10
@@ -100,7 +100,6 @@ CONFIG_CRYPTO_RNG2=y
 CONFIG_CRYPTO_ZSTD=y
 CONFIG_DCACHE_WORD_ACCESS=y
 CONFIG_DEBUG_BCM_5301X=y
-CONFIG_DEBUG_INFO=y
 CONFIG_DEBUG_LL=y
 CONFIG_DEBUG_LL_INCLUDE="debug/8250.S"
 CONFIG_DEBUG_MISC=y
diff --git a/target/linux/bcm53xx/config-5.15 b/target/linux/bcm53xx/config-5.15
index 6049641898..c522d7c902 100644
--- a/target/linux/bcm53xx/config-5.15
+++ b/target/linux/bcm53xx/config-5.15
@@ -100,7 +100,6 @@ CONFIG_CRYPTO_RNG2=y
 CONFIG_CRYPTO_ZSTD=y
 CONFIG_DCACHE_WORD_ACCESS=y
 CONFIG_DEBUG_BCM_5301X=y
-CONFIG_DEBUG_INFO=y
 CONFIG_DEBUG_LL=y
 CONFIG_DEBUG_LL_INCLUDE="debug/8250.S"
 CONFIG_DEBUG_MISC=y
diff --git a/target/linux/bmips/con

[PATCH v2 06/11] kernel: backport build fix for tools/resolve_btfids

2022-04-03 Thread Stijn Tintel
Building tools/resolve_btfids requires libelf and zlib. Without this
build fix, the kernel build system will not find these dependencies.

Signed-off-by: Stijn Tintel 
---
 ...resolve_btfids-Build-with-host-flags.patch | 54 +++
 ...resolve_btfids-Build-with-host-flags.patch | 54 +++
 2 files changed, 108 insertions(+)
 create mode 100644 
target/linux/generic/backport-5.10/200-v5.18-tools-resolve_btfids-Build-with-host-flags.patch
 create mode 100644 
target/linux/generic/backport-5.15/200-v5.18-tools-resolve_btfids-Build-with-host-flags.patch

diff --git 
a/target/linux/generic/backport-5.10/200-v5.18-tools-resolve_btfids-Build-with-host-flags.patch
 
b/target/linux/generic/backport-5.10/200-v5.18-tools-resolve_btfids-Build-with-host-flags.patch
new file mode 100644
index 00..489575fb35
--- /dev/null
+++ 
b/target/linux/generic/backport-5.10/200-v5.18-tools-resolve_btfids-Build-with-host-flags.patch
@@ -0,0 +1,54 @@
+From cdbc4e3399ed8cdcf234a85f7a2482b622379e82 Mon Sep 17 00:00:00 2001
+From: Connor O'Brien 
+Date: Wed, 12 Jan 2022 00:25:03 +
+Subject: [PATCH] tools/resolve_btfids: Build with host flags
+
+resolve_btfids is built using $(HOSTCC) and $(HOSTLD) but does not
+pick up the corresponding flags. As a result, host-specific settings
+(such as a sysroot specified via HOSTCFLAGS=--sysroot=..., or a linker
+specified via HOSTLDFLAGS=-fuse-ld=...) will not be respected.
+
+Fix this by setting CFLAGS to KBUILD_HOSTCFLAGS and LDFLAGS to
+KBUILD_HOSTLDFLAGS.
+
+Also pass the cflags through to libbpf via EXTRA_CFLAGS to ensure that
+the host libbpf is built with flags consistent with resolve_btfids.
+
+Signed-off-by: Connor O'Brien 
+Signed-off-by: Andrii Nakryiko 
+Acked-by: Song Liu 
+Link: https://lore.kernel.org/bpf/20220112002503.115968-1-conn...@google.com
+(cherry picked from commit 0e3a1c902ffb56e9fe4416f0cd382c97b09ecbf6)
+Signed-off-by: Stijn Tintel 
+---
+ tools/bpf/resolve_btfids/Makefile | 6 --
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/tools/bpf/resolve_btfids/Makefile 
b/tools/bpf/resolve_btfids/Makefile
+index af9f9d3534c9..e727058bfe15 100644
+--- a/tools/bpf/resolve_btfids/Makefile
 b/tools/bpf/resolve_btfids/Makefile
+@@ -23,6 +23,8 @@ CC   = $(HOSTCC)
+ LD   = $(HOSTLD)
+ ARCH = $(HOSTARCH)
+ RM  ?= rm
++CFLAGS  := $(KBUILD_HOSTCFLAGS)
++LDFLAGS := $(KBUILD_HOSTLDFLAGS)
+ 
+ OUTPUT ?= $(srctree)/tools/bpf/resolve_btfids/
+ 
+@@ -45,9 +47,9 @@ $(SUBCMDOBJ): fixdep FORCE | $(OUTPUT)/libsubcmd
+   $(Q)$(MAKE) -C $(SUBCMD_SRC) OUTPUT=$(abspath $(dir $@))/ $(abspath $@)
+ 
+ $(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | 
$(OUTPUT)/libbpf
+-  $(Q)$(MAKE) $(submake_extras) -C $(LIBBPF_SRC)  OUTPUT=$(abspath $(dir 
$@))/ $(abspath $@)
++  $(Q)$(MAKE) $(submake_extras) -C $(LIBBPF_SRC)  OUTPUT=$(abspath $(dir 
$@))/ EXTRA_CFLAGS="$(CFLAGS)" $(abspath $@)
+ 
+-CFLAGS := -g \
++CFLAGS += -g \
+   -I$(srctree)/tools/include \
+   -I$(srctree)/tools/include/uapi \
+   -I$(LIBBPF_SRC) \
+-- 
+2.35.1
+
diff --git 
a/target/linux/generic/backport-5.15/200-v5.18-tools-resolve_btfids-Build-with-host-flags.patch
 
b/target/linux/generic/backport-5.15/200-v5.18-tools-resolve_btfids-Build-with-host-flags.patch
new file mode 100644
index 00..489575fb35
--- /dev/null
+++ 
b/target/linux/generic/backport-5.15/200-v5.18-tools-resolve_btfids-Build-with-host-flags.patch
@@ -0,0 +1,54 @@
+From cdbc4e3399ed8cdcf234a85f7a2482b622379e82 Mon Sep 17 00:00:00 2001
+From: Connor O'Brien 
+Date: Wed, 12 Jan 2022 00:25:03 +
+Subject: [PATCH] tools/resolve_btfids: Build with host flags
+
+resolve_btfids is built using $(HOSTCC) and $(HOSTLD) but does not
+pick up the corresponding flags. As a result, host-specific settings
+(such as a sysroot specified via HOSTCFLAGS=--sysroot=..., or a linker
+specified via HOSTLDFLAGS=-fuse-ld=...) will not be respected.
+
+Fix this by setting CFLAGS to KBUILD_HOSTCFLAGS and LDFLAGS to
+KBUILD_HOSTLDFLAGS.
+
+Also pass the cflags through to libbpf via EXTRA_CFLAGS to ensure that
+the host libbpf is built with flags consistent with resolve_btfids.
+
+Signed-off-by: Connor O'Brien 
+Signed-off-by: Andrii Nakryiko 
+Acked-by: Song Liu 
+Link: https://lore.kernel.org/bpf/20220112002503.115968-1-conn...@google.com
+(cherry picked from commit 0e3a1c902ffb56e9fe4416f0cd382c97b09ecbf6)
+Signed-off-by: Stijn Tintel 
+---
+ tools/bpf/resolve_btfids/Makefile | 6 --
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/tools/bpf/resolve_btfids/Makefile 
b/tools/bpf/resolve_btfids/Makefile
+index af9f9d3534c9..e727058bfe15 100644
+--- a/tools/bpf/resolve_btfids/Makefile
 b/tools/bpf/resolve_btfids/Makefile
+@@ -23,6 +23,8 @@ CC   = $(HOSTCC)
+ LD   = $(HOSTLD)
+ ARCH = $(HOSTARCH)
+ RM  ?= rm
++CFLAGS  := $(KBUILD_HOSTCFLAGS)
++LDFLAGS := $(KBUILD_HOSTLDFLAGS)
+ 
+ OUTPUT ?= $(srctree)

[PATCH v2 09/11] build: add option KERNEL_DEBUG_INFO_BTF

2022-04-03 Thread Stijn Tintel
From: Tony Ambardar 

Generate BTF (BPF Type Format) information from DWARF debug info. This is
embedded in the kernel and exported via sysfs as /sys/kernel/btf/vmlinux.
BTF data enhances kernel portability and introspection for BPF programs.

Selecting this also enables the dwarves host package which provides the
pahole tool used for BTF encoding.

Test using: "bpftool btf dump file /sys/kernel/btf/vmlinux format c"

This needs to depend on KERNEL_DEBUG_INFO_REDUCED not being set,
otherwise we can enable both KERNEL_DEBUG_INFO_BTF and
KERNEL_DEBUG_INFO_REDUCED, which will result in undefined behaviour.

Signed-off-by: Tony Ambardar 
Signed-off-by: Felix Fietkau 
[split DEBUG_INFO_REDUCED into separate commit, add dependency]
Signed-off-by: Stijn Tintel 
---
 config/Config-kernel.in | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/config/Config-kernel.in b/config/Config-kernel.in
index a9f4172d7f..a5e9ef477b 100644
--- a/config/Config-kernel.in
+++ b/config/Config-kernel.in
@@ -368,6 +368,20 @@ config KERNEL_DEBUG_INFO
help
  This will compile your kernel and modules with debug information.
 
+config KERNEL_DEBUG_INFO_BTF
+
+   bool "Enable additional BTF type information"
+   default n
+   depends on !HOST_OS_MACOS
+   depends on KERNEL_DEBUG_INFO && !KERNEL_DEBUG_INFO_REDUCED
+   select DWARVES
+   help
+ Generate BPF Type Format (BTF) information from DWARF debug info.
+ Turning this on expects presence of pahole tool, which will convert
+ DWARF type info into equivalent deduplicated BTF type info.
+
+ Required to run BPF CO-RE applications.
+
 config KERNEL_DEBUG_INFO_REDUCED
bool "Reduce debugging information"
default y
-- 
2.35.1


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


[PATCH v2 05/11] tools/dwarves: add host package

2022-04-03 Thread Stijn Tintel
From: Tony Ambardar 

dwarves is a set of tools that use the debugging information inserted in
ELF binaries by compilers such as GCC. Utilities in the dwarves suite
include pahole, which can be used to find alignment holes in structs and
classes, and also extracts other information such as CPU cacheline
alignment, helping pack those structures to achieve more cache hits.

These tools are also used to encode and read the BTF type information
format used with the bpf syscall, making this a Linux build dependency
when using kernel BTF information.

Signed-off-by: Tony Ambardar 
Signed-off-by: Felix Fietkau 
[bump to 1.23, add elfutils dep, drop host lib usage, drop cmake release
target, use RM macro]
Signed-off-by: Stijn Tintel 
---
 toolchain/Config.in|  8 
 tools/Makefile |  2 ++
 tools/dwarves/Makefile | 35 +++
 3 files changed, 45 insertions(+)
 create mode 100644 tools/dwarves/Makefile

diff --git a/toolchain/Config.in b/toolchain/Config.in
index 366f5c8b48..fb14006055 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -247,6 +247,14 @@ comment "Binary tools"
 
 source "toolchain/binutils/Config.in"
 
+config DWARVES
+   bool
+   prompt "Build pahole" if TOOLCHAINOPTS
+   depends on !HOST_OS_MACOS
+   default n
+   help
+ Enable if you want to build pahole and the dwarves tools.
+
 comment "Compiler"
depends on TOOLCHAINOPTS
 
diff --git a/tools/Makefile b/tools/Makefile
index 416039cf38..507971c6d5 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -84,7 +84,9 @@ endif
 ifeq ($(HOST_OS),Darwin)
   tools-y += bash
 else
+  $(curdir)/dwarves/compile += $(curdir)/elfutils/compile
   $(curdir)/elfutils/compile := $(curdir)/zlib/compile
+  tools-$(CONFIG_DWARVES) += dwarves
   tools-y += elfutils
 endif
 
diff --git a/tools/dwarves/Makefile b/tools/dwarves/Makefile
new file mode 100644
index 00..41f0532701
--- /dev/null
+++ b/tools/dwarves/Makefile
@@ -0,0 +1,35 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=dwarves
+
+PKG_SOURCE_VERSION:=v1.23
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/devel/pahole/pahole.git
+PKG_MIRROR_HASH:=6ab1bb1dbdf6c73ffcf485d909229dc1da1a3d24efd213e92c56489b58d6a4bd
+PKG_LICENSE:=GPL-2.0-only
+PKG_LICENSE_FILES:=COPYING
+
+HOST_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+CMAKE_HOST_OPTIONS += \
+   -D__LIB=lib \
+   -DCMAKE_INSTALL_RPATH="$(STAGING_DIR_HOST)/lib" \
+   -DCMAKE_SKIP_RPATH=FALSE
+
+define Host/Clean
+   $(RM) $(STAGING_DIR_HOST)/bin/{codiff,ctracer,dtagnames,pahole,pdwtags}
+   $(RM) $(STAGING_DIR_HOST)/bin/{pfunct,pglobal,prefcnt,scncopy,syscse}
+   $(RM) $(STAGING_DIR_HOST)/bin/{ostra-cg,btfdiff,fullcircle}
+   $(RM) $(STAGING_DIR_HOST)/lib/libdwarves*.so*
+   $(RM) $(STAGING_DIR_HOST)/share/man/man1/pahole.1
+   rm -rf $(STAGING_DIR_HOST)/include/dwarves
+   rm -rf $(STAGING_DIR_HOST)/share/dwarves
+   $(call Host/Clean/Default)
+endef
+
+$(eval $(call HostBuild))
-- 
2.35.1


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


[PATCH v2 04/11] build: use KBUILD_HOSTLDFLAGS

2022-04-03 Thread Stijn Tintel
According to the GNU make manual, specifying library paths should be
done in LDFLAGS rather than LDLIBS. Replace KBUILD_HOSTLDLIBS with
KBUILD_HOSTLDFLAGS to pass the host lib directory.

Signed-off-by: Stijn Tintel 
---
 include/kernel.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/kernel.mk b/include/kernel.mk
index f27b78bbcc..01b737f132 100644
--- a/include/kernel.mk
+++ b/include/kernel.mk
@@ -110,7 +110,7 @@ KERNEL_MAKE_FLAGS = \
KBUILD_BUILD_HOST="$(call qstrip,$(CONFIG_KERNEL_BUILD_DOMAIN))" \
KBUILD_BUILD_TIMESTAMP="$(KBUILD_BUILD_TIMESTAMP)" \
KBUILD_BUILD_VERSION="0" \
-   KBUILD_HOSTLDLIBS="-L$(STAGING_DIR_HOST)/lib" \
+   KBUILD_HOSTLDFLAGS="-L$(STAGING_DIR_HOST)/lib" \
CONFIG_SHELL="$(BASH)" \
$(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \
$(if $(PKG_BUILD_ID),LDFLAGS_MODULE=--build-id=0x$(PKG_BUILD_ID)) \
-- 
2.35.1


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


[PATCH v2 08/11] kernel: add DEBUG_INFO_REDUCED config option

2022-04-03 Thread Stijn Tintel
Add DEBUG_INFO_REDUCED as a kernel config option and remove it from the
kernel configs. This is in preparation of the upcoming option to enable
BTF typeinfo, which is incompatible with DEBUG_INFO_REDUCED.

Signed-off-by: Stijn Tintel 
---
 config/Config-kernel.in  | 14 ++
 target/linux/generic/config-5.10 |  1 -
 target/linux/generic/config-5.15 |  1 -
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/config/Config-kernel.in b/config/Config-kernel.in
index 5e12ddd78d..a9f4172d7f 100644
--- a/config/Config-kernel.in
+++ b/config/Config-kernel.in
@@ -368,6 +368,20 @@ config KERNEL_DEBUG_INFO
help
  This will compile your kernel and modules with debug information.
 
+config KERNEL_DEBUG_INFO_REDUCED
+   bool "Reduce debugging information"
+   default y
+   depends on KERNEL_DEBUG_INFO
+   help
+ If you say Y here gcc is instructed to generate less debugging
+ information for structure types. This means that tools that
+ need full debugging information (like kgdb or systemtap) won't
+ be happy. But if you merely need debugging information to
+ resolve line numbers there is no loss. Advantage is that
+ build directory object sizes shrink dramatically over a full
+ DEBUG_INFO build and compile times are reduced too.
+ Only works with newer gcc versions.
+
 config KERNEL_DEBUG_LL_UART_NONE
bool
default n
diff --git a/target/linux/generic/config-5.10 b/target/linux/generic/config-5.10
index a46fe13e64..806017e505 100644
--- a/target/linux/generic/config-5.10
+++ b/target/linux/generic/config-5.10
@@ -1276,7 +1276,6 @@ CONFIG_DEBUG_FS_ALLOW_ALL=y
 # CONFIG_DEBUG_INFO_BTF is not set
 # CONFIG_DEBUG_INFO_COMPRESSED is not set
 # CONFIG_DEBUG_INFO_DWARF4 is not set
-CONFIG_DEBUG_INFO_REDUCED=y
 # CONFIG_DEBUG_INFO_SPLIT is not set
 CONFIG_DEBUG_KERNEL=y
 # CONFIG_DEBUG_KMEMLEAK is not set
diff --git a/target/linux/generic/config-5.15 b/target/linux/generic/config-5.15
index 04c5d51409..9f5ca48b07 100644
--- a/target/linux/generic/config-5.15
+++ b/target/linux/generic/config-5.15
@@ -1309,7 +1309,6 @@ CONFIG_DEBUG_FS_ALLOW_ALL=y
 # CONFIG_DEBUG_INFO_DWARF4 is not set
 # CONFIG_DEBUG_INFO_DWARF5 is not set
 CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y
-CONFIG_DEBUG_INFO_REDUCED=y
 # CONFIG_DEBUG_INFO_SPLIT is not set
 # CONFIG_DEBUG_IRQFLAGS is not set
 CONFIG_DEBUG_KERNEL=y
-- 
2.35.1


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


[PATCH v2 01/11] elfutils: move host build to tools

2022-04-03 Thread Stijn Tintel
The upcoming dwarves host package requires elfutils. As dependencies for
tools must exist in tools, we need to move elfutils host build there.

As there is at least one package that depends on this, and there is no
proper way to create such dependency in the build system, build it
unconditionally when not building on macOS.

Signed-off-by: Stijn Tintel 
---
 package/libs/elfutils/Makefile |  4 
 tools/Makefile |  3 +++
 tools/elfutils/Makefile| 32 
 3 files changed, 35 insertions(+), 4 deletions(-)
 create mode 100644 tools/elfutils/Makefile

diff --git a/package/libs/elfutils/Makefile b/package/libs/elfutils/Makefile
index 07b3ea66c6..2a7b5c50e2 100644
--- a/package/libs/elfutils/Makefile
+++ b/package/libs/elfutils/Makefile
@@ -24,11 +24,8 @@ PKG_INSTALL:=1
 PKG_USE_MIPS16:=1
 PKG_BUILD_DEPENDS:=!USE_GLIBC:argp-standalone
 
-HOST_BUILD_DEPENDS:=argp-standalone/host musl-fts/host
-
 include $(INCLUDE_DIR)/package.mk
 include $(INCLUDE_DIR)/nls.mk
-include $(INCLUDE_DIR)/host-build.mk
 
 define Package/elfutils/Default
   SECTION:=libs
@@ -114,7 +111,6 @@ define Package/libelf/install
 endef
 
 # these lines need to be ordered by dependency because of ABI versioning
-$(eval $(call HostBuild))
 $(eval $(call BuildPackage,libelf))
 $(eval $(call BuildPackage,libdw))
 $(eval $(call BuildPackage,libasm))
diff --git a/tools/Makefile b/tools/Makefile
index ec382b4122..416039cf38 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -83,6 +83,9 @@ ifneq ($(HOST_OS),Linux)
 endif
 ifeq ($(HOST_OS),Darwin)
   tools-y += bash
+else
+  $(curdir)/elfutils/compile := $(curdir)/zlib/compile
+  tools-y += elfutils
 endif
 
 ifneq ($(CONFIG_CCACHE)$(CONFIG_SDK),)
diff --git a/tools/elfutils/Makefile b/tools/elfutils/Makefile
new file mode 100644
index 00..98694beb0e
--- /dev/null
+++ b/tools/elfutils/Makefile
@@ -0,0 +1,32 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=elfutils
+PKG_VERSION:=0.186
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=https://sourceware.org/$(PKG_NAME)/ftp/$(PKG_VERSION)
+PKG_HASH:=7f6fb9149b1673d38d9178a0d3e0fb8a1ec4f53a9f4c2ff89469609879641177
+
+PKG_LICENSE:=GPL-3.0-or-later
+PKG_LICENSE_FILES:=COPYING COPYING-GPLV2 COPYING-LGPLV3
+PKG_CPE_ID:=cpe:/a:elfutils_project:elfutils
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+HOST_BUILD_DEPENDS:=argp-standalone/host musl-fts/host
+
+include $(INCLUDE_DIR)/host-build.mk
+
+HOST_CONFIGURE_ARGS += \
+   --disable-debuginfod \
+   --disable-libdebuginfod \
+   --disable-nls \
+   --disable-shared \
+   --without-lzma \
+   --without-zstd
+
+$(eval $(call HostBuild))
-- 
2.35.1


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


[PATCH v2 03/11] build: drop HOST_LOADLIBES

2022-04-03 Thread Stijn Tintel
HOST_LOADLIBES was renamed to KBUILD_HOSTLDLIBS in kernel 4.19. As the
oldest kernel version we support is 5.10, cleanup HOST_LOADLIBES use.

Signed-off-by: Stijn Tintel 
---
 include/kernel-build.mk | 1 -
 include/kernel.mk   | 1 -
 2 files changed, 2 deletions(-)

diff --git a/include/kernel-build.mk b/include/kernel-build.mk
index 80da4455bc..cc651f29b1 100644
--- a/include/kernel-build.mk
+++ b/include/kernel-build.mk
@@ -162,7 +162,6 @@ define BuildKernel
$(LINUX_RECONF_CMD) > $(LINUX_DIR)/.config
$(_SINGLE)$(KERNEL_MAKE) \
$(if $(findstring Darwin,$(HOST_OS)), \
-   HOST_LOADLIBES="-L$(STAGING_DIR_HOST)/lib -lncurses" \
HOSTLDLIBS_mconf="-L$(STAGING_DIR_HOST)/lib -lncurses" \
filechk_conf_cfg="  :" \
) \
diff --git a/include/kernel.mk b/include/kernel.mk
index e4074a48f4..f27b78bbcc 100644
--- a/include/kernel.mk
+++ b/include/kernel.mk
@@ -110,7 +110,6 @@ KERNEL_MAKE_FLAGS = \
KBUILD_BUILD_HOST="$(call qstrip,$(CONFIG_KERNEL_BUILD_DOMAIN))" \
KBUILD_BUILD_TIMESTAMP="$(KBUILD_BUILD_TIMESTAMP)" \
KBUILD_BUILD_VERSION="0" \
-   HOST_LOADLIBES="-L$(STAGING_DIR_HOST)/lib" \
KBUILD_HOSTLDLIBS="-L$(STAGING_DIR_HOST)/lib" \
CONFIG_SHELL="$(BASH)" \
$(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='') \
-- 
2.35.1


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


[PATCH v2 00/11] BPF events and Type Format support

2022-04-03 Thread Stijn Tintel
This series adds support for BPF events, and BPF Type Format [1]. It
supersedes [2].

BPF events can be used to send data to userspace for post-processing or
logging. Building the kernel with BTF support is required to run BPF
CO-RE applications.

Some fixes are required to make this possible, and it will not be
possible to enable BTF when building on macOS, due to incompatibilities.

Also see Github pull requests [3] and [4].

[1] https://www.kernel.org/doc/html/latest/bpf/btf.html
[2] http://lists.openwrt.org/pipermail/openwrt-devel/2022-February/038114.html
[2] https://github.com/openwrt/openwrt/pull/3855
[3] https://github.com/openwrt/openwrt/pull/9362

Stijn Tintel (8):
  elfutils: move host build to tools
  bpf-headers: drop HOST_LOADLIBES
  build: drop HOST_LOADLIBES
  build: use KBUILD_HOSTLDFLAGS
  kernel: backport build fix for tools/resolve_btfids
  layerscape/armv8_64b: enable DEBUG_INFO_REDUCED
  kernel: add DEBUG_INFO_REDUCED config option
  kernel: add KERNEL_BPF_EVENTS config option

Tony Ambardar (3):
  tools/dwarves: add host package
  build: add option KERNEL_DEBUG_INFO_BTF
  config: limit CONFIG_DEBUG_INFO to top-level generic configs

 config/Config-kernel.in   | 40 +-
 include/kernel-build.mk   |  1 -
 include/kernel.mk |  3 +-
 package/kernel/bpf-headers/Makefile   |  1 -
 package/libs/elfutils/Makefile|  4 --
 target/linux/at91/sam9x/config-default|  1 -
 target/linux/at91/sama7/config-default|  1 -
 target/linux/bcm27xx/bcm2708/config-5.10  |  1 -
 target/linux/bcm27xx/bcm2709/config-5.10  |  1 -
 target/linux/bcm27xx/bcm2710/config-5.10  |  1 -
 target/linux/bcm27xx/bcm2711/config-5.10  |  1 -
 target/linux/bcm53xx/config-5.10  |  1 -
 target/linux/bcm53xx/config-5.15  |  1 -
 target/linux/bmips/config-5.10|  1 -
 ...resolve_btfids-Build-with-host-flags.patch | 54 +++
 ...resolve_btfids-Build-with-host-flags.patch | 54 +++
 target/linux/generic/config-5.10  |  1 -
 target/linux/generic/config-5.15  |  1 -
 target/linux/layerscape/armv8_64b/config-5.10 |  2 -
 target/linux/mediatek/mt7623/config-5.10  |  1 -
 target/linux/mediatek/mt7623/config-5.15  |  1 -
 target/linux/mvebu/config-5.10|  1 -
 target/linux/omap/config-5.10 |  1 -
 target/linux/qoriq/config-5.10|  2 -
 target/linux/realtek/rtl838x/config-5.10  |  1 -
 target/linux/realtek/rtl839x/config-5.10  |  1 -
 target/linux/realtek/rtl930x/config-5.10  |  1 -
 target/linux/realtek/rtl931x/config-5.10  |  1 -
 toolchain/Config.in   |  8 +++
 tools/Makefile|  5 ++
 tools/dwarves/Makefile| 35 
 tools/elfutils/Makefile   | 32 +++
 32 files changed, 228 insertions(+), 32 deletions(-)
 create mode 100644 
target/linux/generic/backport-5.10/200-v5.18-tools-resolve_btfids-Build-with-host-flags.patch
 create mode 100644 
target/linux/generic/backport-5.15/200-v5.18-tools-resolve_btfids-Build-with-host-flags.patch
 create mode 100644 tools/dwarves/Makefile
 create mode 100644 tools/elfutils/Makefile

-- 
2.35.1


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


[PATCH v2 02/11] bpf-headers: drop HOST_LOADLIBES

2022-04-03 Thread Stijn Tintel
HOST_LOADLIBES was renamed to KBUILD_HOSTLDLIBS in kernel 4.19. As the
oldest kernel version we support is 5.10, cleanup HOST_LOADLIBES use.

Signed-off-by: Stijn Tintel 
---
 package/kernel/bpf-headers/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/package/kernel/bpf-headers/Makefile 
b/package/kernel/bpf-headers/Makefile
index b5891a9722..4df63a511d 100644
--- a/package/kernel/bpf-headers/Makefile
+++ b/package/kernel/bpf-headers/Makefile
@@ -56,7 +56,6 @@ KERNEL_MAKE := \
LLVM=1 CC="$(CLANG)" LD="$(TARGET_CROSS)ld" \
HOSTCC="$(HOSTCC)" \
HOSTCXX="$(HOSTCXX)" \
-   HOST_LOADLIBES="-L$(STAGING_DIR_HOST)/lib" \
KBUILD_HOSTLDLIBS="-L$(STAGING_DIR_HOST)/lib" \
CONFIG_SHELL="$(BASH)" \
INSTALL_HDR_PATH="$(PKG_BUILD_DIR)/user_headers"
-- 
2.35.1


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


[PATCH] kernel: enable SERIAL_8250_16550A_VARIANTS

2022-03-14 Thread Stijn Tintel
Kernel 5.6 introduced a new config symbol SERIAL_8250_16550A_VARIANTS.
In kernel 5.8, this symbol was changed to default to on on !x86, as some
embedded devices still use 16650A variants. Let's play safe here and
enable this symbol in the generic config, to avoid others from running
into this problem and having to spend several hours trying to bisect
this problem. While we could disable the symbol in the x86 target
configs, a 20ms boot time reduction really isn't worth the time wasted
on bisecting this issue.

Matt discovered this problem while working on adding support for the
WatchGuard Firebox M200 to the qoriq target, where it caused some
characters to be missing on the console output.

Reported-by: Matt Fawcett 
Signed-off-by: Stijn Tintel 
---
 target/linux/generic/config-5.10 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/generic/config-5.10 b/target/linux/generic/config-5.10
index ca93b5f269..5f762529f0 100644
--- a/target/linux/generic/config-5.10
+++ b/target/linux/generic/config-5.10
@@ -5313,7 +5313,7 @@ CONFIG_SELECT_MEMORY_MODEL=y
 # CONFIG_SENSORS_XGENE is not set
 # CONFIG_SENSORS_ZL6100 is not set
 CONFIG_SERIAL_8250=y
-# CONFIG_SERIAL_8250_16550A_VARIANTS is not set
+CONFIG_SERIAL_8250_16550A_VARIANTS=y
 # CONFIG_SERIAL_8250_ACCENT is not set
 # CONFIG_SERIAL_8250_ASPEED_VUART is not set
 # CONFIG_SERIAL_8250_BOCA is not set
-- 
2.34.1


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


Re: Drop CONFIG_IPV6 ?

2022-03-14 Thread Stijn Tintel
On 14/03/2022 01:31, Etienne Champetier wrote:
> Hi All,
>
> We currently have some circular dependencies caused by the usage of
> PROVIDES and @IPV6
> https://github.com/openwrt/openwrt/issues/9407
>
> One radical way to fix, suggested by Jow, is to completely remove
> CONFIG_IPV6 from OpenWrt.
> This would also allow to simplify packaging of some core components.
>
> Is anyone disabling CONFIG_IPV6 ?
Not me
> Do people agree we can drop CONFIG_IPV6 ?
Yes
> Should we do this before we branch 22.x ?

As we're already in a feature freeze, no.

Thanks,
Stijn


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


Re: [PATCH 2/6] tools/dwarves: add host package

2022-02-28 Thread Stijn Tintel
On 28/02/2022 16:16, Ansuel Smith wrote:
>> On 27/02/2022 17:20, Ansuel Smith wrote:
>>>  >
 From: Tony Ambardar 

 dwarves is a set of tools that use the debugging information inserted in
 ELF binaries by compilers such as GCC. Utilities in the dwarves suite
 include pahole, which can be used to find alignment holes in structs and
 classes, and also extracts other information such as CPU cacheline
 alignment, helping pack those structures to achieve more cache hits.

 These tools are also used to encode and read the BTF type information
 format used with the bpf syscall, making this a Linux build dependency
 when using kernel BTF information.
>>> BTW this fails to build if libdw-dev is not installed with
>>>
>>> -- Checking availability of DWARF and ELF development libraries
>>> -- Could NOT find dwarf include dir
>>> -- Could NOT find libdw include dir
>>> -- Could NOT find libdw library
>>> CMake Error at cmake/modules/FindDWARF.cmake:93 (message):
>>>   Could NOT find some ELF and DWARF libraries, please install the missing
>>>   packages
>>> Call Stack (most recent call first):
>>>   CMakeLists.txt:60 (find_package)
>>>
>>> ERROR: tools/dwarves failed to build.
>>>
>>> Should we add it to the build prereq?
>> Please try this instead:
>>
>> diff --git a/tools/dwarves/Makefile b/tools/dwarves/Makefile
>> index b02a2398a1..e5a55706be 100644
>> --- a/tools/dwarves/Makefile
>> +++ b/tools/dwarves/Makefile
>> @@ -12,14 +12,12 @@PKG_LICENSE:=GPL-2.0-only
>> PKG_LICENSE_FILES:=COPYING
>>
>> HOST_BUILD_PARALLEL:=1
>> +PKG_BUILD_DEPENDS:=elfutils/host
>>
>> include $(INCLUDE_DIR)/host-build.mk
>> include $(INCLUDE_DIR)/cmake.mk
>>
>> CMAKE_HOST_OPTIONS += \
>> -   -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH \
>> -   -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH \
>> -   -DCMAKE_BUILD_TYPE=Release \
>>-D__LIB=lib \
>>-DCMAKE_INSTALL_RPATH="$(STAGING_DIR_HOST)/lib" \
>>-DCMAKE_SKIP_RPATH=FALSE
>>
>> Thanks,
>> Stijn
>>
> No luck... still
>
Apparently we cannot use PKG_BUILD_DEPENDS or HOST_BUILD_DEPENDS in
tools/, as this is handled in include/package-dumpinfo.mk, which is
included from include/package.mk, which we don't include in tools/...
Could use some guidance here, as I am not familiar enough with this part
of the code.

Thanks,
Stijn


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


Re: [PATCH] image: let mksquashfs4 use all processors

2022-02-28 Thread Stijn Tintel
On 28/02/2022 13:22, Paul Spooren wrote:
> Hi team,
>
>> On 19. Feb 2022, at 19:21, Phillip Lougher  wrote:
>>
>> On Sat, Feb 19, 2022 at 4:01 PM Felix Fietkau  wrote:
>>> On 19.02.22 16:54, Stijn Tintel wrote:
>>>> Drop the -processors argument from the mksquashfs4 call, so it will use
>>>> all available processors. This dramatically reduces the time to create
>>>> squashfs filesystems.
>>>>
>>>> The times below are observed when building an image for my main router,
>>>> the WatchGuard Firebox M300 (qoriq target):
>>>>
>>>> Before:
>>>> real4m45,973s
>>>>
>>>> After:
>>>> real0m23,497s
>>>>
>>>> Signed-off-by: Stijn Tintel 
>>> We need to verify that this doesn't break reproducible builds...
>>>
>> It won't break reproducible builds.  Since Mksquashfs version 4.4 the
>> ordering is guaranteed to be the same, irrespective of how many
>> threads or processors are used.
> I think OpenWrt uses `squashfskit`[1] which is a fork some squashfs-tools 
> version. I think it happened due to stalled development some years ago. 
> Anyway, if squashfs-tools is actively maintained we should consider moving 
> back to the upstream version.
>
> Some time ago I already wanted to make the move but squashfskit uses some 
> downstream patches which expose more compression options, are those now part 
> of squashfs-tools[2]? If not, do we need those anyway?
Not aware if we do or don't.
>
> Thanks for all further information, I’d be happy to have upstream 
> squashfs-tools with reproducible multithread support within OpenWrt!
>
> Sunshine,
> Paul
>
> [1]: https://github.com/squashfskit/squashfskit
> [2]: 
> https://github.com/squashfskit/squashfskit/commit/5568b6a7d7db01c8f60a502d549a431a2b7219ae

If you decide to switch back to squashfs-tools, and incorporate the
change to let it use all processors, we should probably respect the
number of jobs the user passes to make, and limit mksquashfs to use at
most that number of processors. This was suggested on #openwrt-devel,
after my initial submission. Unfortunately I have not found a way to do
so, as MAKE_JOBSERVER is exported in include/toplevel.mk, which is not
included in include/image.mk, and I am not familiar enough with this
part of the code to understand the impact of adding that include.

Stijn


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


Re: [PATCH 2/6] tools/dwarves: add host package

2022-02-28 Thread Stijn Tintel
On 27/02/2022 17:20, Ansuel Smith wrote:
>  >
>> From: Tony Ambardar 
>>
>> dwarves is a set of tools that use the debugging information inserted in
>> ELF binaries by compilers such as GCC. Utilities in the dwarves suite
>> include pahole, which can be used to find alignment holes in structs and
>> classes, and also extracts other information such as CPU cacheline
>> alignment, helping pack those structures to achieve more cache hits.
>>
>> These tools are also used to encode and read the BTF type information
>> format used with the bpf syscall, making this a Linux build dependency
>> when using kernel BTF information.
> BTW this fails to build if libdw-dev is not installed with
>
> -- Checking availability of DWARF and ELF development libraries
> -- Could NOT find dwarf include dir
> -- Could NOT find libdw include dir
> -- Could NOT find libdw library
> CMake Error at cmake/modules/FindDWARF.cmake:93 (message):
>   Could NOT find some ELF and DWARF libraries, please install the missing
>   packages
> Call Stack (most recent call first):
>   CMakeLists.txt:60 (find_package)
>
> ERROR: tools/dwarves failed to build.
>
> Should we add it to the build prereq?

Please try this instead:

diff --git a/tools/dwarves/Makefile b/tools/dwarves/Makefile
index b02a2398a1..e5a55706be 100644
--- a/tools/dwarves/Makefile
+++ b/tools/dwarves/Makefile
@@ -12,14 +12,12 @@PKG_LICENSE:=GPL-2.0-only
PKG_LICENSE_FILES:=COPYING

HOST_BUILD_PARALLEL:=1
+PKG_BUILD_DEPENDS:=elfutils/host

include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/cmake.mk

CMAKE_HOST_OPTIONS += \
-   -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH \
-   -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH \
-   -DCMAKE_BUILD_TYPE=Release \
   -D__LIB=lib \
   -DCMAKE_INSTALL_RPATH="$(STAGING_DIR_HOST)/lib" \
   -DCMAKE_SKIP_RPATH=FALSE

Thanks,
Stijn


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


[PATCH 2/6] tools/dwarves: add host package

2022-02-27 Thread Stijn Tintel
From: Tony Ambardar 

dwarves is a set of tools that use the debugging information inserted in
ELF binaries by compilers such as GCC. Utilities in the dwarves suite
include pahole, which can be used to find alignment holes in structs and
classes, and also extracts other information such as CPU cacheline
alignment, helping pack those structures to achieve more cache hits.

These tools are also used to encode and read the BTF type information
format used with the bpf syscall, making this a Linux build dependency
when using kernel BTF information.

Signed-off-by: Tony Ambardar 
Signed-off-by: Felix Fietkau 
[bump to 1.23]
Signed-off-by: Stijn Tintel 
---
 toolchain/Config.in|  8 
 tools/Makefile |  1 +
 tools/dwarves/Makefile | 38 ++
 3 files changed, 47 insertions(+)
 create mode 100644 tools/dwarves/Makefile

diff --git a/toolchain/Config.in b/toolchain/Config.in
index 366f5c8b48..fb14006055 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -247,6 +247,14 @@ comment "Binary tools"
 
 source "toolchain/binutils/Config.in"
 
+config DWARVES
+   bool
+   prompt "Build pahole" if TOOLCHAINOPTS
+   depends on !HOST_OS_MACOS
+   default n
+   help
+ Enable if you want to build pahole and the dwarves tools.
+
 comment "Compiler"
depends on TOOLCHAINOPTS
 
diff --git a/tools/Makefile b/tools/Makefile
index 681344a014..9eefcaf393 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -36,6 +36,7 @@ tools-$(CONFIG_TARGET_tegra) += cbootimage cbootimage-configs
 tools-$(CONFIG_USES_MINOR) += kernel2minor
 tools-$(CONFIG_USE_SPARSE) += sparse
 tools-$(CONFIG_USE_LLVM_BUILD) += llvm-bpf
+tools-$(CONFIG_DWARVES) += dwarves
 
 # builddir dependencies
 $(curdir)/autoconf/compile := $(curdir)/m4/compile
diff --git a/tools/dwarves/Makefile b/tools/dwarves/Makefile
new file mode 100644
index 00..b02a2398a1
--- /dev/null
+++ b/tools/dwarves/Makefile
@@ -0,0 +1,38 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=dwarves
+
+PKG_SOURCE_VERSION:=v1.23
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/devel/pahole/pahole.git
+PKG_MIRROR_HASH:=6ab1bb1dbdf6c73ffcf485d909229dc1da1a3d24efd213e92c56489b58d6a4bd
+PKG_LICENSE:=GPL-2.0-only
+PKG_LICENSE_FILES:=COPYING
+
+HOST_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+CMAKE_HOST_OPTIONS += \
+   -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH \
+   -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=BOTH \
+   -DCMAKE_BUILD_TYPE=Release \
+   -D__LIB=lib \
+   -DCMAKE_INSTALL_RPATH="$(STAGING_DIR_HOST)/lib" \
+   -DCMAKE_SKIP_RPATH=FALSE
+
+define Host/Clean
+   rm -f $(STAGING_DIR_HOST)/bin/{codiff,ctracer,dtagnames,pahole,pdwtags}
+   rm -f $(STAGING_DIR_HOST)/bin/{pfunct,pglobal,prefcnt,scncopy,syscse}
+   rm -f $(STAGING_DIR_HOST)/bin/{ostra-cg,btfdiff,fullcircle}
+   rm -f $(STAGING_DIR_HOST)/lib/libdwarves*.so*
+   rm -f $(STAGING_DIR_HOST)/share/man/man1/pahole.1
+   rm -rf $(STAGING_DIR_HOST)/include/dwarves
+   rm -rf $(STAGING_DIR_HOST)/share/dwarves
+   $(call Host/Clean/Default)
+endef
+
+$(eval $(call HostBuild))
-- 
2.34.1


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


[PATCH 1/6] layerscape/armv8_64b: enable DEBUG_INFO_REDUCED

2022-02-27 Thread Stijn Tintel
We currently enable DEBUG_INFO_REDUCED for all targets via the generic
kernel config. There is only one subtarget, layerscape/armv8_64b, that
overrides this setting. As there is no explanation for this in the
commit message that introduced this, and question to its author went
unanswered, let's simply drop this symbol from the subtarget config.
This way, we have consistency across the tree, and we do not have to
introduce a special case when moving this symbol to an OpenWrt kernel
config option.

Signed-off-by: Stijn Tintel 
---
 target/linux/layerscape/armv8_64b/config-5.10 | 1 -
 target/linux/layerscape/armv8_64b/config-5.4  | 1 -
 2 files changed, 2 deletions(-)

diff --git a/target/linux/layerscape/armv8_64b/config-5.10 
b/target/linux/layerscape/armv8_64b/config-5.10
index aa4be18f05..7b91dccfbf 100644
--- a/target/linux/layerscape/armv8_64b/config-5.10
+++ b/target/linux/layerscape/armv8_64b/config-5.10
@@ -196,7 +196,6 @@ CONFIG_CRYPTO_ZSTD=y
 CONFIG_DCACHE_WORD_ACCESS=y
 CONFIG_DEBUG_BUGVERBOSE=y
 CONFIG_DEBUG_INFO=y
-# CONFIG_DEBUG_INFO_REDUCED is not set
 CONFIG_DEBUG_MEMORY_INIT=y
 CONFIG_DECOMPRESS_BZIP2=y
 CONFIG_DECOMPRESS_GZIP=y
diff --git a/target/linux/layerscape/armv8_64b/config-5.4 
b/target/linux/layerscape/armv8_64b/config-5.4
index 2d717434d1..2751b25223 100644
--- a/target/linux/layerscape/armv8_64b/config-5.4
+++ b/target/linux/layerscape/armv8_64b/config-5.4
@@ -173,7 +173,6 @@ CONFIG_CRYPTO_ZSTD=y
 CONFIG_DCACHE_WORD_ACCESS=y
 CONFIG_DEBUG_BUGVERBOSE=y
 CONFIG_DEBUG_INFO=y
-# CONFIG_DEBUG_INFO_REDUCED is not set
 CONFIG_DEBUG_MEMORY_INIT=y
 CONFIG_DECOMPRESS_BZIP2=y
 CONFIG_DECOMPRESS_GZIP=y
-- 
2.34.1


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


[PATCH 4/6] build: add option KERNEL_DEBUG_INFO_BTF

2022-02-27 Thread Stijn Tintel
From: Tony Ambardar 

Generate BTF (BPF Type Format) information from DWARF debug info. This is
embedded in the kernel and exported via sysfs as /sys/kernel/btf/vmlinux.
BTF data enhances kernel portability and introspection for BPF programs.

Selecting this also enables the dwarves host package which provides the
pahole tool used for BTF encoding.

Test using: "bpftool btf dump file /sys/kernel/btf/vmlinux format c"

This needs to depend on KERNEL_DEBUG_INFO_REDUCED not being set,
otherwise we can enable both KERNEL_DEBUG_INFO_BTF and
KERNEL_DEBUG_INFO_REDUCED, which will result in undefined behaviour.

Signed-off-by: Tony Ambardar 
Signed-off-by: Felix Fietkau 
[split DEBUG_INFO_REDUCED into separate commit, add dependency]
Signed-off-by: Stijn Tintel 
---
 config/Config-kernel.in | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/config/Config-kernel.in b/config/Config-kernel.in
index 6ba40e15fd..06619fcbb2 100644
--- a/config/Config-kernel.in
+++ b/config/Config-kernel.in
@@ -368,6 +368,20 @@ config KERNEL_DEBUG_INFO
help
  This will compile your kernel and modules with debug information.
 
+config KERNEL_DEBUG_INFO_BTF
+
+   bool "Enable additional BTF type information"
+   default n
+   depends on !HOST_OS_MACOS
+   depends on KERNEL_DEBUG_INFO && !KERNEL_DEBUG_INFO_REDUCED
+   select DWARVES
+   help
+ Generate BPF Type Format (BTF) information from DWARF debug info.
+ Turning this on expects presence of pahole tool, which will convert
+ DWARF type info into equivalent deduplicated BTF type info.
+
+ Required to run BPF CO-RE applications.
+
 config KERNEL_DEBUG_INFO_REDUCED
bool "Reduce debugging information"
default y
-- 
2.34.1


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


[PATCH 6/6] kernel: add KERNEL_BPF_EVENTS config option

2022-02-27 Thread Stijn Tintel
This is required to use BPF maps of type BPF_MAP_TYPE_PERF_EVENT_ARRAY
for sending data from BPF programs to user-space for post-processing
or logging.

As this symbol exposes KERNEL_BPF_KPROBE_OVERRIDE, also add a config
option for it.

Signed-off-by: Stijn Tintel 
---
 config/Config-kernel.in | 16 
 1 file changed, 16 insertions(+)

diff --git a/config/Config-kernel.in b/config/Config-kernel.in
index 06619fcbb2..3725247046 100644
--- a/config/Config-kernel.in
+++ b/config/Config-kernel.in
@@ -450,6 +450,22 @@ config KERNEL_KPROBE_EVENTS
bool
default y if KERNEL_KPROBES
 
+
+config KERNEL_BPF_EVENTS
+   bool "Compile the kernel with BPF event support"
+   default n
+   select KERNEL_KPROBES
+   help
+ Allows to attach BPF programs to kprobe, uprobe and tracepoint events.
+ This is required to use BPF maps of type BPF_MAP_TYPE_PERF_EVENT_ARRAY
+ for sending data from BPF programs to user-space for post-processing
+ or logging.
+
+config KERNEL_BPF_KPROBE_OVERRIDE
+   bool
+   default n
+   depends on KERNEL_BPF_EVENTS
+
 config KERNEL_AIO
bool "Compile the kernel with asynchronous IO support"
default y if !SMALL_FLASH
-- 
2.34.1


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


[PATCH 5/6] config: limit CONFIG_DEBUG_INFO to top-level generic configs

2022-02-27 Thread Stijn Tintel
From: Tony Ambardar 

Remove redundant target-level entries, noting that these settings will be
configured from "Kernel build options" of Kconfig.

Signed-off-by: Tony Ambardar 
Signed-off-by: Felix Fietkau 
[remove from new configs introduced after patch submission]
Signed-off-by: Stijn Tintel 
---
 target/linux/at91/sam9x/config-default| 1 -
 target/linux/bcm27xx/bcm2708/config-5.10  | 1 -
 target/linux/bcm27xx/bcm2709/config-5.10  | 1 -
 target/linux/bcm27xx/bcm2710/config-5.10  | 1 -
 target/linux/bcm27xx/bcm2711/config-5.10  | 1 -
 target/linux/bcm53xx/config-5.10  | 1 -
 target/linux/bcm53xx/config-5.4   | 1 -
 target/linux/bmips/config-5.10| 1 -
 target/linux/layerscape/armv8_64b/config-5.10 | 1 -
 target/linux/layerscape/armv8_64b/config-5.4  | 1 -
 target/linux/mediatek/mt7623/config-5.10  | 1 -
 target/linux/mvebu/config-5.10| 1 -
 target/linux/omap/config-5.10 | 1 -
 target/linux/omap/config-5.4  | 1 -
 target/linux/qoriq/config-5.10| 2 --
 target/linux/realtek/rtl838x/config-5.10  | 1 -
 target/linux/realtek/rtl839x/config-5.10  | 1 -
 target/linux/realtek/rtl930x/config-5.10  | 1 -
 target/linux/realtek/rtl931x/config-5.10  | 1 -
 19 files changed, 20 deletions(-)

diff --git a/target/linux/at91/sam9x/config-default 
b/target/linux/at91/sam9x/config-default
index 9f97e7542e..07dfee21b8 100644
--- a/target/linux/at91/sam9x/config-default
+++ b/target/linux/at91/sam9x/config-default
@@ -81,7 +81,6 @@ CONFIG_CRYPTO_HASH_INFO=y
 CONFIG_CRYPTO_LZO=y
 CONFIG_CRYPTO_RNG2=y
 CONFIG_CRYPTO_ZSTD=y
-CONFIG_DEBUG_INFO=y
 CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S"
 CONFIG_DMADEVICES=y
 CONFIG_DMA_ENGINE=y
diff --git a/target/linux/bcm27xx/bcm2708/config-5.10 
b/target/linux/bcm27xx/bcm2708/config-5.10
index 56e076ba95..f5d9fdd70f 100644
--- a/target/linux/bcm27xx/bcm2708/config-5.10
+++ b/target/linux/bcm27xx/bcm2708/config-5.10
@@ -110,7 +110,6 @@ CONFIG_CRYPTO_CRC32C=y
 CONFIG_CRYPTO_RNG2=y
 CONFIG_DCACHE_WORD_ACCESS=y
 CONFIG_DEBUG_BUGVERBOSE=y
-CONFIG_DEBUG_INFO=y
 CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S"
 CONFIG_DMABUF_HEAPS=y
 CONFIG_DMABUF_HEAPS_CMA=y
diff --git a/target/linux/bcm27xx/bcm2709/config-5.10 
b/target/linux/bcm27xx/bcm2709/config-5.10
index f15f6e3562..0eb4a680bd 100644
--- a/target/linux/bcm27xx/bcm2709/config-5.10
+++ b/target/linux/bcm27xx/bcm2709/config-5.10
@@ -142,7 +142,6 @@ CONFIG_CRYPTO_SHA512=y
 CONFIG_CRYPTO_XTS=y
 CONFIG_DCACHE_WORD_ACCESS=y
 CONFIG_DEBUG_BUGVERBOSE=y
-CONFIG_DEBUG_INFO=y
 CONFIG_DEBUG_LL_INCLUDE="mach/debug-macro.S"
 CONFIG_DIMLIB=y
 CONFIG_DMABUF_HEAPS=y
diff --git a/target/linux/bcm27xx/bcm2710/config-5.10 
b/target/linux/bcm27xx/bcm2710/config-5.10
index 39c00762ba..e83f700fba 100644
--- a/target/linux/bcm27xx/bcm2710/config-5.10
+++ b/target/linux/bcm27xx/bcm2710/config-5.10
@@ -143,7 +143,6 @@ CONFIG_CRYPTO_SHA512=y
 CONFIG_CRYPTO_XTS=y
 CONFIG_DCACHE_WORD_ACCESS=y
 CONFIG_DEBUG_BUGVERBOSE=y
-CONFIG_DEBUG_INFO=y
 CONFIG_DMABUF_HEAPS=y
 CONFIG_DMABUF_HEAPS_CMA=y
 CONFIG_DMABUF_HEAPS_SYSTEM=y
diff --git a/target/linux/bcm27xx/bcm2711/config-5.10 
b/target/linux/bcm27xx/bcm2711/config-5.10
index ed095231ae..74953d12c9 100644
--- a/target/linux/bcm27xx/bcm2711/config-5.10
+++ b/target/linux/bcm27xx/bcm2711/config-5.10
@@ -147,7 +147,6 @@ CONFIG_CRYPTO_SHA512=y
 CONFIG_CRYPTO_XTS=y
 CONFIG_DCACHE_WORD_ACCESS=y
 CONFIG_DEBUG_BUGVERBOSE=y
-CONFIG_DEBUG_INFO=y
 CONFIG_DIMLIB=y
 CONFIG_DMABUF_HEAPS=y
 CONFIG_DMABUF_HEAPS_CMA=y
diff --git a/target/linux/bcm53xx/config-5.10 b/target/linux/bcm53xx/config-5.10
index 3dd0359113..95fec4c8c9 100644
--- a/target/linux/bcm53xx/config-5.10
+++ b/target/linux/bcm53xx/config-5.10
@@ -100,7 +100,6 @@ CONFIG_CRYPTO_RNG2=y
 CONFIG_CRYPTO_ZSTD=y
 CONFIG_DCACHE_WORD_ACCESS=y
 CONFIG_DEBUG_BCM_5301X=y
-CONFIG_DEBUG_INFO=y
 CONFIG_DEBUG_LL=y
 CONFIG_DEBUG_LL_INCLUDE="debug/8250.S"
 CONFIG_DEBUG_MISC=y
diff --git a/target/linux/bcm53xx/config-5.4 b/target/linux/bcm53xx/config-5.4
index 46f9d36f8f..072bf0f0f3 100644
--- a/target/linux/bcm53xx/config-5.4
+++ b/target/linux/bcm53xx/config-5.4
@@ -127,7 +127,6 @@ CONFIG_CRYPTO_RNG2=y
 CONFIG_CRYPTO_ZSTD=y
 CONFIG_DCACHE_WORD_ACCESS=y
 CONFIG_DEBUG_BCM_5301X=y
-CONFIG_DEBUG_INFO=y
 CONFIG_DEBUG_LL=y
 CONFIG_DEBUG_LL_INCLUDE="debug/8250.S"
 CONFIG_DEBUG_MISC=y
diff --git a/target/linux/bmips/config-5.10 b/target/linux/bmips/config-5.10
index bd54950210..e42d32bdaa 100644
--- a/target/linux/bmips/config-5.10
+++ b/target/linux/bmips/config-5.10
@@ -65,7 +65,6 @@ CONFIG_CRYPTO_LZO=y
 CONFIG_CRYPTO_RNG2=y
 CONFIG_CRYPTO_ZSTD=y
 CONFIG_CSRC_R4K=y
-CONFIG_DEBUG_INFO=y
 CONFIG_DMA_NONCOHERENT=y
 CONFIG_DTC=y
 # CONFIG_DT_BCM93384WVG is not set
diff --git a/target/linux/layerscape/armv8_64b/config-5.10 
b/target/linux/layerscape/armv8_64b/config-5.10
index 7b91dccfbf..ab729ae85

[PATCH 3/6] kernel: add DEBUG_INFO_REDUCED config option

2022-02-27 Thread Stijn Tintel
Add DEBUG_INFO_REDUCED as a kernel config option and remove it from the
kernel configs. This is in preparation of the upcoming option to enable
BTF typeinfo, which is incompatible with DEBUG_INFO_REDUCED.

Signed-off-by: Stijn Tintel 
---
 config/Config-kernel.in  | 14 ++
 target/linux/generic/config-5.10 |  1 -
 target/linux/generic/config-5.4  |  1 -
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/config/Config-kernel.in b/config/Config-kernel.in
index 31d4e276fd..6ba40e15fd 100644
--- a/config/Config-kernel.in
+++ b/config/Config-kernel.in
@@ -368,6 +368,20 @@ config KERNEL_DEBUG_INFO
help
  This will compile your kernel and modules with debug information.
 
+config KERNEL_DEBUG_INFO_REDUCED
+   bool "Reduce debugging information"
+   default y
+   depends on KERNEL_DEBUG_INFO
+   help
+ If you say Y here gcc is instructed to generate less debugging
+ information for structure types. This means that tools that
+ need full debugging information (like kgdb or systemtap) won't
+ be happy. But if you merely need debugging information to
+ resolve line numbers there is no loss. Advantage is that
+ build directory object sizes shrink dramatically over a full
+ DEBUG_INFO build and compile times are reduced too.
+ Only works with newer gcc versions.
+
 config KERNEL_DEBUG_LL_UART_NONE
bool
default n
diff --git a/target/linux/generic/config-5.10 b/target/linux/generic/config-5.10
index c6a34eea13..87c5153b58 100644
--- a/target/linux/generic/config-5.10
+++ b/target/linux/generic/config-5.10
@@ -1274,7 +1274,6 @@ CONFIG_DEBUG_FS_ALLOW_ALL=y
 # CONFIG_DEBUG_INFO_BTF is not set
 # CONFIG_DEBUG_INFO_COMPRESSED is not set
 # CONFIG_DEBUG_INFO_DWARF4 is not set
-CONFIG_DEBUG_INFO_REDUCED=y
 # CONFIG_DEBUG_INFO_SPLIT is not set
 CONFIG_DEBUG_KERNEL=y
 # CONFIG_DEBUG_KMEMLEAK is not set
diff --git a/target/linux/generic/config-5.4 b/target/linux/generic/config-5.4
index 899d04c669..141dbfb233 100644
--- a/target/linux/generic/config-5.4
+++ b/target/linux/generic/config-5.4
@@ -1193,7 +1193,6 @@ CONFIG_DEBUG_FS=y
 # CONFIG_DEBUG_INFO is not set
 # CONFIG_DEBUG_INFO_BTF is not set
 # CONFIG_DEBUG_INFO_DWARF4 is not set
-CONFIG_DEBUG_INFO_REDUCED=y
 # CONFIG_DEBUG_INFO_SPLIT is not set
 CONFIG_DEBUG_KERNEL=y
 # CONFIG_DEBUG_KMEMLEAK is not set
-- 
2.34.1


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


[PATCH v2 2/2] ramips: support TP-Link EAP615-Wall

2022-02-26 Thread Stijn Tintel
Add support for the TP-Link EAP615-Wall, an AX1800 Wall Plate WiFi 6 AP.
The device is very similar to the TP-Link EAP235-Wall.

Hardware:
* SoC: MediaTek MT7621AT
* RAM: 128MiB
* Flash: 16MiB SPI-NOR
* Ethernet: 4x GbE
  * Back: ETH0 (PoE-PD)
  * Bottom: ETH1, ETH2, ETH3 (PoE passthrough)
* WiFi: MT7905DAN/MT7975DN 2.4/5 GHz 2T2R
* LEDS: 1x white
* Buttons: 1x LED, 1x reset

Stock firmware uses a random MAC address for ethernet. OpenWrt uses the
MAC address that is on the device label for ethernet and the wireless
interfaces. MAC address must not be incremented, as this will cause MAC
address conflicts in case you have two devices with consecutive MAC
addresses. Instead, different locally administered addresses will be
generated automatically, based on the MAC on the label.

Installation via stock firmware:
* Enable SSH in the TP-Link web interface
* SSH to the device
* Run `cliclientd stopcs`
* Upload the OpenWrt factory image via the TP-Link web interface

Installation via bootloader:
* Solder TTL header. Pinout: 1: TX, 2: RX, 3: GND, 4: VCC, with pin 1
  closest to ETH1. Baud rate 115200
* Interrupt boot process by holding a key during boot
* Boot the OpenWrt initramfs:
  # tftpboot 0x8400 
openwrt-ramips-mt7621-tplink_eap615-wall-v1-initramfs-kernel.bin
  # bootm
* Copy openwrt-ramips-mt7621-tplink_eap615-wall-v1-squashfs-sysupgrade.bin
  to /tmp and use sysupgrade to install it

Thanks to Sander Vanheule for his work on the EAP235-Wall, which made
adding support for the EAP615-Wall very easy.

Signed-off-by: Stijn Tintel 
---
v2: - PoE-PT -> PoE passthrough
- MT7915E -> MT7905DAN/MT7975DN
- dropped ethernet@1e10, moved reg override to 
- dropped bus-range from 
- dropped port@5 from 
- added dsa-migration
- kept kernel padding as it silences a warning
- firmware-tools change committed to firmware-tools.git 
---
 .../dts/mt7621_tplink_eap615-wall-v1.dts  | 210 ++
 target/linux/ramips/image/mt7621.mk   |  13 ++
 .../mt7621/base-files/etc/board.d/02_network  |   3 +-
 3 files changed, 225 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/ramips/dts/mt7621_tplink_eap615-wall-v1.dts

diff --git a/target/linux/ramips/dts/mt7621_tplink_eap615-wall-v1.dts 
b/target/linux/ramips/dts/mt7621_tplink_eap615-wall-v1.dts
new file mode 100644
index 00..a57fe9cc97
--- /dev/null
+++ b/target/linux/ramips/dts/mt7621_tplink_eap615-wall-v1.dts
@@ -0,0 +1,210 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "mt7621.dtsi"
+
+#include 
+#include 
+#include 
+
+/ {
+   compatible = "tplink,eap615-wall-v1", "mediatek,mt7621-soc";
+   model = "TP-Link EAP615-Wall v1";
+
+   aliases {
+   label-mac-device = 
+   led-boot = _status;
+   led-failsafe = _status;
+   led-running = _status;
+   led-upgrade = _status;
+   };
+
+   chosen {
+   bootargs = "console=ttyS0,115200";
+   };
+
+   leds {
+   compatible = "gpio-leds";
+
+   led_status: status {
+   label = "white:status";
+   color = ;
+   function = LED_FUNCTION_STATUS;
+   gpios = < 12 GPIO_ACTIVE_LOW>;
+   };
+   };
+
+   keys {
+   compatible = "gpio-keys";
+
+   led {
+   label = "led";
+   gpios = < 10 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+
+   reset {
+   label = "reset";
+   gpios = < 8 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+   };
+
+   gpio-export {
+   compatible = "gpio-export";
+
+   poe_passthrough {
+   gpio-export,name = "poe-passthrough";
+   gpio-export,output = <0>;
+   gpios = < 7 GPIO_ACTIVE_HIGH>;
+   };
+   };
+};
+
+ {
+   reg = <0x1e10 0xe000>;
+};
+
+ {
+   status = "okay";
+
+   flash@0 {
+   compatible = "jedec,spi-nor";
+   reg = <0>;
+   spi-max-frequency = <2000>;
+
+   partitions {
+   compatible = "fixed-partitions";
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   partition@0 {
+   label = "u-boot";
+   reg = <0x0 0x8>;
+   read-only;
+   };
+
+   partition@8 {
+   label = "partition-t

[PATCH v2 1/2] firmware-utils: bump to git HEAD

2022-02-26 Thread Stijn Tintel
  57d0e31 tplink-safeloader: TP-Link EAP615-Wall v1 support

Signed-off-by: Stijn Tintel 
---
 tools/firmware-utils/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/firmware-utils/Makefile b/tools/firmware-utils/Makefile
index 60e0c74b45..5a1f4db077 100644
--- a/tools/firmware-utils/Makefile
+++ b/tools/firmware-utils/Makefile
@@ -11,9 +11,9 @@ PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_URL=$(PROJECT_GIT)/project/firmware-utils.git
-PKG_SOURCE_DATE:=2022-01-29
-PKG_SOURCE_VERSION:=872c87c6805bea08677de71b744cce7deb24903e
-PKG_MIRROR_HASH:=e9bb14bca59485345c9f109f6ee2aec709e4d29cd389e3b05447a91c06806cf8
+PKG_SOURCE_DATE:=2022-02-20
+PKG_SOURCE_VERSION:=57d0e315cdaa34c922218e4d6851b52a71346786
+PKG_MIRROR_HASH:=b5b5fc15a5f4dcd8e05585ec54155c20e884368725ed4ded87aeadda267f04b8
 
 include $(INCLUDE_DIR)/host-build.mk
 include $(INCLUDE_DIR)/cmake.mk
-- 
2.34.1


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


layerscape/armv8_64b: CONFIG_DEBUG_INFO_REDUCED

2022-02-21 Thread Stijn Tintel
Hi Yangbo,

In https://git.openwrt.org/8fdda1cc you introduced
CONFIG_DEBUG_INFO_REDUCED as disabled for layerscape/armv8_64b. Do you
remember if this was intentional? The generic kernel configs have this
enabled, and layerscape/armv8_64b is the only subtarget that overrides
it. If this wasn't intentional, I'd like to remove the symbol from the
layerscape/armv8_64b configs so all targets are consistent, before
introducing a new kernel config option for it.

Thanks,
Stijn


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


[PATCH] image: let mksquashfs4 use all processors

2022-02-19 Thread Stijn Tintel
Drop the -processors argument from the mksquashfs4 call, so it will use
all available processors. This dramatically reduces the time to create
squashfs filesystems.

The times below are observed when building an image for my main router,
the WatchGuard Firebox M300 (qoriq target):

Before:
real4m45,973s

After:
real0m23,497s

Signed-off-by: Stijn Tintel 
---
 include/image.mk | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/include/image.mk b/include/image.mk
index 275a0adcac..a7b04bac6b 100644
--- a/include/image.mk
+++ b/include/image.mk
@@ -229,8 +229,7 @@ $(eval $(foreach S,$(NAND_BLOCKSIZE),$(call 
Image/mkfs/jffs2-nand/template,$(S))
 define Image/mkfs/squashfs-common
$(STAGING_DIR_HOST)/bin/mksquashfs4 $(call mkfs_target_dir,$(1)) $@ \
-nopad -noappend -root-owned \
-   -comp $(SQUASHFSCOMP) $(SQUASHFSOPT) \
-   -processors 1
+   -comp $(SQUASHFSCOMP) $(SQUASHFSOPT)
 endef
 
 ifeq ($(CONFIG_TARGET_ROOTFS_SECURITY_LABELS),y)
-- 
2.34.1


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


[PATCH 2/2] cli: improve error logging for call command

2022-02-18 Thread Stijn Tintel
When the ubus "call" command fails, ubus prints "Command failed: ...".
This is fine when the call command is executed interactively by the
user. However, when the call command is executed non-interactively,
these log messages leave the user completely clueless:

  netifd: wan6 (10841): Command failed: Unknown error

  procd: /etc/rc.d/S80umdns: Failed to parse message data

These messages contain absolutely no info that explains where they come
from; it's not even clear they are coming from ubus. This makes tracking
down what's causing them virtually impossible.

Improve this situation by printing the full ubus call to stderr when
stderr is not a TTY.

Example of improved error message:
  netifd: wan (2836): Command failed: ubus call network.interface notify_proto 
{ "action": 0, "link-up": false, "keep": false, "interface": "wan" } 
(Permission denied)

While one might argue not to include the JSON message in the log,
excluding it will still not help to reproduce the failed command.
As we only print the full command when stderr is not a TTY, seeing this
error means we're doing a bad ubus call somewhere, which is a bug and
should be fixed. Printing the full command makes more sense than
printing half the command and still requiring us to figure out the exact
command that failed.

Signed-off-by: Stijn Tintel 
Reviewed-by: Jo-Philipp Wich 
---
 cli.c | 25 +++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/cli.c b/cli.c
index c47ea0c..3aa4a29 100644
--- a/cli.c
+++ b/cli.c
@@ -119,6 +119,23 @@ static void receive_event(struct ubus_context *ctx, struct 
ubus_event_handler *e
print_event(type, msg);
 }
 
+static int ubus_cli_error(char *cmd, int argc, char **argv, int err)
+{
+   int i;
+
+   if (!simple_output && !isatty(fileno(stderr))) {
+  fprintf(stderr, "Command failed: ubus %s ", cmd);
+  for (i = 0; i < argc; i++) {
+  fprintf(stderr, "%s ", argv[i]);
+  }
+  fprintf(stderr, "(%s)\n", ubus_strerror(err));
+
+  return -err;
+   }
+
+   return err;
+}
+
 static int ubus_cli_list(struct ubus_context *ctx, int argc, char **argv)
 {
const char *path = NULL;
@@ -142,14 +159,18 @@ static int ubus_cli_call(struct ubus_context *ctx, int 
argc, char **argv)
 
blob_buf_init(, 0);
if (argc == 3 && !blobmsg_add_json_from_string(, argv[2])) {
-   return UBUS_STATUS_PARSE;
+   return ubus_cli_error("call", argc, argv, UBUS_STATUS_PARSE);
}
 
ret = ubus_lookup_id(ctx, argv[0], );
if (ret)
return ret;
 
-   return ubus_invoke(ctx, id, argv[1], b.head, receive_call_result_data, 
NULL, timeout * 1000);
+   ret = ubus_invoke(ctx, id, argv[1], b.head, receive_call_result_data, 
NULL, timeout * 1000);
+   if (ret)
+   return ubus_cli_error("call", argc, argv, ret);
+
+   return ret;
 }
 
 struct cli_listen_data {
-- 
2.34.1


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


[PATCH 1/2] cli: introduce UBUS_STATUS_PARSE status message

2022-02-18 Thread Stijn Tintel
Introduce a new status message UBUS_STATUS_PARSE.

Signed-off-by: Stijn Tintel 
Reviewed-by: Jo-Philipp Wich 
---
 cli.c | 8 ++--
 libubus.c | 1 +
 ubusmsg.h | 1 +
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/cli.c b/cli.c
index 81591ec..c47ea0c 100644
--- a/cli.c
+++ b/cli.c
@@ -142,9 +142,7 @@ static int ubus_cli_call(struct ubus_context *ctx, int 
argc, char **argv)
 
blob_buf_init(, 0);
if (argc == 3 && !blobmsg_add_json_from_string(, argv[2])) {
-   if (!simple_output)
-   fprintf(stderr, "Failed to parse message data\n");
-   return -1;
+   return UBUS_STATUS_PARSE;
}
 
ret = ubus_lookup_id(ctx, argv[0], );
@@ -268,9 +266,7 @@ static int ubus_cli_send(struct ubus_context *ctx, int 
argc, char **argv)
blob_buf_init(, 0);
 
if (argc == 2 && !blobmsg_add_json_from_string(, argv[1])) {
-   if (!simple_output)
-   fprintf(stderr, "Failed to parse message data\n");
-   return -1;
+   return UBUS_STATUS_PARSE;
}
 
return ubus_send_event(ctx, argv[0], b.head);
diff --git a/libubus.c b/libubus.c
index aee2a3b..3664d8e 100644
--- a/libubus.c
+++ b/libubus.c
@@ -34,6 +34,7 @@ const char *__ubus_strerror[__UBUS_STATUS_LAST] = {
[UBUS_STATUS_NOT_SUPPORTED] = "Operation not supported",
[UBUS_STATUS_UNKNOWN_ERROR] = "Unknown error",
[UBUS_STATUS_CONNECTION_FAILED] = "Connection failed",
+   [UBUS_STATUS_PARSE] = "Parsing message data failed",
 };
 
 struct blob_buf b __hidden = {};
diff --git a/ubusmsg.h b/ubusmsg.h
index 398b126..f506ce1 100644
--- a/ubusmsg.h
+++ b/ubusmsg.h
@@ -127,6 +127,7 @@ enum ubus_msg_status {
UBUS_STATUS_NOT_SUPPORTED,
UBUS_STATUS_UNKNOWN_ERROR,
UBUS_STATUS_CONNECTION_FAILED,
+   UBUS_STATUS_PARSE,
__UBUS_STATUS_LAST
 };
 
-- 
2.34.1


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


Re: [RFC PATCH ubus] cli: improve error logging for call command

2022-02-18 Thread Stijn Tintel
On 18/02/2022 11:31, Stijn Tintel wrote:
> When the ubus "call" command fails, ubus prints "Command failed: ...".
> This is fine when the call command is executed interactively by the
> user. However, when the call command is executed non-interactively,
> these log messages leave the user completely clueless:
>
>   netifd: wan6 (10841): Command failed: Unknown error
>
>   procd: /etc/rc.d/S80umdns: Failed to parse message data
>
> These messages contain absolutely no info that explains where they come
> from; it's not even clear they are coming from ubus. This makes tracking
> down what's causing them virtually impossible.
>
> Improve this situation by printing the full ubus call to stderr when
> stderr is not a TTY.
>
> Example of improved error message:
>   netifd: wan (2836): Command failed: ubus call network.interface 
> notify_proto { "action": 0, "link-up": false, "keep": false, "interface": 
> "wan" } (Permission denied)
>
> While one might argue not to include the JSON message in the log,
> excluding it will still not help to reproduce the failed command.
> As we only print the full command when stderr is not a TTY, seeing this
> error means we're doing a bad ubus call somewhere, which is a bug and
> should be fixed. Printing the full command makes more sense than
> printing half the command and still requiring us to figure out the exact
> command that failed.
>
> Signed-off-by: Stijn Tintel 
> ---
> If anyone wants to argue this isn't useful:
> https://forum.openwrt.org/search?q=%22Command%20failed%22
> ---
>  cli.c | 23 +--
>  1 file changed, 21 insertions(+), 2 deletions(-)
>
> diff --git a/cli.c b/cli.c
> index 81591ec..bc14daf 100644
> --- a/cli.c
> +++ b/cli.c
> @@ -119,6 +119,19 @@ static void receive_event(struct ubus_context *ctx, 
> struct ubus_event_handler *e
>   print_event(type, msg);
>  }
>  
> +static void print_error(char *msg, char *cmd, int argc, char **argv, int err)
> +{
> + int i;
> +
> + fprintf(stderr, "%s failed: ubus %s ", msg, cmd);
> + for (i = 0; i < argc; i++) {
> + fprintf(stderr, "%s ", argv[i]);
> + }
> + if (err)
> + fprintf(stderr, "(%s)", ubus_strerror(err));
> + fprintf(stderr, "\n");
> +}
> +
>  static int ubus_cli_list(struct ubus_context *ctx, int argc, char **argv)
>  {
>   const char *path = NULL;
> @@ -143,7 +156,7 @@ static int ubus_cli_call(struct ubus_context *ctx, int 
> argc, char **argv)
>   blob_buf_init(, 0);
>   if (argc == 3 && !blobmsg_add_json_from_string(, argv[2])) {
>   if (!simple_output)
> - fprintf(stderr, "Failed to parse message data\n");
> + print_error("Parsing message data", "call", argc, argv, 
> ret);
Should have used 0 instead of ret here, but instead I will initialize
ret to 0 at the start of the function.
>   return -1;
>   }
>  
> @@ -151,7 +164,13 @@ static int ubus_cli_call(struct ubus_context *ctx, int 
> argc, char **argv)
>   if (ret)
>   return ret;
>  
> - return ubus_invoke(ctx, id, argv[1], b.head, receive_call_result_data, 
> NULL, timeout * 1000);
> + ret = ubus_invoke(ctx, id, argv[1], b.head, receive_call_result_data, 
> NULL, timeout * 1000);
> + if (ret && !simple_output && !isatty(fileno(stderr) == ENOTTY)) {
> + print_error("Command", "call", argc, argv, ret);
> + return -1;
> + }
> +
> + return ret;
>  }
>  
>  struct cli_listen_data {



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


[RFC PATCH ubus] cli: improve error logging for call command

2022-02-18 Thread Stijn Tintel
When the ubus "call" command fails, ubus prints "Command failed: ...".
This is fine when the call command is executed interactively by the
user. However, when the call command is executed non-interactively,
these log messages leave the user completely clueless:

  netifd: wan6 (10841): Command failed: Unknown error

  procd: /etc/rc.d/S80umdns: Failed to parse message data

These messages contain absolutely no info that explains where they come
from; it's not even clear they are coming from ubus. This makes tracking
down what's causing them virtually impossible.

Improve this situation by printing the full ubus call to stderr when
stderr is not a TTY.

Example of improved error message:
  netifd: wan (2836): Command failed: ubus call network.interface notify_proto 
{ "action": 0, "link-up": false, "keep": false, "interface": "wan" } 
(Permission denied)

While one might argue not to include the JSON message in the log,
excluding it will still not help to reproduce the failed command.
As we only print the full command when stderr is not a TTY, seeing this
error means we're doing a bad ubus call somewhere, which is a bug and
should be fixed. Printing the full command makes more sense than
printing half the command and still requiring us to figure out the exact
command that failed.

Signed-off-by: Stijn Tintel 
---
If anyone wants to argue this isn't useful:
https://forum.openwrt.org/search?q=%22Command%20failed%22
---
 cli.c | 23 +--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/cli.c b/cli.c
index 81591ec..bc14daf 100644
--- a/cli.c
+++ b/cli.c
@@ -119,6 +119,19 @@ static void receive_event(struct ubus_context *ctx, struct 
ubus_event_handler *e
print_event(type, msg);
 }
 
+static void print_error(char *msg, char *cmd, int argc, char **argv, int err)
+{
+   int i;
+
+   fprintf(stderr, "%s failed: ubus %s ", msg, cmd);
+   for (i = 0; i < argc; i++) {
+   fprintf(stderr, "%s ", argv[i]);
+   }
+   if (err)
+   fprintf(stderr, "(%s)", ubus_strerror(err));
+   fprintf(stderr, "\n");
+}
+
 static int ubus_cli_list(struct ubus_context *ctx, int argc, char **argv)
 {
const char *path = NULL;
@@ -143,7 +156,7 @@ static int ubus_cli_call(struct ubus_context *ctx, int 
argc, char **argv)
blob_buf_init(, 0);
if (argc == 3 && !blobmsg_add_json_from_string(, argv[2])) {
if (!simple_output)
-   fprintf(stderr, "Failed to parse message data\n");
+   print_error("Parsing message data", "call", argc, argv, 
ret);
return -1;
}
 
@@ -151,7 +164,13 @@ static int ubus_cli_call(struct ubus_context *ctx, int 
argc, char **argv)
if (ret)
return ret;
 
-   return ubus_invoke(ctx, id, argv[1], b.head, receive_call_result_data, 
NULL, timeout * 1000);
+   ret = ubus_invoke(ctx, id, argv[1], b.head, receive_call_result_data, 
NULL, timeout * 1000);
+   if (ret && !simple_output && !isatty(fileno(stderr) == ENOTTY)) {
+   print_error("Command", "call", argc, argv, ret);
+   return -1;
+   }
+
+   return ret;
 }
 
 struct cli_listen_data {
-- 
2.34.1


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


Re: [PATCH 2/2] hostapd: refresh patches

2022-02-07 Thread Stijn Tintel
On 17/01/2022 21:57, David Bauer wrote:
> Refresh patches after updating to hostapd v2.10.

We usually combine bump and patch refresh in the same commit.

Thanks,
Stijn


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


Re: [PATCH 1/2] hostapd: update to v2.10

2022-02-07 Thread Stijn Tintel
Hi David,

On 17/01/2022 21:57, David Bauer wrote:
> Upstreamed patches:
> 020-mesh-make-forwarding-configurable.patch
> e6db1bc5da3fd7d5f4dba24aa102543b4749912f
> 550-WNM-allow-specifying-dialog-token.patch
> 979f19716539362f8ce60a77bf1b88fdcf5ba8e5
> 720-ACS-fix-channel-100-frequency.patch
> 2341585c349231af00cdef8d51458df01bc6965f
> 741-proxyarp-fix-compilation-with-Hotspot-2.0-disabled.patch
> 08bdf4f90de61a84ed8f4dd918272dd9d36e2e1f
>
> Compile-tested: wpad-wolfssl hostapd-openssl
> Run-tested: ath79-generic
>
> Signed-off-by: David Bauer 
Tested-by: Stijn Tintel 


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


Re: [PATCH] ramips: support TP-Link EAP615-Wall

2022-02-05 Thread Stijn Tintel
On 5/02/2022 14:21, Sander Vanheule wrote:
> On Fri, 2022-02-04 at 20:05 +0200, Stijn Tintel wrote:
>> On 29/01/2022 15:03, Sander Vanheule wrote:
>>> Hi Stijn,
>>>
>>> Thanks for the patch, been looking forward to this!
>>>
>>> On Fri, 2022-01-28 at 00:00 +0200, Stijn Tintel wrote:
>>>> Add support for the TP-Link EAP615-Wall, an AX1800 Wall Plate WiFi 6 AP.
>>>> The device is very similar to the TP-Link EAP235-Wall.
>>>>
>>>> Hardware:
>>>> * SoC: MediaTek MT7621AT
>>>> * RAM: 128MiB
>>>> * Flash: 16MiB SPI-NOR
>>>> * Ethernet: 4x GbE
>>>>   * Back: ETH0 (PoE-PD)
>>>>   * Bottom: ETH1, ETH2, ETH3 (PoE-PT)
>>> PT > passthrough
>> Not sure what else PoE-PT can refer to. I like that it's the same style
>> as PoE-PD.
> AFAICT the PD (powered device) and PSE (power sourcing equipment) names are 
> part of the
> PoE standard, while 'PT' isn't.
Ok.
>
>>>> * WiFi: MT7915E 2.4/5 GHz 2T2R
>>>> * LEDS: 1x white
>>>> * Buttons: 1x LED, 1x reset
>>>>
>>>> Stock firmware uses a random MAC address for ethernet. OpenWrt uses the
>>>> MAC address that is on the device label for ethernet and the wireless
>>>> interfaces. MAC address must not be incremented, as this will cause MAC
>>>> address conflicts in case you have two devices with consecutive MAC
>>>> addresses. Instead, different locally administered addresses will be
>>>> generated automatically, based on the MAC on the label.
>>>>
>>>> Installation via stock firmware:
>>>> * Enable SSH in the TP-Link web interface
>>>> * SSH to the device
>>>> * Run `cliclientd stopcs`
>>>> * Upload the OpenWrt factory image via the TP-Link webinterface
>>>>
>>>> Installation via bootloader:
>>>> * Solder TTL header. Pinout: 1: TX, 2: RX, 3: GND, 4: VCC, with pin 1
>>>>   closest to ETH1. Baud rate 115200
>>>> * Interrupt boot process by holding a key during boot
>>>> * Boot the OpenWrt initramfs:
>>>>   # tftpboot 0x8400 
>>>> openwrt-ramips-mt7621-tplink_eap615-wall-v1-initramfs-
>>>> kernel.bin
>>>>   # bootm
>>>> * Copy openwrt-ramips-mt7621-tplink_eap615-wall-v1-squashfs-sysupgrade.bin
>>>>   to /tmp and use sysupgrade to install it
>>>>
>>>> Thanks to Sander Vanheule for his work on the EAP235-Wall, which made
>>>> adding support for the EAP615-Wall very easy.
>>>>
>>>> Signed-off-by: Stijn Tintel 
>>>> ---
>>>>  .../dts/mt7621_tplink_eap615-wall-v1.dts  | 250 ++
>>>>  target/linux/ramips/image/mt7621.mk   |  12 +
>>>>  .../mt7621/base-files/etc/board.d/02_network  |   3 +-
>>>>  tools/firmware-utils/patches/999-eap615.patch |  55 
>>>>  4 files changed, 319 insertions(+), 1 deletion(-)
>>>>  create mode 100644 
>>>> target/linux/ramips/dts/mt7621_tplink_eap615-wall-v1.dts
>>>>  create mode 100644 tools/firmware-utils/patches/999-eap615.patch
>>>>
>>>> diff --git a/target/linux/ramips/dts/mt7621_tplink_eap615-wall-v1.dts
>>>> b/target/linux/ramips/dts/mt7621_tplink_eap615-wall-v1.dts
>>>> new file mode 100644
>>>> index 00..fd5a68973b
>>>> --- /dev/null
>>>> +++ b/target/linux/ramips/dts/mt7621_tplink_eap615-wall-v1.dts
>>>> @@ -0,0 +1,250 @@
>>>> +// SPDX-License-Identifier: GPL-2.0-or-later
>>>> +
>>>> +#include "mt7621.dtsi"
>>>> +
>>>> +#include 
>>>> +#include 
>>>> +#include 
>>>> +
>>>> +/ {
>>>> +   compatible = "tplink,eap615-wall-v1", "mediatek,mt7621-soc";
>>>> +   model = "TP-Link EAP615-Wall v1";
>>>> +
>>>> +   aliases {
>>>> +   label-mac-device = 
>>>> +   led-boot = _status;
>>>> +   led-failsafe = _status;
>>>> +   led-running = _status;
>>>> +   led-upgrade = _status;
>>>> +   };
>>>> +
>>>> +   chosen {
>>>> +   bootargs = "console=ttyS0,115200";
>>>> +   };
>>>> +
>>>> +   leds {
>>>> +   compatible = "gpio-leds";
>>>&

Re: [PATCH] ramips: support TP-Link EAP615-Wall

2022-02-05 Thread Stijn Tintel
On 4/02/2022 20:05, Stijn Tintel wrote:
>>> +  DEVICE_MODEL := EAP615-Wall
>>> +  DEVICE_VARIANT := v1
>>> +  DEVICE_PACKAGES := kmod-mt7915e
>>> +  TPLINK_BOARD_ID := EAP615-WALL-V1
>>> +  KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword
>>> $$(DEVICE_DTS)).dtb | pad-to 64k
>>> +  KERNEL_INITRAMFS := kernel-bin | lzma | fit lzma 
>>> $$(KDIR)/image-$$(firstword
>>> $$(DEVICE_DTS)).dtb with-initrd | pad-to 64k
>> Is the 'pad-to 64k' required? mtdsplit can split at arbitrary boundaries, so 
>> I think the
>> padding here isn't very useful. The other device with FIT images on mt7621 
>> also don't add
>> padding to the kernel.
> Removed.

Removing the padding causes this logging line during boot:

[    0.712046] mtd: partition "rootfs" doesn't start on an erase/write
block boundary -- force read-only

While it doesn't cause any real issues, I prefer to not have this
message. The datasheet leaves me clueless about the erase block size,
but in sysfs I can find 64k, so I'm going to add back pad-to 64k to KERNEL.

Stijn


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


Re: [PATCH] ramips: support TP-Link EAP615-Wall

2022-02-04 Thread Stijn Tintel
On 29/01/2022 15:03, Sander Vanheule wrote:
> Hi Stijn,
>
> Thanks for the patch, been looking forward to this!
>
> On Fri, 2022-01-28 at 00:00 +0200, Stijn Tintel wrote:
>> Add support for the TP-Link EAP615-Wall, an AX1800 Wall Plate WiFi 6 AP.
>> The device is very similar to the TP-Link EAP235-Wall.
>>
>> Hardware:
>> * SoC: MediaTek MT7621AT
>> * RAM: 128MiB
>> * Flash: 16MiB SPI-NOR
>> * Ethernet: 4x GbE
>>   * Back: ETH0 (PoE-PD)
>>   * Bottom: ETH1, ETH2, ETH3 (PoE-PT)
> PT > passthrough
Not sure what else PoE-PT can refer to. I like that it's the same style
as PoE-PD.
>
>> * WiFi: MT7915E 2.4/5 GHz 2T2R
>> * LEDS: 1x white
>> * Buttons: 1x LED, 1x reset
>>
>> Stock firmware uses a random MAC address for ethernet. OpenWrt uses the
>> MAC address that is on the device label for ethernet and the wireless
>> interfaces. MAC address must not be incremented, as this will cause MAC
>> address conflicts in case you have two devices with consecutive MAC
>> addresses. Instead, different locally administered addresses will be
>> generated automatically, based on the MAC on the label.
>>
>> Installation via stock firmware:
>> * Enable SSH in the TP-Link web interface
>> * SSH to the device
>> * Run `cliclientd stopcs`
>> * Upload the OpenWrt factory image via the TP-Link webinterface
>>
>> Installation via bootloader:
>> * Solder TTL header. Pinout: 1: TX, 2: RX, 3: GND, 4: VCC, with pin 1
>>   closest to ETH1. Baud rate 115200
>> * Interrupt boot process by holding a key during boot
>> * Boot the OpenWrt initramfs:
>>   # tftpboot 0x8400 
>> openwrt-ramips-mt7621-tplink_eap615-wall-v1-initramfs-kernel.bin
>>   # bootm
>> * Copy openwrt-ramips-mt7621-tplink_eap615-wall-v1-squashfs-sysupgrade.bin
>>   to /tmp and use sysupgrade to install it
>>
>> Thanks to Sander Vanheule for his work on the EAP235-Wall, which made
>> adding support for the EAP615-Wall very easy.
>>
>> Signed-off-by: Stijn Tintel 
>> ---
>>  .../dts/mt7621_tplink_eap615-wall-v1.dts  | 250 ++
>>  target/linux/ramips/image/mt7621.mk   |  12 +
>>  .../mt7621/base-files/etc/board.d/02_network  |   3 +-
>>  tools/firmware-utils/patches/999-eap615.patch |  55 
>>  4 files changed, 319 insertions(+), 1 deletion(-)
>>  create mode 100644 target/linux/ramips/dts/mt7621_tplink_eap615-wall-v1.dts
>>  create mode 100644 tools/firmware-utils/patches/999-eap615.patch
>>
>> diff --git a/target/linux/ramips/dts/mt7621_tplink_eap615-wall-v1.dts
>> b/target/linux/ramips/dts/mt7621_tplink_eap615-wall-v1.dts
>> new file mode 100644
>> index 00..fd5a68973b
>> --- /dev/null
>> +++ b/target/linux/ramips/dts/mt7621_tplink_eap615-wall-v1.dts
>> @@ -0,0 +1,250 @@
>> +// SPDX-License-Identifier: GPL-2.0-or-later
>> +
>> +#include "mt7621.dtsi"
>> +
>> +#include 
>> +#include 
>> +#include 
>> +
>> +/ {
>> +   compatible = "tplink,eap615-wall-v1", "mediatek,mt7621-soc";
>> +   model = "TP-Link EAP615-Wall v1";
>> +
>> +   aliases {
>> +   label-mac-device = 
>> +   led-boot = _status;
>> +   led-failsafe = _status;
>> +   led-running = _status;
>> +   led-upgrade = _status;
>> +   };
>> +
>> +   chosen {
>> +   bootargs = "console=ttyS0,115200";
>> +   };
>> +
>> +   leds {
>> +   compatible = "gpio-leds";
>> +
>> +   led_status: status {
>> +   label = "white:status";
>> +   color = ;
>> +   function = LED_FUNCTION_STATUS;
>> +   gpios = < 12 GPIO_ACTIVE_LOW>;
>> +   };
>> +   };
>> +
>> +   keys {
>> +   compatible = "gpio-keys";
>> +
>> +   led {
>> +   label = "led";
>> +   gpios = < 10 GPIO_ACTIVE_LOW>;
>> +   linux,code = ;
>> +   };
>> +
>> +   reset {
>> +   label = "reset";
>> +   gpios = < 8 GPIO_ACTIVE_LOW>;
>> +   linux,code = ;
>> +   };
>> +   };
>> +
>> +   gpio-export {
>> +  

Re: [PATCH 08/11] util-linux: Do not build raw any more.

2022-01-31 Thread Stijn Tintel
On 30/01/2022 18:25, Hauke Mehrtens wrote:
> The man page of the raw tool does not build because the disk-utils/raw.8
> file is missing. It looks like it should be in the tar.xz file we
> download, but it is missing.
>
> We do not package the raw tool, so this is not a problem.
>
> This fixes the following build error:
> No rule to make target 'disk-utils/raw.8', needed by 'all-am'.  Stop.
If this error is introduced by the version bump, please disable raw
before doing the bump, otherwise we potentially break bisecting.

Thanks,
Stijn


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


Re: Pre-install MiniUPnPd on OpenWrt by default

2022-01-30 Thread Stijn Tintel
On 29/01/2022 12:53, Sergey Ponomarev wrote:
> As a follow up I asked in a dev chat:
>
>  Hi, Is there any process of deciding what to include into
> OpenWrt builds by default? I sent a letter to devlist "Pre-install
> MiniUPnPd on OpenWrt by default" but it seems not interesting in the
> context of devlist which is used mostly for patches.
>  stokito: UPNP of any kind as default is a huge security
> attack surface
>  stokito: miniupnpd is in the packages feed, and afaik we do
> not install things from the package feed by default
>  stokito: even OEM's have learned to turn it off or not include it
>  it is also unmaintained,
>  yes but still miniupnpd is supported and all security issues
> was resolved years ago
>  stokito: UPnP, in and of itself, is a *massive* security issue
>  stokito: there is no such thing as "all security issues
> resolved years ago"
>  UPNP itself *is* the security issue. The ability for any
> Application to open a port to the outside is ludicris
>  ok, what about having just a NAT-PMP server which is much
> simpler and easier to audit?
>  stokito: Any system which allows a device to request an
> external:internal port mapping without any end-user input is a
> HORRIBLE IDEA.
>  If you understand enough about networking etc. to use UPnP
> and/or NAT-PMP "safely" (insofar as that's possible), then you are
> also capable of building a custom image, or just installing it
> yourself.
>  it does not need to be, should not need to be, and probably
> will never be built in by default.
>  stokito: But... You can use Imagebuilder if you don't want
> to build from source and include miniupnp in your builds
>  stokito: You'll better understand what issues your network
> might face and can decide for yourself
>  stokito: it's unlikely to happen, due to miniupnpd being in
> the packages feed, unmaintained, considered a major security risk, we
> prefer security over convenience, etc
>  stokito: your best bet is to build a custom image with
> https://sysupgrade.openwrt.org/
>  I need it from a client point of view i.e. for my
> application that needs to open a port. The concerns about UPnP safety
> is a first thing that everybody have and I tried to answer on it here
> http://lists.openwrt.org/pipermail/openwrt-devel/2022-January/037721.html
>  neggles: can it still do that with iptables/nftables rules ?
>  stokito: like I said, it's unlikely to happen, build a
> custom image with https://sysupgrade.openwrt.org/
>  stokito: Why not just Port forward then
>  or just install it yourself?
>  Which is what UPnP does.
>  if you want UPnP, just... install miniupnpd? if you really
> badly need it baked into the image, as stintel and myself and at least
> one other have already said in here, use sysupgrade.openwrt.org or the
> image builder to make a custom image
>  if you are capable of installing and configuring OpenWrt,
> you are capable of installing and configuring a UPnP daemon
>  Wait... What kind of Application are you making that you
> want to make UPnP a default in OpenWrt?
>  Malware? Wormable Hello World? I mean... What?
>  Gromish: I am building a p2p program with VoIP capabilities
> intended for not so experienced users. And I would like it to make it
> simple to use. That's why I'm interested in having a wider support of
> NAT-PMP. I wondered that OpenWrt doesn't have it out of the box and in
> fact this makes my current VoIP programs work slower.
>  stokito: yeah, no, there's a reason why there are no p2p
> voip applications that anyone actually uses
>  UPnP will not solve your problem
>  you have forgotten about CG-NAT, for one
>  Ok, thank you for your answers. You refined more to me
>  stokito: VoIP is an absolute nightmare at the best of times;
> just having UPnP present on OpenWrt by default would not make a
> significant difference to this.
>  even if it was preinstalled, it would *never* be enabled out
> of the box
>  the other problem with have upnp by default is that at some
> point someone is going to hold us responsible for their network being
> hacked
>  and while the licence says "no warranty" ... having to deal
> with such people is very very very demotivating
>  so no, you're probably not going to convince many of us that
> including that by default is a good idea
>
> So even given that NAT-PMP would be safer than manual port forwarding
> and allows the use of safer and more reliable programs the OpenWrt is
> intended only for advanced users that at the same time don't want to
> use the Internet.

Strange conclusion you're drawing here.

The fact that you forgot to disable a static port forwarding is an error
on your end. Arguing that NAT-PMP is safer because of that, is a bit of
a stretch. You should have removed the port forwarding. Or you can rely
on NAT-PMP to do that by installing and enabling it yourself. The
advanced user you are talking about here, can make an educated decision
about doing so. Average Joe not so much, and it's exactly this group
that should *not* 

[PATCH] util-linux: package ipcs command

2022-01-29 Thread Stijn Tintel
Add a package for util-linux' ipcs command, to show information about
System V inter-process communication facilities.

Signed-off-by: Stijn Tintel 
---
 package/utils/util-linux/Makefile | 18 ++
 1 file changed, 18 insertions(+)

diff --git a/package/utils/util-linux/Makefile 
b/package/utils/util-linux/Makefile
index bf8a67f074..a093cca4ae 100644
--- a/package/utils/util-linux/Makefile
+++ b/package/utils/util-linux/Makefile
@@ -265,6 +265,18 @@ define Package/hwclock/description
  hwclock is a tool for accessing the Hardware Clock
 endef
 
+define Package/ipcs
+$(call Package/util-linux/Default)
+  TITLE:=show information on IPC facilities
+endef
+
+define Package/ipcs/description
+  ipcs shows information on the inter-process communication facilities for
+  which the calling process has read access. By default it shows information
+  about all three resources: shared memory segments, message queues, and
+  semaphore arrays.
+endef
+
 define Package/logger
 $(call Package/util-linux/Default)
   TITLE:=a shell command interface to the syslog system log module
@@ -689,6 +701,11 @@ define Package/hwclock/install
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/hwclock $(1)/usr/sbin/
 endef
 
+define Package/ipcs/install
+   $(INSTALL_DIR) $(1)/usr/bin
+   $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ipcs $(1)/usr/bin/
+endef
+
 define Package/logger/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/logger 
$(1)/usr/bin/util-linux-logger
@@ -841,6 +858,7 @@ $(eval $(call BuildPackage,flock))
 $(eval $(call BuildPackage,fstrim))
 $(eval $(call BuildPackage,getopt))
 $(eval $(call BuildPackage,hwclock))
+$(eval $(call BuildPackage,ipcs))
 $(eval $(call BuildPackage,logger))
 $(eval $(call BuildPackage,look))
 $(eval $(call BuildPackage,losetup))
-- 
2.34.1


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


[PATCH 1/2] ramips: move mt7621_nand driver to files

2022-01-27 Thread Stijn Tintel
The patch was rejected by upstream. The mtk_nand driver should be
modified to support the mt7621 flash controller instead. As there is no
newer version to backport, or no upstream version to fix bugs, let's
move the driver to the files dir under the ramips target. This makes it
easier to make changes to the driver while waiting for mt7621 support to
land in mtk_nand.

Signed-off-by: Stijn Tintel 
---
 .../files/drivers/mtd/nand/raw/mt7621_nand.c  | 1353 
 ...driver-support-for-MT7621-nand-flash.patch | 1356 -
 2 files changed, 1353 insertions(+), 1356 deletions(-)
 create mode 100644 target/linux/ramips/files/drivers/mtd/nand/raw/mt7621_nand.c

diff --git a/target/linux/ramips/files/drivers/mtd/nand/raw/mt7621_nand.c 
b/target/linux/ramips/files/drivers/mtd/nand/raw/mt7621_nand.c
new file mode 100644
index 00..825142e951
--- /dev/null
+++ b/target/linux/ramips/files/drivers/mtd/nand/raw/mt7621_nand.c
@@ -0,0 +1,1353 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * MediaTek MT7621 NAND Flash Controller driver
+ *
+ * Copyright (C) 2020 MediaTek Inc. All Rights Reserved.
+ *
+ * Author: Weijie Gao 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* NFI core registers */
+#define NFI_CNFG   0x000
+#define   CNFG_OP_MODE_S   12
+#define   CNFG_OP_MODE_M   GENMASK(14, 12)
+#define CNFG_OP_CUSTOM 6
+#define   CNFG_AUTO_FMT_EN BIT(9)
+#define   CNFG_HW_ECC_EN   BIT(8)
+#define   CNFG_BYTE_RW BIT(6)
+#define   CNFG_READ_MODE   BIT(1)
+
+#define NFI_PAGEFMT0x004
+#define   PAGEFMT_FDM_ECC_S12
+#define   PAGEFMT_FDM_ECC_MGENMASK(15, 12)
+#define   PAGEFMT_FDM_S8
+#define   PAGEFMT_FDM_MGENMASK(11, 8)
+#define   PAGEFMT_SPARE_S  4
+#define   PAGEFMT_SPARE_M  GENMASK(5, 4)
+#define   PAGEFMT_PAGE_S   0
+#define   PAGEFMT_PAGE_M   GENMASK(1, 0)
+
+#define NFI_CON0x008
+#define   CON_NFI_SEC_S12
+#define   CON_NFI_SEC_MGENMASK(15, 12)
+#define   CON_NFI_BWR  BIT(9)
+#define   CON_NFI_BRD  BIT(8)
+#define   CON_NFI_RST  BIT(1)
+#define   CON_FIFO_FLUSH   BIT(0)
+
+#define NFI_ACCCON 0x00c
+#define   ACCCON_POECS_S   28
+#define   ACCCON_POECS_MAX 0x0f
+#define   ACCCON_POECS_DEF 3
+#define   ACCCON_PRECS_S   22
+#define   ACCCON_PRECS_MAX 0x3f
+#define   ACCCON_PRECS_DEF 3
+#define   ACCCON_C2R_S 16
+#define   ACCCON_C2R_MAX   0x3f
+#define   ACCCON_C2R_DEF   7
+#define   ACCCON_W2R_S 12
+#define   ACCCON_W2R_MAX   0x0f
+#define   ACCCON_W2R_DEF   7
+#define   ACCCON_WH_S  8
+#define   ACCCON_WH_MAX0x0f
+#define   ACCCON_WH_DEF15
+#define   ACCCON_WST_S 4
+#define   ACCCON_WST_MAX   0x0f
+#define   ACCCON_WST_DEF   15
+#define   ACCCON_WST_MIN   3
+#define   ACCCON_RLT_S 0
+#define   ACCCON_RLT_MAX   0x0f
+#define   ACCCON_RLT_DEF   15
+#define   ACCCON_RLT_MIN   3
+
+#define NFI_CMD0x020
+
+#define NFI_ADDRNOB0x030
+#define   ADDR_ROW_NOB_S   4
+#define   ADDR_ROW_NOB_M   GENMASK(6, 4)
+#define   ADDR_COL_NOB_S   0
+#define   ADDR_COL_NOB_M   GENMASK(2, 0)
+
+#define NFI_COLADDR0x034
+#define NFI_ROWADDR0x038
+
+#define NFI_STRDATA0x040
+#define   STR_DATA BIT(0)
+
+#define NFI_CNRNB  0x044
+#define   CB2R_TIME_S  4
+#define   CB2R_TIME_M  GENMASK(7, 4)
+#define   STR_CNRNBBIT(0)
+
+#define NFI_DATAW  0x050
+#define NFI_DATAR  0x054
+
+#define NFI_PIO_DIRDY  0x058
+#define   PIO_DIRDYBIT(0)
+
+#define NFI_STA0x060
+#define   STA_NFI_FSM_S16
+#define   STA_NFI_FSM_MGENMASK(19, 16)
+#define STA_FSM_CUSTOM_DATA14
+#define   STA_BUSY BIT(8)
+#define   STA_ADDR BIT(1)
+#define   STA_CMD  BIT(0)
+
+#define NFI_ADDRCNTR   0x070
+#define   SEC_CNTR_S   12
+#define   SEC_CNTR_M   GENMASK(15, 12)
+#define   SEC_ADDR_S   0

[PATCH 2/2] ramips: mt7621_nand: reduce log verbosity

2022-01-27 Thread Stijn Tintel
Avoid flooding the log with the message below by increasing the log
level to debug:

  mt7621-nand 1e003000.nand: Using programmed access timing: 31c07388

Signed-off-by: Stijn Tintel 
---
 target/linux/ramips/files/drivers/mtd/nand/raw/mt7621_nand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/ramips/files/drivers/mtd/nand/raw/mt7621_nand.c 
b/target/linux/ramips/files/drivers/mtd/nand/raw/mt7621_nand.c
index 825142e951..c829fc7170 100644
--- a/target/linux/ramips/files/drivers/mtd/nand/raw/mt7621_nand.c
+++ b/target/linux/ramips/files/drivers/mtd/nand/raw/mt7621_nand.c
@@ -759,7 +759,7 @@ static int mt7621_nfc_setup_interface(struct nand_chip 
*nand, int csline,
 
acccon = ACCTIMING(tpoecs, tprecs, tc2r, tw2r, twh, twst, trlt);
 
-   dev_info(nfc->dev, "Using programmed access timing: %08x\n", acccon);
+   dev_dbg(nfc->dev, "Using programmed access timing: %08x\n", acccon);
 
nfi_write32(nfc, NFI_ACCCON, acccon);
 
-- 
2.34.1


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


Re: [PATCH] toolchain/gcc: set dialects for each version

2022-01-27 Thread Stijn Tintel
On 27/01/2022 20:10, Bas Mevissen via openwrt-devel wrote:
>
> On 1/25/22 18:02, Stijn Tintel wrote:
>> GCC has an option "-std=" to set the language standard for C and C++.
>> Newer GCC versions sometimes switch to newer standards by default. This
>> has the potential to break the OpenWrt toolchain build whenever a distro
>> introduces a new GCC version that uses a newer dialect by default.
>>
>> Let's set the default dialects used for each of the GCC versions we
>> support, to avoid these toolchain build failures in the future.
>>
>
> Shouldn't the logic be different? It is the software that is to be
> compiled that is written in a certain version or versions of C or C++
> language.

In OpenWiFi we unfortunately use QSDK for the ipq6xxx/ipq8xxx platforms.
This comes with ancient GCC 5, which doesn't build on GCC 11, because
GCC 11 uses -std=gnu++17, causing this problem:

|/home/stijn/Development/TIP/wlan-ap/openwrt/build_dir/toolchain-arm_cortex-a7_gcc-5.5.0_musl_eabi/gcc-5.5.0/gcc/reload1.c:
In function 'void init_reload()':
||/home/stijn/Development/TIP/wlan-ap/openwrt/build_dir/toolchain-arm_cortex-a7_gcc-5.5.0_musl_eabi/gcc-5.5.0/gcc/reload1.c:115:24:
error: use of an operand of type 'bool' in 'operator++' is forbidden in
C++17 ||115 | (this_target_reload->x_spill_indirect_levels) |||
~^~~~|

|Setting the dialects to build GCC 5, to the default dialect used by GCC
5, avoids this problem. However, since QSDK is obviously completely
irrelevant for OpenWrt, I tried finding a general way of avoiding these
kinds of problems. Setting the default dialects would avoid the same
problem in the future, e.g. once GCC 13 forbids some syntax that is used
in some of the GCC versions we still support.|

|Anyway, downstream answer was "won't fix, build on Ubuntu 20.04", so
I'm going to mark this patch as rejected and not waste any more time on it.|

|Stijn |


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


[PATCH] ramips: support TP-Link EAP615-Wall

2022-01-27 Thread Stijn Tintel
Add support for the TP-Link EAP615-Wall, an AX1800 Wall Plate WiFi 6 AP.
The device is very similar to the TP-Link EAP235-Wall.

Hardware:
* SoC: MediaTek MT7621AT
* RAM: 128MiB
* Flash: 16MiB SPI-NOR
* Ethernet: 4x GbE
  * Back: ETH0 (PoE-PD)
  * Bottom: ETH1, ETH2, ETH3 (PoE-PT)
* WiFi: MT7915E 2.4/5 GHz 2T2R
* LEDS: 1x white
* Buttons: 1x LED, 1x reset

Stock firmware uses a random MAC address for ethernet. OpenWrt uses the
MAC address that is on the device label for ethernet and the wireless
interfaces. MAC address must not be incremented, as this will cause MAC
address conflicts in case you have two devices with consecutive MAC
addresses. Instead, different locally administered addresses will be
generated automatically, based on the MAC on the label.

Installation via stock firmware:
* Enable SSH in the TP-Link web interface
* SSH to the device
* Run `cliclientd stopcs`
* Upload the OpenWrt factory image via the TP-Link webinterface

Installation via bootloader:
* Solder TTL header. Pinout: 1: TX, 2: RX, 3: GND, 4: VCC, with pin 1
  closest to ETH1. Baud rate 115200
* Interrupt boot process by holding a key during boot
* Boot the OpenWrt initramfs:
  # tftpboot 0x8400 
openwrt-ramips-mt7621-tplink_eap615-wall-v1-initramfs-kernel.bin
  # bootm
* Copy openwrt-ramips-mt7621-tplink_eap615-wall-v1-squashfs-sysupgrade.bin
  to /tmp and use sysupgrade to install it

Thanks to Sander Vanheule for his work on the EAP235-Wall, which made
adding support for the EAP615-Wall very easy.

Signed-off-by: Stijn Tintel 
---
 .../dts/mt7621_tplink_eap615-wall-v1.dts  | 250 ++
 target/linux/ramips/image/mt7621.mk   |  12 +
 .../mt7621/base-files/etc/board.d/02_network  |   3 +-
 tools/firmware-utils/patches/999-eap615.patch |  55 
 4 files changed, 319 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/ramips/dts/mt7621_tplink_eap615-wall-v1.dts
 create mode 100644 tools/firmware-utils/patches/999-eap615.patch

diff --git a/target/linux/ramips/dts/mt7621_tplink_eap615-wall-v1.dts 
b/target/linux/ramips/dts/mt7621_tplink_eap615-wall-v1.dts
new file mode 100644
index 00..fd5a68973b
--- /dev/null
+++ b/target/linux/ramips/dts/mt7621_tplink_eap615-wall-v1.dts
@@ -0,0 +1,250 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "mt7621.dtsi"
+
+#include 
+#include 
+#include 
+
+/ {
+   compatible = "tplink,eap615-wall-v1", "mediatek,mt7621-soc";
+   model = "TP-Link EAP615-Wall v1";
+
+   aliases {
+   label-mac-device = 
+   led-boot = _status;
+   led-failsafe = _status;
+   led-running = _status;
+   led-upgrade = _status;
+   };
+
+   chosen {
+   bootargs = "console=ttyS0,115200";
+   };
+
+   leds {
+   compatible = "gpio-leds";
+
+   led_status: status {
+   label = "white:status";
+   color = ;
+   function = LED_FUNCTION_STATUS;
+   gpios = < 12 GPIO_ACTIVE_LOW>;
+   };
+   };
+
+   keys {
+   compatible = "gpio-keys";
+
+   led {
+   label = "led";
+   gpios = < 10 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+
+   reset {
+   label = "reset";
+   gpios = < 8 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+   };
+
+   gpio-export {
+   compatible = "gpio-export";
+
+   poe_passthrough {
+   gpio-export,name = "poe-passthrough";
+   gpio-export,output = <0>;
+   gpios = < 7 GPIO_ACTIVE_HIGH>;
+   };
+   };
+
+   ethernet@1e10 {
+   reg = <0x1e10 0xe000>;
+
+   mac@0 {
+   phy-mode = "rgmii";
+
+   fixed-link {
+   pause;
+   speed = <1000>;
+   };
+   };
+
+   mac@1 {
+   status = "okay";
+
+   phy-mode = "rgmii";
+
+   fixed-link {
+   full-duplex;
+   pause;
+   speed = <1000>;
+   };
+   };
+   };
+
+};
+
+ {
+   status = "okay";
+
+   flash@0 {
+   compatible = "jedec,spi-nor";
+   reg = <0>;
+   spi-max-frequency = <2000>;
+
+   partitions {
+   compatible = "fixed-partiti

[PATCH] toolchain/gcc: set dialects for each version

2022-01-25 Thread Stijn Tintel
GCC has an option "-std=" to set the language standard for C and C++.
Newer GCC versions sometimes switch to newer standards by default. This
has the potential to break the OpenWrt toolchain build whenever a distro
introduces a new GCC version that uses a newer dialect by default.

Let's set the default dialects used for each of the GCC versions we
support, to avoid these toolchain build failures in the future.

Signed-off-by: Stijn Tintel 
---
 toolchain/gcc/common.mk | 8 
 1 file changed, 8 insertions(+)

diff --git a/toolchain/gcc/common.mk b/toolchain/gcc/common.mk
index bef4fa37f8..3e31a139cd 100644
--- a/toolchain/gcc/common.mk
+++ b/toolchain/gcc/common.mk
@@ -29,14 +29,20 @@ PKG_SOURCE_URL:=@GNU/gcc/gcc-$(PKG_VERSION)
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 
 ifeq ($(PKG_VERSION),8.4.0)
+  C_DIALECT=-std=gnu17
+  CXX_DIALECT=-std=gnu++14
   PKG_HASH:=e30a6e52d10e1f27ed55104ad233c30bd1e99cfb5ff98ab022dc941edd1b2dd4
 endif
 
 ifeq ($(PKG_VERSION),10.3.0)
+  C_DIALECT=-std=gnu17
+  CXX_DIALECT=-std=gnu++14
   PKG_HASH:=64f404c1a650f27fc33da242e1f2df54952e3963a49e06e73f6940f3223ac344
 endif
 
 ifeq ($(PKG_VERSION),11.2.0)
+  C_DIALECT=-std=gnu17
+  CXX_DIALECT=-std=gnu++17
   PKG_HASH:=d08edc536b54c372a1010ff6619dd274c0f1603aa49212ba20f7aa2cda36fa8b
 endif
 
@@ -86,6 +92,8 @@ GCC_CONFIGURE:= \
CFLAGS="-O2 -fbracket-depth=512 -pipe" \
CXXFLAGS="-O2 -fbracket-depth=512 -pipe" \
) \
+   CFLAGS="$(CFLAGS) $(C_DIALECT)" \
+   CXXFLAGS="$(CXXFLAGS) $(CXX_DIALECT)" \
$(HOST_SOURCE_DIR)/configure \
--with-bugurl=$(BUGURL) \
--with-pkgversion="$(PKGVERSION)" \
-- 
2.34.1


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


Re: Self hosted GitLab instance [Was: Re: Switch issues and CI to GitHub]

2022-01-23 Thread Stijn Tintel
On 22/01/2022 14:37, Petr Štetiar wrote:
> Paul Spooren  [2022-01-07 10:34:34]:
>
> Hi,
>
> (adding openwrt-adm@ into the loop)
>
>> None of the OpenWrt project members is willing to setup and maintain a
>> GitLab instance
> so what about having that GitLab instance prepared and co-maintained by some
> trusted 3rd party? I mean, define our needs, find someone who would be willing
> to do that, estimate the costs and then prepare some fundraiser which should
> cover the costs for next 3-5 years, so we don't need to repeat this daunting
> task every year.

Maintaining the Gitlab instance isn't the only issue. I've seen several
people expressing their dislike about Gitlab. I'll list some of my own
reasons.

* The UI/UX is terribly bloated, making the whole product really
cumbersome to work with.
* TOTP is required before U2F/FIDO2 hardware keys can be used, and
requests to revert that change have been ignored for years.
* FIDO2 backed SSH keys are not supported. Reading the issue requesting
it is not very confidence inspiring.
* Installation instructions "curl ... | sudo bash". Seriously?

So pretty please, let us not go the Gitlab route. Github UI/UX, while
not being perfect, is way better than Gitlab. And do not mistake this
for me advocating Github. I would still prefer to ditch Github and
Gitlab entirely, stick to git send-email and patchwork, but it's
becoming clear that this is an obstacle for newer generations. Many
people seem to use the Gmail web interface, and like it. I find it
horrible. I've gotten into a discussion on Twitter about the subject
once, and was quickly blamed for excluding people using it. Apparently
we are dinosaurs and need to come out of the stone age. Hence I've given
up that fight. But if I have to choose between Github and Gitlab, Github
wins.

Stijn



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


Re: [PATCH] arc770: Remove arc770 target

2022-01-23 Thread Stijn Tintel
On 22/01/2022 21:24, Hauke Mehrtens wrote:
> The arc700 target is not booting up since some time, see here:
> https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/issues/400
>
> It looks like there is a problem in the toolchain when using glibc.
>
> Currently no one is working on fixing this problem, remove the target
> instead. This target also does not have many users we are aware of.
>
> If someone wants to have this target back, feel free to add a fixed
> version of this target again.
>
> Signed-off-by: Hauke Mehrtens 
Acked-by: Stijn Tintel 

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


[PATCH fstools] libfstools: avoid segfault in find_mount_point

2021-12-21 Thread Stijn Tintel
If block is NULL, find_mount_point will segfault when comparing it
against the device name found in /proc/self/mountinfo. Avoid this by
checking if block is NULL.

Signed-off-by: Stijn Tintel 
---
 libfstools/find.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/libfstools/find.c b/libfstools/find.c
index cefdd23..1d91c51 100644
--- a/libfstools/find.c
+++ b/libfstools/find.c
@@ -109,6 +109,9 @@ find_mount_point(char *block, int root_only)
int rstat;
unsigned int minor, major;
 
+   if (!block)
+   return NULL;
+
if (!fp)
return NULL;
 
-- 
2.32.0


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


Re: [PATCH v2 7/8] qoriq: new target

2021-12-21 Thread Stijn Tintel
On 21/12/2021 16:49, Rui Salvaterra wrote:
> Hi, Stijn,
>
> Nice to see this! :) A few nits/comments/questions below…
>
> On Mon, 20 Dec 2021 at 19:01, Stijn Tintel  wrote:
>> Add a new target named "qoriq", that will support boards using PowerPC
>> processors from NXP's QorIQ brand.
>>
>> This doesn't actually add support for any board yet, so that
>> installation instructions can go in the commit message of the commit
>> that adds actual support for a board.
>>
>> Signed-off-by: Stijn Tintel 
>> ---
>>  package/kernel/linux/modules/other.mk |   2 +-
>>  target/linux/qoriq/Makefile   |  23 ++
>>  target/linux/qoriq/config-5.10| 384 ++
>>  target/linux/qoriq/generic/target.mk  |   3 +
>>  target/linux/qoriq/image/Makefile |  36 +++
>>  target/linux/qoriq/image/generic.mk   |   0
>>  6 files changed, 447 insertions(+), 1 deletion(-)
>>  create mode 100644 target/linux/qoriq/Makefile
>>  create mode 100644 target/linux/qoriq/config-5.10
>>  create mode 100644 target/linux/qoriq/generic/target.mk
>>  create mode 100644 target/linux/qoriq/image/Makefile
>>  create mode 100644 target/linux/qoriq/image/generic.mk
>>
>> diff --git a/package/kernel/linux/modules/other.mk 
>> b/package/kernel/linux/modules/other.mk
>> index fdcc089025..f712c95c8e 100644
>> --- a/package/kernel/linux/modules/other.mk
>> +++ b/package/kernel/linux/modules/other.mk
>> @@ -992,7 +992,7 @@ $(eval $(call KernelPackage,ptp))
>>  define KernelPackage/ptp-qoriq
>>SUBMENU:=$(OTHER_MENU)
>>TITLE:=Freescale QorIQ PTP support
>> -  DEPENDS:=@TARGET_mpc85xx +kmod-ptp
>> +  DEPENDS:=@(TARGET_mpc85xx||TARGET_qoriq) +kmod-ptp
>>KCONFIG:=CONFIG_PTP_1588_CLOCK_QORIQ
>>FILES:=$(LINUX_DIR)/drivers/ptp/ptp-qoriq.ko
>>AUTOLOAD:=$(call AutoProbe,ptp-qoriq)
>> diff --git a/target/linux/qoriq/Makefile b/target/linux/qoriq/Makefile
>> new file mode 100644
>> index 00..960ab32c98
>> --- /dev/null
>> +++ b/target/linux/qoriq/Makefile
>> @@ -0,0 +1,23 @@
>> +# SPDX-License-Identifier: GPL-2.0-only
>> +#
>> +# Copyright (C) 2021 Stijn Tintel 
>> +
>> +include $(TOPDIR)/rules.mk
>> +
>> +ARCH:=powerpc64
>> +BOARD:=qoriq
>> +BOARDNAME:=NXP QorIQ (PowerPC)
>> +CPU_TYPE:=e5500
>> +FEATURES:=boot-part ext4 fpu legacy-sdcard powerpc64 ramdisk root-part rtc 
>> source-only
>> +SUBTARGETS:=generic
>> +
>> +KERNEL_PATCHVER:=5.10
>> +KERNEL_TESTING_PATCHVER:=5.10
> Should we keep TESTING_PATCHVER when it's the same version?
Dropped.
>
>> +
>> +KERNELNAME:=zImage
>> +
>> +include $(INCLUDE_DIR)/target.mk
>> +
>> +DEFAULT_PACKAGES += e2fsprogs uboot-envtools
>> +
>> +$(eval $(call BuildTarget))
>> diff --git a/target/linux/qoriq/config-5.10 b/target/linux/qoriq/config-5.10
>> new file mode 100644
>> index 00..6984e60475
>> --- /dev/null
>> +++ b/target/linux/qoriq/config-5.10
>> @@ -0,0 +1,384 @@
>> +CONFIG_64BIT=y
>> +CONFIG_ALTIVEC=y
>> +CONFIG_ARCH_DMA_ADDR_T_64BIT=y
>> +CONFIG_ARCH_HIBERNATION_POSSIBLE=y
>> +CONFIG_ARCH_KEEP_MEMBLOCK=y
>> +CONFIG_ARCH_MAY_HAVE_PC_FDC=y
>> +CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
>> +CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y
>> +CONFIG_ARCH_MMAP_RND_BITS=18
>> +CONFIG_ARCH_MMAP_RND_BITS_MAX=32
>> +CONFIG_ARCH_MMAP_RND_BITS_MIN=18
>> +CONFIG_ARCH_MMAP_RND_COMPAT_BITS=11
>> +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=17
>> +CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11
>> +CONFIG_ARCH_SELECT_MEMORY_MODEL=y
>> +CONFIG_ARCH_SPARSEMEM_ENABLE=y
>> +CONFIG_ARCH_WEAK_RELEASE_ACQUIRE=y
>> +CONFIG_ASN1=y
>> +CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH=y
>> +CONFIG_AUDIT_ARCH=y
>> +CONFIG_BLK_DEV_SD=y
>> +CONFIG_BLK_MQ_PCI=y
>> +CONFIG_BLK_PM=y
>> +CONFIG_BLK_SCSI_REQUEST=y
>> +CONFIG_BLOCK_COMPAT=y
>> +CONFIG_BOOKE=y
>> +CONFIG_CLKDEV_LOOKUP=y
>> +CONFIG_CLK_QORIQ=y
>> +CONFIG_CLONE_BACKWARDS=y
>> +CONFIG_CLZ_TAB=y
>> +CONFIG_COMMON_CLK=y
>> +CONFIG_COMPAT=y
>> +CONFIG_COMPAT_32BIT_TIME=y
> We shouldn't need 32-bit time_t compatibility, since we're building
> from scratch.
Dropped.
>
>> +CONFIG_COMPAT_BINFMT_ELF=y
>> +CONFIG_COMPAT_NETLINK_MESSAGES=y
>> +CONFIG_COMPAT_OLD_SIGACTION=y
>> +CONFIG_CONSOLE_TRANSLATIONS=y
>> +CONFIG_CORENET_GENERIC=y
>> +# CONFIG_CPUFREQ_DT is not set
>> +CONFIG_CPU_BIG_ENDIAN=y
>> +CONFIG_CPU_FREQ=y
>> +CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
>> 

Re: [PATCH v2 2/8] toolchain/musl: ppc64: check for AltiVec in setjmp/longjmp

2021-12-21 Thread Stijn Tintel
Please ignore this patch, it's not required for the M300 and upstream 
requested changes. I'll omit it when pushing this series and work on it 
before continuing on the M200 and BSAP-3040.


On 20/12/2021 21:00, Stijn Tintel wrote:

Signed-off-by: Stijn Tintel 
---
  ...-check-for-AltiVec-in-setjmp-longjmp.patch | 82 +++
  1 file changed, 82 insertions(+)
  create mode 100644 
toolchain/musl/patches/100-ppc64-check-for-AltiVec-in-setjmp-longjmp.patch

diff --git 
a/toolchain/musl/patches/100-ppc64-check-for-AltiVec-in-setjmp-longjmp.patch 
b/toolchain/musl/patches/100-ppc64-check-for-AltiVec-in-setjmp-longjmp.patch
new file mode 100644
index 00..8b27819022
--- /dev/null
+++ b/toolchain/musl/patches/100-ppc64-check-for-AltiVec-in-setjmp-longjmp.patch
@@ -0,0 +1,82 @@
+From 0b6f90a930fcda6df287065d39e6b865428e3c69 Mon Sep 17 00:00:00 2001
+From: Stijn Tintel 
+Date: Sat, 27 Nov 2021 04:58:50 +0200
+Subject: [PATCH] ppc64: check for AltiVec in setjmp/longjmp
+
+On machines without AltiVec, the lvx and stvx instructions are not
+supported. Use __hwcap to test if AltiVec is supported.
+
+Fixes SIGILL on PowerPC 64 processors without AltiVec support.
+Runtime-tested on e5500 and e6500.
+
+Signed-off-by: Stijn Tintel 
+---
+ src/setjmp/powerpc64/longjmp.s | 13 -
+ src/setjmp/powerpc64/setjmp.s  | 13 -
+ 2 files changed, 24 insertions(+), 2 deletions(-)
+
+diff --git a/src/setjmp/powerpc64/longjmp.s b/src/setjmp/powerpc64/longjmp.s
+index 81d45ff6..da7172af 100644
+--- a/src/setjmp/powerpc64/longjmp.s
 b/src/setjmp/powerpc64/longjmp.s
+@@ -56,7 +56,17 @@ longjmp:
+   lfd 30, 38*8(3)
+   lfd 31, 39*8(3)
+
+-  # 6) restore vector registers v20-v31
++  # 6) restore vector registers v20-v31 if hardware supports AltiVec
++  mflr 0
++  bl 1f
++  .hidden __hwcap
++  .long __hwcap-.
++1:  mflr 4
++  lwz 5, 0(4)
++  add 4, 4, 5
++  ld 4, 0(4)
++  andis. 4, 4, 0x1000
++  beq 1f
+   addi 3, 3, 40*8
+   lvx 20, 0, 3 ; addi 3, 3, 16
+   lvx 21, 0, 3 ; addi 3, 3, 16
+@@ -70,6 +80,7 @@ longjmp:
+   lvx 29, 0, 3 ; addi 3, 3, 16
+   lvx 30, 0, 3 ; addi 3, 3, 16
+   lvx 31, 0, 3
++1:mtlr 0
+
+   # 7) return r4 ? r4 : 1
+   mr3,   4
+diff --git a/src/setjmp/powerpc64/setjmp.s b/src/setjmp/powerpc64/setjmp.s
+index 37683fda..32853693 100644
+--- a/src/setjmp/powerpc64/setjmp.s
 b/src/setjmp/powerpc64/setjmp.s
+@@ -69,7 +69,17 @@ __setjmp_toc:
+   stfd 30, 38*8(3)
+   stfd 31, 39*8(3)
+
+-  # 5) store vector registers v20-v31
++  # 5) store vector registers v20-v31 if hardware supports AltiVec
++  mflr 0
++  bl 1f
++  .hidden __hwcap
++  .long __hwcap-.
++1:mflr 4
++  lwz 5, 0(4)
++  add 4, 4, 5
++  ld 4, 0(4)
++  andis. 4, 4, 0x1000
++  beq 1f
+   addi  3, 3, 40*8
+   stvx 20, 0, 3 ; addi 3, 3, 16
+   stvx 21, 0, 3 ; addi 3, 3, 16
+@@ -83,6 +93,7 @@ __setjmp_toc:
+   stvx 29, 0, 3 ; addi 3, 3, 16
+   stvx 30, 0, 3 ; addi 3, 3, 16
+   stvx 31, 0, 3
++1:mtlr 0
+
+   # 6) return 0
+   li 3, 0
+--
+2.32.0
+


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


[PATCH v2 7/8] qoriq: new target

2021-12-20 Thread Stijn Tintel
Add a new target named "qoriq", that will support boards using PowerPC
processors from NXP's QorIQ brand.

This doesn't actually add support for any board yet, so that
installation instructions can go in the commit message of the commit
that adds actual support for a board.

Signed-off-by: Stijn Tintel 
---
 package/kernel/linux/modules/other.mk |   2 +-
 target/linux/qoriq/Makefile   |  23 ++
 target/linux/qoriq/config-5.10| 384 ++
 target/linux/qoriq/generic/target.mk  |   3 +
 target/linux/qoriq/image/Makefile |  36 +++
 target/linux/qoriq/image/generic.mk   |   0
 6 files changed, 447 insertions(+), 1 deletion(-)
 create mode 100644 target/linux/qoriq/Makefile
 create mode 100644 target/linux/qoriq/config-5.10
 create mode 100644 target/linux/qoriq/generic/target.mk
 create mode 100644 target/linux/qoriq/image/Makefile
 create mode 100644 target/linux/qoriq/image/generic.mk

diff --git a/package/kernel/linux/modules/other.mk 
b/package/kernel/linux/modules/other.mk
index fdcc089025..f712c95c8e 100644
--- a/package/kernel/linux/modules/other.mk
+++ b/package/kernel/linux/modules/other.mk
@@ -992,7 +992,7 @@ $(eval $(call KernelPackage,ptp))
 define KernelPackage/ptp-qoriq
   SUBMENU:=$(OTHER_MENU)
   TITLE:=Freescale QorIQ PTP support
-  DEPENDS:=@TARGET_mpc85xx +kmod-ptp
+  DEPENDS:=@(TARGET_mpc85xx||TARGET_qoriq) +kmod-ptp
   KCONFIG:=CONFIG_PTP_1588_CLOCK_QORIQ
   FILES:=$(LINUX_DIR)/drivers/ptp/ptp-qoriq.ko
   AUTOLOAD:=$(call AutoProbe,ptp-qoriq)
diff --git a/target/linux/qoriq/Makefile b/target/linux/qoriq/Makefile
new file mode 100644
index 00..960ab32c98
--- /dev/null
+++ b/target/linux/qoriq/Makefile
@@ -0,0 +1,23 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# Copyright (C) 2021 Stijn Tintel 
+
+include $(TOPDIR)/rules.mk
+
+ARCH:=powerpc64
+BOARD:=qoriq
+BOARDNAME:=NXP QorIQ (PowerPC)
+CPU_TYPE:=e5500
+FEATURES:=boot-part ext4 fpu legacy-sdcard powerpc64 ramdisk root-part rtc 
source-only
+SUBTARGETS:=generic
+
+KERNEL_PATCHVER:=5.10
+KERNEL_TESTING_PATCHVER:=5.10
+
+KERNELNAME:=zImage
+
+include $(INCLUDE_DIR)/target.mk
+
+DEFAULT_PACKAGES += e2fsprogs uboot-envtools
+
+$(eval $(call BuildTarget))
diff --git a/target/linux/qoriq/config-5.10 b/target/linux/qoriq/config-5.10
new file mode 100644
index 00..6984e60475
--- /dev/null
+++ b/target/linux/qoriq/config-5.10
@@ -0,0 +1,384 @@
+CONFIG_64BIT=y
+CONFIG_ALTIVEC=y
+CONFIG_ARCH_DMA_ADDR_T_64BIT=y
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_KEEP_MEMBLOCK=y
+CONFIG_ARCH_MAY_HAVE_PC_FDC=y
+CONFIG_ARCH_MIGHT_HAVE_PC_PARPORT=y
+CONFIG_ARCH_MIGHT_HAVE_PC_SERIO=y
+CONFIG_ARCH_MMAP_RND_BITS=18
+CONFIG_ARCH_MMAP_RND_BITS_MAX=32
+CONFIG_ARCH_MMAP_RND_BITS_MIN=18
+CONFIG_ARCH_MMAP_RND_COMPAT_BITS=11
+CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MAX=17
+CONFIG_ARCH_MMAP_RND_COMPAT_BITS_MIN=11
+CONFIG_ARCH_SELECT_MEMORY_MODEL=y
+CONFIG_ARCH_SPARSEMEM_ENABLE=y
+CONFIG_ARCH_WEAK_RELEASE_ACQUIRE=y
+CONFIG_ASN1=y
+CONFIG_ASYNC_TX_ENABLE_CHANNEL_SWITCH=y
+CONFIG_AUDIT_ARCH=y
+CONFIG_BLK_DEV_SD=y
+CONFIG_BLK_MQ_PCI=y
+CONFIG_BLK_PM=y
+CONFIG_BLK_SCSI_REQUEST=y
+CONFIG_BLOCK_COMPAT=y
+CONFIG_BOOKE=y
+CONFIG_CLKDEV_LOOKUP=y
+CONFIG_CLK_QORIQ=y
+CONFIG_CLONE_BACKWARDS=y
+CONFIG_CLZ_TAB=y
+CONFIG_COMMON_CLK=y
+CONFIG_COMPAT=y
+CONFIG_COMPAT_32BIT_TIME=y
+CONFIG_COMPAT_BINFMT_ELF=y
+CONFIG_COMPAT_NETLINK_MESSAGES=y
+CONFIG_COMPAT_OLD_SIGACTION=y
+CONFIG_CONSOLE_TRANSLATIONS=y
+CONFIG_CORENET_GENERIC=y
+# CONFIG_CPUFREQ_DT is not set
+CONFIG_CPU_BIG_ENDIAN=y
+CONFIG_CPU_FREQ=y
+CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
+# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
+# CONFIG_CPU_FREQ_GOV_ONDEMAND is not set
+CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
+# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
+# CONFIG_CPU_FREQ_GOV_USERSPACE is not set
+# CONFIG_CPU_FREQ_STAT is not set
+CONFIG_CPU_IDLE=y
+CONFIG_CPU_IDLE_GOV_LADDER=y
+CONFIG_CPU_IDLE_GOV_TEO=y
+CONFIG_CPU_ISOLATION=y
+CONFIG_CPU_RMAP=y
+CONFIG_CRC16=y
+CONFIG_CRYPTO_AUTHENC=y
+CONFIG_CRYPTO_CRC32C=y
+# CONFIG_CRYPTO_CRC32C_VPMSUM is not set
+CONFIG_CRYPTO_DES=y
+CONFIG_CRYPTO_DEV_FSL_CAAM=y
+CONFIG_CRYPTO_DEV_FSL_CAAM_AHASH_API=y
+CONFIG_CRYPTO_DEV_FSL_CAAM_AHASH_API_DESC=y
+CONFIG_CRYPTO_DEV_FSL_CAAM_COMMON=y
+CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API=y
+CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API_DESC=y
+CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API_QI=y
+# CONFIG_CRYPTO_DEV_FSL_CAAM_DEBUG is not set
+# CONFIG_CRYPTO_DEV_FSL_CAAM_INTC is not set
+CONFIG_CRYPTO_DEV_FSL_CAAM_JR=y
+CONFIG_CRYPTO_DEV_FSL_CAAM_PKC_API=y
+CONFIG_CRYPTO_DEV_FSL_CAAM_RINGSIZE=9
+CONFIG_CRYPTO_DEV_FSL_CAAM_RNG_API=y
+# CONFIG_CRYPTO_DEV_NX is not set
+CONFIG_CRYPTO_ECB=y
+CONFIG_CRYPTO_ENGINE=y
+CONFIG_CRYPTO_GF128MUL=y
+CONFIG_CRYPTO_HW=y
+CONFIG_CRYPTO_LIB_DES=y
+CONFIG_CRYPTO_LIB_POLY1305_RSIZE=1
+# CONFIG_CRYPTO_MD5_PPC is not set
+CONFIG_CRYPTO_NULL2=y
+CONFIG_CRYPTO_RNG=y
+CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_RSA=y
+# CONFIG_CRYPTO_SHA1_PPC is not set
+CONFIG_CRYPTO_XTS=y
+CONFIG_DAT

[PATCH v2 8/8] qoriq: add support for WatchGuard Firebox M300

2021-12-20 Thread Stijn Tintel
This device is based on NXP's QorIQ T2081QDS board, with a quad-core
dual-threaded 1.5 GHz ppc64 CPU and 4GB ECC RAM. The board has 5
ethernet interfaces, of which 3 are connected to the ethernet ports on
the front panel. The other 2 are internally connected to a Marvell
88E6171 switch; the other 5 ports of this switch are also connected to
the ethernet ports on the front panel.

Installation: write the sdcard image to an SD card. Stock U-Boot will
not boot, wait for it to fail then run these commands:

setenv OpenWrt_fdt image-watchguard-firebox-m300.dtb
setenv OpenWrt_kernel watchguard_firebox-m300-kernel.bin
setenv wgBootSysA 'setenv bootargs root=/dev/mmcblk0p2 rw rootdelay=2 
console=$consoledev,$baudrate fsl_dpaa_fman.fsl_fm_max_frm=1530; ext2load mmc 
0:1 $fdtaddr $OpenWrt_fdt; ext2load mmc 0:1 $loadaddr $OpenWrt_kernel; bootm 
$loadaddr - $fdtaddr'
saveenv
reset

The default U-Boot boot entry will now boot OpenWrt from the SD card.

Signed-off-by: Stijn Tintel 
---
 package/boot/uboot-envtools/files/qoriq   |  19 +
 .../qoriq/base-files/etc/board.d/02_network   |  38 ++
 .../base-files/lib/preinit/79_move_config |  17 +
 .../qoriq/base-files/lib/upgrade/platform.sh  |  36 ++
 .../boot/dts/fsl/watchguard-firebox-m300.dts  | 328 ++
 target/linux/qoriq/image/generic.mk   |  13 +
 6 files changed, 451 insertions(+)
 create mode 100644 package/boot/uboot-envtools/files/qoriq
 create mode 100644 target/linux/qoriq/base-files/etc/board.d/02_network
 create mode 100644 target/linux/qoriq/base-files/lib/preinit/79_move_config
 create mode 100755 target/linux/qoriq/base-files/lib/upgrade/platform.sh
 create mode 100644 
target/linux/qoriq/files/arch/powerpc/boot/dts/fsl/watchguard-firebox-m300.dts

diff --git a/package/boot/uboot-envtools/files/qoriq 
b/package/boot/uboot-envtools/files/qoriq
new file mode 100644
index 00..df99103203
--- /dev/null
+++ b/package/boot/uboot-envtools/files/qoriq
@@ -0,0 +1,19 @@
+[ -e /etc/config/ubootenv ] && exit 0
+
+touch /etc/config/ubootenv
+
+. /lib/uboot-envtools.sh
+. /lib/functions.sh
+
+board=$(board_name)
+
+case "$board" in
+watchguard,firebox-m300)
+   ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1" "0x1"
+   ;;
+esac
+
+config_load ubootenv
+config_foreach ubootenv_add_app_config ubootenv
+
+exit 0
diff --git a/target/linux/qoriq/base-files/etc/board.d/02_network 
b/target/linux/qoriq/base-files/etc/board.d/02_network
new file mode 100644
index 00..35b7ce9f32
--- /dev/null
+++ b/target/linux/qoriq/base-files/etc/board.d/02_network
@@ -0,0 +1,38 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+. /lib/functions/uci-defaults.sh
+. /lib/functions.sh
+. /lib/functions/system.sh
+
+board_config_update
+board=$(board_name)
+
+wg_set_opt_interface() {
+   local device="$1"
+   local offset="$2"
+
+   ucidef_set_interface "$device" device "$device" protocol static ipaddr 
"10.0.${offset}.1" netmask 255.255.255.0
+}
+
+case "$board" in
+watchguard,firebox-m300)
+   ucidef_set_interfaces_lan_wan "eth1" "eth0"
+   wg_set_opt_interface "eth2" "2"
+
+   sweth_mac_offset=0x186d
+
+   for sweth in /sys/class/net/sweth*; do
+   device="$(basename "$sweth")"
+   mac="$(mtd_get_mac_text wg_cfg0 "$sweth_mac_offset")"
+   switchports="$switchports $device"
+   ucidef_set_network_device_mac "$device" "$mac"
+   wg_set_opt_interface "$device" "${device#sweth}"
+   sweth_mac_offset=$(printf "0x%X\n" $(( $sweth_mac_offset + 
0x14)))
+   done
+
+   ;;
+esac
+
+board_config_flush
+
+exit 0
diff --git a/target/linux/qoriq/base-files/lib/preinit/79_move_config 
b/target/linux/qoriq/base-files/lib/preinit/79_move_config
new file mode 100644
index 00..54dd579660
--- /dev/null
+++ b/target/linux/qoriq/base-files/lib/preinit/79_move_config
@@ -0,0 +1,17 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+. /lib/functions.sh
+. /lib/upgrade/common.sh
+
+move_config() {
+   local partdev
+
+   if export_bootdevice && export_partdevice partdev 1; then
+   mkdir -p /boot
+   mount -o rw,noatime "/dev/$partdev" /boot
+   [ -f "/boot/$BACKUP_FILE" ] && mv -f "/boot/$BACKUP_FILE" /
+   umount /boot
+   fi
+}
+
+boot_hook_add preinit_mount_root move_config
diff --git a/target/linux/qoriq/base-files/lib/upgrade/platform.sh 
b/target/linux/qoriq/base-files/lib/upgrade/platform.sh
new file mode 100755
index 00..1392d5eb22
--- /dev/null
+++ b/target/linux/qoriq/base-files/lib/upgrade/platform.sh
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: GPL-2.0-or-lat

[PATCH v2 6/8] libunwind: add ppc64 support

2021-12-20 Thread Stijn Tintel
Backport an upstream patch to make libunwind build on ppc64, and add
powerpc64 to the dependencies.

Signed-off-by: Stijn Tintel 
---
 package/libs/libunwind/Makefile   |  4 +--
 ...ce-exec_prefix-lib64-libdir-on-ppc64.patch | 29 +++
 2 files changed, 31 insertions(+), 2 deletions(-)
 create mode 100644 
package/libs/libunwind/patches/001-Don-t-force-exec_prefix-lib64-libdir-on-ppc64.patch

diff --git a/package/libs/libunwind/Makefile b/package/libs/libunwind/Makefile
index 7f79996d25..f129dafcbf 100644
--- a/package/libs/libunwind/Makefile
+++ b/package/libs/libunwind/Makefile
@@ -10,7 +10,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libunwind
 PKG_VERSION:=1.5.0
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=@SAVANNAH/$(PKG_NAME)
@@ -32,7 +32,7 @@ define Package/libunwind
   CATEGORY:=Libraries
   TITLE:=The libunwind project
   URL:=http://www.nongnu.org/libunwind/
-  
DEPENDS:=@((mips||mipsel||mips64||x86_64||arm||aarch64)||(USE_GLIBC&&(powerpc||i386)))
 +zlib
+  
DEPENDS:=@((mips||mipsel||mips64||powerpc64||x86_64||arm||aarch64)||(USE_GLIBC&&(powerpc||i386)))
 +zlib
   ABI_VERSION:=8
 endef
 
diff --git 
a/package/libs/libunwind/patches/001-Don-t-force-exec_prefix-lib64-libdir-on-ppc64.patch
 
b/package/libs/libunwind/patches/001-Don-t-force-exec_prefix-lib64-libdir-on-ppc64.patch
new file mode 100644
index 00..d6010ec0ae
--- /dev/null
+++ 
b/package/libs/libunwind/patches/001-Don-t-force-exec_prefix-lib64-libdir-on-ppc64.patch
@@ -0,0 +1,29 @@
+From 0af7e7a53480ce8e1cf6cfb4e9fe071c1185ef31 Mon Sep 17 00:00:00 2001
+From: Matthias Diener 
+Date: Fri, 2 Jul 2021 12:36:10 -0500
+Subject: [PATCH] Don't force {exec_prefix}/lib64 libdir on ppc64
+
+---
+ configure.ac | 6 --
+ 1 file changed, 6 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 9fadc163..0dec4ca6 100644
+--- a/configure.ac
 b/configure.ac
+@@ -215,12 +215,6 @@ fi
+ AM_CONDITIONAL(USE_DWARF, [test x$use_dwarf = xyes])
+ AC_MSG_RESULT([$use_dwarf])
+ 
+-if test x$target_arch = xppc64; then
+-libdir='${exec_prefix}/lib64'
+-AC_MSG_NOTICE([PowerPC64 detected, lib will be installed ${libdir}]);
+-AC_SUBST([libdir])
+-fi
+-
+ AC_MSG_CHECKING([whether to restrict build to remote support])
+ if test x$target_arch != x$host_arch; then
+   CPPFLAGS="${CPPFLAGS} -DUNW_REMOTE_ONLY"
+-- 
+2.32.0
+
-- 
2.32.0


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


[PATCH v2 5/8] nettle: disable assembler on ppc64

2021-12-20 Thread Stijn Tintel
As of version 3.7, Nettle added PowerPC64 assembly for several
algorithms. Unfortunately, they cause build to fail due to ABI mismatch:

gcm-hash.o: ABI version 1 is not compatible with ABI version 2 output

Disable assembler when ppc64 and musl are used for now.

Signed-off-by: Stijn Tintel 
---
 package/libs/nettle/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/package/libs/nettle/Makefile b/package/libs/nettle/Makefile
index 3b4bd9d053..87853baa82 100644
--- a/package/libs/nettle/Makefile
+++ b/package/libs/nettle/Makefile
@@ -44,7 +44,8 @@ CONFIGURE_ARGS += \
--enable-fat \
--disable-openssl \
--disable-documentation \
-   --enable-static
+   --enable-static \
+   $(if $(CONFIG_powerpc64), $(if $(CONFIG_USE_MUSL),--disable-assembler))
 
 ifeq ($(CONFIG_LIBNETTLE_MINI),y)
 CONFIGURE_ARGS += --enable-mini-gmp
-- 
2.32.0


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


[PATCH v2 2/8] toolchain/musl: ppc64: check for AltiVec in setjmp/longjmp

2021-12-20 Thread Stijn Tintel
Signed-off-by: Stijn Tintel 
---
 ...-check-for-AltiVec-in-setjmp-longjmp.patch | 82 +++
 1 file changed, 82 insertions(+)
 create mode 100644 
toolchain/musl/patches/100-ppc64-check-for-AltiVec-in-setjmp-longjmp.patch

diff --git 
a/toolchain/musl/patches/100-ppc64-check-for-AltiVec-in-setjmp-longjmp.patch 
b/toolchain/musl/patches/100-ppc64-check-for-AltiVec-in-setjmp-longjmp.patch
new file mode 100644
index 00..8b27819022
--- /dev/null
+++ b/toolchain/musl/patches/100-ppc64-check-for-AltiVec-in-setjmp-longjmp.patch
@@ -0,0 +1,82 @@
+From 0b6f90a930fcda6df287065d39e6b865428e3c69 Mon Sep 17 00:00:00 2001
+From: Stijn Tintel 
+Date: Sat, 27 Nov 2021 04:58:50 +0200
+Subject: [PATCH] ppc64: check for AltiVec in setjmp/longjmp
+
+On machines without AltiVec, the lvx and stvx instructions are not
+supported. Use __hwcap to test if AltiVec is supported.
+
+Fixes SIGILL on PowerPC 64 processors without AltiVec support.
+Runtime-tested on e5500 and e6500.
+
+Signed-off-by: Stijn Tintel 
+---
+ src/setjmp/powerpc64/longjmp.s | 13 -
+ src/setjmp/powerpc64/setjmp.s  | 13 -
+ 2 files changed, 24 insertions(+), 2 deletions(-)
+
+diff --git a/src/setjmp/powerpc64/longjmp.s b/src/setjmp/powerpc64/longjmp.s
+index 81d45ff6..da7172af 100644
+--- a/src/setjmp/powerpc64/longjmp.s
 b/src/setjmp/powerpc64/longjmp.s
+@@ -56,7 +56,17 @@ longjmp:
+   lfd 30, 38*8(3)
+   lfd 31, 39*8(3)
+ 
+-  # 6) restore vector registers v20-v31
++  # 6) restore vector registers v20-v31 if hardware supports AltiVec
++  mflr 0
++  bl 1f
++  .hidden __hwcap
++  .long __hwcap-.
++1:  mflr 4
++  lwz 5, 0(4)
++  add 4, 4, 5
++  ld 4, 0(4)
++  andis. 4, 4, 0x1000
++  beq 1f
+   addi 3, 3, 40*8
+   lvx 20, 0, 3 ; addi 3, 3, 16
+   lvx 21, 0, 3 ; addi 3, 3, 16
+@@ -70,6 +80,7 @@ longjmp:
+   lvx 29, 0, 3 ; addi 3, 3, 16
+   lvx 30, 0, 3 ; addi 3, 3, 16
+   lvx 31, 0, 3
++1:mtlr 0
+ 
+   # 7) return r4 ? r4 : 1
+   mr3,   4
+diff --git a/src/setjmp/powerpc64/setjmp.s b/src/setjmp/powerpc64/setjmp.s
+index 37683fda..32853693 100644
+--- a/src/setjmp/powerpc64/setjmp.s
 b/src/setjmp/powerpc64/setjmp.s
+@@ -69,7 +69,17 @@ __setjmp_toc:
+   stfd 30, 38*8(3)
+   stfd 31, 39*8(3)
+ 
+-  # 5) store vector registers v20-v31
++  # 5) store vector registers v20-v31 if hardware supports AltiVec
++  mflr 0
++  bl 1f
++  .hidden __hwcap
++  .long __hwcap-.
++1:mflr 4
++  lwz 5, 0(4)
++  add 4, 4, 5
++  ld 4, 0(4)
++  andis. 4, 4, 0x1000
++  beq 1f
+   addi  3, 3, 40*8
+   stvx 20, 0, 3 ; addi 3, 3, 16
+   stvx 21, 0, 3 ; addi 3, 3, 16
+@@ -83,6 +93,7 @@ __setjmp_toc:
+   stvx 29, 0, 3 ; addi 3, 3, 16
+   stvx 30, 0, 3 ; addi 3, 3, 16
+   stvx 31, 0, 3
++1:mtlr 0
+ 
+   # 6) return 0
+   li 3, 0
+-- 
+2.32.0
+
-- 
2.32.0


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


[PATCH v2 0/8] qoriq: new target

2021-12-20 Thread Stijn Tintel
 FD status = 0x0020

I couldn't find anything directly explaining this error, but in ethtool claims
these are "rx header error". I believe these errors occur when FMan fails to
parse the receive frame protocol header, so it cannot perform classification
on these frames. As we don't use this feature, they are probably harmless.
That said, I will look into packaging the Frame Manager Configuration tool [2]
and see if anything can be done there to hide these errors.


Thanks,
Stijn

[1] 
https://community.nxp.com/t5/CodeWarrior-for-QorIQ/What-causes-quot-cpu1-fsl-dpa-ethernet-30-dpaa-eth-c-828-dpa-rx/m-p/266154
[2] https://source.codeaurora.org/external/qoriq/qoriq-components/fmc/


Changes since v1:
- Bump OpenSSL PKG_RELEASE
- Change CPU_TYPE to e5500
- Disable BCJ in squashfs images
- Add ppc64 support to libunwind
- Add target DEFAULT_PACKAGES:
  - e2fsprogs
  - uboot-envtools
- Disable BCJ in squashfs compression
- Change default DEVICE_DTS in target/linux/qoriq/image/Makefile
- Add qoriq to target dependency of kmod-ptp-qoriq
- Add kmod-ptp-qoriq to DEVICE_PACKAGES for M300
- Add /etc/board.d/02_network
  - Network config like OEM firmware
- Configure u-boot-env partition in uboot-envtools
- SPDX identifier in:
  - target/linux/qoriq/base-files/lib/preinit/79_move_config
  - target/linux/qoriq/base-files/lib/upgrade/platform.sh
- Changes in m300.dts:
  - Renamed to watchguard-firebox-m300.dts
  - Empty line after compatible
  - Drop empty aliases node
  - Define fixed-link array properties as object to improve readability
  - Remove padding in partition@x labels
  - Drop commented out dsa,member property from switch node
  - Drop Marvell switch detected comment, should be clear from the switch node
  - Renamed all partitions and made all but u-boot-env read-only
  - Include qoriq-fman3-0-10g-1.dtsi before t2081si-post.dtsi to fix interface
order (digit matches front panel)
  - Name switchports swethX (digit matches front panel)
  - Override ethernetX aliases to have MAC address like OEM firmware
- Changes in target/linux/qoriq/image/generic.mk
  - Rename device to watchguard_firebox-m300
  - Drop SUPPORTED_DEVICES line
- Added in target/linux/qoriq/config-5.10
  - CONFIG_MATH_EMULATION=y
  - CONFIG_MATH_EMULATION_HW_UNIMPLEMENTED=y
  - CONFIG_PPC_QUEUED_SPINLOCKS=y
  - CONFIG_QUEUED_RWLOCKS=y
  - CONFIG_QUEUED_SPINLOCKS=y
- Dropped from target/linux/qoriq/config-5.10
  - CONFIG_CONSOLE_POLL=y
  - CONFIG_DEBUGGER=y
  - CONFIG_DEBUG_MEMORY_INIT=y
  - CONFIG_DEBUG_STACKOVERFLOW=y
  - CONFIG_EXT4_FS_SECURITY=y
  - CONFIG_GCC_PLUGINS=y
  - CONFIG_KGDB=y
  - CONFIG_NET_DSA_MV88E6XXX_PTP=y
  - CONFIG_NET_PTP_CLASSIFY=y
  - CONFIG_NMI_IPI=y
  - CONFIG_PTP_1588_CLOCK=y
  - CONFIG_PTP_1588_CLOCK_QORIQ=y
  - CONFIG_RCU_NEED_SEGCBLIST=y
  - CONFIG_RCU_STALL_COMMON=y
  - CONFIG_RCU_TRACE=y
  - CONFIG_SCHED_SMT=y
  - CONFIG_SCHED_STACK_END_CHECK=y
  - CONFIG_SLUB_DEBUG_ON=y
  - CONFIG_TRACE_CLOCK=y


Stijn Tintel (8):
  build: add e5500 CPU_TYPE
  toolchain/musl: ppc64: check for AltiVec in setjmp/longjmp
  toolchain/gcc: use ELFv2 ABI on ppc64 with musl
  openssl: add ppc64 support
  nettle: disable assembler on ppc64
  libunwind: add ppc64 support
  qoriq: new target
  qoriq: add support for WatchGuard Firebox M300

 include/target.mk |   1 +
 package/boot/uboot-envtools/files/qoriq   |  19 +
 package/kernel/linux/modules/other.mk |   2 +-
 package/libs/libunwind/Makefile   |   4 +-
 ...ce-exec_prefix-lib64-libdir-on-ppc64.patch |  29 ++
 package/libs/nettle/Makefile  |   3 +-
 package/libs/openssl/Makefile |   2 +-
 ...m-ppc-xlate.pl-add-linux64v2-flavour.patch |  63 +++
 .../openssl/patches/110-openwrt_targets.patch |   6 +-
 target/linux/qoriq/Makefile   |  23 ++
 .../qoriq/base-files/etc/board.d/02_network   |  38 ++
 .../base-files/lib/preinit/79_move_config |  17 +
 .../qoriq/base-files/lib/upgrade/platform.sh  |  36 ++
 target/linux/qoriq/config-5.10| 384 ++
 .../boot/dts/fsl/watchguard-firebox-m300.dts  | 328 +++
 target/linux/qoriq/generic/target.mk  |   3 +
 target/linux/qoriq/image/Makefile |  36 ++
 target/linux/qoriq/image/generic.mk   |  13 +
 toolchain/gcc/common.mk   |   1 +
 ...-check-for-AltiVec-in-setjmp-longjmp.patch |  82 
 20 files changed, 1084 insertions(+), 6 deletions(-)
 create mode 100644 package/boot/uboot-envtools/files/qoriq
 create mode 100644 
package/libs/libunwind/patches/001-Don-t-force-exec_prefix-lib64-libdir-on-ppc64.patch
 create mode 100644 
package/libs/openssl/patches/001-crypto-perlasm-ppc-xlate.pl-add-linux64v2-flavour.patch
 create mode 100644 target/linux/qoriq/Makefile
 create mode 100644 target/linux/qoriq/base-files/etc/board.d/02_network
 create mode 100644 target/linux/qoriq/base-files/lib/preinit/79_move_config
 create mode 100755 target/linux/qoriq/ba

[PATCH v2 4/8] openssl: add ppc64 support

2021-12-20 Thread Stijn Tintel
Backport an upstream patch that adds support for ELFv2 ABI on big endian
ppc64. As musl only supports ELFv2 ABI on ppc64 regardless of
endianness, this is required to be able to build OpenSSL for ppc64be.

Modify our targets patch to add linux-powerpc64-openwrt, which will use
the linux64v2 perlasm scheme. This will probably break the combination
ppc64 with glibc, but as we really only want to support musl, this
shouldn't be a problem.

Signed-off-by: Stijn Tintel 
---
 package/libs/openssl/Makefile |  2 +-
 ...m-ppc-xlate.pl-add-linux64v2-flavour.patch | 63 +++
 .../openssl/patches/110-openwrt_targets.patch |  6 +-
 3 files changed, 69 insertions(+), 2 deletions(-)
 create mode 100644 
package/libs/openssl/patches/001-crypto-perlasm-ppc-xlate.pl-add-linux64v2-flavour.patch

diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile
index 3f5fe90d9c..0512abdc48 100644
--- a/package/libs/openssl/Makefile
+++ b/package/libs/openssl/Makefile
@@ -11,7 +11,7 @@ PKG_NAME:=openssl
 PKG_BASE:=1.1.1
 PKG_BUGFIX:=l
 PKG_VERSION:=$(PKG_BASE)$(PKG_BUGFIX)
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 PKG_USE_MIPS16:=0
 ENGINES_DIR=engines-1.1
 
diff --git 
a/package/libs/openssl/patches/001-crypto-perlasm-ppc-xlate.pl-add-linux64v2-flavour.patch
 
b/package/libs/openssl/patches/001-crypto-perlasm-ppc-xlate.pl-add-linux64v2-flavour.patch
new file mode 100644
index 00..bdc0509f8c
--- /dev/null
+++ 
b/package/libs/openssl/patches/001-crypto-perlasm-ppc-xlate.pl-add-linux64v2-flavour.patch
@@ -0,0 +1,63 @@
+From 34ab13b7d8e3e723adb60be8142e38b7c9cd382a Mon Sep 17 00:00:00 2001
+From: Andy Polyakov 
+Date: Sun, 5 May 2019 18:25:50 +0200
+Subject: [PATCH] crypto/perlasm/ppc-xlate.pl: add linux64v2 flavour
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This is a big endian ELFv2 configuration. ELFv2 was already being
+used for little endian, and big endian was traditionally ELFv1
+but there are practical configurations that use ELFv2 with big
+endian nowadays (Adélie Linux, Void Linux, possibly Gentoo, etc.)
+
+Reviewed-by: Paul Dale 
+Reviewed-by: Richard Levitte 
+(Merged from https://github.com/openssl/openssl/pull/8883)
+---
+ crypto/perlasm/ppc-xlate.pl | 8 
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/crypto/perlasm/ppc-xlate.pl b/crypto/perlasm/ppc-xlate.pl
+index e52f2f6ea6..5fcd0526df 100755
+--- a/crypto/perlasm/ppc-xlate.pl
 b/crypto/perlasm/ppc-xlate.pl
+@@ -49,7 +49,7 @@ my $globl = sub {
+   /osx/   && do { $name = "_$name";
+   last;
+ };
+-  /linux.*(32|64le)/
++  /linux.*(32|64(le|v2))/
+   && do { $ret .= ".globl $name";
+   if (!$$type) {
+   $ret .= "\n.type$name,\@function";
+@@ -80,7 +80,7 @@ my $globl = sub {
+ };
+ my $text = sub {
+ my $ret = ($flavour =~ /aix/) ? ".csect\t.text[PR],7" : ".text";
+-$ret = ".abiversion   2\n".$ret   if ($flavour =~ /linux.*64le/);
++$ret = ".abiversion   2\n".$ret   if ($flavour =~ 
/linux.*64(le|v2)/);
+ $ret;
+ };
+ my $machine = sub {
+@@ -186,7 +186,7 @@ my $vmr = sub {
+ 
+ # Some ABIs specify vrsave, special-purpose register #256, as reserved
+ # for system use.
+-my $no_vrsave = ($flavour =~ /aix|linux64le/);
++my $no_vrsave = ($flavour =~ /aix|linux64(le|v2)/);
+ my $mtspr = sub {
+ my ($f,$idx,$ra) = @_;
+ if ($idx == 256 && $no_vrsave) {
+@@ -320,7 +320,7 @@ while($line=<>) {
+   if ($label) {
+   my $xlated = ($GLOBALS{$label} or $label);
+   print "$xlated:";
+-  if ($flavour =~ /linux.*64le/) {
++  if ($flavour =~ /linux.*64(le|v2)/) {
+   if ($TYPES{$label} =~ /function/) {
+   printf "\n.localentry   %s,0\n",$xlated;
+   }
+-- 
+2.31.1
+
diff --git a/package/libs/openssl/patches/110-openwrt_targets.patch 
b/package/libs/openssl/patches/110-openwrt_targets.patch
index d0530b4661..828c14d21d 100644
--- a/package/libs/openssl/patches/110-openwrt_targets.patch
+++ b/package/libs/openssl/patches/110-openwrt_targets.patch
@@ -12,7 +12,7 @@ new file mode 100644
 index 00..86a86d31e4
 --- /dev/null
 +++ b/Configurations/25-openwrt.conf
-@@ -0,0 +1,48 @@
+@@ -0,0 +1,52 @@
 +## Openwrt "CONFIG_ARCH" matching targets.
 +
 +# The targets need to end in '-openwrt' for the AFALG patch to work
@@ -52,6 +52,10 @@ index 00..86a86d31e4
 +"linux-powerpc-openwrt" => {
 +inherit_from=> [ "linux-ppc", "openwrt" ],
 +},
++"linux-powerpc64-openwrt" => {
++inherit_from=> [ "linux-ppc64", "openwrt" ],
++perlasm_scheme  

[PATCH v2 3/8] toolchain/gcc: use ELFv2 ABI on ppc64 with musl

2021-12-20 Thread Stijn Tintel
At configuration time, gcc assumes that ppc64be targets use the ELFv1
ABI, and ppc64le targets use the ELFv2 ABI. However, musl libc does not
support the ELFv1 ABI on ppc64 at all, regardless of the endianness.

Therefore, when building for a ppc64 arch and with musl libc, instruct
gcc to use the ELFv2 ABI.

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93157 for more info.

Signed-off-by: Stijn Tintel 
---
 toolchain/gcc/common.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/toolchain/gcc/common.mk b/toolchain/gcc/common.mk
index a195002888..bef4fa37f8 100644
--- a/toolchain/gcc/common.mk
+++ b/toolchain/gcc/common.mk
@@ -108,6 +108,7 @@ GCC_CONFIGURE:= \
$(if $(CONFIG_mips64)$(CONFIG_mips64el),--with-arch=mips64 \
--with-abi=$(call qstrip,$(CONFIG_MIPS64_ABI))) \
$(if $(CONFIG_arc),--with-cpu=$(CONFIG_CPU_TYPE)) \
+   $(if $(CONFIG_powerpc64), $(if 
$(CONFIG_USE_MUSL),--with-abi=elfv2)) \
--with-gmp=$(TOPDIR)/staging_dir/host \
--with-mpfr=$(TOPDIR)/staging_dir/host \
--with-mpc=$(TOPDIR)/staging_dir/host \
-- 
2.32.0


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


[PATCH v2 1/8] build: add e5500 CPU_TYPE

2021-12-20 Thread Stijn Tintel
This CPU type is compatible with NXP's PPC based QorIQ processors, and
will be used by the upcoming new qoriq target.

Signed-off-by: Stijn Tintel 
---
 include/target.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/target.mk b/include/target.mk
index 60760bf602..fb57553f7d 100644
--- a/include/target.mk
+++ b/include/target.mk
@@ -234,6 +234,7 @@ ifeq ($(DUMP),1)
   endif
   ifeq ($(ARCH),powerpc64)
 CPU_TYPE ?= powerpc64
+CPU_CFLAGS_e5500:=-mcpu=e5500
 CPU_CFLAGS_powerpc64:=-mcpu=powerpc64
   endif
   ifeq ($(ARCH),sparc)
-- 
2.32.0


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


Re: [PATCH v2] realtek: reset both ethernet NIC and queues

2021-11-24 Thread Stijn Tintel
On 18/11/2021 19:39, Sander Vanheule wrote:
> Recent versions of Realtek's SDK reset both the ethernet NIC and queues
> (SW_NIC_RST and SW_Q_RST bits) when initialising the hardware.
>
> Furthermore, when issuing a CPU reset on the Zyxel GS1900-8 (not
> supported by any current driver), the networking part of the SoC is not
> reset. This leads to unresponsive network after the restart. By
> resetting both the ethernet NIC and queues, networking always comes up
> reliably.
>
Thanks, will merge this soon.

Tested-by: Stijn Tintel 


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


Re: [PATCH v4 0/5] realtek: Use WDT for system restart

2021-11-24 Thread Stijn Tintel
On 14/11/2021 20:45, Sander Vanheule wrote:
> Backport and enable the Realtek Otto watchdog driver for enhanced system
> reliability. The watchdog driver can also be used to restart the system,
> but that requires the _machine_restart to be removed.
>
> Removing _machine_restart has the added benefit of enabling the use of other
> restart handlers in addition to the watchdog restart, such as gpio-restart,
> which may be more reliable than the SoCs internal reset circuitry. Removing 
> the
> override also brings the current target closer to upstream, which will become
> relevant when switching to the next LTS kernel.
>
> This series contains the watchdog driver as currently submitted upstream,
> without the devicetree bindings. If the driver gets accepted before this 
> series
> is merged, I can already update it with the final version. Otherwise, a
> follow-up will be sent to replace the patch.
>
> The WDT driver was previously tested on my Netgear GS110TPPv1, Zyxel GS1900-8,
> and Zyxel XGS1250-12. Testers with other devices should ensure that their
> system can still restart after applying the complete series.
>
> Main changes in v4:
> - Use cold restart (full SoC reset) on all devices by default

Thanks, will merge these soon.

Tested-by: Stijn Tintel 


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


Re: [PATCH 2/5] mac80211: add patch for BCM43436 firmware

2021-11-20 Thread Stijn Tintel
On 20/11/2021 15:10, Rafał Miłecki wrote:
> On 20.11.2021 04:41, Stijn Tintel wrote:
>> This chip is used in the Raspberry Pi Zero 2.
>>
>> Signed-off-by: Stijn Tintel 
>
> This trivial patch could easily be upstreamed, please send it to
> linux-wireless@.

This is pointless without the firmware being available in
linux-firmware.git. Since I can't submit that firmware, I rather not
submit this patch either.

Stijn


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


[PATCH 5/5] bcm27xx: add support for Raspberry Pi Zero 2

2021-11-19 Thread Stijn Tintel
Updating the entire patchset from Raspberry Pi upstream would also add
the Raspberry Pi Zero 2 patch, but as that is a cumbersome process, just
import the required patch. Prefix it with 950 so it is clear that this
patch comes from the same source, but use a high number for the 2nd part
of the prefix so that it's clear the patch is not in the upstream order.

Signed-off-by: Stijn Tintel 
---
 .../bcm27xx/base-files/etc/board.d/02_network |   1 +
 target/linux/bcm27xx/base-files/etc/diag.sh   |   1 +
 target/linux/bcm27xx/image/Makefile   |  18 +-
 ...0-9900-ARM-dts-Add-Pi-Zero-2-Support.patch | 229 ++
 4 files changed, 243 insertions(+), 6 deletions(-)
 create mode 100644 
target/linux/bcm27xx/patches-5.10/950-9900-ARM-dts-Add-Pi-Zero-2-Support.patch

diff --git a/target/linux/bcm27xx/base-files/etc/board.d/02_network 
b/target/linux/bcm27xx/base-files/etc/board.d/02_network
index f279941e1e..b4d73bf967 100644
--- a/target/linux/bcm27xx/base-files/etc/board.d/02_network
+++ b/target/linux/bcm27xx/base-files/etc/board.d/02_network
@@ -23,6 +23,7 @@ raspberrypi,4-model-b)
ucidef_set_interface_lan "eth0"
;;
 
+raspberrypi,model-zero-2 |\
 raspberrypi,model-zero-w)
ucidef_set_interface_lan "wlan0"
;;
diff --git a/target/linux/bcm27xx/base-files/etc/diag.sh 
b/target/linux/bcm27xx/base-files/etc/diag.sh
index f5e9ee0111..2a10aa9bdb 100644
--- a/target/linux/bcm27xx/base-files/etc/diag.sh
+++ b/target/linux/bcm27xx/base-files/etc/diag.sh
@@ -20,6 +20,7 @@ set_state() {
raspberrypi,3-compute-module |\
raspberrypi,model-b |\
raspberrypi,model-zero |\
+   raspberrypi,model-zero-2 |\
raspberrypi,model-zero-w)
status_led="led0"
;;
diff --git a/target/linux/bcm27xx/image/Makefile 
b/target/linux/bcm27xx/image/Makefile
index f0c3ae1272..3165a2d1e5 100644
--- a/target/linux/bcm27xx/image/Makefile
+++ b/target/linux/bcm27xx/image/Makefile
@@ -96,14 +96,17 @@ define Device/rpi-2
bcm2709-rpi-2-b bcm2710-rpi-2-b \
bcm2710-rpi-3-b bcm2710-rpi-3-b-plus \
bcm2711-rpi-4-b bcm2711-rpi-400 \
-   bcm2710-rpi-cm3 bcm2711-rpi-cm4
+   bcm2710-rpi-cm3 bcm2711-rpi-cm4 \
+   bcm2710-rpi-zero-2
   SUPPORTED_DEVICES := \
-   rpi-2-b rpi-3-b rpi-3-b-plus rpi-cm \
+   rpi-2-b rpi-3-b rpi-3-b-plus rpi-cm rpi-zero-2 \
raspberrypi,2-model-b raspberrypi,2-model-b-rev2 \
raspberrypi,3-model-b raspberrypi,3-model-b-plus \
raspberrypi,3-compute-module raspberrypi,compute-module-3 \
-   raspberrypi,400 raspberrypi,4-compute-module raspberrypi,4-model-b
+   raspberrypi,400 raspberrypi,4-compute-module raspberrypi,4-model-b \
+   raspberrypi,model-zero-2
   DEVICE_PACKAGES := \
+   bcm43436-firmware \
cypress-firmware-43430-sdio \
cypress-nvram-43430-sdio-rpi-3b \
cypress-firmware-43455-sdio \
@@ -126,13 +129,16 @@ define Device/rpi-3
   DEVICE_DTS := \
broadcom/bcm2710-rpi-2-b \
broadcom/bcm2710-rpi-3-b broadcom/bcm2710-rpi-3-b-plus \
-   broadcom/bcm2710-rpi-cm3
+   broadcom/bcm2710-rpi-cm3 \
+   broadcom/bcm2710-rpi-zero-2
   SUPPORTED_DEVICES := \
-   rpi-3-b rpi-3-b-plus \
+   rpi-3-b rpi-3-b-plus rpi-zero-2 \
raspberrypi,2-model-b-rev2 \
raspberrypi,3-model-b raspberrypi,3-model-b-plus \
-   raspberrypi,3-compute-module raspberrypi,compute-module-3
+   raspberrypi,3-compute-module raspberrypi,compute-module-3 \
+   raspberrypi,model-zero-2
   DEVICE_PACKAGES := \
+   bcm43436-firmware \
cypress-firmware-43430-sdio \
cypress-nvram-43430-sdio-rpi-3b \
cypress-firmware-43455-sdio \
diff --git 
a/target/linux/bcm27xx/patches-5.10/950-9900-ARM-dts-Add-Pi-Zero-2-Support.patch
 
b/target/linux/bcm27xx/patches-5.10/950-9900-ARM-dts-Add-Pi-Zero-2-Support.patch
new file mode 100644
index 00..6c37045c80
--- /dev/null
+++ 
b/target/linux/bcm27xx/patches-5.10/950-9900-ARM-dts-Add-Pi-Zero-2-Support.patch
@@ -0,0 +1,229 @@
+From 84dc624be6ae704fdb3c413b7d86315cf49fbb0b Mon Sep 17 00:00:00 2001
+From: Phil Elwell 
+Date: Thu, 9 Sep 2021 10:37:15 +0100
+Subject: [PATCH] ARM: dts: Add Pi Zero 2 support
+
+Signed-off-by: Phil Elwell 
+---
+ arch/arm/boot/dts/Makefile|   1 +
+ arch/arm/boot/dts/bcm2710-rpi-zero-2.dts  | 177 ++
+ arch/arm64/boot/dts/broadcom/Makefile |   1 +
+ .../boot/dts/broadcom/bcm2710-rpi-zero-2.dts  |   1 +
+ 4 files changed, 180 insertions(+)
+ create mode 100644 arch/arm/boot/dts/bcm2710-rpi-zero-2.dts
+ create mode 100644 arch/arm64/boot/dts/broadcom/bcm2710-rpi-zero-2.dts
+
+diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
+index 12cd8bf582e1b..66956d0f2c187 100644
+--- a/arch/arm/boot/dts/Makefile
 b/arch/arm/boot/dts/Makefile
+@@ -7,6 +7,7 @@ dtb-$(CONFIG_ARCH_BCM2835) += \
+   bcm2708-rpi-cm.dtb 

[PATCH 0/5] add support for Raspberry Pi Zero 2

2021-11-19 Thread Stijn Tintel
This series adds support for the new Raspberry Pi Zero 2. I've been
running it on mine for 10 days.

Stijn Tintel (5):
  cypress-firmware: update URL
  mac80211: add patch for BCM43436 firmware
  bcm43436-firmware: new package
  bcm27xx-gpu-fw: bump to git HEAD
  bcm27xx: add support for Raspberry Pi Zero 2

 package/firmware/bcm43436-firmware/Makefile   |  36 +++
 package/firmware/cypress-firmware/Makefile|   2 +-
 package/kernel/bcm27xx-gpu-fw/Makefile|  30 +--
 ...ac-BCM43436-needs-dedicated-firmware.patch |  29 +++
 .../bcm27xx/base-files/etc/board.d/02_network |   1 +
 target/linux/bcm27xx/base-files/etc/diag.sh   |   1 +
 target/linux/bcm27xx/image/Makefile   |  18 +-
 ...0-9900-ARM-dts-Add-Pi-Zero-2-Support.patch | 229 ++
 8 files changed, 324 insertions(+), 22 deletions(-)
 create mode 100644 package/firmware/bcm43436-firmware/Makefile
 create mode 100644 
package/kernel/mac80211/patches/brcm/865-brcmfmac-BCM43436-needs-dedicated-firmware.patch
 create mode 100644 
target/linux/bcm27xx/patches-5.10/950-9900-ARM-dts-Add-Pi-Zero-2-Support.patch

-- 
2.32.0


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


[PATCH 4/5] bcm27xx-gpu-fw: bump to git HEAD

2021-11-19 Thread Stijn Tintel
Signed-off-by: Stijn Tintel 
---
 package/kernel/bcm27xx-gpu-fw/Makefile | 30 +-
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/package/kernel/bcm27xx-gpu-fw/Makefile 
b/package/kernel/bcm27xx-gpu-fw/Makefile
index b99912542b..faca1777fa 100644
--- a/package/kernel/bcm27xx-gpu-fw/Makefile
+++ b/package/kernel/bcm27xx-gpu-fw/Makefile
@@ -2,8 +2,8 @@ include $(TOPDIR)/rules.mk
 include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=bcm27xx-gpu-fw
-PKG_VERSION:=2021-08-19
-PKG_RELEASE:=25e2b597ebfb2495eab4816a276758dcc6ea21f1
+PKG_VERSION:=2021-11-08
+PKG_RELEASE:=fa9a00624e7d5d3dcdb297dff132dc32cc2d9a25
 
 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)/rpi-firmware-$(PKG_RELEASE)
 
@@ -26,7 +26,7 @@ define Download/bootcode_bin
   FILE:=$(RPI_FIRMWARE_FILE)-bootcode.bin
   URL:=$(RPI_FIRMWARE_URL)
   URL_FILE:=bootcode.bin
-  HASH:=36fba28838867f26670a0cd1de340da62e13171cfdec0e7822737e849b3c0681
+  HASH:=2f0ca5a15006c1fb3960858af2b8bfde5f04cab2a0cb834b70a1f2c6f1a76067
 endef
 $(eval $(call Download,bootcode_bin))
 
@@ -34,7 +34,7 @@ define Download/fixup_dat
   FILE:=$(RPI_FIRMWARE_FILE)-fixup.dat
   URL:=$(RPI_FIRMWARE_URL)
   URL_FILE:=fixup.dat
-  HASH:=b06aa43aa668d6982de66044299d1b0dd6b449ec321dd83742aa1eb68774e15b
+  HASH:=7bf95d9c1eb48a021e62ec8160576364bb3e0eaa03924ec5bee73a1fccabcec6
 endef
 $(eval $(call Download,fixup_dat))
 
@@ -42,7 +42,7 @@ define Download/fixup_cd_dat
   FILE:=$(RPI_FIRMWARE_FILE)-fixup_cd.dat
   URL:=$(RPI_FIRMWARE_URL)
   URL_FILE:=fixup_cd.dat
-  HASH:=fff4fd9fbb691100be46269f554acd866eac8cfef39082e03ac12f70fbfe9d95
+  HASH:=1f1fa3364f0a560f44862be8f14caca54d096f32a4a9362dc9ae0a80c39bcf69
 endef
 $(eval $(call Download,fixup_cd_dat))
 
@@ -50,7 +50,7 @@ define Download/fixup_x_dat
   FILE:=$(RPI_FIRMWARE_FILE)-fixup_x.dat
   URL:=$(RPI_FIRMWARE_URL)
   URL_FILE:=fixup_x.dat
-  HASH:=d74f97ae37cd476e6d4c8e466c3013be49e891e63b9aabc0c9b7637d85068cd0
+  HASH:=6ca7a7bca3eccd2194371be55e84b815e7dc49dde315851633fd2aaebd6a9cdf
 endef
 $(eval $(call Download,fixup_x_dat))
 
@@ -58,7 +58,7 @@ define Download/fixup4_dat
   FILE:=$(RPI_FIRMWARE_FILE)-fixup4.dat
   URL:=$(RPI_FIRMWARE_URL)
   URL_FILE:=fixup4.dat
-  HASH:=a607f4dc3000c188f8daaa3417c70a9e5ecc039fae36ba46807c00294f89cd24
+  HASH:=6d594ef2479913c7debfe1831412670839fb10c7b035317d6e5439ec892049c7
 endef
 $(eval $(call Download,fixup4_dat))
 
@@ -66,7 +66,7 @@ define Download/fixup4cd_dat
   FILE:=$(RPI_FIRMWARE_FILE)-fixup4cd.dat
   URL:=$(RPI_FIRMWARE_URL)
   URL_FILE:=fixup4cd.dat
-  HASH:=fff4fd9fbb691100be46269f554acd866eac8cfef39082e03ac12f70fbfe9d95
+  HASH:=1f1fa3364f0a560f44862be8f14caca54d096f32a4a9362dc9ae0a80c39bcf69
 endef
 $(eval $(call Download,fixup4cd_dat))
 
@@ -74,7 +74,7 @@ define Download/fixup4x_dat
   FILE:=$(RPI_FIRMWARE_FILE)-fixup4x.dat
   URL:=$(RPI_FIRMWARE_URL)
   URL_FILE:=fixup4x.dat
-  HASH:=14ba09cba83d82a158481a7267fad06ada73c26c3a27dfd34694955f11ba6e27
+  HASH:=f832f37176fbdab5b87ab3852f9eef9298dfbfaa62cb842f1b8df9748cbea52e
 endef
 $(eval $(call Download,fixup4x_dat))
 
@@ -82,7 +82,7 @@ define Download/start_elf
   FILE:=$(RPI_FIRMWARE_FILE)-start.elf
   URL:=$(RPI_FIRMWARE_URL)
   URL_FILE:=start.elf
-  HASH:=8bee170c56529bf1666ad4afdd18ae18c7123e7a2fd30e2992cd0d9a01fa63ee
+  HASH:=3793ee113c754937b99193fe76924b31bbed52d27b913557b661fa9e2a3bd54c
 endef
 $(eval $(call Download,start_elf))
 
@@ -90,7 +90,7 @@ define Download/start_cd_elf
   FILE:=$(RPI_FIRMWARE_FILE)-start_cd.elf
   URL:=$(RPI_FIRMWARE_URL)
   URL_FILE:=start_cd.elf
-  HASH:=27d9354ff1af79a521527a288fe736f7337f91bca12bbc177c80e29dbbef0ffd
+  HASH:=3e6913e421c14c39dd6682883e6e5ff21b2971bab05eaa47f4af0c8a07e668a6
 endef
 $(eval $(call Download,start_cd_elf))
 
@@ -98,7 +98,7 @@ define Download/start_x_elf
   FILE:=$(RPI_FIRMWARE_FILE)-start_x.elf
   URL:=$(RPI_FIRMWARE_URL)
   URL_FILE:=start_x.elf
-  HASH:=499bfdf3deba7bb0a033d2a4487b7f05bce45de2692c7c6dabc4a456237fd438
+  HASH:=638955b326294e857553ef51841d8d5f076303af84a9be39d63a53c87871bb30
 endef
 $(eval $(call Download,start_x_elf))
 
@@ -106,7 +106,7 @@ define Download/start4_elf
   FILE:=$(RPI_FIRMWARE_FILE)-start4.elf
   URL:=$(RPI_FIRMWARE_URL)
   URL_FILE:=start4.elf
-  HASH:=158bf783090223626cf45794bf679a3fadbf64bba55b76e3349b94e01be34202
+  HASH:=b432da6622feb39887bf4d3d7fb5f8ff7637ddd8c708c31d12dd114da55bc524
 endef
 $(eval $(call Download,start4_elf))
 
@@ -114,7 +114,7 @@ define Download/start4cd_elf
   FILE:=$(RPI_FIRMWARE_FILE)-start4cd.elf
   URL:=$(RPI_FIRMWARE_URL)
   URL_FILE:=start4cd.elf
-  HASH:=c4912701f620cdd9e44bbacbfc4adb4be1b6fb7ccf81f6029ce2115511970cc0
+  HASH:=8708b12510adb7fae03fe17110fde2612d7fb41a25cebccb22c2967ff3221c94
 endef
 $(eval $(call Download,start4cd_elf))
 
@@ -122,7 +122,7 @@ define Download/start4x_elf
   FILE:=$(RPI_FIRMWARE_FILE)-start4x.elf
   URL:=$(RPI_FIRMWARE_URL)
   URL_FILE:=start4x.elf
-  HASH:=3eb1adb5dfef21da0a16679ef65314a64196a67c6fca3422df8bc721d6b6fa94
+  HASH

[PATCH 3/5] bcm43436-firmware: new package

2021-11-19 Thread Stijn Tintel
This package contains the firmware for the Wi-Fi chip used in the
Raspberry Pi Zero 2. This firmware is not available in
linux-firmware.git, nor in the latest Cypress Linux Wi-Fi archive.

Signed-off-by: Stijn Tintel 
---
 package/firmware/bcm43436-firmware/Makefile | 36 +
 1 file changed, 36 insertions(+)
 create mode 100644 package/firmware/bcm43436-firmware/Makefile

diff --git a/package/firmware/bcm43436-firmware/Makefile 
b/package/firmware/bcm43436-firmware/Makefile
new file mode 100644
index 00..4fec44bf15
--- /dev/null
+++ b/package/firmware/bcm43436-firmware/Makefile
@@ -0,0 +1,36 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=bcm43436-firmware
+PKG_SOURCE_DATE:=2021-11-02
+PKG_SOURCE_VERSION:=54ffdd6e2ea6055d46656b78e148fe7def3ec9d8
+PKG_MIRROR_HASH:=
+PKG_RELEASE:=1
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/RPi-Distro/firmware-nonfree.git
+
+PKG_FLAGS:=nonshared
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/bcm43436-firmware
+  TITLE:=BCM43436 firmware
+  SECTION:=firmware
+  CATEGORY:=Firmware
+  DEPENDS:=@TARGET_bcm27xx
+  URL:=https://github.com/RPi-Distro/firmware-nonfree
+  PROVIDES:=brcmfmac-firmware-43436-sdio
+endef
+
+define Build/Compile
+   true
+endef
+
+define Package/bcm43436-firmware/install
+   $(INSTALL_DIR) $(1)/lib/firmware/brcm
+   $(INSTALL_DATA) \
+   $(PKG_BUILD_DIR)/brcm/brcmfmac43436* \
+   $(1)/lib/firmware/brcm
+endef
+
+$(eval $(call BuildPackage,bcm43436-firmware))
-- 
2.32.0


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


[PATCH 1/5] cypress-firmware: update URL

2021-11-19 Thread Stijn Tintel
Cypress was acquired by Infineon and the URL is no longer valid.

Signed-off-by: Stijn Tintel 
---
 package/firmware/cypress-firmware/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package/firmware/cypress-firmware/Makefile 
b/package/firmware/cypress-firmware/Makefile
index d4ace8509a..19bb8af9e8 100644
--- a/package/firmware/cypress-firmware/Makefile
+++ b/package/firmware/cypress-firmware/Makefile
@@ -25,7 +25,7 @@ include $(INCLUDE_DIR)/package.mk
 define Package/cypress-firmware-default
   SECTION:=firmware
   CATEGORY:=Firmware
-  URL:=https://community.cypress.com/community/linux
+  
URL:=https://community.infineon.com/t5/Wi-Fi-Bluetooth-for-Linux/bd-p/WiFiBluetoothLinux
 endef
 
 define Build/Compile
-- 
2.32.0


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


[PATCH 2/5] mac80211: add patch for BCM43436 firmware

2021-11-19 Thread Stijn Tintel
This chip is used in the Raspberry Pi Zero 2.

Signed-off-by: Stijn Tintel 
---
 ...ac-BCM43436-needs-dedicated-firmware.patch | 29 +++
 1 file changed, 29 insertions(+)
 create mode 100644 
package/kernel/mac80211/patches/brcm/865-brcmfmac-BCM43436-needs-dedicated-firmware.patch

diff --git 
a/package/kernel/mac80211/patches/brcm/865-brcmfmac-BCM43436-needs-dedicated-firmware.patch
 
b/package/kernel/mac80211/patches/brcm/865-brcmfmac-BCM43436-needs-dedicated-firmware.patch
new file mode 100644
index 00..d5e650dcb3
--- /dev/null
+++ 
b/package/kernel/mac80211/patches/brcm/865-brcmfmac-BCM43436-needs-dedicated-firmware.patch
@@ -0,0 +1,29 @@
+From 0a2690fa8c3a0b356a0cf5fc63c2428264ead0e7 Mon Sep 17 00:00:00 2001
+From: Phil Elwell 
+Date: Tue, 19 May 2020 09:46:12 +0100
+Subject: [PATCH] brcmfmac: BCM43436 needs dedicated firmware
+
+Signed-off-by: Phil Elwell 
+---
+ drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
 b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+@@ -615,6 +615,7 @@ BRCMF_FW_DEF(4335, "brcmfmac4335-sdio");
+ BRCMF_FW_DEF(43362, "brcmfmac43362-sdio");
+ BRCMF_FW_DEF(4339, "brcmfmac4339-sdio");
+ BRCMF_FW_DEF(43430A0, "brcmfmac43430a0-sdio");
++BRCMF_FW_DEF(43436, "brcmfmac43436-sdio");
+ /* Note the names are not postfixed with a1 for backward compatibility */
+ BRCMF_FW_CLM_DEF(43430A1, "brcmfmac43430-sdio");
+ BRCMF_FW_DEF(43430B0, "brcmfmac43430b0-sdio");
+@@ -649,6 +650,8 @@ static const struct brcmf_firmware_mappi
+   BRCMF_FW_ENTRY(BRCM_CC_4339_CHIP_ID, 0x, 4339),
+   BRCMF_FW_ENTRY(BRCM_CC_43430_CHIP_ID, 0x0001, 43430A0),
+   BRCMF_FW_ENTRY(BRCM_CC_43430_CHIP_ID, 0x0002, 43430A1),
++  BRCMF_FW_ENTRY(BRCM_CC_43430_CHIP_ID, 0x0004, 43436),
++  BRCMF_FW_ENTRY(BRCM_CC_43430_CHIP_ID, 0xFFFA, 43430A1),
+   BRCMF_FW_ENTRY(BRCM_CC_43430_CHIP_ID, 0xFFFC, 43430B0),
+   BRCMF_FW_ENTRY(BRCM_CC_4345_CHIP_ID, 0x0200, 43456),
+   BRCMF_FW_ENTRY(BRCM_CC_4345_CHIP_ID, 0xFDC0, 43455),
-- 
2.32.0


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


[PATCH 1/2] kernel: add missing UBSAN config symbols

2021-11-03 Thread Stijn Tintel
Enabling KERNEL_UBSAN exposes several missing symbols. Add new kernel
build options for UBSAN_BOUNDS and UBSAN_TRAP, disable CONFIG_TEST_UBSAN
in the generic kernel configs and enable CONFIG_UBSAN_MISC in generic
5.10 config. The latter symbol was removed in later kernels, so just set
it to the default value in 5.10 instead of adding a build option for it.

Fixes build failures with KERNEL_UBSAN enabled.

Signed-off-by: Stijn Tintel 
---
 config/Config-kernel.in  | 23 +++
 target/linux/generic/config-5.10 |  2 ++
 target/linux/generic/config-5.4  |  1 +
 3 files changed, 26 insertions(+)

diff --git a/config/Config-kernel.in b/config/Config-kernel.in
index dc249a6031..6758d278e7 100644
--- a/config/Config-kernel.in
+++ b/config/Config-kernel.in
@@ -114,6 +114,16 @@ config KERNEL_UBSAN_ALIGNMENT
  Enabling this option on architectures that support unaligned
  accesses may produce a lot of false positives.
 
+config KERNEL_UBSAN_BOUNDS
+   bool "Perform array index bounds checking"
+   depends on KERNEL_UBSAN
+   help
+ This option enables detection of directly indexed out of bounds array
+ accesses, where the array size is known at compile time. Note that
+ this does not protect array overflows via bad calls to the
+ {str,mem}*cpy() family of functions (that is addressed by
+ FORTIFY_SOURCE).
+
 config KERNEL_UBSAN_NULL
bool "Enable checking of null pointers"
depends on KERNEL_UBSAN
@@ -121,6 +131,19 @@ config KERNEL_UBSAN_NULL
  This option enables detection of memory accesses via a
  null pointer.
 
+config KERNEL_UBSAN_TRAP
+   bool "On Sanitizer warnings, abort the running kernel code"
+   depends on KERNEL_UBSAN
+   help
+ Building kernels with Sanitizer features enabled tends to grow the
+ kernel size by around 5%, due to adding all the debugging text on
+ failure paths. To avoid this, Sanitizer instrumentation can just
+ issue a trap. This reduces the kernel size overhead but turns all
+ warnings (including potentially harmless conditions) into full
+ exceptions that abort the running kernel code (regardless of context,
+ locks held, etc), which may destabilize the system. For some system
+ builders this is an acceptable trade-off.
+
 config KERNEL_KASAN
bool "Compile the kernel with KASan: runtime memory debugger"
select KERNEL_SLUB_DEBUG
diff --git a/target/linux/generic/config-5.10 b/target/linux/generic/config-5.10
index 7b952e8ca8..83004d0879 100644
--- a/target/linux/generic/config-5.10
+++ b/target/linux/generic/config-5.10
@@ -6082,6 +6082,7 @@ CONFIG_TCP_CONG_CUBIC=y
 # CONFIG_TEST_STRING_HELPERS is not set
 # CONFIG_TEST_STRSCPY is not set
 # CONFIG_TEST_SYSCTL is not set
+# CONFIG_TEST_UBSAN is not set
 # CONFIG_TEST_UDELAY is not set
 # CONFIG_TEST_USER_COPY is not set
 # CONFIG_TEST_UUID is not set
@@ -6348,6 +6349,7 @@ CONFIG_UBIFS_FS_ZLIB=y
 CONFIG_UBIFS_FS_ZSTD=y
 # CONFIG_UBSAN is not set
 CONFIG_UBSAN_ALIGNMENT=y
+CONFIG_UBSAN_MISC=y
 # CONFIG_UCB1400_CORE is not set
 # CONFIG_UCSI is not set
 # CONFIG_UDF_FS is not set
diff --git a/target/linux/generic/config-5.4 b/target/linux/generic/config-5.4
index c44e9cf40b..bf2b462529 100644
--- a/target/linux/generic/config-5.4
+++ b/target/linux/generic/config-5.4
@@ -5631,6 +5631,7 @@ CONFIG_TCP_CONG_CUBIC=y
 # CONFIG_TEST_STRING_HELPERS is not set
 # CONFIG_TEST_STRSCPY is not set
 # CONFIG_TEST_SYSCTL is not set
+# CONFIG_TEST_UBSAN is not set
 # CONFIG_TEST_UDELAY is not set
 # CONFIG_TEST_USER_COPY is not set
 # CONFIG_TEST_UUID is not set
-- 
2.32.0


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


[PATCH 2/2] kernel: add missing KASAN config symbols

2021-11-03 Thread Stijn Tintel
Enabling KERNEL_KASAN exposes several missing symbols. As KASAN_SW_TAGS
is only implemented for arm64 CPUs and requires clang, it doesn't make
sense to make this a build option so just default to KASAN_GENERIC and
disable KASAN_SW_TAGS.

While at it, disable TEST_KASAN_MODULE in the generic 5.10 config.

Fixes build failures with KERNEL_KASAN enabled.

Signed-off-by: Stijn Tintel 
---
 config/Config-kernel.in  | 7 +++
 target/linux/generic/config-5.10 | 1 +
 2 files changed, 8 insertions(+)

diff --git a/config/Config-kernel.in b/config/Config-kernel.in
index 6758d278e7..902e211ea1 100644
--- a/config/Config-kernel.in
+++ b/config/Config-kernel.in
@@ -170,6 +170,13 @@ config KERNEL_KASAN_EXTRA
  compile time.
  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81715 has more
 
+if KERNEL_KASAN
+   config KERNEL_KASAN_GENERIC
+   def_bool y
+
+   config KERNEL_KASAN_SW_TAGS
+   def_bool n
+endif
 
 choice
prompt "Instrumentation type"
diff --git a/target/linux/generic/config-5.10 b/target/linux/generic/config-5.10
index 83004d0879..ddcf083a7d 100644
--- a/target/linux/generic/config-5.10
+++ b/target/linux/generic/config-5.10
@@ -6064,6 +6064,7 @@ CONFIG_TCP_CONG_CUBIC=y
 # CONFIG_TEST_HASH is not set
 # CONFIG_TEST_HEXDUMP is not set
 # CONFIG_TEST_IDA is not set
+# CONFIG_TEST_KASAN_MODULE is not set
 # CONFIG_TEST_KMOD is not set
 # CONFIG_TEST_KSTRTOX is not set
 # CONFIG_TEST_LIST_SORT is not set
-- 
2.32.0


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


[PATCH] nftables: bump to 1.0.0

2021-10-14 Thread Stijn Tintel
This introduces support for hardware flow offloading, which was added in
in nftables 0.9.9.

Signed-off-by: Stijn Tintel 
---
 package/network/utils/nftables/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/package/network/utils/nftables/Makefile 
b/package/network/utils/nftables/Makefile
index 7830596e84..8ead30a127 100644
--- a/package/network/utils/nftables/Makefile
+++ b/package/network/utils/nftables/Makefile
@@ -7,12 +7,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=nftables
-PKG_VERSION:=0.9.6
-PKG_RELEASE:=2
+PKG_VERSION:=1.0.0
+PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=https://netfilter.org/projects/$(PKG_NAME)/files
-PKG_HASH:=68d6fdfe8ab02303e6b1f13968a4022da5b0120110eaee3233d806857937b66e
+PKG_HASH:=58bf547daf967a2b88ecb4f425f126006ebde22711db806b25c1d6cf84fe45f4
 PKG_MAINTAINER:=
 PKG_LICENSE:=GPL-2.0
 
-- 
2.32.0


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


[PATCH] nftables: bump to 1.0.0

2021-10-14 Thread Stijn Tintel
This introduces support for hardware flow offloading, which was added in
in nftables 0.9.9.

Signed-off-by: Stijn Tintel 
---
 package/network/utils/nftables/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/package/network/utils/nftables/Makefile 
b/package/network/utils/nftables/Makefile
index 7830596e84..8ead30a127 100644
--- a/package/network/utils/nftables/Makefile
+++ b/package/network/utils/nftables/Makefile
@@ -7,12 +7,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=nftables
-PKG_VERSION:=0.9.6
-PKG_RELEASE:=2
+PKG_VERSION:=1.0.0
+PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=https://netfilter.org/projects/$(PKG_NAME)/files
-PKG_HASH:=68d6fdfe8ab02303e6b1f13968a4022da5b0120110eaee3233d806857937b66e
+PKG_HASH:=58bf547daf967a2b88ecb4f425f126006ebde22711db806b25c1d6cf84fe45f4
 PKG_MAINTAINER:=
 PKG_LICENSE:=GPL-2.0
 
-- 
2.32.0


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


Re: Release goals for 22.XX

2021-09-30 Thread Stijn Tintel
On 30/09/2021 01:19, Nick wrote:
> On 9/29/21 22:28, Hauke Mehrtens wrote:
>
>> kernel 5.10:
>> We should get all targets to kernel 5.10. All targets which are not
>> on kernel 5.10 when we branch off should get removed.
> Kernel 5.15 could be also a LTS Kernel that should be released in the
> end of October? Why not aiming for it if we plan to release in 2022?

This would undoubtedly delay the next release, as we've seen in the
past. We don't even have all targets on 5.10, which was released roughly
9 months ago. You do the math. If we target 5.15, I doubt we'll even see
a release in 2022.

Stijn


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


[PATCH] bcm27xx: add RPI_AXIPERF symbol

2021-09-30 Thread Stijn Tintel
When KERNEL_PERF_EVENTS is enabled in OpenWrt, or PERF_EVENTS in the
kernel config, the RPI_AXIPERF is exposed. Add it to the subtarget
kernel configs to avoid build failures.

Signed-off-by: Stijn Tintel 
---
 target/linux/bcm27xx/bcm2708/config-5.10 | 1 +
 target/linux/bcm27xx/bcm2708/config-5.4  | 1 +
 target/linux/bcm27xx/bcm2709/config-5.10 | 1 +
 target/linux/bcm27xx/bcm2709/config-5.4  | 1 +
 target/linux/bcm27xx/bcm2710/config-5.10 | 1 +
 target/linux/bcm27xx/bcm2710/config-5.4  | 1 +
 target/linux/bcm27xx/bcm2711/config-5.10 | 1 +
 target/linux/bcm27xx/bcm2711/config-5.4  | 1 +
 8 files changed, 8 insertions(+)

diff --git a/target/linux/bcm27xx/bcm2708/config-5.10 
b/target/linux/bcm27xx/bcm2708/config-5.10
index 12567abb24..8e8ae51443 100644
--- a/target/linux/bcm27xx/bcm2708/config-5.10
+++ b/target/linux/bcm27xx/bcm2708/config-5.10
@@ -302,6 +302,7 @@ CONFIG_RESET_CONTROLLER=y
 # CONFIG_RESET_RASPBERRYPI is not set
 CONFIG_RESET_SIMPLE=y
 # CONFIG_RPIVID_MEM is not set
+# CONFIG_RPI_AXIPERF is not set
 # CONFIG_RPI_POE_POWER is not set
 CONFIG_SCSI=y
 # CONFIG_SCSI_LOWLEVEL is not set
diff --git a/target/linux/bcm27xx/bcm2708/config-5.4 
b/target/linux/bcm27xx/bcm2708/config-5.4
index 42203d2587..ea68858483 100644
--- a/target/linux/bcm27xx/bcm2708/config-5.4
+++ b/target/linux/bcm27xx/bcm2708/config-5.4
@@ -292,6 +292,7 @@ CONFIG_REGULATOR_FIXED_VOLTAGE=y
 CONFIG_RESET_CONTROLLER=y
 CONFIG_RESET_SIMPLE=y
 # CONFIG_RPIVID_MEM is not set
+# CONFIG_RPI_AXIPERF is not set
 CONFIG_SCSI=y
 # CONFIG_SCSI_LOWLEVEL is not set
 # CONFIG_SCSI_PROC_FS is not set
diff --git a/target/linux/bcm27xx/bcm2709/config-5.10 
b/target/linux/bcm27xx/bcm2709/config-5.10
index 3986cffec2..928f17c974 100644
--- a/target/linux/bcm27xx/bcm2709/config-5.10
+++ b/target/linux/bcm27xx/bcm2709/config-5.10
@@ -379,6 +379,7 @@ CONFIG_RESET_RASPBERRYPI=y
 CONFIG_RESET_SIMPLE=y
 CONFIG_RFS_ACCEL=y
 # CONFIG_RPIVID_MEM is not set
+# CONFIG_RPI_AXIPERF is not set
 # CONFIG_RPI_POE_POWER is not set
 CONFIG_RPS=y
 CONFIG_RWSEM_SPIN_ON_OWNER=y
diff --git a/target/linux/bcm27xx/bcm2709/config-5.4 
b/target/linux/bcm27xx/bcm2709/config-5.4
index 4392674371..4e4ef63ad0 100644
--- a/target/linux/bcm27xx/bcm2709/config-5.4
+++ b/target/linux/bcm27xx/bcm2709/config-5.4
@@ -378,6 +378,7 @@ CONFIG_RESET_CONTROLLER=y
 CONFIG_RESET_SIMPLE=y
 CONFIG_RFS_ACCEL=y
 # CONFIG_RPIVID_MEM is not set
+# CONFIG_RPI_AXIPERF is not set
 CONFIG_RPS=y
 CONFIG_RWSEM_SPIN_ON_OWNER=y
 CONFIG_SCSI=y
diff --git a/target/linux/bcm27xx/bcm2710/config-5.10 
b/target/linux/bcm27xx/bcm2710/config-5.10
index 4d111eb4c5..3c4c46f85a 100644
--- a/target/linux/bcm27xx/bcm2710/config-5.10
+++ b/target/linux/bcm27xx/bcm2710/config-5.10
@@ -371,6 +371,7 @@ CONFIG_RESET_SIMPLE=y
 CONFIG_RFS_ACCEL=y
 CONFIG_RODATA_FULL_DEFAULT_ENABLED=y
 # CONFIG_RPIVID_MEM is not set
+# CONFIG_RPI_AXIPERF is not set
 # CONFIG_RPI_POE_POWER is not set
 CONFIG_RPS=y
 CONFIG_RWSEM_SPIN_ON_OWNER=y
diff --git a/target/linux/bcm27xx/bcm2710/config-5.4 
b/target/linux/bcm27xx/bcm2710/config-5.4
index 201b6fc2d6..b79c20fc89 100644
--- a/target/linux/bcm27xx/bcm2710/config-5.4
+++ b/target/linux/bcm27xx/bcm2710/config-5.4
@@ -375,6 +375,7 @@ CONFIG_RESET_SIMPLE=y
 CONFIG_RFS_ACCEL=y
 CONFIG_RODATA_FULL_DEFAULT_ENABLED=y
 # CONFIG_RPIVID_MEM is not set
+# CONFIG_RPI_AXIPERF is not set
 CONFIG_RPS=y
 CONFIG_RWSEM_SPIN_ON_OWNER=y
 CONFIG_SCSI=y
diff --git a/target/linux/bcm27xx/bcm2711/config-5.10 
b/target/linux/bcm27xx/bcm2711/config-5.10
index 77254279ea..188d5a41ec 100644
--- a/target/linux/bcm27xx/bcm2711/config-5.10
+++ b/target/linux/bcm27xx/bcm2711/config-5.10
@@ -383,6 +383,7 @@ CONFIG_RESET_SIMPLE=y
 CONFIG_RFS_ACCEL=y
 CONFIG_RODATA_FULL_DEFAULT_ENABLED=y
 # CONFIG_RPIVID_MEM is not set
+# CONFIG_RPI_AXIPERF is not set
 # CONFIG_RPI_POE_POWER is not set
 CONFIG_RPS=y
 CONFIG_RWSEM_SPIN_ON_OWNER=y
diff --git a/target/linux/bcm27xx/bcm2711/config-5.4 
b/target/linux/bcm27xx/bcm2711/config-5.4
index 25af3338eb..258f29989f 100644
--- a/target/linux/bcm27xx/bcm2711/config-5.4
+++ b/target/linux/bcm27xx/bcm2711/config-5.4
@@ -387,6 +387,7 @@ CONFIG_RESET_SIMPLE=y
 CONFIG_RFS_ACCEL=y
 CONFIG_RODATA_FULL_DEFAULT_ENABLED=y
 # CONFIG_RPIVID_MEM is not set
+# CONFIG_RPI_AXIPERF is not set
 CONFIG_RPS=y
 CONFIG_RWSEM_SPIN_ON_OWNER=y
 CONFIG_SCSI=y
-- 
2.32.0


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


  1   2   3   4   >