Re: [PATCH] packages: nvram: add NVRAM quirks for bcm53xx target

2022-05-03 Thread Jo-Philipp Wich
Hi,

> I think boot() would look better, but it would be good to keep this consistent
> with the bcm47xx code. Using boot() or start() does not make a big difference,
> boot() calls start() anyway.

an "/etc/init.d/whatever restart" will not execute boot(), which would be a
reason to prefer it over start() for code that is not meant to be (re)executed
by the user.

~ Jo



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


Re: ZTE MF286R modem support

2022-05-03 Thread Hauke Mehrtens

On 4/29/22 00:20, Lech Perczak wrote:

W dniu 2022-04-23 o 22:32, Hauke Mehrtens pisze:

On 4/16/22 22:26, Lech Perczak wrote:

Hello,

Recently my PR #9670 [1] which includes fixes needed to support 
built-in modem of ZTE MF286R router was merged to master. The 
(incomplete) support for MF286R landed together with MF286A before 
branching off 22.03 release.
I'd be grateful if fixes from [1] could be cherry-picked to 22.03, 
for MF286R to have full support in that release.


Required commits are c99013e, b2940bb, ed79578 and e02fb42, a67629b 
is optional, but would be beneficial if another variant of the modem 
is found, with different interface configuration - that may require 
to override the autodetection results. Also, skipping that patch can 
yield merge conflicts.


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



Hi,

I ported the changes to OpenWrt 22.03 branch. I will also add the new 
change you posted some hours ago.


Hauke


Hi Hauke,

Thanks for backporting these changes. I noticed that 
8a1003c5986514d7a78f78b3ee94003837d82582 is still missing on 22.03 
branch, so a kind reminder :-)


Kind regards,
Lech



Hi Lech,

Thanks for the hint, I cherry picked the commit at the weekend.

Hauke

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


Re: [PATCH] packages: nvram: add NVRAM quirks for bcm53xx target

2022-05-03 Thread Arınç ÜNAL
> On 3 May 2022, at 23:12, Hauke Mehrtens  wrote:
> 
> On 5/3/22 09:44, Arınç ÜNAL wrote:
>>> On 03/05/2022 10:20, Rafał Miłecki wrote:
>>> On 31.03.2022 21:19, Arınç ÜNAL wrote:
 Add NVRAM quirks script for the bcm53xx target. Split NVRAM quirks for the
 bcm47xx and bcm53xx targets. Move clear partialboot NVRAM quirk for Linksys
 EA9500 here. Add set wireless LED behaviour quirk for Asus RT-AC88U.
 
 Signed-off-by: Arınç ÜNAL 
 ---
   package/utils/nvram/Makefile  |  8 +++-
   .../files/{nvram.init => nvram-bcm47xx.init}  |  2 +-
   package/utils/nvram/files/nvram-bcm53xx.init  | 40 +++
   .../base-files/etc/init.d/clear_partialboot   | 13 --
   4 files changed, 47 insertions(+), 16 deletions(-)
   rename package/utils/nvram/files/{nvram.init => nvram-bcm47xx.init} (97%)
   create mode 100755 package/utils/nvram/files/nvram-bcm53xx.init
   delete mode 100755 
 target/linux/bcm53xx/base-files/etc/init.d/clear_partialboot
 
 diff --git a/package/utils/nvram/Makefile b/package/utils/nvram/Makefile
 index 863b304d0d..b957211283 100644
 --- a/package/utils/nvram/Makefile
 +++ b/package/utils/nvram/Makefile
 @@ -8,7 +8,7 @@
   include $(TOPDIR)/rules.mk
   PKG_NAME:=nvram
 -PKG_RELEASE:=10
 +PKG_RELEASE:=11
   PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
 @@ -44,7 +44,11 @@ define Package/nvram/install
   $(INSTALL_BIN) $(PKG_BUILD_DIR)/nvram $(1)/usr/sbin/
   ifneq ($(CONFIG_TARGET_bcm47xx),)
   $(INSTALL_DIR) $(1)/etc/init.d
 -$(INSTALL_BIN) ./files/nvram.init $(1)/etc/init.d/nvram
 +$(INSTALL_BIN) ./files/nvram-bcm47xx.init $(1)/etc/init.d/nvram
 +endif
 +ifneq ($(CONFIG_TARGET_bcm53xx),)
 +$(INSTALL_DIR) $(1)/etc/init.d
 +$(INSTALL_BIN) ./files/nvram-bcm53xx.init $(1)/etc/init.d/nvram
   endif
   endef
 diff --git a/package/utils/nvram/files/nvram.init 
 b/package/utils/nvram/files/nvram-bcm47xx.init
 similarity index 97%
 rename from package/utils/nvram/files/nvram.init
 rename to package/utils/nvram/files/nvram-bcm47xx.init
 index 467ab28195..c95933246c 100755
 --- a/package/utils/nvram/files/nvram.init
 +++ b/package/utils/nvram/files/nvram-bcm47xx.init
 @@ -1,7 +1,7 @@
   #!/bin/sh /etc/rc.common
   # NVRAM setup
   #
 -# This file handles the NVRAM quirks of various hardware.
 +# This file handles the NVRAM quirks of various hardware of the bcm47xx 
 target.
   START=02
   alias debug=${DEBUG:-:}
 diff --git a/package/utils/nvram/files/nvram-bcm53xx.init 
 b/package/utils/nvram/files/nvram-bcm53xx.init
 new file mode 100755
 index 00..d50917c776
 --- /dev/null
 +++ b/package/utils/nvram/files/nvram-bcm53xx.init
 @@ -0,0 +1,40 @@
 +#!/bin/sh /etc/rc.common
 +# NVRAM setup
 +#
 +# This file handles the NVRAM quirks of various hardware of the bcm53xx 
 target.
 +
 +START=02
 +
 +clear_partialboots() {
 +# clear partialboots
 +
 +case $(board_name) in
 +linksys,panamera)
 +COMMIT=1
 +nvram set partialboots=0
 +;;
 +esac
 +}
 +
 +set_wireless_led_behaviour() {
 +# set Broadcom wireless LED behaviour for both radios
 +# 0:ledbh9 -> Behaviour of 2.4GHz LED
 +# 1:ledbh9 -> Behaviour of 5GHz LED
 +# 0x7 makes the wireless LEDs on, when radios are enabled, and blink 
 when there's activity
 +
 +case $(board_name) in
 +asus,rt-ac88u)
 +COMMIT=1
 +nvram set 0:ledbh9=0x7 set 1:ledbh9=0x7
 +;;
 +esac
 +}
 +
 +start() {
 +. /lib/functions.sh
 +
 +clear_partialboots
 +set_wireless_led_behaviour
 +
 +[ "$COMMIT" = "1" ] && nvram commit
 +}
>>> 
>>> Do we want / need to switch from boot() to start()?
>>> 
>>> I don't have opinion, just making sure it's intentional.
>> Wiki says boot() is executed before start() which is usually used to turn on 
>> hardware. bcm47xx nvram initscript uses start() so it doesn't seem to 
>> matter. I tested the patch on my Asus RT-AC88U to make sure the initscript 
>> works fine.
>> https://openwrt.org/docs/techref/initscripts#other_functions
>> Arınç
> 
> I think boot() would look better, but it would be good to keep this 
> consistent with the bcm47xx code. Using boot() or start() does not make a big 
> difference, boot() calls start() anyway.
> 
> What about to also change the bcm47xx code to boot()?

Sure, why not. I’ll send v2.

Arınç

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


Re: [PATCH] packages: nvram: add NVRAM quirks for bcm53xx target

2022-05-03 Thread Hauke Mehrtens

On 5/3/22 09:44, Arınç ÜNAL wrote:

On 03/05/2022 10:20, Rafał Miłecki wrote:

On 31.03.2022 21:19, Arınç ÜNAL wrote:
Add NVRAM quirks script for the bcm53xx target. Split NVRAM quirks 
for the
bcm47xx and bcm53xx targets. Move clear partialboot NVRAM quirk for 
Linksys

EA9500 here. Add set wireless LED behaviour quirk for Asus RT-AC88U.

Signed-off-by: Arınç ÜNAL 
---
  package/utils/nvram/Makefile  |  8 +++-
  .../files/{nvram.init => nvram-bcm47xx.init}  |  2 +-
  package/utils/nvram/files/nvram-bcm53xx.init  | 40 +++
  .../base-files/etc/init.d/clear_partialboot   | 13 --
  4 files changed, 47 insertions(+), 16 deletions(-)
  rename package/utils/nvram/files/{nvram.init => nvram-bcm47xx.init} 
(97%)

  create mode 100755 package/utils/nvram/files/nvram-bcm53xx.init
  delete mode 100755 
target/linux/bcm53xx/base-files/etc/init.d/clear_partialboot


diff --git a/package/utils/nvram/Makefile b/package/utils/nvram/Makefile
index 863b304d0d..b957211283 100644
--- a/package/utils/nvram/Makefile
+++ b/package/utils/nvram/Makefile
@@ -8,7 +8,7 @@
  include $(TOPDIR)/rules.mk
  PKG_NAME:=nvram
-PKG_RELEASE:=10
+PKG_RELEASE:=11
  PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
@@ -44,7 +44,11 @@ define Package/nvram/install
  $(INSTALL_BIN) $(PKG_BUILD_DIR)/nvram $(1)/usr/sbin/
  ifneq ($(CONFIG_TARGET_bcm47xx),)
  $(INSTALL_DIR) $(1)/etc/init.d
-    $(INSTALL_BIN) ./files/nvram.init $(1)/etc/init.d/nvram
+    $(INSTALL_BIN) ./files/nvram-bcm47xx.init $(1)/etc/init.d/nvram
+endif
+ifneq ($(CONFIG_TARGET_bcm53xx),)
+    $(INSTALL_DIR) $(1)/etc/init.d
+    $(INSTALL_BIN) ./files/nvram-bcm53xx.init $(1)/etc/init.d/nvram
  endif
  endef
diff --git a/package/utils/nvram/files/nvram.init 
b/package/utils/nvram/files/nvram-bcm47xx.init

similarity index 97%
rename from package/utils/nvram/files/nvram.init
rename to package/utils/nvram/files/nvram-bcm47xx.init
index 467ab28195..c95933246c 100755
--- a/package/utils/nvram/files/nvram.init
+++ b/package/utils/nvram/files/nvram-bcm47xx.init
@@ -1,7 +1,7 @@
  #!/bin/sh /etc/rc.common
  # NVRAM setup
  #
-# This file handles the NVRAM quirks of various hardware.
+# This file handles the NVRAM quirks of various hardware of the 
bcm47xx target.

  START=02
  alias debug=${DEBUG:-:}
diff --git a/package/utils/nvram/files/nvram-bcm53xx.init 
b/package/utils/nvram/files/nvram-bcm53xx.init

new file mode 100755
index 00..d50917c776
--- /dev/null
+++ b/package/utils/nvram/files/nvram-bcm53xx.init
@@ -0,0 +1,40 @@
+#!/bin/sh /etc/rc.common
+# NVRAM setup
+#
+# This file handles the NVRAM quirks of various hardware of the 
bcm53xx target.

+
+START=02
+
+clear_partialboots() {
+    # clear partialboots
+
+    case $(board_name) in
+    linksys,panamera)
+    COMMIT=1
+    nvram set partialboots=0
+    ;;
+    esac
+}
+
+set_wireless_led_behaviour() {
+    # set Broadcom wireless LED behaviour for both radios
+    # 0:ledbh9 -> Behaviour of 2.4GHz LED
+    # 1:ledbh9 -> Behaviour of 5GHz LED
+    # 0x7 makes the wireless LEDs on, when radios are enabled, and 
blink when there's activity

+
+    case $(board_name) in
+    asus,rt-ac88u)
+    COMMIT=1
+    nvram set 0:ledbh9=0x7 set 1:ledbh9=0x7
+    ;;
+    esac
+}
+
+start() {
+    . /lib/functions.sh
+
+    clear_partialboots
+    set_wireless_led_behaviour
+
+    [ "$COMMIT" = "1" ] && nvram commit
+}


Do we want / need to switch from boot() to start()?

I don't have opinion, just making sure it's intentional.


Wiki says boot() is executed before start() which is usually used to 
turn on hardware. bcm47xx nvram initscript uses start() so it doesn't 
seem to matter. I tested the patch on my Asus RT-AC88U to make sure the 
initscript works fine.


https://openwrt.org/docs/techref/initscripts#other_functions

Arınç


I think boot() would look better, but it would be good to keep this 
consistent with the bcm47xx code. Using boot() or start() does not make 
a big difference, boot() calls start() anyway.


What about to also change the bcm47xx code to boot()?

The rest looks ok to me.

Hauke

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


Re: [PATCH v2] bcm53xx: complete Asus RT-AC88U support

2022-05-03 Thread Arınç ÜNAL

On 03/05/2022 11:24, Rafał Miłecki wrote:

On 31.03.2022 08:35, Arınç ÜNAL wrote:

Add white:lan LED configuration. Remove the BROKEN flag.

Signed-off-by: Arınç ÜNAL 
---
v2: remove adding rtl8365mb patch as it's already done.

---
  target/linux/bcm53xx/base-files/etc/board.d/01_leds | 3 +++
  target/linux/bcm53xx/image/Makefile | 1 -
  2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/target/linux/bcm53xx/base-files/etc/board.d/01_leds 
b/target/linux/bcm53xx/base-files/etc/board.d/01_leds

index aba526b9c3..bd24234046 100644
--- a/target/linux/bcm53xx/base-files/etc/board.d/01_leds
+++ b/target/linux/bcm53xx/base-files/etc/board.d/01_leds
@@ -4,6 +4,9 @@
  board_config_update
  case "$(board_name)" in
+asus,rt-ac88u)
+    ucidef_set_led_netdev "lan" "LAN" "white:lan" "eth1"
+    ;;


I believe this router uses
WAN LED for WAN traffic (1 port)
LAN LED for LAN traffic (8 ports)

If you use eth1 interface as LED trigger, won't it make LAN LED react
also to WAN traffic?

My guess: should we assign 8 switch ports as that LED triggers?


There's red and white LEDs for WAN but the white one is actually not 
wired to any GPIO. Official Asus firmware controls it some other way. So 
we could only use the red one for wan traffic which I don't like. On top 
of that, we'd have to listen a bridge interface (we can't define 
multiple interfaces) in order to cover traffic on all of the lan ports 
of the switch which I also don't like because the configuration can be 
changed by user.


I think we should leave this to the user. You can discard the LED 
configuration and just remove the BROKEN flag.


Arınç

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


Re: [PATCH v2] bcm53xx: complete Asus RT-AC88U support

2022-05-03 Thread Rafał Miłecki

On 31.03.2022 08:35, Arınç ÜNAL wrote:

Add white:lan LED configuration. Remove the BROKEN flag.

Signed-off-by: Arınç ÜNAL 
---
v2: remove adding rtl8365mb patch as it's already done.

---
  target/linux/bcm53xx/base-files/etc/board.d/01_leds | 3 +++
  target/linux/bcm53xx/image/Makefile | 1 -
  2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/target/linux/bcm53xx/base-files/etc/board.d/01_leds 
b/target/linux/bcm53xx/base-files/etc/board.d/01_leds
index aba526b9c3..bd24234046 100644
--- a/target/linux/bcm53xx/base-files/etc/board.d/01_leds
+++ b/target/linux/bcm53xx/base-files/etc/board.d/01_leds
@@ -4,6 +4,9 @@
  board_config_update
  
  case "$(board_name)" in

+asus,rt-ac88u)
+   ucidef_set_led_netdev "lan" "LAN" "white:lan" "eth1"
+   ;;


I believe this router uses
WAN LED for WAN traffic (1 port)
LAN LED for LAN traffic (8 ports)

If you use eth1 interface as LED trigger, won't it make LAN LED react
also to WAN traffic?

My guess: should we assign 8 switch ports as that LED triggers?

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


Re: [PATCH] ramips: mt7621-dts: fix claiming rgmii2 pin group for EdgeRouter X SFP

2022-05-03 Thread Arınç ÜNAL

Hi, I'd like to remind of this patch.

On 17/03/2022 16:10, Arınç ÜNAL wrote:

For a TX->TX connected external phy to transmit/receive data, the rgmii2
pin group needs to be claimed with gpio function, at least for EdgeRouter X
SFP. We already claim the pin group under the pinctrl node with gpio
function on the gpio node on mt7621_ubnt_edgerouter-x.dtsi.

However, we should claim a pin group under its consumer node. It's the
ethernet node in this case, which we already claim the rgmii2 pin group
under it on mt7621.dtsi. Therefore, set the function as gpio on the rgmii2
node for EdgeRouter X SFP and get rid of claiming the rgmii2 pin group
under the pinctrl node. With this change, we also get to remove a
definition from mt7621_ubnt_edgerouter-x.dtsi which is specific to
EdgeRouter X SFP.

This change is tested on an EdgeRouter X SFP.

Signed-off-by: Arınç ÜNAL 
---
  target/linux/ramips/dts/mt7621_ubnt_edgerouter-x-sfp.dts | 6 ++
  target/linux/ramips/dts/mt7621_ubnt_edgerouter-x.dtsi| 6 +-
  2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/target/linux/ramips/dts/mt7621_ubnt_edgerouter-x-sfp.dts 
b/target/linux/ramips/dts/mt7621_ubnt_edgerouter-x-sfp.dts
index 897aa90ea3..c00eb52c7c 100644
--- a/target/linux/ramips/dts/mt7621_ubnt_edgerouter-x-sfp.dts
+++ b/target/linux/ramips/dts/mt7621_ubnt_edgerouter-x-sfp.dts
@@ -59,6 +59,12 @@
};
  };
  
+_pins {

+   rgmii2 {
+   function = "gpio";
+   };
+};
+
   {
ports {
port@5 {
diff --git a/target/linux/ramips/dts/mt7621_ubnt_edgerouter-x.dtsi 
b/target/linux/ramips/dts/mt7621_ubnt_edgerouter-x.dtsi
index dcc84d7ccc..95cf3d2ccd 100644
--- a/target/linux/ramips/dts/mt7621_ubnt_edgerouter-x.dtsi
+++ b/target/linux/ramips/dts/mt7621_ubnt_edgerouter-x.dtsi
@@ -19,10 +19,6 @@
};
  };
  
- {

-   pinctrl-0 = <_pins>, <_pins>;
-};
-
   {
nvmem-cells = <_factory_22>;
nvmem-cell-names = "mac-address";
@@ -114,7 +110,7 @@
  
  _default {

gpio {
-   groups = "uart2", "uart3", "pcie", "rgmii2", "jtag";
+   groups = "uart2", "uart3", "pcie", "jtag";
function = "gpio";
};
  };


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


Re: [PATCH] packages: nvram: add NVRAM quirks for bcm53xx target

2022-05-03 Thread Arınç ÜNAL

On 03/05/2022 10:20, Rafał Miłecki wrote:

On 31.03.2022 21:19, Arınç ÜNAL wrote:
Add NVRAM quirks script for the bcm53xx target. Split NVRAM quirks for 
the
bcm47xx and bcm53xx targets. Move clear partialboot NVRAM quirk for 
Linksys

EA9500 here. Add set wireless LED behaviour quirk for Asus RT-AC88U.

Signed-off-by: Arınç ÜNAL 
---
  package/utils/nvram/Makefile  |  8 +++-
  .../files/{nvram.init => nvram-bcm47xx.init}  |  2 +-
  package/utils/nvram/files/nvram-bcm53xx.init  | 40 +++
  .../base-files/etc/init.d/clear_partialboot   | 13 --
  4 files changed, 47 insertions(+), 16 deletions(-)
  rename package/utils/nvram/files/{nvram.init => nvram-bcm47xx.init} 
(97%)

  create mode 100755 package/utils/nvram/files/nvram-bcm53xx.init
  delete mode 100755 
target/linux/bcm53xx/base-files/etc/init.d/clear_partialboot


diff --git a/package/utils/nvram/Makefile b/package/utils/nvram/Makefile
index 863b304d0d..b957211283 100644
--- a/package/utils/nvram/Makefile
+++ b/package/utils/nvram/Makefile
@@ -8,7 +8,7 @@
  include $(TOPDIR)/rules.mk
  PKG_NAME:=nvram
-PKG_RELEASE:=10
+PKG_RELEASE:=11
  PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
@@ -44,7 +44,11 @@ define Package/nvram/install
  $(INSTALL_BIN) $(PKG_BUILD_DIR)/nvram $(1)/usr/sbin/
  ifneq ($(CONFIG_TARGET_bcm47xx),)
  $(INSTALL_DIR) $(1)/etc/init.d
-    $(INSTALL_BIN) ./files/nvram.init $(1)/etc/init.d/nvram
+    $(INSTALL_BIN) ./files/nvram-bcm47xx.init $(1)/etc/init.d/nvram
+endif
+ifneq ($(CONFIG_TARGET_bcm53xx),)
+    $(INSTALL_DIR) $(1)/etc/init.d
+    $(INSTALL_BIN) ./files/nvram-bcm53xx.init $(1)/etc/init.d/nvram
  endif
  endef
diff --git a/package/utils/nvram/files/nvram.init 
b/package/utils/nvram/files/nvram-bcm47xx.init

similarity index 97%
rename from package/utils/nvram/files/nvram.init
rename to package/utils/nvram/files/nvram-bcm47xx.init
index 467ab28195..c95933246c 100755
--- a/package/utils/nvram/files/nvram.init
+++ b/package/utils/nvram/files/nvram-bcm47xx.init
@@ -1,7 +1,7 @@
  #!/bin/sh /etc/rc.common
  # NVRAM setup
  #
-# This file handles the NVRAM quirks of various hardware.
+# This file handles the NVRAM quirks of various hardware of the 
bcm47xx target.

  START=02
  alias debug=${DEBUG:-:}
diff --git a/package/utils/nvram/files/nvram-bcm53xx.init 
b/package/utils/nvram/files/nvram-bcm53xx.init

new file mode 100755
index 00..d50917c776
--- /dev/null
+++ b/package/utils/nvram/files/nvram-bcm53xx.init
@@ -0,0 +1,40 @@
+#!/bin/sh /etc/rc.common
+# NVRAM setup
+#
+# This file handles the NVRAM quirks of various hardware of the 
bcm53xx target.

+
+START=02
+
+clear_partialboots() {
+    # clear partialboots
+
+    case $(board_name) in
+    linksys,panamera)
+    COMMIT=1
+    nvram set partialboots=0
+    ;;
+    esac
+}
+
+set_wireless_led_behaviour() {
+    # set Broadcom wireless LED behaviour for both radios
+    # 0:ledbh9 -> Behaviour of 2.4GHz LED
+    # 1:ledbh9 -> Behaviour of 5GHz LED
+    # 0x7 makes the wireless LEDs on, when radios are enabled, and 
blink when there's activity

+
+    case $(board_name) in
+    asus,rt-ac88u)
+    COMMIT=1
+    nvram set 0:ledbh9=0x7 set 1:ledbh9=0x7
+    ;;
+    esac
+}
+
+start() {
+    . /lib/functions.sh
+
+    clear_partialboots
+    set_wireless_led_behaviour
+
+    [ "$COMMIT" = "1" ] && nvram commit
+}


Do we want / need to switch from boot() to start()?

I don't have opinion, just making sure it's intentional.


Wiki says boot() is executed before start() which is usually used to 
turn on hardware. bcm47xx nvram initscript uses start() so it doesn't 
seem to matter. I tested the patch on my Asus RT-AC88U to make sure the 
initscript works fine.


https://openwrt.org/docs/techref/initscripts#other_functions

Arınç

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


[openwrt] Patch notification: 1 patch updated

2022-05-03 Thread Patchwork
Hello,

The following patch (submitted by you) has been updated in Patchwork:

 * openwrt: tplink-safeloader: Patch to handle partitions with alternate names.
 - 
http://patchwork.ozlabs.org/project/openwrt/patch/mailman.11211.1651508692.441203.openwrt-de...@lists.openwrt.org/
 - for: OpenWrt development
was: Under Review
now: Changes Requested

This email is a notification only - you do not need to respond.

Happy patchworking.

--

This is an automated mail sent by the Patchwork system at
patchwork.ozlabs.org. To stop receiving these notifications, edit
your mail settings at:
  http://patchwork.ozlabs.org/mail/

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


Re: [PATCH] packages: nvram: add NVRAM quirks for bcm53xx target

2022-05-03 Thread Rafał Miłecki

On 31.03.2022 21:19, Arınç ÜNAL wrote:

Add NVRAM quirks script for the bcm53xx target. Split NVRAM quirks for the
bcm47xx and bcm53xx targets. Move clear partialboot NVRAM quirk for Linksys
EA9500 here. Add set wireless LED behaviour quirk for Asus RT-AC88U.

Signed-off-by: Arınç ÜNAL 
---
  package/utils/nvram/Makefile  |  8 +++-
  .../files/{nvram.init => nvram-bcm47xx.init}  |  2 +-
  package/utils/nvram/files/nvram-bcm53xx.init  | 40 +++
  .../base-files/etc/init.d/clear_partialboot   | 13 --
  4 files changed, 47 insertions(+), 16 deletions(-)
  rename package/utils/nvram/files/{nvram.init => nvram-bcm47xx.init} (97%)
  create mode 100755 package/utils/nvram/files/nvram-bcm53xx.init
  delete mode 100755 
target/linux/bcm53xx/base-files/etc/init.d/clear_partialboot

diff --git a/package/utils/nvram/Makefile b/package/utils/nvram/Makefile
index 863b304d0d..b957211283 100644
--- a/package/utils/nvram/Makefile
+++ b/package/utils/nvram/Makefile
@@ -8,7 +8,7 @@
  include $(TOPDIR)/rules.mk
  
  PKG_NAME:=nvram

-PKG_RELEASE:=10
+PKG_RELEASE:=11
  
  PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
  
@@ -44,7 +44,11 @@ define Package/nvram/install

$(INSTALL_BIN) $(PKG_BUILD_DIR)/nvram $(1)/usr/sbin/
  ifneq ($(CONFIG_TARGET_bcm47xx),)
$(INSTALL_DIR) $(1)/etc/init.d
-   $(INSTALL_BIN) ./files/nvram.init $(1)/etc/init.d/nvram
+   $(INSTALL_BIN) ./files/nvram-bcm47xx.init $(1)/etc/init.d/nvram
+endif
+ifneq ($(CONFIG_TARGET_bcm53xx),)
+   $(INSTALL_DIR) $(1)/etc/init.d
+   $(INSTALL_BIN) ./files/nvram-bcm53xx.init $(1)/etc/init.d/nvram
  endif
  endef
  
diff --git a/package/utils/nvram/files/nvram.init b/package/utils/nvram/files/nvram-bcm47xx.init

similarity index 97%
rename from package/utils/nvram/files/nvram.init
rename to package/utils/nvram/files/nvram-bcm47xx.init
index 467ab28195..c95933246c 100755
--- a/package/utils/nvram/files/nvram.init
+++ b/package/utils/nvram/files/nvram-bcm47xx.init
@@ -1,7 +1,7 @@
  #!/bin/sh /etc/rc.common
  # NVRAM setup
  #
-# This file handles the NVRAM quirks of various hardware.
+# This file handles the NVRAM quirks of various hardware of the bcm47xx target.
  
  START=02

  alias debug=${DEBUG:-:}
diff --git a/package/utils/nvram/files/nvram-bcm53xx.init 
b/package/utils/nvram/files/nvram-bcm53xx.init
new file mode 100755
index 00..d50917c776
--- /dev/null
+++ b/package/utils/nvram/files/nvram-bcm53xx.init
@@ -0,0 +1,40 @@
+#!/bin/sh /etc/rc.common
+# NVRAM setup
+#
+# This file handles the NVRAM quirks of various hardware of the bcm53xx target.
+
+START=02
+
+clear_partialboots() {
+   # clear partialboots
+
+   case $(board_name) in
+   linksys,panamera)
+   COMMIT=1
+   nvram set partialboots=0
+   ;;
+   esac
+}
+
+set_wireless_led_behaviour() {
+   # set Broadcom wireless LED behaviour for both radios
+   # 0:ledbh9 -> Behaviour of 2.4GHz LED
+   # 1:ledbh9 -> Behaviour of 5GHz LED
+   # 0x7 makes the wireless LEDs on, when radios are enabled, and blink 
when there's activity
+
+   case $(board_name) in
+   asus,rt-ac88u)
+   COMMIT=1
+   nvram set 0:ledbh9=0x7 set 1:ledbh9=0x7
+   ;;
+   esac
+}
+
+start() {
+   . /lib/functions.sh
+
+   clear_partialboots
+   set_wireless_led_behaviour
+
+   [ "$COMMIT" = "1" ] && nvram commit
+}


Do we want / need to switch from boot() to start()?

I don't have opinion, just making sure it's intentional.



diff --git a/target/linux/bcm53xx/base-files/etc/init.d/clear_partialboot 
b/target/linux/bcm53xx/base-files/etc/init.d/clear_partialboot
deleted file mode 100755
index b3eddf4af0..00
--- a/target/linux/bcm53xx/base-files/etc/init.d/clear_partialboot
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh /etc/rc.common
-
-START=97
-boot() {
-   . /lib/functions.sh
-
-   case $(board_name) in
-   linksys,panamera)
-   # clear partialboots
-   nvram set partialboots=0 && nvram commit
-   ;;
-   esac
-}



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


Re: [PATCH] tplink-safeloader: Patch to handle partitions with alternate names.

2022-05-03 Thread Rafał Miłecki

On 2.05.2022 18:24, Ole Kristian Lona via openwrt-devel wrote:

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.


Please kindly fix your domain setup. That ML workaround with forwarding
makes it hard to read / review / apply your changes.

> @@ -3306,6 +3318,8 @@  static void build_image(const char *output,
>struct flash_partition_entry *os_image_partition = NULL;
>struct flash_partition_entry *file_system_partition = NULL;
>size_t firmware_partition_index = 0;
> +  char fs_name[32];
> +  char os_name[32];
>
>for (i = 0; info->partitions[i].name; i++) {
>if (!strcmp(info->partitions[i].name, "firmware"))

I don't think you need those fs_name / os_name. Just add "const" where
it's needed.


> @@ -3339,15 +3359,38 @@  static void build_image(const char *output,
>
>file_system_partition->size = firmware_partition->size - 
file_system_partition->base;
>
> -  os_image_partition->name = "os-image";
> +  if (info->partition_names.os_image == NULL)
> +  os_image_partition->name = "os-image";
> +  else {
> +  strcpy(os_name, info->partition_names.os_image);
> +  os_image_partition->name = os_name;
> +  }
> +
>os_image_partition->size = kernel.st_size;
>}
>
> -  parts[0] = make_partition_table(info->partitions);
> -  parts[1] = make_soft_version(info, rev);
> +  if (info->partition_names.partition_table == NULL)
> +  parts[0] = make_partition_table("partition-table", 
info->partitions);
> +  else
> +  parts[0] = 
make_partition_table(info->partition_names.partition_table, info->partitions);
> +
> +  if (info->partition_names.soft_ver == NULL)
> +  parts[1] = make_soft_version("soft-version", info, rev);
> +  else
> +  parts[1] = make_soft_version(info->partition_names.soft_ver, info, 
rev);
> +
>parts[2] = make_support_list(info);
> -  parts[3] = read_file("os-image", kernel_image, false, NULL);
> -  parts[4] = read_file("file-system", rootfs_image, add_jffs2_eof, 
file_system_partition);
> +
> +  if (info->partition_names.os_image == NULL)
> +  parts[3] = read_file("os-image", kernel_image, false, NULL);
> +  else
> +  parts[3] = read_file(info->partition_names.os_image, kernel_image, 
false, NULL);
> +
> +  if (info->partition_names.file_system == NULL)
> +  parts[4] = read_file("file-system", rootfs_image, add_jffs2_eof, 
file_system_partition);
> +  else
> +  parts[4] = read_file(info->partition_names.file_system, 
rootfs_image, add_jffs2_eof, file_system_partition);
> +
>
>/* Some devices need the extra-para partition to accept the firmware */
>if (strcasecmp(info->id, "ARCHER-A6-V3") == 0 ||

We now have all those (foo == NULL) checks everywhere. We also have
default names inlined all around.

What about adding new function that will setup default names if custom
ones are not specified? That would gather all checking code in one place
and would let you move all NULL checks to a single place.

set_default_names()
{
if (!info->partition_names.partition_table)
info->partition_names.partition_table = "partition-table";
if (!info->partition_names.soft_ver)
info->partition_names.soft_ver = "soft-version";
(...)
}

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