On 10/14/24 09:35, Ted Mittelstaedt wrote:
If you do that I'd be interested in seeing a custom-build done. I started on this myself
last year with a Netgear R6050 but due to my inexperience with setting up an OpenWRT
toolchain and lack of time, and in particular the low price of other, supported, devices,
I never got a "Round Tuit" I did post my findings here:
https://forum.openwrt.org/t/openwrt-support-for-a-netgear-r6050/179491
And it looks to be a very easy port job, just a few mods of the R6020 build.
If there's any interest I'd be happy to solder on a serial port to the thing
and show up with it and a laptop and tested with nmrpflash ready to go.
Unfortunately, while I had asked some specific questions on what to expect from
setting up a build system for openwrt on that forum - none of the dev's
responded to any of them. Sigh.
Since then I've gotten a lot more experience installing OpenWRT builds.
In my experience openWRT compliant devices either fall into 1 of 2 camps:
You got the ones like the Cisco Meraki MR52, or many of the TP-Link devices, or
the 4Mb flash devices like the WNR2000, which require special, long procedures
to install - usually a rs232 serial port, etc. or with the tp-links, pulling
the factory firmware down to a Linux box, slicing off the uboot header and
sticking it on the front of the openwrt firmware. Or finding older versions of
openwrt.
This can take a lot of time and reading to figure out the secret sauce for the
specific device.
Many of the custom builds I've seen people do in the openwrt forum for these
edge cases involve cutting out extras to get newer firmware releases to fit in
4MB fash devices. I've used a number of these builds people have produced and
found them to be all of high quality. Needless to say, I used them on devices
that are behind firewalls, and are just being used as client bridges or access
points since many of them are of older releases.
Then you got everything else in which installing openwrt is a snap - 5 minutes and you
are done. Because I use OpenWRT on a LOT of devices (I have probably 50 of them I manage
now) I have found it just easier to buy supported devices that are in the
"installation is a snap" camp.
But it still would be interesting to see a few border case installs, like my
R6050
I think that porting OpenWrt to a new device is probably more involved
than there is time for in a 2 hour PLUG meeting.
According to https://en.techinfodepot.shoutwiki.com/wiki/Netgear_R6050,
your device has an MT7620A SoC. There are other MT7620A-based devices
that are supported (the R6020 is a related-but-different SoC, the
MT7628A), so they'd be a decent starting point. To get support added,
you'd need to create a proper device tree file and add some support in
configuration scripts for the device name.
You are going to need to build from source, and from the master branch,
not a release version. Basically, git clone
https://git.openwrt.org/openwrt/openwrt.git, then create a branch for
your device porting shenanigans:
git checkout -b add-support-for-netgear-r6050
Here is a recent case of someone adding support for another
MT7620A-based device:
https://git.openwrt.org/?p=openwrt/openwrt.git;a=commitdiff;h=c08f8a4a4913d80ed3fb261dadc711e94b8428dd
You will need a serial console on the device. The first step is to get a
tftp'able initramfs image built and try booting it. That will enable you
to run software without touching the flash, at first. That will require
getting to the u-boot console. From it, you can get copies of the
current flash contents, in case you need to recover later on, as well
information about the flash layout. Often, instance-specific data is
recorded on a partition, things like MAC addresses and calibration data.
Without the calibration data, the radio might not ever work. It is good
practice when dealing with a new device to get and keep a complete copy
of the flash. Worst case, you can get an external programmer and write
it back on to the flash, which is much easier with SPI NOR flash, which
the R6020 has. Your device has NAND flash, and I'm not very familiar
with the tooling for externally writing NAND flash. And, for NAND flash
devices, the current practice tends to be to reformat as much as
possible into UBI volumes for wear leveling and general robustness, and
that might require replacing the u-boot with a custom one. This might
explain why no one has put in the effort to port OpenWrt to the device
so far.
I can only find two MT7620A-based devices that suggest they might have
NAND flash, and details are sketchy on those.
If you only have one, I'd just get a different device. I mean, porting
can be fun and educational, but unless you are amortizing over a bunch
of devices, or want to in the future, it probably isn't going to be a
paying proposition. Porting to a NOR flash device is going to be a
better place to get your feet wet.
The clinic I'm proposing might include building from source, but only so
far as creating a custom image.
The advantages of building custom images include: being able to flash
remotely with a decent chance the device will come up configured and
reachable again; and having things built-in enable factory resets back
to the pre-configured version, rather than a generic OpenWrt image that
needs manual configuration and package installs again.
And the clinic would probably involve going through the steps of
installing on already supported hardware. For example, Keith has some
new devices and we might be able to get those installed.
Re debricking, it is very rare that you can't recover from a serial
console. I have only JTAG'd two devices in nearly 20 years of hacking on
OpenWrt, and one was for fun. Unless you are particularly malicious, you
typically never write over the bootloader, and you can recover from the
bootloader for any operating system mistakes or misconfigurations. So,
first order of business is have an appropriate serial cable, for SOHO
hardware, that's almost always a 3.3v ttl usb-to-serial adapter. I like
these: https://www.adafruit.com/product/5335, but I have also purchased
less reliable pl2303 adapters from china for $2-3 each. More modern
devices are starting to show up with 1.8v serial consoles, so it's good
to watch out for that. SPI NOR flash, an external programmer, and the
flashrom software covers most other cases.
Re Broadcom wifi, OpenWrt mostly decided the devices are too painful to
be worth the effort. OpenWrt has focused on being an upstream,
buildable-from-source project. Current development versions are running
on 6.6 kernels. If you really want to run on broadcom wifi, it's
probably best to pick a different project. Broadcom CPUs might be
supported, but wifi ... I'd rather have my fingers chewed off by a
wolverine.
--
Russell Senior
[email protected]