[PATCH V5 4/4] mtd: extract TRX parser out of bcm47xxpart into a separated module

Brian Norris computersforpeace at gmail.com
Thu May 25 13:51:54 PDT 2017


On Wed, May 24, 2017 at 11:44:37AM +0200, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal at milecki.pl>
> 
> This makes TRX parsing code reusable with other platforms and parsers.
> 
> Please note this patch doesn't really change anything in the existing
> code, just moves it. There is still some place for improvement (e.g.
> working on non-hacky method of checking rootfs format) but it's not
> really a subject of this change.
> 
> Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
> ---
> V2: A totally rebased & refreshed version.
> V5: Add TRX format verification, improve comment, fix memory leak
>     Thanks Brian

I think this looks OK now. I'll wait on resolving the rest of the
infrastucture, so I'll leave this here for now:

Reviewed-by: Brian Norris <computersforpeace at gmail.com>

> ---
>  drivers/mtd/Kconfig              |   4 ++
>  drivers/mtd/Makefile             |   1 +
>  drivers/mtd/bcm47xxpart.c        |  99 ++----------------------------
>  drivers/mtd/parsers/Kconfig      |   8 +++
>  drivers/mtd/parsers/Makefile     |   1 +
>  drivers/mtd/parsers/parser_trx.c | 126 +++++++++++++++++++++++++++++++++++++++
>  6 files changed, 145 insertions(+), 94 deletions(-)
>  create mode 100644 drivers/mtd/parsers/Kconfig
>  create mode 100644 drivers/mtd/parsers/Makefile
>  create mode 100644 drivers/mtd/parsers/parser_trx.c
> 

...

> diff --git a/drivers/mtd/parsers/Kconfig b/drivers/mtd/parsers/Kconfig
> new file mode 100644
> index 000000000000..ebb697a52698
> --- /dev/null
> +++ b/drivers/mtd/parsers/Kconfig
> @@ -0,0 +1,8 @@
> +config MTD_PARSER_TRX
> +	tristate "Parser for TRX format partitions"
> +	depends on MTD && (BCM47XX || ARCH_BCM_5301X)

|| COMPILE_TEST ? Would be nice to be able to build-test things like
this, even if you know they're only used for a few architectures.

> +	help
> +	  TRX is a firmware format used by Broadcom on their devices. It
> +	  may contain up to 3/4 partitions (depending on the version).
> +	  This driver will parse TRX header and report at least two partitions:
> +	  kernel and rootfs.

...

Brian



More information about the linux-mtd mailing list