WIP
Without lzma-loader the kernel does not boot:
Uncompressing Kernel Image ... lzma compressed: uncompress error 1
Must RESET board to recover
Changing LINUX_LOADADDR to 0x81001000 as used by OEM solves the lzma
error but then the kernel doesn't boot - no output at all on the console
after this line:
Loading Device Tree to
9be77000, end
9be7c4b7 ... OK
Eventually came accross this forum post:
https://forum.openwrt.org/t/compile-ramips-with-data-address-at-0x81001000-instead-of-0x80001000/97379
Which seems solve the problem. The question is: is there a better way?
Can't find any documentation about lzma-loader, what it does exactly,
and why it is needed, so for now this allows to boot OpenWrt from flash.
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "mt7621.dtsi"
+
+
+/ {
+ compatible = "zrouter,zr-2662-v1";
+ model = "Zrouter ZR-2662 v1.0";
+
+ chosen {
+ bootargs = "console=ttyS0,115200";
+ };
+};
+
+ðernet {
+ reg = <0x1e100000 0xe000>;
+};
+
+&nand {
+ status = "okay";
+
+ mediatek,bbt;
+ mediatek,bmt-remap-range = <0x180000 0x5800000>;
+
+ partitions {
+ #address-cells = <0x01>;
+ #size-cells = <0x01>;
+ compatible = "fixed-partitions";
+
+ partition@0 {
+ label = "Bootloader";
+ reg = <0x0 0x80000>;
+ read-only;
+ };
+
+ partition@80000 {
+ label = "Config";
+ reg = <0x80000 0x80000>;
+ read-only;
+ };
+
+ factory: partition@100000 {
+ label = "Factory";
+ reg = <0x100000 0x80000>;
+ read-only;
+ };
+
+ partition@180000 {
+ compatible = "denx,fit";
+ label = "firmware";
+ reg = <0x180000 0x5800000>;
+ };
+
+ partition@5980000 {
+ label = "firmware_backup";
+ reg = <0x5980000 0x2000000>;
+ read-only;
+ };
+
+ partition@7b00000 {
+ label = "zrsave";
+ reg = <0x7b00000 0x100000>;
+ read-only;
+ };
+
+ partition@7c00000 {
+ label = "config2";
+ reg = <0x7c00000 0x100000>;
+ read-only;
+ };
+ };
+};
+
+&pcie {
+ status = "okay";
+
+ bus-range = <0x00 0xff>;
+};
+
+&pcie1 {
+ wifi@0,0 {
+ mediatek,mtd-eeprom = <&factory 0x0>;
+ };
+};
+
+&pcie2 {
+ status = "disabled";
+};
+
+&state_default {
+ gpio {
+ groups = "i2c";
+ function = "gpio";
+ };
+};
+
+&switch0 {
+ compatible = "mediatek,mt7530";
+ ports {
+ port@1 {
+ status = "okay";
+
+ label = "lan3";
+ };
+
+ port@2 {
+ status = "okay";
+
+ label = "lan2";
+ };
+
+ port@3 {
+ status = "okay";
+
+ label = "lan1";
+ };
+
+ port@4 {
+ status = "okay";
+
+ label = "wan";
+ };
+ };
+};
endef
TARGET_DEVICES += zio_freezio
+define Device/zrouter_zr-2662-v1
+ $(Device/dsa-migration)
+ BLOCKSIZE := 128k
+ DEVICE_VENDOR:= Zrouter
+ DEVICE_MODEL := ZR-2662
+ DEVICE_PACKAGES := kmod-mt7915e
+ DEVICE_VARIANT := v1.0
+ IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size | append-metadata
+ IMAGE_SIZE := 88576k
+ KERNEL := kernel-bin | lzma | loader-kernel | fit none $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb
+ KERNEL_INITRAMFS := kernel-bin | lzma | loader-kernel | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd
+ #KERNEL_LOADADDR := 0x81001000
+endef
+TARGET_DEVICES += zrouter_zr-2662-v1
+
define Device/zyxel_nr7101
$(Device/dsa-migration)
BLOCKSIZE := 128k
xiaomi,mi-router-cr6606|\
xiaomi,mi-router-cr6608|\
xiaomi,mi-router-cr6609|\
- xiaomi,redmi-router-ac2100)
+ xiaomi,redmi-router-ac2100|\
+ zrouter,zr-2662-v1)
ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" "wan"
;;
asiarf,ap7621-001|\
wan_mac=$(mtd_get_mac_ascii Config protest_wan_mac)
label_mac=$lan_mac
;;
+ zrouter,zr-2662-v1)
+ lan_mac=$(mtd_get_mac_ascii Factory lanmac)
+ wan_mac=$(mtd_get_mac_ascii Factory wanmac)
+ label_mac=$lan_mac
esac
[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
hw_mac_addr="$(mtd_get_mac_binary factory 0x4)"
[ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr "0x100000" > /sys${DEVPATH}/macaddress
;;
+ zrouter,zr-2662-v1)
+ hw_mac_addr_2g="$(mtd_get_mac_binary Factory wifi2gmac)"
+ hw_mac_addr_5g="$(mtd_get_mac_binary Factory wifi5gmac)"
+ [ "$PHYNBR" = "0" ] && macaddr_add $hw_mac_addr_2g "0" > /sys${DEVPATH}/macaddress
+ [ "$PHYNBR" = "1" ] && macaddr_add $hw_mac_addr_5g "0" > /sys${DEVPATH}/macaddress
+ ;;
esac