[OpenWrt-Devel] [PATCH v1 0/7] Add custom TRX header option

Will Sheppard sheppard.will at gmail.com
Mon Feb 9 16:12:29 EST 2015


Hi - thanks for review; reply inline

On 9 February 2015 at 20:52, Florian Fainelli <florian at openwrt.org> wrote:

> On 09/02/15 08:29, Will Sheppard wrote:
> > Patchset to essentially add custom TRX header to all firmware produced.
> >
> > This is most useful for the Belkin routers from my experience. I'm not
> > how other trx based firmwares modify the header for their own purposes.
> >
> > This is applied across the board so that the kernel, trx tools and mtd
> > tools are all compiled with the specified header.
> >
> > I have modified the kernel specifically for the brcm47xx based boards to
> > ensure the mtd parser looks for the correct magic. NOTE: This function
> will,
> > for other boards, fail.
>
> I don't think this is desirable at all to have, for many reasons:
>
> - how can an use figure out the proper TRX_MAGIC value he/she should use?
>

There's simply no hard-and-fast rule for this - just looking at a factory
binary might not help - it worked for me.

>
> - this is extremely error prone and can result, as you mention in
> failing to work with existing devices with well-defined TRX headers
>

Error prone inasmuch as it could be the wrong value and thus brick the
router? ( I guess I'm always thinking from a "have a serial port"
perspective )

>
> - how can we get some level of reproducibility for both the kernel and
> firmware tools builds?
>
> I would really encourage you to extend the existing code to take an
> arbitrary list of TRX magics, such that you can have maybe a single file
> to modify and both "mtd" and the kernel can use that list of magic
> values accordingly.
>

I agree. As the mtd utility looks for this value though, it would have to
know what router it was being used on - i'm not sure that is available as a
value in user-space is it?

>
> Out of curiosity, how many different TRX magic values should we have to
> support with or without your patches?
>

I know that Belkin seem to use different magics i.e. not HDR0, I'm not sure
about other manufacturers. But presumably these values could be added as
they become known.

>
> >
> > Will Sheppard (7):
> >   config: Add option to specify custom TRX header
> >   mtd: Add custom trx magic option to mtd tool
> >   mtd: Fix: Use TRX_MAGIC define not hard-coded number
> >   trx: Add custom TRX option to trx firmware tool
> >   mtd: Add debug showing header magic in use
> >   kernel: bcm47xx: Add custom TRX header option to kernel
> >   mtd: Fix makefile to work with quilt as per wiki
> >
> >  config/Config-images.in                            | 15 ++++++++++
> >  package/system/mtd/Makefile                        |  9 +++++-
> >  package/system/mtd/src/trx.c                       | 10 +++++--
> >  .../patches-3.14/162-Belkin_custom_trx_magic.patch | 35
> ++++++++++++++++++++++
> >  tools/firmware-utils/Makefile                      |  4 +++
> >  tools/firmware-utils/src/trx.c                     | 10 ++++++-
> >  6 files changed, 79 insertions(+), 4 deletions(-)
> >  create mode 100644
> target/linux/brcm47xx/patches-3.14/162-Belkin_custom_trx_magic.patch
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20150209/87dcacd0/attachment.htm>
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list