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

mediatek: add Nokia EA0326GMP support #14993

Merged
merged 2 commits into from
Jun 6, 2024

Conversation

1715173329
Copy link
Member

@1715173329 1715173329 commented Mar 27, 2024

Hardware specification:
  SoC: MediaTek MT7981B 2x A53
  Flash: 128 MB SPI-NAND
  RAM: 256MB
  Ethernet: 4x 10/100/1000 Mbps
  Switch: MediaTek MT7531AE
  WiFi: MediaTek MT7976C
  Button: Reset, WPS/Mesh
  Power: DC 12V 1A

Gain SSH access:
1. Login into web interface, and download the configuration.
2. Download the configration utilities:
   https://firmware.download.immortalwrt.eu.org/cnsztl/mediatek/filogic/openwrt-mediatek-mt7981-nokia-ea0326gmp-config-utils.tar.gz
     These binaries are extraced from the factory firmware, which are
     dynamically linked with aarch64 musl 1.1.24. To use them, you
     must run them under the same runtime environment, otherwise the
     binaries will not work properly!
3. Upload the configuration and utilities to a suitable environment.
4. Uncompress the utilities, move them to '/bin' and give them executable permisison:
   tar -zxf openwrt-mediatek-mt7981-nokia-ea0326gmp-config-utils.tar.gz
   mv mkconfig seama /bin
   chmod +x /bin/mkconfig
   chmod +x /bin/seama
5. Decrypt and uncompress the configuration:
     Enter fakeroot if you are not login as root.
   mkconfig -a de-enca -m EA0326GMP_3FE79221BAAA -i EA0326GMP_3FE79221BAAA-xxxxxxxx-backup.tar.gz -o backup.tar.gz
   tar -zxf backup.tar.gz
6. Edit 'etc/config/dropbear', set 'enable' to '1'.
7. Edit 'etc/passwd', remove root password: 'root::1:0:99999:7:::'.
8. Repack the configuration:
   tar -zcf backup.tar.gz etc/
   mkconfig -a enca -m EA0326GMP_3FE79221BAAA -i backup.tar.gz -o EA0326GMP_3FE79221BAAA-xxxxxxxx-backup.tar.gz
9. Upload new configuration via web interface, now you can SSH to EA0326GMP.

A minimum configuration which enabled SSH access is also provided
to simplify the process:
https://firmware.download.immortalwrt.eu.org/cnsztl/mediatek/filogic/openwrt-mediatek-mt7981-nokia-ea0326gmp-enable-ssh.tar.gz

Flash instructions:
1. SSH to EA0326GMP, backup everything, especially 'Factory' part.
2. Write new BL2:
   mtd write openwrt-mediatek-filogic-nokia_ea0326gmp-preloader.bin BL2
3. Write new FIP:
   mtd write openwrt-mediatek-filogic-nokia_ea0326gmp-bl31-uboot.fip FIP
4. Set static IP on your PC:
   IP 192.168.1.254/24, GW 192.168.1.1
5. Serve OpenWrt initramfs image using TFTP server.
6. Cut off the power and re-engage, wait for TFTP recovery to complete.
7. After OpenWrt has booted, run the following command:
     This is required as there is a bug about detecting rootdisk.
   sed -i 's,ubiblock,,g' /lib/upgrade/platform.sh
8. Perform sysupgrade.

@1715173329
Copy link
Member Author

Hi @dangowrt could you please take a look?

For the first-time installation the ubiblock_xx device does not exist in /sys/class/block, so fitblk_get_bootdev outputs nothing, resulting sysupgrade failure.

@github-actions github-actions bot added core packages pull request/issue for core (in-tree) packages target/mediatek pull request/issue for mediatek target labels Mar 27, 2024
@dangowrt
Copy link
Member

dangowrt commented Apr 3, 2024

For the first-time installation the ubiblock_xx device does not exist in /sys/class/block, so fitblk_get_bootdev outputs nothing, resulting sysupgrade failure.

This is difficult to fix by design, and I guess the best would be to include ubimkvol and ubiblock calls in the installation instructions, so then the block device will exist and fitblk_get_bootdev should work. I'm open for other ideas, if any, of course.

@1715173329 1715173329 force-pushed the master-mediatek-nokia branch 2 times, most recently from 309f3c4 to da3cfc3 Compare April 12, 2024 08:54
@1715173329
Copy link
Member Author

Would it make sense to simply introduce fitblk to legacy fit sysupgrade logic? The code will check if fit device exists so it should not break anything. And it's also unnecessary to do bootdev detection for a single-storage device.

	h3c,magic-nx30-pro|\
	jcg,q30-pro|\
	mediatek,mt7981-rfb|\
	netcore,n60|\
	qihoo,360t7|\
	xiaomi,mi-router-ax3000t-ubootmod|\
	xiaomi,mi-router-wr30u-ubootmod)
+		[ -e /dev/fit0 ] && fitblk /dev/fit0
+		[ -e /dev/fitrw ] && fitblk /dev/fitrw
		CI_KERNPART="fit"
		nand_do_upgrade "$1"
		;;

@dangowrt
Copy link
Member

Would it make sense to simply introduce fitblk to legacy fit sysupgrade logic?

Technically this can work. I was kinda intending to make it as obvious as possible which device has already been converted to fitblk, so device owners notice and may carry out conversion on the device.

And it's also unnecessary to do bootdev detection for a single-storage device.

The hope was kinda to have a single generic sysupgrade codepath, but yes, given the chicken-egg/bootstrapping problem when installing OpenWrt to a device currently running vendor firmware or older OpenWrt that would be the best work-around I can imagine.

@1715173329
Copy link
Member Author

1715173329 commented Apr 14, 2024

@Tian-Jionglu can you stop sending off-topic comments here?

@1715173329
Copy link
Member Author

1715173329 commented Apr 14, 2024

I was kinda intending to make it as obvious as possible which device has already been converted to fitblk, so device owners notice and may carry out conversion on the device.

I see, thank you!
I created a new 'case' for these devices as a workaround for now.

@1715173329
Copy link
Member Author

@dangowrt could you please take a look? thanks!

Hardware specification:
  SoC: MediaTek MT7981B 2x A53
  Flash: 128 MB SPI-NAND
  RAM: 256MB
  Ethernet: 4x 10/100/1000 Mbps
  Switch: MediaTek MT7531AE
  WiFi: MediaTek MT7976C
  Button: Reset, WPS/Mesh
  Power: DC 12V 1A

Gain SSH access:
1. Login into web interface, and download the configuration.
2. Download the configration utilities:
   https://firmware.download.immortalwrt.eu.org/cnsztl/mediatek/filogic/openwrt-mediatek-mt7981-nokia-ea0326gmp-config-utils.tar.gz
     These binaries are extraced from the factory firmware, which are
     dynamically linked with aarch64 musl 1.1.24. To use them, you
     must run them under the same runtime environment, otherwise the
     binaries will not work properly!
3. Upload the configuration and utilities to a suitable environment.
4. Uncompress the utilities, move them to '/bin' and give them executable permisison:
   tar -zxf openwrt-mediatek-mt7981-nokia-ea0326gmp-config-utils.tar.gz
   mv mkconfig seama /bin
   chmod +x /bin/mkconfig
   chmod +x /bin/seama
5. Decrypt and uncompress the configuration:
     Enter fakeroot if you are not login as root.
   mkconfig -a de-enca -m EA0326GMP_3FE79221BAAA -i EA0326GMP_3FE79221BAAA-xxxxxxxx-backup.tar.gz -o backup.tar.gz
   tar -zxf backup.tar.gz
6. Edit 'etc/config/dropbear', set 'enable' to '1'.
7. Edit 'etc/passwd', remove root password: 'root::1:0:99999:7:::'.
8. Repack the configuration:
   tar -zcf backup.tar.gz etc/
   mkconfig -a enca -m EA0326GMP_3FE79221BAAA -i backup.tar.gz -o EA0326GMP_3FE79221BAAA-xxxxxxxx-backup.tar.gz
9. Upload new configuration via web interface, now you can SSH to EA0326GMP.

A minimum configuration which enabled SSH access is also provided
to simplify the process:
https://firmware.download.immortalwrt.eu.org/cnsztl/mediatek/filogic/openwrt-mediatek-mt7981-nokia-ea0326gmp-enable-ssh.tar.gz

Flash instructions:
1. SSH to EA0326GMP, backup everything, especially 'Factory' part.
2. Write new BL2:
   mtd write openwrt-mediatek-filogic-nokia_ea0326gmp-preloader.bin BL2
3. Write new FIP:
   mtd write openwrt-mediatek-filogic-nokia_ea0326gmp-bl31-uboot.fip FIP
4. Set static IP on your PC:
   IP 192.168.1.254/24, GW 192.168.1.1
5. Serve OpenWrt initramfs image using TFTP server.
6. Cut off the power and re-engage, wait for TFTP recovery to complete.
7. After OpenWrt has booted, perform sysupgrade.

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
For the first-time installation (mostly migrates from vendor firmware)
the ubiblock is not ready, but bootdev detection relies on it. This
means users must create ubiblock manually otherwise the sysupgrade
will not work.

Now a unique case is added for nand devices which use new fit format,
let's move to it.

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
@openwrt-bot openwrt-bot merged commit a568540 into openwrt:main Jun 6, 2024
13 of 15 checks passed
@1715173329 1715173329 deleted the master-mediatek-nokia branch June 6, 2024 18:20
@CTCD
Copy link

CTCD commented Jun 7, 2024

@1715173329 I have a script that simulates WPS key presses, which works fine on other devices but produces the opposite results on the EA0326GMP. This is because the ACTION="pressed" and ACTION="released" are swapped. Later, I found that changing the key to a low level made it work correctly. gpios = <&pio 0 GPIO_ACTIVE_LOW>;

@1715173329
Copy link
Member Author

That's weird. I extracted this value from vendor dts. Will confirm it later.

@1715173329
Copy link
Member Author

Indeed. So they just copy&paste the rfb dts. Thanks for report.
Would you mind leaving a Reported-by tag?

@1715173329
Copy link
Member Author

#15651

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core packages pull request/issue for core (in-tree) packages target/mediatek pull request/issue for mediatek target
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants