[PATCH] ramips: use on-flash partition table for Sercomm BZV/CHJ

2023-01-27 Thread Jan Hoffmann
These devices have a partition table stored in flash, which compensates
for any pre-existing bad blocks by enlarging the respective partition.
This means that the current static partition table is only correct for
devices without any bad blocks.

Typical results of this mismatch are degraded wireless performance and
wrong MAC addresses, when the factory partition is shifted due to a bad
block somewhere before it. If there is a bad block already before the
ubi partition, then OpenWrt may not run at all because the kernel can't
find the rootfs.

Use the on-flash partition table to fix these issues. Replace the two
reserved partitions by the full partition list, as the driver does not
allow merging them.

Signed-off-by: Jan Hoffmann 
---

I only tested on a WAC124 without any bad blocks, but the kernel log
shows that the partition map parser is used.

This issue seems to be quite common, as it has appeared multiple times
in forum posts. Variants of this patch have been around, and users
trying them have reported that it actually works on devices with bad
blocks.

 .../dts/mt7621_netgear_sercomm_bzv.dtsi   | 169 +-
 .../dts/mt7621_netgear_sercomm_chj.dtsi   | 169 +-
 2 files changed, 330 insertions(+), 8 deletions(-)

diff --git a/target/linux/ramips/dts/mt7621_netgear_sercomm_bzv.dtsi 
b/target/linux/ramips/dts/mt7621_netgear_sercomm_bzv.dtsi
index 9fa4af8fd666..ab96b8fdd121 100644
--- a/target/linux/ramips/dts/mt7621_netgear_sercomm_bzv.dtsi
+++ b/target/linux/ramips/dts/mt7621_netgear_sercomm_bzv.dtsi
@@ -223,47 +223,208 @@
status = "okay";
 
partitions {
-   compatible = "fixed-partitions";
+   compatible = "sercomm,sc-partitions", "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
 
partition@0 {
label = "u-boot";
reg = <0x0 0x10>;
+   sercomm,scpart-id = <0>;
read-only;
};
 
partition@10 {
label = "SC PART_MAP";
reg = <0x10 0x10>;
+   sercomm,scpart-id = <1>;
read-only;
};
 
partition@20 {
label = "kernel";
reg = <0x20 0x40>;
+   sercomm,scpart-id = <2>;
};
 
partition@60 {
label = "ubi";
reg = <0x60 0x280>;
+   sercomm,scpart-id = <3>;
};
 
partition@2e0 {
-   label = "reserved0";
-   reg = <0x2e0 0x180>;
+   label = "English UI";
+   reg = <0x2e0 0x20>;
+   sercomm,scpart-id = <4>;
+   read-only;
+   };
+
+   partition@300 {
+   label = "ML1";
+   reg = <0x300 0x20>;
+   sercomm,scpart-id = <5>;
+   read-only;
+   };
+
+   partition@320 {
+   label = "ML2";
+   reg = <0x320 0x20>;
+   sercomm,scpart-id = <6>;
+   read-only;
+   };
+
+   partition@340 {
+   label = "ML3";
+   reg = <0x340 0x20>;
+   sercomm,scpart-id = <7>;
+   read-only;
+   };
+
+   partition@360 {
+   label = "ML4";
+   reg = <0x360 0x20>;
+   sercomm,scpart-id = <8>;
+   read-only;
+   };
+
+   partition@380 {
+   label = "ML5";
+   reg = <0x380 0x20>;
+   sercomm,scpart-id = <9>;
+   read-only;
+   };
+
+   partition@3a0 {
+   label = "ML6";
+   reg = <0x3a0 0x20>;
+   sercomm,scpart-id = <10>;
+   read-only;
+   };
+
+   partition@3c0 {
+   label = "ML7";
+   reg = <0x3c0 0x20>;
+   sercomm,scpart-id = <11>;
+   read-only;
+   };
+
+   partition@3e0 {
+   label = "ML8";
+   reg = <0x3e0 0x20>;
+   sercomm,scpart-id = <12>;
+   read-only;
+   };
+
+   partition@400 {
+   label = "ML9";
+   reg = 

[PATCH] kernel: modules: add lkdtm module

2023-01-27 Thread Brian Norris
Useful for debugging panic/error handling, crash logging, and more.

Signed-off-by: Brian Norris 
---

 package/kernel/linux/modules/other.mk | 16 
 1 file changed, 16 insertions(+)

diff --git a/package/kernel/linux/modules/other.mk 
b/package/kernel/linux/modules/other.mk
index c5f944ed3194..2bd15dfe67e1 100644
--- a/package/kernel/linux/modules/other.mk
+++ b/package/kernel/linux/modules/other.mk
@@ -243,6 +243,22 @@ endef
 $(eval $(call KernelPackage,gpio-f7188x))
 
 
+define KernelPackage/lkdtm
+  SUBMENU:=$(OTHER_MENU)
+  TITLE:=Linux Kernel Dump Test Tool Module
+  KCONFIG:=CONFIG_LKDTM
+  FILES:=$(LINUX_DIR)/drivers/misc/lkdtm/lkdtm.ko
+  AUTOLOAD:=$(call AutoProbe,lkdtm)
+endef
+
+define KernelPackage/lkdtm/description
+ This module enables testing of the different dumping mechanisms by inducing
+ system failures at predefined crash points.
+endef
+
+$(eval $(call KernelPackage,lkdtm))
+
+
 define KernelPackage/pinctrl-mcp23s08
   SUBMENU:=$(OTHER_MENU)
   TITLE:=Microchip MCP23xxx I/O expander
-- 
2.39.0


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


Re: X86 partition tables

2023-01-27 Thread Paul Oranje 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 ---
Op 22 jan. 2023, om 23:12 heeft Philip Prindeville 
 het volgende geschreven:
> 
> Hi,
> 
> Couple of questions about partition tables on x86 hardware.
> 
> Do most x86 machines (an APUv6 w/ Coreboot in my case, and a Qemu/KVM VM with 
> Bochs as well) support GPT in BIOS (CGM or whatever)?
> 
> And what are the steps on a live system to (1) convert the MBR partition 
> table to MBR, and (2) reinstall grub?
Assuming you intent to convert MBR to GPT, gdisk offers functionality to that 
purpose.

> 
> Thanks,
> 
> -Philip
> 
> 
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Bye,
Paul



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


Re: X86 partition tables

2023-01-27 Thread Paul Oranje 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 ---
Op 22 jan. 2023, om 23:12 heeft Philip Prindeville 
 het volgende geschreven:
> 
> Hi,
> 
> Couple of questions about partition tables on x86 hardware.
> 
> Do most x86 machines (an APUv6 w/ Coreboot in my case, and a Qemu/KVM VM with 
> Bochs as well) support GPT in BIOS (CGM or whatever)?
> 
> And what are the steps on a live system to (1) convert the MBR partition 
> table to MBR, and (2) reinstall grub?
Assuming you intent to convert MBR to GPT, gdisk offers functionality to that 
purpose.

> 
> Thanks,
> 
> -Philip
> 
> 
> ___
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Bye,
Paul



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


[PATCH v2] ramips: add support for Huasifei WS1208V2

2023-01-27 Thread arinc9 . unal
From: Arınç ÜNAL 

The Huasifei WS1208V2 is an AC1200 router featuring 5 Ethernet ports with a
Quectel RM520N-GL cellular modem which supports QMI and MBIM modes.

Specifications:
- MT7621AT, 256 MiB RAM, 16 MiB SPI Flash
- MT7603EN 2.4 GHz & MT7612EN 5 GHz WLAN
- Quectel RM520N-GL Cellular Modem
- 2 WLAN & 4 Cellular Antennas
- 5 Gigabit Ethernet Ports
- 1 USB 2.0 port
- 1 PCI-E Slot
- 1 M.2 slot
- 1 SIM card slot
- 1 SD card slot

Installation:
- Install sysupgrade image via ROOter OS.

TFTP Recovery:
- Connect to serial console.
- Boot initramfs image by choosing option 1 when U-Boot prompts.
- Install sysupgrade image via OpenWrt.

Link: https://www.huasifei.com/a/Products/5G%20CPE/240.html
Signed-off-by: Arınç ÜNAL 
---

v2: Add recovery information.

---
 .../ramips/dts/mt7621_huasifei_ws1208v2.dts   | 187 ++
 target/linux/ramips/image/mt7621.mk   |  12 ++
 .../mt7621/base-files/etc/board.d/01_leds |   3 +
 3 files changed, 202 insertions(+)
 create mode 100644 target/linux/ramips/dts/mt7621_huasifei_ws1208v2.dts

diff --git a/target/linux/ramips/dts/mt7621_huasifei_ws1208v2.dts 
b/target/linux/ramips/dts/mt7621_huasifei_ws1208v2.dts
new file mode 100644
index 00..c69f05a0f4
--- /dev/null
+++ b/target/linux/ramips/dts/mt7621_huasifei_ws1208v2.dts
@@ -0,0 +1,187 @@
+#include "mt7621.dtsi"
+
+#include 
+#include 
+
+/ {
+   compatible = "huasifei,ws1208v2", "mediatek,mt7621-soc";
+   model = "Huasifei WS1208V2";
+
+   aliases {
+   led-boot = _status;
+   led-failsafe = _status;
+   led-running = _status;
+   led-upgrade = _status;
+   label-mac-device = 
+   };
+
+   chosen {
+   bootargs = "console=ttyS0,115200";
+   };
+
+   keys {
+   compatible = "gpio-keys";
+
+   button-reset {
+   label = "Reset";
+   gpios = < 18 GPIO_ACTIVE_LOW>;
+   linux,code = ;
+   };
+   };
+
+   leds {
+   compatible = "gpio-leds";
+
+   led_status: led-status {
+   label = "green:status";
+   gpios = < 12 GPIO_ACTIVE_LOW>;
+   };
+
+   led-cellular {
+   label = "green:cellular";
+   gpios = < 10 GPIO_ACTIVE_LOW>;
+   };
+
+   led-wlan5g {
+   label = "green:wlan5g";
+   gpios = < 14 GPIO_ACTIVE_LOW>;
+   linux,default-trigger = "phy1tpt";
+   };
+
+   led-wlan2g {
+   label = "green:wlan2g";
+   gpios = < 5 GPIO_ACTIVE_LOW>;
+   linux,default-trigger = "phy0tpt";
+   };
+
+   led-usb {
+   label = "green:usb";
+   gpios = < 11 GPIO_ACTIVE_HIGH>;
+   trigger-sources = <_ehci_port1>;
+   linux,default-trigger = "usbport";
+   };
+   };
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+
+   flash@0 {
+   compatible = "jedec,spi-nor";
+   reg = <0>;
+   spi-max-frequency = <1000>;
+
+   partitions {
+   compatible = "fixed-partitions";
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   partition@0 {
+   label = "u-boot";
+   reg = <0x0 0x3>;
+   read-only;
+   };
+
+   partition@3 {
+   label = "u-boot-env";
+   reg = <0x3 0x1>;
+   read-only;
+   };
+
+   factory: partition@4 {
+   label = "factory";
+   reg = <0x4 0x1>;
+   read-only;
+   };
+
+   firmware: partition@5 {
+   compatible = "denx,uimage";
+   reg = <0x5 0xfb>;
+   label = "firmware";
+   };
+   };
+   };
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   wifi@0,0 {
+   compatible = "pci14c3,7603";
+   reg = <0x 0 0 0 0>;
+   mediatek,mtd-eeprom = < 0x>;
+   };
+};
+
+ {
+   wifi@0,0 {
+   compatible = "pci14c3,7662";
+   reg = <0x 0 0 0 0>;
+   mediatek,mtd-eeprom = < 0x8000>;
+   ieee80211-freq-limit = <500 600>;
+
+   led {
+   led-sources = <2>;
+   };
+   };
+};
+
+ {
+