Re: [U-Boot] [PATCH v2 4/5] tools: kwbimage: don't adjust for image_header for Armada MSYS

2019-02-18 Thread Stefan Roese

Hi Chris,

On 18.02.19 23:23, Chris Packham wrote:

On Mon, Feb 18, 2019 at 8:13 PM Stefan Roese  wrote:


Hi Chris,

On 15.02.19 23:49, Chris Packham wrote:

For the time being the Armada MSYS SoCs need to use the bin_hdr from the
Marvell U-Boot. Because of this the binary.0 does not contain the image
header that a proper u-boot SPL would so the adjustment introduced by
commit 94084eea3bd3 ("tools: kwbimage: Fix dest addr") does not apply.


Thanks for the explanation. I'm wondering if it would be better (if
possible) to auto detect this situation of using a bin_hdr from Marvell
vs U-Boot SPL instead in this tool. This would help especially if we
have full DDR init support in mainline U-Boot for this SoC at some
time, as we then need to differentiate between those two options for
this SoC.

Would this be possible?


One way would be to check the filename, binary.0 means don't adjust it
whereas u-boot-spl.img does. I also considered modifying the process
to create binary.0 to prepend sizeof(image_header_t) bytes to allow it
to work but I went with the quickest option for me to implement.

If it's an acceptable solution the filename thing would be quite easy
to implement. Adding a flag or parameter in the kwbimage.cfg would
also be relatively easy.


I'm okay with using the filename to decide here. Please go ahead with
this change and perhaps add a warning / error, if none of the standard
names is provided (u-boot-spl.* vs binary.0).

Thanks,
Stefan
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 4/5] tools: kwbimage: don't adjust for image_header for Armada MSYS

2019-02-18 Thread Chris Packham
On Mon, Feb 18, 2019 at 8:13 PM Stefan Roese  wrote:
>
> Hi Chris,
>
> On 15.02.19 23:49, Chris Packham wrote:
> > For the time being the Armada MSYS SoCs need to use the bin_hdr from the
> > Marvell U-Boot. Because of this the binary.0 does not contain the image
> > header that a proper u-boot SPL would so the adjustment introduced by
> > commit 94084eea3bd3 ("tools: kwbimage: Fix dest addr") does not apply.
>
> Thanks for the explanation. I'm wondering if it would be better (if
> possible) to auto detect this situation of using a bin_hdr from Marvell
> vs U-Boot SPL instead in this tool. This would help especially if we
> have full DDR init support in mainline U-Boot for this SoC at some
> time, as we then need to differentiate between those two options for
> this SoC.
>
> Would this be possible?

One way would be to check the filename, binary.0 means don't adjust it
whereas u-boot-spl.img does. I also considered modifying the process
to create binary.0 to prepend sizeof(image_header_t) bytes to allow it
to work but I went with the quickest option for me to implement.

If it's an acceptable solution the filename thing would be quite easy
to implement. Adding a flag or parameter in the kwbimage.cfg would
also be relatively easy.


>
> Thanks,
> Stefan
>
> > Signed-off-by: Chris Packham 
> > ---
> >
> > Changes in v2:
> > - new, split out from Add DB-XC3-24G4XG board with a better explanation
> >
> >   tools/Makefile   | 4 
> >   tools/kwbimage.c | 4 
> >   2 files changed, 8 insertions(+)
> >
> > diff --git a/tools/Makefile b/tools/Makefile
> > index 081383d7a790..d99098d6167a 100644
> > --- a/tools/Makefile
> > +++ b/tools/Makefile
> > @@ -148,6 +148,10 @@ ifneq ($(CONFIG_ARMADA_38X)$(CONFIG_ARMADA_39X),)
> >   HOSTCFLAGS_kwbimage.o += -DCONFIG_KWB_SECURE
> >   endif
> >
> > +ifneq ($(CONFIG_ARMADA_MSYS),)
> > +HOSTCFLAGS_kwbimage.o += -DCONFIG_KWB_DESTADDR_COMPAT
> > +endif
> > +
> >   # MXSImage needs LibSSL
> >   ifneq 
> > ($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_ARMADA_38X)$(CONFIG_ARMADA_39X)$(CONFIG_FIT_SIGNATURE),)
> >   HOSTLOADLIBES_mkimage += \
> > diff --git a/tools/kwbimage.c b/tools/kwbimage.c
> > index a88a3830c0c8..4c60679fbb53 100644
> > --- a/tools/kwbimage.c
> > +++ b/tools/kwbimage.c
> > @@ -1252,8 +1252,12 @@ static void *image_create_v1(size_t *imagesz, struct 
> > image_tool_params *params,
> >   cpu_to_le32(payloadsz - headersz + sizeof(uint32_t));
> >   main_hdr->headersz_lsb = cpu_to_le16(headersz & 0x);
> >   main_hdr->headersz_msb = (headersz & 0x) >> 16;
> > +#ifdef CONFIG_KWB_DESTADDR_COMPAT
> > + main_hdr->destaddr = cpu_to_le32(params->addr);
> > +#else
> >   main_hdr->destaddr = cpu_to_le32(params->addr)
> >- sizeof(image_header_t);
> > +#endif
> >   main_hdr->execaddr = cpu_to_le32(params->ep);
> >   main_hdr->srcaddr  = cpu_to_le32(headersz);
> >   main_hdr->ext  = hasext;
> >
>
> Viele Grüße,
> Stefan
>
> --
> DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
> HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
> Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: s...@denx.de
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


Re: [U-Boot] [PATCH v2 4/5] tools: kwbimage: don't adjust for image_header for Armada MSYS

2019-02-17 Thread Stefan Roese

Hi Chris,

On 15.02.19 23:49, Chris Packham wrote:

For the time being the Armada MSYS SoCs need to use the bin_hdr from the
Marvell U-Boot. Because of this the binary.0 does not contain the image
header that a proper u-boot SPL would so the adjustment introduced by
commit 94084eea3bd3 ("tools: kwbimage: Fix dest addr") does not apply.


Thanks for the explanation. I'm wondering if it would be better (if
possible) to auto detect this situation of using a bin_hdr from Marvell
vs U-Boot SPL instead in this tool. This would help especially if we
have full DDR init support in mainline U-Boot for this SoC at some
time, as we then need to differentiate between those two options for
this SoC.

Would this be possible?

Thanks,
Stefan
 

Signed-off-by: Chris Packham 
---

Changes in v2:
- new, split out from Add DB-XC3-24G4XG board with a better explanation

  tools/Makefile   | 4 
  tools/kwbimage.c | 4 
  2 files changed, 8 insertions(+)

diff --git a/tools/Makefile b/tools/Makefile
index 081383d7a790..d99098d6167a 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -148,6 +148,10 @@ ifneq ($(CONFIG_ARMADA_38X)$(CONFIG_ARMADA_39X),)
  HOSTCFLAGS_kwbimage.o += -DCONFIG_KWB_SECURE
  endif
  
+ifneq ($(CONFIG_ARMADA_MSYS),)

+HOSTCFLAGS_kwbimage.o += -DCONFIG_KWB_DESTADDR_COMPAT
+endif
+
  # MXSImage needs LibSSL
  ifneq 
($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_ARMADA_38X)$(CONFIG_ARMADA_39X)$(CONFIG_FIT_SIGNATURE),)
  HOSTLOADLIBES_mkimage += \
diff --git a/tools/kwbimage.c b/tools/kwbimage.c
index a88a3830c0c8..4c60679fbb53 100644
--- a/tools/kwbimage.c
+++ b/tools/kwbimage.c
@@ -1252,8 +1252,12 @@ static void *image_create_v1(size_t *imagesz, struct 
image_tool_params *params,
cpu_to_le32(payloadsz - headersz + sizeof(uint32_t));
main_hdr->headersz_lsb = cpu_to_le16(headersz & 0x);
main_hdr->headersz_msb = (headersz & 0x) >> 16;
+#ifdef CONFIG_KWB_DESTADDR_COMPAT
+   main_hdr->destaddr = cpu_to_le32(params->addr);
+#else
main_hdr->destaddr = cpu_to_le32(params->addr)
 - sizeof(image_header_t);
+#endif
main_hdr->execaddr = cpu_to_le32(params->ep);
main_hdr->srcaddr  = cpu_to_le32(headersz);
main_hdr->ext  = hasext;



Viele Grüße,
Stefan

--
DENX Software Engineering GmbH,  Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: s...@denx.de
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


[U-Boot] [PATCH v2 4/5] tools: kwbimage: don't adjust for image_header for Armada MSYS

2019-02-15 Thread Chris Packham
For the time being the Armada MSYS SoCs need to use the bin_hdr from the
Marvell U-Boot. Because of this the binary.0 does not contain the image
header that a proper u-boot SPL would so the adjustment introduced by
commit 94084eea3bd3 ("tools: kwbimage: Fix dest addr") does not apply.

Signed-off-by: Chris Packham 
---

Changes in v2:
- new, split out from Add DB-XC3-24G4XG board with a better explanation

 tools/Makefile   | 4 
 tools/kwbimage.c | 4 
 2 files changed, 8 insertions(+)

diff --git a/tools/Makefile b/tools/Makefile
index 081383d7a790..d99098d6167a 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -148,6 +148,10 @@ ifneq ($(CONFIG_ARMADA_38X)$(CONFIG_ARMADA_39X),)
 HOSTCFLAGS_kwbimage.o += -DCONFIG_KWB_SECURE
 endif
 
+ifneq ($(CONFIG_ARMADA_MSYS),)
+HOSTCFLAGS_kwbimage.o += -DCONFIG_KWB_DESTADDR_COMPAT
+endif
+
 # MXSImage needs LibSSL
 ifneq 
($(CONFIG_MX23)$(CONFIG_MX28)$(CONFIG_ARMADA_38X)$(CONFIG_ARMADA_39X)$(CONFIG_FIT_SIGNATURE),)
 HOSTLOADLIBES_mkimage += \
diff --git a/tools/kwbimage.c b/tools/kwbimage.c
index a88a3830c0c8..4c60679fbb53 100644
--- a/tools/kwbimage.c
+++ b/tools/kwbimage.c
@@ -1252,8 +1252,12 @@ static void *image_create_v1(size_t *imagesz, struct 
image_tool_params *params,
cpu_to_le32(payloadsz - headersz + sizeof(uint32_t));
main_hdr->headersz_lsb = cpu_to_le16(headersz & 0x);
main_hdr->headersz_msb = (headersz & 0x) >> 16;
+#ifdef CONFIG_KWB_DESTADDR_COMPAT
+   main_hdr->destaddr = cpu_to_le32(params->addr);
+#else
main_hdr->destaddr = cpu_to_le32(params->addr)
 - sizeof(image_header_t);
+#endif
main_hdr->execaddr = cpu_to_le32(params->ep);
main_hdr->srcaddr  = cpu_to_le32(headersz);
main_hdr->ext  = hasext;
-- 
2.20.1

___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot