JiaY-shi / openwrt

This repository is a mirror of https://git.openwrt.org/openwrt/openwrt.git It is for reference only and is not active for check-ins. We will continue to accept Pull Requests here. They will be merged via staging trees then into openwrt.git.
Other
134 stars 111 forks source link

Discussion about new ipq60xx devices (Xiaomi AX1800 / ZN-M2 etc.) #14

Closed pexcn closed 1 year ago

pexcn commented 1 year ago

Describe the bug

Not a bug. Just want to ask, can it be based on the stable version of openwrt 23.05?

OpenWrt version

openwrt 23.05

OpenWrt target/subtarget

ipq60xx

Device

xiaomi ax1800

Image kind

Self-built image

Steps to reproduce

No response

Actual behaviour

No response

Expected behaviour

No response

Additional info

No response

Diffconfig

No response

Terms

JiaY-shi commented 1 year ago

No, the ipq60xx series is based on openwrt main and kernel 6.1, but the kernel of openwrt 23.05 is 5.15.

pexcn commented 1 year ago

OK, by the way, what is the difference between ipq60xx-devel_nss and ipq60xx-devel branches? which one is recommended?

pexcn commented 1 year ago

Can we add support for more devices, such as Xiaomi AX1800/Redmi AX5 and ZN-M2?

JiaY-shi commented 1 year ago

OK, by the way, what is the difference between ipq60xx-devel_nss and ipq60xx-devel branches? which one is recommended?

@pexcn The ipq60xx-devel_nss branch has full nss core support, but is only experimental. The ipq60xx-devel branch is relatively stable and is recommended.

JiaY-shi commented 1 year ago

Can we add support for more devices, such as Xiaomi AX1800/Redmi AX5 and ZN-M2?

@pexcn Sorry, I don't have these devices, so I can't provide support.

pexcn commented 1 year ago

OK, I found the dts for xiaomi ax1800 in another repo, maybe I can try it. 😁

JiaY-shi commented 1 year ago

@pexcn Hello buddy, how is the porting of these devices for Xiaomi AX1800/Redmi AX5 and ZN-M2? I plan to buy a ZN-M2.

pexcn commented 1 year ago

@pexcn Hello buddy, how is the porting of these devices for Xiaomi AX1800/Redmi AX5 and ZN-M2? I plan to buy a ZN-M2.

Hi, it hasn't started yet, I'm planning to give it a try this weekend.😅 At the same time, I have just cherry-picked some necessary commits and plan to make a version for myself, thank you very much for your commits~

By the way, ZN-M2 PCB is very fragile and easy to break, and its WiFi signal is poor, so not recommended to buy. In my DIY process, I only succeeded with my second purchase.

At the same time, it is highly recommended that you buy Xiaomi AX1800 (It should be very cheap now on the second-hand market, the price is estimated to be about twice that of ZN-M2), It has good appearance, heat dissipation, and a very good quality PCB. Still, I don't know why this model is so unpopular.

pexcn commented 1 year ago

@JiaY-shi I found the patch for ZN-M2 here, it should work directly, but I haven't tried it yet.

JiaY-shi commented 1 year ago

@pexcn Hello buddy, how is the porting of these devices for Xiaomi AX1800/Redmi AX5 and ZN-M2? I plan to buy a ZN-M2.

Hi, it hasn't started yet, I'm planning to give it a try this weekend.😅 At the same time, I have just cherry-picked some necessary commits and plan to make a version for myself, thank you very much for your commits~

By the way, ZN-M2 PCB is very fragile and easy to break, and its WiFi signal is poor, so not recommended to buy. In my DIY process, I only succeeded with my second purchase.

At the same time, it is highly recommended that you buy Xiaomi AX1800 (It should be very cheap now on the second-hand market, the price is estimated to be about twice that of ZN-M2), It has good appearance, heat dissipation, and a very good quality PCB. Still, I don't know why this model is so unpopular.

@pexcn Thanks for your sharing and suggestions, I will reconsider Xiaomi AX1800 and ZN-M2. You are also welcome to share your use of the source code of this repo for these two devices.

pexcn commented 1 year ago

@JiaY-shi For this repo I haven't tried yet, but I have some experience with openwrt 19.07 version (kernel 4.4.60).

For this version, except that the kernel version is too low and batman-adv cannot compile with the V protocol, everything else works well. For ZN-M2, everything works well, but after turning on wireless, the SoC temperature is 10 degrees higher than that of disabled wireless, maybe it's because ZN-M2 doesn't radiating well. For Xiaomi AX1800, everything works fine except wireless. It's wireless signal is extremely low, I think this firmware caused by the lack of board-2.bin for this model, but how to obtain board-2.bin? I don't know anything about this.

pexcn commented 1 year ago

In addition, Xiaomi AX1800 and Redmi AX5 should be two similar models. Their firmware maybe can used universally.

JiaY-shi commented 1 year ago

@JiaY-shi For this repo I haven't tried yet, but I have some experience with openwrt 19.07 version (kernel 4.4.60).

For this version, except that the kernel version is too low and batman-adv cannot compile with the V protocol, everything else works well. For ZN-M2, everything works well, but after turning on wireless, the SoC temperature is 10 degrees higher than that of disabled wireless, maybe it's because ZN-M2 doesn't radiating well. For Xiaomi AX1800, everything works fine except wireless. It's wireless signal is extremely low, I think this firmware caused by the lack of board-2.bin for this model, but how to obtain board-2.bin? I don't know anything about this.

@pexcn The 4.4.60 kernel is the qsdk kernel and is too old. It is normal that some new features are not supported. This is also the reason why there is this repo.

As for the board-2.bin file, it can be extracted from the original factory firmware.

pexcn commented 1 year ago

As for the board-2.bin file, it can be extracted from the original factory firmware.

@JiaY-shi I have unpacked the official firmware through binwalk. Can you tell me how to extract it? Through what tools and in what ways?

pexcn commented 1 year ago

There is another question, if Xiaomi AX1800 wants to use this repo, can I use the DTS here directly? Does it need to be rewrite?

JiaY-shi commented 1 year ago

@pexcn

As for the board-2.bin file, it can be extracted from the original factory firmware.

@JiaY-shi I have unpacked the official firmware through binwalk. Can you tell me how to extract it? Through what tools and in what ways?

You can unzip the stock firmware and find it in the /lib/firmware directory. Or you can flash the stock firmware into the router and find it from /lib/firmware directory.

There is another question, if Xiaomi AX1800 wants to use this repo, can I use the DTS here directly? Does it need to be rewrite?

It seems feasible, you can try it.

pexcn commented 1 year ago

Hello @JiaY-shi, today I tried to add support for ZN-M2.

I also refer to this commit, so I have a question, do I need to add this line and this line?

pexcn commented 1 year ago

You can unzip the stock firmware and find it in the /lib/firmware directory. Or you can flash the stock firmware into the router and find it from /lib/firmware directory.

Does it mean that it cannot be obtained through unpacking, must be flash back to the official firmware to obtain this file? Is it generated at runtime?

Recently I also know about a tool, can it obtain board-2.bin from official unpacked files?

JiaY-shi commented 1 year ago

Hello @JiaY-shi, today I tried to add support for ZN-M2.

I also refer to this commit, so I have a question, do I need to add this line and this line?

Neither line is needed.

You can unzip the stock firmware and find it in the /lib/firmware directory. Or you can flash the stock firmware into the router and find it from /lib/firmware directory.

Does it mean that it cannot be obtained through unpacking, must be flash back to the official firmware to obtain this file? Is it generated at runtime?

Recently I also know about a tool, can it obtain from official unpacked files?board-2.bin

It's not generated at runtime, I think it can be extracted from the original firmware, I'm a little unsure since it's been so long. As for the tool you mentioned, it is indeed needed. You can try to use this tool to unpack my boad-2.bin file, and then combine it with this dts file, and you will know what you have changed.

pexcn commented 1 year ago

Neither line is needed.

But why not needed? How does it know that what I need is the dts file of zn-m2?

It's not generated at runtime, I think it can be extracted from the original firmware, I'm a little unsure since it's been so long. As for the tool you mentioned, it is indeed needed. You can try to use this tool to unpack my boad-2.bin file, and then combine it with this dts file, and you will know what you have changed.

It's a bit complicated indeed 😅, I'll try it later.

pexcn commented 1 year ago

Hello @JiaY-shi, I use ath11k-bdencoder extracted your board-2.bin file, found many 64KB files. image

At the same time, I extracted the official firmware and found that there were many 64KB files in the firmware directory. image

So does this mean I can generate board-2.bin from these 64KB files?

JiaY-shi commented 1 year ago

@pexcn How is the progress of your zn-m2 transplant?

pexcn commented 1 year ago

@pexcn How is the progress of your zn-m2 transplant?

ZN-M2 works fine, but I just briefly tested it. There is a problem, every time I restart the ZN-M2, the wifi mac address will change.

Now I'm trying my best to port to Xiaomi AX1800 https://github.com/openwrt-dev/openwrt-ipq60xx/commits/main (ethernet port and wifi not working)

pexcn commented 1 year ago

So does this mean I can generate board-2.bin from these 64KB files?

@JiaY-shi Can you please answer this question, Do I need to use all files starting with bdwlan or just one of them?

JiaY-shi commented 1 year ago

So does this mean I can generate from these 64KB files?board-2.bin

@JiaY-shi Can you please answer this question, Do I need to use all files starting with or just one of them?bdwlan

You only need to use one, but the board-id must be 255. You can also test each bdwlan file and choose the one with the best wifi signal.

ZN-M2 works fine, but I just briefly tested it. There is a problem, every time I restart the ZN-M2, the wifi mac address will change.

Good news, as for the mac address changing every time you restart, you can confirm whether the mac address has been written in the art partition. If not, you can generate one.

pexcn commented 1 year ago

You only need to use one, but the board-id must be 255. You can also test each bdwlan file and choose the one with the best wifi signal.

OK.😄

Good news, as for the mac address changing every time you restart, you can confirm whether the mac address has been written in the art partition. If not, you can generate one.

The art partition should exist, I'll check it out when I have time. I also saw it is extracted to /lib/firmware/ath11k/IPQ6018/hw1.0/cal-ahb-c000000.wifi.bin when booting.

pexcn commented 1 year ago

Today I rewrite device tree of AX1800, almost finished porting this firmware for it, but there are still two small issues.

  1. Wrong mac address of ethernet port, I hope it can be consistent with the mac address of the original firmware (I wish eth0 ~ 2 use lan mac, eth3 use wan mac). What should I do?
  2. It won't boot again after every reboot, need to re-plug and unplug the power supply to power on. TTL output shows it's stuck in this position:
    Format: Log Type - Time(microsec) - Message - Optional Info
    Log Type: B - Since Boot(Power On Reset),  D - Delta,  S - Statistic
    S - QC_IMAGE_VERSION_STRING=BOOT.XF.0.3-00077-IPQ60xxLZB-2
    S - IMAGE_VARIANT_STRING=IPQ6018LA
    S - OEM_IMAGE_VERSION_STRING=crm-ubuntu64
    S - Boot Interface: NAND
    S - Secure Boot: Off
    S - Boot Config @ 0x000a602c = 0x000002e5
    S - JTAG ID @ 0x000a607c = 0x001390e1
    S - OEM ID @ 0x000a6080 = 0x00000000
    S - Serial Number @ 0x000a4128 = 0x717a2e02
    S - OEM Config Row 0 @ 0x000a4188 = 0x0000000000000000
    S - OEM Config Row 1 @ 0x000a4190 = 0x0000000000000000
    S - Feature Config Row 0 @ 0x000a4130 = 0x0000800018200021
    S - Feature Config Row 1 @ 0x000a4138 = 0x02c3e83783000009
    S - PBL Patch Ver: 1
    S - I-cache: On
    S - D-cache: On
    B -      3413 - PBL, Start
    B -       592 - bootable_media_detect_entry, Start
    B -      4339 - bootable_media_detect_success, Start
    B -      5147 - elf_loader_entry, Start
    B -      5319 - auth_hash_seg_entry, Start
    B -      7786 - auth_hash_seg_exit, Start
    B -      8283 - elf_segs_hash_verify_entry, Start
    B -    110537 - elf_segs_hash_verify_exit, Start
    B -    114961 - auth_xbl_sec_hash_seg_entry, Start
    B -    115103 - auth_xbl_sec_hash_seg_exit, Start
    B -    121651 - xbl_sec_segs_hash_verify_entry, Start
    B -    121652 - xbl_sec_segs_hash_verify_exit, Start
    B -    122581 - PBL, End
    B -    103364 - SBL1, Start
    B -    243420 - GCC [RstStat:0x2, RstDbg:0x420100] WDog Stat : 0x4
    B -    245891 - clock_init, Start
    D -      2745 - clock_init, Delta
    B -    254370 - boot_flash_init, Start
    D -     26626 - boot_flash_init, Delta
    B -    284229 - sbl1_ddr_set_default_params, Start
    D -       244 - sbl1_ddr_set_default_params, Delta
    B -    290848 - boot_config_data_table_init, Start
    D -      4819 - boot_config_data_table_init, Delta - (575 Bytes)
    B -    300760 - CDT Version:2,Platform ID:8,Major ID:3,Minor ID:2,Subtype:0
    B -    305549 - Image Load, Start
    D -      6588 - OEM_MISC Image Loaded, Delta - (0 Bytes)
    B -    314882 - Image Load, Start
    D -      5063 - PMIC Image Loaded, Delta - (0 Bytes)
    B -    322751 - sbl1_ddr_set_params, Start
    B -    327722 - CPR configuration: 0x366
    B -    330925 - Pre_DDR_clock_init, Start
    D -       213 - Pre_DDR_clock_init, Delta
    D -         0 - sbl1_ddr_set_params, Delta

@JiaY-shi Do you have any suggestions? :)