[U-Boot] [PATCH 1/4] common: imx: Implement generic u-boot.nand target

Marek Vasut
2013-02-25T21:10:35Z

Dear Scott Wood,

> On 02/25/2013 12:19:54 PM, Marek Vasut wrote:
> > Implement u-boot.nand target that can be reused with a small amount of
> > churn across all CPU models. The idea is to delegate the u-boot.nand
> > target
> > out of the main Makefile and into the CPU's Makefile (very similar to
> > what
> > u-boot.imx does now). The main Makefile shall only contain path to
> > which the
> > u-boot.nand target is delegated. Hopefully this will not produce too
> > much
> > bloat in the main Makefile.
> >
> > To demonstrate this implementation, add u-boot.nand target for i.MX53.
> >
> > Signed-off-by: Marek Vasut <marex@denx.de>
> > Cc: Beno?t Th?baudeau <benoit.thebaudeau@advansee.com>
> > Cc: Fabio Estevam <fabio.estevam@freescale.com>
> > Cc: Stefano Babic <sbabic@denx.de>
> > ---
> >
> > Makefile | 18 ++++++++++++++++++
> > arch/arm/imx-common/Makefile | 6 ++++++
> > 2 files changed, 24 insertions(+)
> >
> > diff --git a/Makefile b/Makefile
> > index 41054b7..8b1010a 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -470,6 +470,23 @@ $(obj)u-boot.img: $(obj)u-boot.bin
> >
> > $(obj)u-boot.imx: $(obj)u-boot.bin depend
> >
> > $(MAKE) -C $(SRCTREE)/arch/arm/imx-common
> >
> > $(obj)u-boot.imx
> >
> > +#
> > +# Generic u-boot.nand target.
> > +#
> > +# Every CPU that needs u-boot.nand must add a path to an
> > implementation of
> > +# the actual u-boot.nand generator below.
> > +#
> > +ifdef CONFIG_MX53
> > +CONFIG_NAND_TRG_PATH := $(SRCTREE)/arch/arm/imx-common
> > +endif
> > +
> > +$(obj)u-boot.nand: $(obj)u-boot.bin depend
> > + if [ "X$(CONFIG_NAND_TRG_PATH)X" = "XX" ] ;
> > then \
> > + echo "This CPU does not support u-boot.nand
> > target!" ; \
> > + exit 1
> > ; \
> > + fi
> > + $(MAKE) -C $(CONFIG_NAND_TRG_PATH) $(obj)u-boot.nand
>
> We already have CONFIG_SPL_TARGET. Why do we need a new mechanism
> specific to NAND, with ifdefs in the main Makefile?

This board doesn't use SPL at all.

> If we do have something specific to NAND, it should be u-boot-nand.bin
> to match what nand_spl produced, and it should just be a generic rule
> that links to what CONFIG_SPL_TARGET produced, if the right CONFIG
> symbol is set by the board config to say that this is a NAND SPL. Or
> is someone going to say that they want to generate multiple different
> SPL images from the same build? :-P

I'd like to generate a bootable NAND image on mx53 and on mx23/28, thus I need
generic target. And I need it flexible enough, since on mx23/28 it munges u-
boot.sb into the resulting image while on mx53 it munges u-boot.imx into the
resulting image.

> -Scott

Best regards,
Marek Vasut