Is updating U-Boot Worth it?

I'm using the latest stable release of OpenWrt on TPLink Archer C6u V1. It has the vendor provided U-Boot build from 2020. There are some odd env vars and uboot complains about it:

U-Boot 1.1.3 (May 13 2020 - 19:39:06)

Board: Ralink APSoC DRAM:  128 MB
relocate_code Pointer at: 87f58000

Config XHCI 40M PLL 
flash manufacture id: ef, device id 40 18
find flash: W25Q128BV
*** Warning - bad CRC, using default environment

The odd env vars:

printenv 
bootargs=console=ttyS1,115200 
root=/dev/mtdblock2 
rootfstype=squashfs 
init=/etc/preinit mtdparts=raspi:256k(uboot),2048k(uImage),14016k@0x240000(rootfs),64k@0xff0000(ART) 
mem=128M 
bootcmd=tftp 
bootdelay=0x1 
baudrate=115200 
ethaddr="00:AA:BB:CC:DD:10" 
ipaddr=192.168.0.1 
serverip=192.168.0.5 
stdin=serial 
stdout=serial 
stderr=serial 
Environment size: 332/4092 bytes 
MT7621 #

I was thinking of buildling a new version of U-Boot from their official repository (They have a dedicated page for MT7621) and flashing it to my router using mtd write or serial (kermit).

Is this a bad idea ? I do have backups of all the mtd partitions, so flashing the Winbond SPI Chip using a CH341 or similar flasher is doable in the worst case scenario.

"if it works, don't mess with it."

6 Likes

Definitely be very careful with this. Frequently, the vendors will add custom extensions, drivers, features, and support that won’t work “out of the box” on the official, vanilla U-Boot. Some hardware designs require further customized device trees and patches simply to provide basic functionality.

For example, I once attempted to do this for the old Seagate GoFlex Home a number of years back in order to resolve a few quirks in how U-Boot was operating at the time. Although the vanilla tree had support for some Kirkwood-based devices, the code simply couldn’t address device-specific critical components and so it couldn’t even boot far enough to provide serial output. For me, I got lucky; The Kirkwood platform is able to accept a new bootloader over serial and the device didn’t overwrite critical data on the attempt, so I didn’t brick it by trying. However, not everyone will be so lucky and not every device provides that level of flexibility.

Recent MediaTek chips seem to be forgiving about this, but make sure this individual device is. The mtk_uartboot tool might be able to offer this device a bootloader over the serial port, but it does still rely on the chip being flashed with support for it and it also relies on the tool recognizing and communicating properly with this chip.

For anyone reading along who is curious and really wants to build and flash a custom U-Boot to a device, make absolutely sure you have a low-level way of restoring good data to the device if something goes wrong. Even today, not every device provides such an option. While some have platform-specific functionality within the hard-burned stages of the boot chain, it’s not a universal solution. This often means you’ll need to make sure there is a working JTAG port, you’ll need to know how to use it, and you’ll need to have a copy of the original bootloader and potentially a whole flash image prior to any attempt. Pay close attention to any partitions or data that isn’t open source or available online. Some devices still require additional data partitions that you can’t download from anywhere, and some are even specific to each and every individual unit. If your custom bootloader were to somehow damage that data and you don’t have a recovery copy…

2 Likes

OpenWrt ignores those. If it boots it is ok (.1 / .5 are OEM recovery params)

1 Like

There is nothing odd in these variables. These are settings for boot partition, boot command, TFTP recovery, serial UART. Some are necessary at each boot, so following @frollic 's advice : don't mess with them :rofl:

Thank you guys ! After reading all the responses, I've decided that it's way too risky and too much of a hassel. So I'll just leave it as it is.

2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.