From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Babic Date: Thu, 09 Jul 2015 18:04:17 +0200 Subject: [U-Boot] [PATCH RESEND] tools/imximage: set DCD pointer to NULL when its length is 0 In-Reply-To: <24b427fa8ee7500d08b6ed412da70e597bf5061a.1436454776.git.baruch@tkos.co.il> References: <24b427fa8ee7500d08b6ed412da70e597bf5061a.1436454776.git.baruch@tkos.co.il> Message-ID: <559E9B81.7010506@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Baruch, On 09/07/2015 17:19, Baruch Siach wrote: > When dcd_len is 0 the Write Data command that the set_dcd_rst_v2() routine > generates is empty. This causes HAB to complain that the command is invalid. > > --------- HAB Event 1 ----------------- > event data: > 0xdb 0x00 0x0c 0x41 0x33 0x06 0xc0 0x00 > 0xcc 0x00 0x04 0x04 > > To fix this set the DCD pointer in the IVT to NULL in this case. The DCD header > itself is still needed for detect_imximage_version() to determine the image > version. > > Signed-off-by: Baruch Siach > --- > Resending with a proper To: header. > > tools/imximage.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/tools/imximage.c b/tools/imximage.c > index 6f469ae6336c..7b91d09699ad 100644 > --- a/tools/imximage.c > +++ b/tools/imximage.c > @@ -250,7 +250,11 @@ static void set_imx_hdr_v2(struct imx_header *imxhdr, uint32_t dcd_len, > hdr_base = entry_point - imximage_init_loadsize + > flash_offset; > fhdr_v2->self = hdr_base; > - fhdr_v2->dcd_ptr = hdr_base + offsetof(imx_header_v2_t, dcd_table); > + if (dcd_len > 0) > + fhdr_v2->dcd_ptr = hdr_base > + + offsetof(imx_header_v2_t, dcd_table); > + else > + fhdr_v2->dcd_ptr = 0; > fhdr_v2->boot_data_ptr = hdr_base > + offsetof(imx_header_v2_t, boot_data); > hdr_v2->boot_data.start = entry_point - imximage_init_loadsize; > It looks ok for me. Acked-by: Stefano Babic Best regards, Stefano Babic -- ===================================================================== DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de =====================================================================