Joined: 28 Dec 2011
|Posted: Wed Dec 12, 2018 14:51 Post subject: USB support for TEW-811DRU, TEW-812DRUv2, and EX6200
|This is mostly an informational thread, to summarize what I learned in my recent attempt at getting USB storage to work on my TEW-811DRU. But I do have a small request for the developers at the end.
What I was trying to do:
There was a service that I wanted to run from the router itself, and to do that, I wanted to attach a small USB flash drive for the binaries and log files.
A little history:
The TEW-811DRU, TEW-812DRUv2, and EX6200 are the only Broadcom ARM (Northstar) devices supported by DD-WRT that have only 8 MiB of flash.
In changeset 25132 from 2014, FAT support was removed from 8 MiB Northstar devices. (JFFS2 was also removed.) USB drives with ext2 could still be mounted.
In changeset 29404 from 2016, the ext2 module was removed; the intent was to use the ext4 module to handle ext2/3/4 filesystems, and the removal of ext2 was supposed to happen only on systems that supported ext4. The problem was that these 8 MiB Northstar devices did not have ext4 (the ext4 module is several times larger than the ext2 module), but ext2 support was removed anyway because, as far as I can tell, these devices were the red-headed stepchildren that simply got overlooked.
So, after 29404, the TEW-811DRU, TEW-812DRUv2, and EX6200 effectively had no USB storage support of any kind. USB support was still present, and a USB device that was plugged in would be properly detected. But without any file system drivers available, you couldn't mount anything. (The change in 29404 affected other sorts of devices as well--e.g., ticket 5467--but those users could fall back to FAT, which is not an option for these three Northstar devices thanks to 25132.)
The next problem for these overlooked devices came with changeset 34022 from 2017. In that changeset, libc_pic.a was added "for testing". This is a version of the C library for profiling performance during development. This was supposed to be a temporary addition and there was no reason to keep it in the firmware file, but it didn't get removed, and it bloated the firmware file by over 1.3 MiB. This is not an issue for most Northstar devices, but for these three 8 MiB devices, it meant that 34xxx and newer builds were too large and could not be flashed, as described in ticket 6144.
The problem of the oversized unflashable firmware was finally addressed build 36242. Not by the removal of the unnecessary libc_pic.a, but instead by stripping away all USB support from these devices. Whereas USB devices could be detected but not mounted in the past, now USB devices won't even be detected, and the configuration UI for USB was removed entirely.
In changeset 36722, the libc_pic.a that was added "for testing" a year prior was finally removed. But the removal of USB support in response to the bloat from libc_pic.a was never reverted.
So in its current state, the TEW-811DRU, TEW-812DRUv2, and EX6200 have no USB support of any kind.
My fix for the problem:
I did not want to revert to a build prior to 29404 because that's just too old and I wanted a build that had SFE. The device is already running 33986, so the next best option seems to be to find a way to add FAT support.
The files needed to support FAT (fat.ko, vfat.ko, and msdos.ko) would only add 30-40 KiB to the final image after squashfs, which makes the original removal of FAT support in 25132 particularly dubious IMHO. ext2 is similarly small, but while I could harvest the FAT files from other Northstar firmwares, none of those firmwares had ext2 (they only had ext4, which is much larger).
Using the firmware modification toolkit (which itself required some modification to get to work properly), I modified the firmware image for build 33986 by adding the FAT kernel module files harvested from another Northstar firmware (I used the TEW-818DRU, but any Northstar model would work; just make sure it's the same build number).
I haven't been able to test this modified firmware yet (the device itself is at the home of a relative and I won't have a chance to get there to flash it until the weekend), but I'm reasonably confident that this will allow me to mount a FAT-formatted USB device. I will update this post once I have a chance to test this fix.
My request for the developers:
Please revert the removal of USB support--it was removed in response to the bloat from libc_pic.a, but libc_pic.a is now gone. And please restore FAT, which only adds a trivially small amount to the final firmware size. (Given the choice between supporting ext2 and FAT, I think FAT would be more widely accessible and useful.) Both of these changes are just small changes to the build configuration--not code changes--so I do hope you can find the time to make them. Thanks in advance!
Buffalo WZR-1750DHP: 34311
TRENDnet TEW-673GRU: 34311
TRENDnet TEW-811DRU: 33986