Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ramips: add support for OrayBox X3A #9457

Closed
wants to merge 1 commit into from
Closed

ramips: add support for OrayBox X3A #9457

wants to merge 1 commit into from

Conversation

w43322
Copy link
Contributor

@w43322 w43322 commented Mar 13, 2022

OrayBox X3A is a 2.4/5GHz dual band AC router, based on MediaTek MT7621.

Specification:

* SoC: MT7621
* RAM: DDR3 128 MiB
* Flash: 16 MiB NOR (XM25Q128)
* Wi-Fi: (single chip hosting both 2.4G and 5G)
  * 2.4GHz: MT7615
  * 5GHz: MT7615
* Ethernet: 3x 1000Mbps
  * Switch: MT7530
* LED:
  * Ethernet LEDs: On the back of the router, hardware-controlled.
  * Status LEDs: One "pixel-like" RGB LED in the front of the router,
                 which is actually made up of 3 individual LEDs (with
                 dedicated GPIO pins) with the color of Red, Green,
                 and Blue.
                 The OEM firmware only lights up one color at a time to
                 indicate status, but that's very boring, and the colors
                 actually look great when combined, so I've improvised a
                 little and made them indicate netdev activities.
                 My test results:
                 GPIO 13/14/15
                 000 white (actually more like bright green or cyan
                            because the brightness of the green LED is
                            higher than red and blue)
                 001 bright purple
                 010 bright green
                 011 red
                 100 bright cyan
                 101 blue
                 110 green
                 111 off

Flash Layout:

 0x0000000-0x0030000 : "u-boot"
 0x0030000-0x0040000 : "u-boot-env"
 0x0040000-0x0050000 : "factory"
 0x0050000-0x0f50000 : "firmware"
 /*0x0f50000 to 0x0fe0000 is undefined, same as OEM firmware*/
 0x0fe0000-0x0ff0000 : "bdinfo"
 0x0ff0000-0x1000000 : "reserve"

MAC address:

 MAC               Source                          Description    Fix
 A0:CX:XX:BX:XX:0D BDINFO_9                        LAN(LABEL)     DTS
 A0:CX:XX:BX:XX:0E BDINFO_9 + 1                    WAN            DTS
 A2:CX:XX:BX:XX:0F FACTORY_4                       WIFI2G         DTS
 A2:CX:XX:CX:XX:0F SETBIT 7 (FACTORY_4 + 0x100000) WIFI5G         HOTPLUG
 A6:CX:XX:BX:XX:0F N/A                             WIFI2G_CLIENT  N/A
 A6:DX:XX:BX:XX:0F N/A                             WIFI5G_CLIENT  N/A

Stock dmesg:
https://pastebin.com/2t2jwLdf

Stock Dumps:
https://pastebin.com/LDLxSWX3

Installation via SSH (does not void your warranty):

1.  -----UNLOCK SSH-----
1.1 Set computer IP to DHCP mode, load 'http://10.168.1.1/cgi-bin/luci' in
    your browser. Password is 'admin'.
1.2 Click the "备份且导出" (backup and export) button, and download the
    config file.
1.3 Open the downloaded file with 7zip, navigate to '/etc/config/'.
1.4 Edit the file './system'. Change the '0' into '1' under
    "config sys 'ssh'".
1.5 Save the file.
1.6 Upload the file by clicking the "导入且恢复" (import and recover)
    button. The router will automatically reboot.
2.  -----FLASH THE OPENWRT FIRMWARE-----
2.1 Use any scp tool to upload the 'sysupgrade' firmware to the '/tmp/'
    folder to your router. It should be root@10.168.1.1 and the password
	is 'admin'.
2.2 SSH into the router, also root@10.168.1.1 and the password is 'admin'.
2.3 **IMPORTANT** Type command 'dd if=/dev/mtd3 of=/tmp/firmware.bin', to
    backup the stock firmware. Since the OEM does not provide firmware
	download on their website, this is the only way to get it.
2.3 **ALSO IMPORTANT** Use any scp tool to download your backed-up stock
    firmware from '/tmp/' to your local drive. Then you'd better use a hex
	reading tool to have a rough look at it to make sure nothing is
	corrupt. Or u can just back up again and cross check the MD5.
2.4 Type command 'mtd write /tmp/XXX.bin firmware', and it should flash
    the firmware.
2.5 Verify that nothing went wrong. If you're confident, type 'reboot' and
    reboot the router.

Revert to stock firmware:

1.  load stock firmware using mtd (make sure u have a backup).

Signed-off-by: Ray Wang raywang777@foxmail.com

@mans0n mans0n added target/ramips pull request/issue for ramips target new device pull request with new device labels Mar 13, 2022
OrayBox X3A is a 2.4/5GHz dual band AC router, based on MediaTek MT7621.

Specification:
* SoC: MT7621
* RAM: DDR3 128 MiB
* Flash: 16 MiB NOR (XM25Q128)
* Wi-Fi: (single chip hosting both 2.4G and 5G)
  * 2.4GHz: MT7615
  * 5GHz: MT7615
* Ethernet: 3x 1000Mbps
  * Switch: MT7530
* LED:
  * Ethernet LEDs: On the back of the router, hardware-controlled.
  * Status LEDs: One "pixel-like" RGB LED in the front of the router,
                 which is actually made up of 3 individual LEDs (with
                 dedicated GPIO pins) with the color of Red, Green,
                 and Blue.
                 The OEM firmware only lights up one color at a time to
                 indicate status, but that's very boring, and the colors
                 actually look great when combined, so I've improvised a
                 little and made them indicate netdev activities.
                 My test results:
                 GPIO 13/14/15
                 000 white (actually more like bright green or cyan
                            because the brightness of the green LED is
                            higher than red and blue)
                 001 bright purple
                 010 bright green
                 011 red
                 100 bright cyan
                 101 blue
                 110 green
                 111 off

Flash Layout:
 0x0000000-0x0030000 : "u-boot"
 0x0030000-0x0040000 : "u-boot-env"
 0x0040000-0x0050000 : "factory"
 0x0050000-0x0f50000 : "firmware"
 /*0x0f50000 to 0x0fe0000 is undefined, same as OEM firmware*/
 0x0fe0000-0x0ff0000 : "bdinfo"
 0x0ff0000-0x1000000 : "reserve"

MAC address:
 MAC               Source                          Description    Fix
 A0:CX:XX:BX:XX:0D BDINFO_9                        LAN(LABEL)     DTS
 A0:CX:XX:BX:XX:0E BDINFO_9 + 1                    WAN            DTS
 A2:CX:XX:BX:XX:0F FACTORY_4                       WIFI2G         DTS
 A2:CX:XX:CX:XX:0F SETBIT 7 (FACTORY_4 + 0x100000) WIFI5G         HOTPLUG
 A6:CX:XX:BX:XX:0F N/A                             WIFI2G_CLIENT  N/A
 A6:DX:XX:BX:XX:0F N/A                             WIFI5G_CLIENT  N/A

Stock dmesg:
https://pastebin.com/2t2jwLdf

Stock Dumps:
https://pastebin.com/LDLxSWX3

Installation via SSH (does not void your warranty):
1.  -----UNLOCK SSH-----
1.1 Set computer IP to DHCP mode, load 'http://10.168.1.1/cgi-bin/luci' in
    your browser. Password is 'admin'.
1.2 Click the "备份且导出" (backup and export) button, and download the
    config file.
1.3 Open the downloaded file with 7zip, navigate to '/etc/config/'.
1.4 Edit the file './system'. Change the '0' into '1' under
    "config sys 'ssh'".
1.5 Save the file.
1.6 Upload the file by clicking the "导入且恢复" (import and recover)
    button. The router will automatically reboot.
2.  -----FLASH THE OPENWRT FIRMWARE-----
2.1 Use any scp tool to upload the 'sysupgrade' firmware to the '/tmp/'
    folder to your router. It should be root@10.168.1.1 and the password
    is 'admin'.
2.2 SSH into the router, also root@10.168.1.1 and the password is 'admin'.
2.3 **IMPORTANT** Type command 'dd if=/dev/mtd3 of=/tmp/firmware.bin', to
    backup the stock firmware. Since the OEM does not provide firmware
    download on their website, this is the only way to get it.
2.3 **ALSO IMPORTANT** Use any scp tool to download your backed-up stock
    firmware from '/tmp/' to your local drive. Then you'd better use a hex
    reading tool to have a rough look at it to make sure nothing is
    corrupt. Or u can just back up again and cross check the MD5.
2.4 Type command 'mtd write /tmp/XXX.bin firmware', and it should flash
    the firmware.
2.5 Verify that nothing went wrong. If you're confident, type 'reboot' and
    reboot the router.

Revert to stock firmware:
1.  load stock firmware using mtd (make sure u have a backup).

Signed-off-by: Ray Wang <raywang777@foxmail.com>
@w43322
Copy link
Contributor Author

w43322 commented Mar 20, 2022

Update:
Been using this device with openwrt for a week now, and everything seems functional and stable.

I've added a wiki page for this device:
https://wikidevi.wi-cat.ru/OrayBox_X3A

@w43322
Copy link
Contributor Author

w43322 commented Mar 20, 2022

If there's any chance this can be merged before the 22.0 branch that'd be great. :)

@w43322
Copy link
Contributor Author

w43322 commented Mar 28, 2022

Update:
Got some testers on this forum and got okay feedback.
https://www.right.com.cn/forum/thread-8200261-1-1.html

@w43322
Copy link
Contributor Author

w43322 commented Mar 28, 2022

OK, so I managed to get the stock firmware from customer service, and it could be flashed through a custom u-boot web environment (recovery mode) made by the OEM that comes with the router.
This might be a better way to revert to factory firmware, and could always be a backup plan in case someone screws up and cannot boot.
The question is where should I host the image I obtained from customer service, so that I can include it in the commit message? Are there any guidelines regarding that?

Also, I‘d also want to know if anyone has any better idea on what the functions leds should indicate. From my observation, when all 3 leds are lit up, it’s too bright and could be disturbing. The stock OEM behavior is to light up blue when the router is on. Ideally I’d want to implement something like a system load indicator, like lighting up red when the cpu is under heavy load (making a combined color of purple), and green (to make the color cyan) when on light load. Or anything else that’s in a binary state (cuz it doesn’t make sense to light up both red and green at the same time). Is there any way to implement that? Or should I just get rid of that config and let the users decide on their own?

Thanks.

@hauke
Copy link
Member

hauke commented Apr 15, 2022

Sharing the firmware you received from the customer support might violate the copyright of the vendor, but I am not a lawyer and I do not care much. You could describe the method to update over the custom u-boot web environment as an alternative.

I would just use a standard LED configuration. I think Linux supports multi color LEDs, this could make the mechanism you want possible, but I am not sure, I never used that.

@w43322
Copy link
Contributor Author

w43322 commented Apr 16, 2022

Sharing the firmware you received from the customer support might violate the copyright of the vendor, but I am not a lawyer and I do not care much. You could describe the method to update over the custom u-boot web environment as an alternative.

I would just use a standard LED configuration. I think Linux supports multi color LEDs, this could make the mechanism you want possible, but I am not sure, I never used that.

The u-boot recovery environment didn't work on my device somehow, and I’m kind of stuck with the ssh method. And I‘ve done some hex comparisons and found out the firmware they gave me is identical to the one I’ve backed up manually. The PR is ready as is btw.

@hauke
Copy link
Member

hauke commented Apr 17, 2022

Thank you for the patch, I applied it to master in 9a750aa.

@hauke hauke closed this Apr 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new device pull request with new device target/ramips pull request/issue for ramips target
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants