Re: [PATCH] ramips: add support for D-Link DAP-X1860 A1

2023-01-07 Thread Sebastian Schaper

On 01/06/23 19:52, Hauke Mehrtens wrote:

Why do you need uImage-relocate and can not use the standard Build/uImage?
You have to set KERNEL_LOADADDR to  0x8100.


Thanks for the hint, I had initially tried several load addresses with the same 
effect,
the kernel would either decompress but the system would just halt, or the 
decompress would
fail (crc error) if the offsets overlap, i.e. decompress would overwrite the 
source.

I now used 0x8200 as with several other devices, which works fine.
Also switched to the fit boilerplate that is shared by many of these devices.

Factory flashing, sysupgrade and initramfs via tftp were tested successfully.


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


Re: [PATCH] ramips: add support for D-Link DAP-X1860 A1

2023-01-06 Thread Hauke Mehrtens

On 12/13/22 23:15, Sebastian Schaper wrote:

The DAP-X1860 is a wall-plug AX1800 repeater.

Specifications:
- MT7621, 256 MiB RAM, 128 MiB SPI NAND
- MT7915 + MT7975 2x2 802.11ax (DBDC)
- Ethernet: 1 port 10/100/1000
- LED RSSI bargraph (2x green, 1x red/green),
   incorrectly populated red/orange status LEDs
   (should be red/green according to documentation)

Installation:
- Keep reset button pressed during plug-in
- Web Recovery Updater is at 192.168.0.50
- Upload factory.bin, confirm flashing
   (seems to work best with Chromium-based browsers)

Revert to OEM firmware:
- tar -xvf DAP-X1860_RevA_Firmware_101b94.bin
- openssl enc -d -md md5 -aes-256-cbc -in FWImage.st2 \
   -out FWImage.st1 -k MB0dBx62oXJXDvt12lETWQ==
- tar -xvf FWImage.st1
- flash kernel_DAP-X1860.bin via Recovery

Signed-off-by: Sebastian Schaper 
---

I am not quite happy with the 4096K fixed-size kernel partition,
but this is consistent with many other devices using UBI.
If one day the kernel image will grow larger, this could be addressed
simultaneously (e.g. using lzma-loader) for all devices.

Do we even need UBI when there is NMBM? But probably better for redundancy.

I see there are further options available for `mediatek,nmbm` in dts, i.e.
`bmt-max-ratio` and `bmt-remap-range`, only used by those two NMBM devices.
Do we need to set these as well, and how should the values be determined?

RSSI bargraph is configured for the 5GHz interface `wlan1` to be consistent
with other devices using the `rssileds` package, however in current master
this is no longer working, since individual interfaces (e.g. `phy1-sta0`)
will be created when connecting to a network. It seems this needs to be
resolved within `rssileds`, rather than individually for this device.

`uImage-relocate` is based on openwrt/staging/nbd from
977e37c0f23e ramips: add work-in-progress support for D-Link DIR-X1860


  .../ramips/dts/mt7621_dlink_dap-x1860-a1.dts  | 197 ++
  target/linux/ramips/image/mt7621.mk   |  37 
  .../mt7621/base-files/etc/board.d/01_leds |   7 +
  .../mt7621/base-files/etc/board.d/02_network  |   1 +
  .../etc/hotplug.d/ieee80211/10_fix_wifi_mac   |   7 +
  .../mt7621/base-files/lib/upgrade/platform.sh |   1 +
  6 files changed, 250 insertions(+)
  create mode 100644 target/linux/ramips/dts/mt7621_dlink_dap-x1860-a1.dts




diff --git a/target/linux/ramips/image/mt7621.mk 
b/target/linux/ramips/image/mt7621.mk
index 08aa592be8..beae1f929a 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -14,6 +14,23 @@ ifdef CONFIG_LINUX_5_10
DTS_CPPFLAGS += -DDTS_LEGACY
  endif
  
+RELOCATE_LOADADDR = 0x8100

+
+define Build/uImage-relocate
+   mkimage \
+   -A $(LINUX_KARCH) \
+   -O linux \
+   -T kernel \
+   -C $(word 1,$(1)) \
+   -a $(RELOCATE_LOADADDR) \
+   -e $(RELOCATE_LOADADDR) \
+   -n '$(if $(UIMAGE_NAME),$(UIMAGE_NAME),$(call 
toupper,$(LINUX_KARCH)) $(VERSION_DIST) Linux-$(LINUX_VERSION))' \
+   $(if $(UIMAGE_MAGIC),-M $(UIMAGE_MAGIC)) \
+   $(wordlist 2,$(words $(1)),$(1)) \
+   -d $@ $@.new
+   mv $@.new $@
+endef
+


Why do you need uImage-relocate and can not use the standard Build/uImage?
You have to set KERNEL_LOADADDR to  0x8100.


  define Build/arcadyan-trx
echo -ne "hsqs" > $@.hsqs
$(eval trx_magic=$(word 1,$(1)))
@@ -470,6 +487,26 @@ define Device/cudy_x6
  endef
  TARGET_DEVICES += cudy_x6
  
+define Device/dlink_dap-x1860-a1

+  $(Device/dsa-migration)
+  IMAGE_SIZE := 53248k
+  DEVICE_VENDOR := D-Link
+  DEVICE_MODEL := DAP-X1860
+  DEVICE_VARIANT := A1
+  UBINIZE_OPTS := -E 5
+  BLOCKSIZE := 128k
+  PAGESIZE := 2048
+  KERNEL_SIZE := 4096k
+  KERNEL := kernel-bin | append-dtb | relocate-kernel | lzma | \
+   uImage-relocate lzma
+  IMAGES += factory.bin
+  IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
+  IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | append-ubi | \
+   check-size | elx-header 011b0060 8844A2D168B45A2D
+  DEVICE_PACKAGES := kmod-mt7915e rssileds
+endef
+TARGET_DEVICES += dlink_dap-x1860-a1
+
  define Device/dlink_dir-8xx-a1
$(Device/dsa-migration)
IMAGE_SIZE := 16000k




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


Re: [PATCH] ramips: add support for D-Link DAP-X1860 A1

2023-01-06 Thread Jan-Niklas Burfeind

On 12/13/22 23:15, Sebastian Schaper wrote:

The DAP-X1860 is a wall-plug AX1800 repeater.

Specifications:
- MT7621, 256 MiB RAM, 128 MiB SPI NAND
- MT7915 + MT7975 2x2 802.11ax (DBDC)
- Ethernet: 1 port 10/100/1000
- LED RSSI bargraph (2x green, 1x red/green),
   incorrectly populated red/orange status LEDs
   (should be red/green according to documentation)

Installation:
- Keep reset button pressed during plug-in
- Web Recovery Updater is at 192.168.0.50
- Upload factory.bin, confirm flashing
   (seems to work best with Chromium-based browsers)

Revert to OEM firmware:
- tar -xvf DAP-X1860_RevA_Firmware_101b94.bin
- openssl enc -d -md md5 -aes-256-cbc -in FWImage.st2 \
   -out FWImage.st1 -k MB0dBx62oXJXDvt12lETWQ==
- tar -xvf FWImage.st1
- flash kernel_DAP-X1860.bin via Recovery

Signed-off-by: Sebastian Schaper 
---

I am not quite happy with the 4096K fixed-size kernel partition,
but this is consistent with many other devices using UBI.
If one day the kernel image will grow larger, this could be addressed
simultaneously (e.g. using lzma-loader) for all devices.

Do we even need UBI when there is NMBM? But probably better for redundancy.

I see there are further options available for `mediatek,nmbm` in dts, i.e.
`bmt-max-ratio` and `bmt-remap-range`, only used by those two NMBM devices.
Do we need to set these as well, and how should the values be determined?

RSSI bargraph is configured for the 5GHz interface `wlan1` to be consistent
with other devices using the `rssileds` package, however in current master
this is no longer working, since individual interfaces (e.g. `phy1-sta0`)
will be created when connecting to a network. It seems this needs to be
resolved within `rssileds`, rather than individually for this device.

`uImage-relocate` is based on openwrt/staging/nbd from
977e37c0f23e ramips: add work-in-progress support for D-Link DIR-X1860


  .../ramips/dts/mt7621_dlink_dap-x1860-a1.dts  | 197 ++
  target/linux/ramips/image/mt7621.mk   |  37 
  .../mt7621/base-files/etc/board.d/01_leds |   7 +
  .../mt7621/base-files/etc/board.d/02_network  |   1 +
  .../etc/hotplug.d/ieee80211/10_fix_wifi_mac   |   7 +
  .../mt7621/base-files/lib/upgrade/platform.sh |   1 +
  6 files changed, 250 insertions(+)
  create mode 100644 target/linux/ramips/dts/mt7621_dlink_dap-x1860-a1.dts

diff --git a/target/linux/ramips/dts/mt7621_dlink_dap-x1860-a1.dts 
b/target/linux/ramips/dts/mt7621_dlink_dap-x1860-a1.dts
new file mode 100644
index 00..8c156c17ce
--- /dev/null
+++ b/target/linux/ramips/dts/mt7621_dlink_dap-x1860-a1.dts
@@ -0,0 +1,197 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "mt7621.dtsi"
+
+#include 
+#include 
+
+/ {
+   compatible = "dlink,dap-x1860-a1", "mediatek,mt7621-soc";
+   model = "D-Link DAP-X1860 A1";
+
+   chosen {
+   bootargs = "console=ttyS0,115200";
+   };
+
+   aliases {
+   label-mac-device = 
+   led-boot = _power_orange;
+   led-failsafe = _power_red;
+   led-running = _power_orange;
+   led-upgrade = _power_red;
+   };
+
+   keys {
+   compatible = "gpio-keys";
+
+   wps {
+   label = "wps";
+   gpios = < 4 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+
+   reset {
+   label = "reset";
+   gpios = < 6 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+   };
+
+   leds {
+   compatible = "gpio-leds";
+
+   led_power_red: power_red {
+   label = "red:power";
+   gpios = < 7 GPIO_ACTIVE_LOW>;
+   };
+
+   led_power_orange: power_orange {
+   label = "orange:power";
+   gpios = < 8 GPIO_ACTIVE_LOW>;
+   default-state = "on";
+   };
+
+   rssihigh {
+   label = "green:rssihigh";
+   gpios = < 22 GPIO_ACTIVE_LOW>;
+   };
+
+   rssimedium {
+   label = "green:rssimedium";
+   gpios = < 23 GPIO_ACTIVE_LOW>;
+   };
+
+   rssilow_orange {
+   label = "orange:rssilow";
+   gpios = < 26 GPIO_ACTIVE_LOW>;
+   };
+
+   rssilow_green {
+   label = "green:rssilow";
+   gpios = < 27 GPIO_ACTIVE_LOW>;
+   };
+   };
+
+   virtual_flash {
+   compatible = "mtd-concat";
+
+   devices = < >;
+
+   partitions {
+   compatible = "fixed-partitions";
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   partition@0 {
+  

[PATCH] ramips: add support for D-Link DAP-X1860 A1

2022-12-13 Thread Sebastian Schaper
The DAP-X1860 is a wall-plug AX1800 repeater.

Specifications:
- MT7621, 256 MiB RAM, 128 MiB SPI NAND
- MT7915 + MT7975 2x2 802.11ax (DBDC)
- Ethernet: 1 port 10/100/1000
- LED RSSI bargraph (2x green, 1x red/green),
  incorrectly populated red/orange status LEDs
  (should be red/green according to documentation)

Installation:
- Keep reset button pressed during plug-in
- Web Recovery Updater is at 192.168.0.50
- Upload factory.bin, confirm flashing
  (seems to work best with Chromium-based browsers)

Revert to OEM firmware:
- tar -xvf DAP-X1860_RevA_Firmware_101b94.bin
- openssl enc -d -md md5 -aes-256-cbc -in FWImage.st2 \
  -out FWImage.st1 -k MB0dBx62oXJXDvt12lETWQ==
- tar -xvf FWImage.st1
- flash kernel_DAP-X1860.bin via Recovery

Signed-off-by: Sebastian Schaper 
---

I am not quite happy with the 4096K fixed-size kernel partition,
but this is consistent with many other devices using UBI.
If one day the kernel image will grow larger, this could be addressed
simultaneously (e.g. using lzma-loader) for all devices.

Do we even need UBI when there is NMBM? But probably better for redundancy.

I see there are further options available for `mediatek,nmbm` in dts, i.e.
`bmt-max-ratio` and `bmt-remap-range`, only used by those two NMBM devices.
Do we need to set these as well, and how should the values be determined?

RSSI bargraph is configured for the 5GHz interface `wlan1` to be consistent
with other devices using the `rssileds` package, however in current master
this is no longer working, since individual interfaces (e.g. `phy1-sta0`)
will be created when connecting to a network. It seems this needs to be
resolved within `rssileds`, rather than individually for this device. 

`uImage-relocate` is based on openwrt/staging/nbd from
977e37c0f23e ramips: add work-in-progress support for D-Link DIR-X1860


 .../ramips/dts/mt7621_dlink_dap-x1860-a1.dts  | 197 ++
 target/linux/ramips/image/mt7621.mk   |  37 
 .../mt7621/base-files/etc/board.d/01_leds |   7 +
 .../mt7621/base-files/etc/board.d/02_network  |   1 +
 .../etc/hotplug.d/ieee80211/10_fix_wifi_mac   |   7 +
 .../mt7621/base-files/lib/upgrade/platform.sh |   1 +
 6 files changed, 250 insertions(+)
 create mode 100644 target/linux/ramips/dts/mt7621_dlink_dap-x1860-a1.dts

diff --git a/target/linux/ramips/dts/mt7621_dlink_dap-x1860-a1.dts 
b/target/linux/ramips/dts/mt7621_dlink_dap-x1860-a1.dts
new file mode 100644
index 00..8c156c17ce
--- /dev/null
+++ b/target/linux/ramips/dts/mt7621_dlink_dap-x1860-a1.dts
@@ -0,0 +1,197 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "mt7621.dtsi"
+
+#include 
+#include 
+
+/ {
+   compatible = "dlink,dap-x1860-a1", "mediatek,mt7621-soc";
+   model = "D-Link DAP-X1860 A1";
+
+   chosen {
+   bootargs = "console=ttyS0,115200";
+   };
+
+   aliases {
+   label-mac-device = 
+   led-boot = _power_orange;
+   led-failsafe = _power_red;
+   led-running = _power_orange;
+   led-upgrade = _power_red;
+   };
+
+   keys {
+   compatible = "gpio-keys";
+
+   wps {
+   label = "wps";
+   gpios = < 4 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+
+   reset {
+   label = "reset";
+   gpios = < 6 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+   };
+
+   leds {
+   compatible = "gpio-leds";
+
+   led_power_red: power_red {
+   label = "red:power";
+   gpios = < 7 GPIO_ACTIVE_LOW>;
+   };
+
+   led_power_orange: power_orange {
+   label = "orange:power";
+   gpios = < 8 GPIO_ACTIVE_LOW>;
+   default-state = "on";
+   };
+
+   rssihigh {
+   label = "green:rssihigh";
+   gpios = < 22 GPIO_ACTIVE_LOW>;
+   };
+
+   rssimedium {
+   label = "green:rssimedium";
+   gpios = < 23 GPIO_ACTIVE_LOW>;
+   };
+
+   rssilow_orange {
+   label = "orange:rssilow";
+   gpios = < 26 GPIO_ACTIVE_LOW>;
+   };
+
+   rssilow_green {
+   label = "green:rssilow";
+   gpios = < 27 GPIO_ACTIVE_LOW>;
+   };
+   };
+
+   virtual_flash {
+   compatible = "mtd-concat";
+
+   devices = < >;
+
+   partitions {
+   compatible = "fixed-partitions";
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   partition@0 {
+   label = "ubi";
+