Skip to contentSkip to conversation

imximage: Add MX53 boot image support

PATCH Superseded Jason Liu 3 participants 7 messages Jan 18, 2011 – Jan 19, 2011 Arm i.MX and Layerscape

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Jason Liu

author
#0 lore raw

PATCH v4 1/1 imximage: Add MX53 boot image support

This patch add the MX53 boot image support.

This patch has been tested on Freescale MX53EVK board and MX51EVK board.

---
Changes for v2:
- Address the following comments from Stefano,
- Get rid of #ifdef in the imximage.h and .c file and use the runtime check for imximage version
- Document the IMXIMAGE_VERSION definiton in doc/README.imximage
- Move mx53evk/config.mk and mx53evk/imximage.cfg to MX53EVK board support patch.

Changes for v3:
- Address the following comments from Stefano,
- Not change the mx51evk file. The code should take VERSION=1 as default, and we do not need to change the actual boards.
- add a note in the documentation and raise an error in code if the VERSION command is read after any other suitable commands.
- Change command IMXIMAGE_VERSION simply to IMAGE_VERSION
- Need recognize the version directly from its structure and not storing the version into the header when do header verify and print.
- Use function pointer to simpliy the code when the version of header is recognized
Changes for v4:
- Address the following comments from Wolfgang,
- Keep the imximage_cmds table sorted,
- Add braces for (expx) && (expy) gloably,
- Return failure to upper call if met errors for function
- Add comments for function set_dcd_rst_v1 alike,
- Re-orgnize code to avoid deep nesting,

---
 doc/README.imximage |   12 +-
 tools/imximage.c    |  527 +++++++++++++++++++++++++++++++++++++--------------
 tools/imximage.h    |  110 +++++++++--
 3 files changed, 489 insertions(+), 160 deletions(-)
doc/README.imximage +10 -2
index 3378f7e..c74239d 100644
@@ -57,6 +57,13 @@ Configuration command line syntax:
 2. Following are the valid command strings and associated data strings:-
 	Command string		data string
 	--------------		-----------
+	IMXIMAGE_VERSION        1/2
+				1 is for mx25/mx35/mx51 compatible,
+				2 is for mx53 compatible,
+				others is invalid and error is generated.
+				This command need appear the fist before
+				other valid commands in configuration file.
+
 	BOOT_FROM		nand/spi/sd/onenand
 				Example:
 				BOOT_FROM spi
@@ -69,8 +76,9 @@ Configuration command line syntax:
 				Example (write to IOMUXC):
 				DATA 4 0x73FA88a0 0x200
 
-The processor support up to 60 register programming commands. An error
-is generated if more commands are found in the configuration file.
+The processor support up to 60 register programming commands for IMXIMAGE_VERSION 1
+and 121 register programming commands for IMXIMAGE_VERSION 2.
+An error is generated if more commands are found in the configuration file.
 
 3. All commands are optional to program.
 
tools/imximage.c +389 -138

606 lines not on this page · raw message

tools/imximage.h +90 -20

153 lines not on this page · raw message

Signature · 1 line
1.7.0.4
#1 lore raw

PATCH v4 1/1 imximage: Add MX53 boot image support

Dear Jason Liu,

Quoted 16 lines · In message <[email protected]> you wrote:

This patch add the MX53 boot image support.

This patch has been tested on Freescale MX53EVK board and MX51EVK board.

---
Changes for v2:
- Address the following comments from Stefano,
- Get rid of #ifdef in the imximage.h and .c file and use the runtime check for imximage version
- Document the IMXIMAGE_VERSION definiton in doc/README.imximage
- Move mx53evk/config.mk and mx53evk/imximage.cfg to MX53EVK board support patch.

Quoted 14 lines

Changes for v3:
- Address the following comments from Stefano,
- Not change the mx51evk file. The code should take VERSION=1 as default, and we do not need to change the actual boards.
- add a note in the documentation and raise an error in code if the VERSION command is read after any other suitable commands.
- Change command IMXIMAGE_VERSION simply to IMAGE_VERSION
- Need recognize the version directly from its structure and not storing the version into the header when do header verify and print.
- Use function pointer to simpliy the code when the version of header is recognized
Changes for v4:
- Address the following comments from Wolfgang,
- Keep the imximage_cmds table sorted,
- Add braces for (expx) && (expy) gloably,

really? see below.

Quoted 4 lines

- Return failure to upper call if met errors for function
- Add comments for function set_dcd_rst_v1 alike,
- Re-orgnize code to avoid deep nesting,
---

...

tools/imximage.c static uint32_t get_cfg_value(char *token, char *name, int linenr) · line 105

Quoted 10 lines
tools/imximage.c +10 -0
+	if ((fhdr_v1->app_code_barker == APP_CODE_BARKER) &&
+		(hdr_v1->dcd_table.preamble.barker == DCD_BARKER))
+
+		return IMXIMAGE_V1;
+
+	/* Try to detect V2 */
+	if ((fhdr_v2->header.tag == IVT_HEADER_TAG) &&
+		(hdr_v2->dcd_table.header.tag == DCD_HEADER_TAG))
+
+		return IMXIMAGE_V2;

These two need braces.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Administration: An ingenious abstraction  in  politics,  designed  to
receive the kicks and cuffs due to the premier or president.
- Ambrose Bierce
#2 lore raw

PATCH v4 1/1 imximage: Add MX53 boot image support

Hi, Wolfgang,

2011/1/19 Wolfgang Denk <[email protected]>:

Quoted 41 lines

Dear Jason Liu,

Quoted 16 lines · In message <[email protected]> you wrote:

This patch add the MX53 boot image support.

This patch has been tested on Freescale MX53EVK board and MX51EVK board.

---
Changes for v2:
- Address the following comments from Stefano,
? - Get rid of ?#ifdef in the imximage.h and .c file and use ? ? the runtime check for imximage version
? - Document the IMXIMAGE_VERSION definiton in doc/README.imximage ? - Move mx53evk/config.mk and mx53evk/imximage.cfg to MX53EVK board ? ? support patch.

Quoted 14 lines

Changes for v3:
- Address the following comments from Stefano,
?- Not change the mx51evk file. The code should take VERSION=1 as default, ? ?and we do not need to change the actual boards.
?- add a note in the documentation and raise an error in code if the
? ?VERSION command is read after any other suitable commands.
?- Change command IMXIMAGE_VERSION simply to IMAGE_VERSION
?- Need recognize the version directly from its structure and not storing the ? ?version into the header when do header verify and print.
?- Use function pointer to simpliy the code when the version of header is recognized Changes for v4:
- Address the following comments from Wolfgang,
?- Keep the imximage_cmds table sorted,
?- Add braces for (expx) && (expy) gloably,

really? see below.

Quoted 4 lines

?- Return failure to upper call if met errors for function ?- Add comments for function set_dcd_rst_v1 alike, ?- Re-orgnize code to avoid deep nesting,
---

...

Quoted 12 lines

Review

Quoted 10 lines

+ ? ? if ((fhdr_v1->app_code_barker == APP_CODE_BARKER) &&
+ ? ? ? ? ? ? (hdr_v1->dcd_table.preamble.barker == DCD_BARKER))

(quoted diff) +8 -0
+
+ ? ? ? ? ? ? return IMXIMAGE_V1;
+
+ ? ? /* Try to detect V2 */
+ ? ? if ((fhdr_v2->header.tag == IVT_HEADER_TAG) &&
+ ? ? ? ? ? ? (hdr_v2->dcd_table.header.tag == DCD_HEADER_TAG))
+
+ ? ? ? ? ? ? return IMXIMAGE_V2;

These two need braces.

Could you please state clear where it need brace? Thanks,

Quoted 17 lines

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Administration: An ingenious abstraction ?in ?politics, ?designed ?to receive the kicks and cuffs due to the premier or president.
- Ambrose Bierce
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#3 lore raw

PATCH v4 1/1 imximage: Add MX53 boot image support

In reply to Wolfgang Denk

Hi, Wolfgang,

2011/1/19 Wolfgang Denk <[email protected]>:

Quoted 41 lines

Dear Jason Liu,

Quoted 16 lines · In message <[email protected]> you wrote:

This patch add the MX53 boot image support.

This patch has been tested on Freescale MX53EVK board and MX51EVK board.

---
Changes for v2:
- Address the following comments from Stefano,
? - Get rid of ?#ifdef in the imximage.h and .c file and use ? ? the runtime check for imximage version
? - Document the IMXIMAGE_VERSION definiton in doc/README.imximage ? - Move mx53evk/config.mk and mx53evk/imximage.cfg to MX53EVK board ? ? support patch.

Quoted 14 lines

Changes for v3:
- Address the following comments from Stefano,
?- Not change the mx51evk file. The code should take VERSION=1 as default, ? ?and we do not need to change the actual boards.
?- add a note in the documentation and raise an error in code if the
? ?VERSION command is read after any other suitable commands.
?- Change command IMXIMAGE_VERSION simply to IMAGE_VERSION
?- Need recognize the version directly from its structure and not storing the ? ?version into the header when do header verify and print.
?- Use function pointer to simpliy the code when the version of header is recognized Changes for v4:
- Address the following comments from Wolfgang,
?- Keep the imximage_cmds table sorted,
?- Add braces for (expx) && (expy) gloably,

really? see below.

Quoted 4 lines

?- Return failure to upper call if met errors for function ?- Add comments for function set_dcd_rst_v1 alike, ?- Re-orgnize code to avoid deep nesting,
---

...

Quoted 12 lines

Review

Quoted 10 lines

+ ? ? if ((fhdr_v1->app_code_barker == APP_CODE_BARKER) &&
+ ? ? ? ? ? ? (hdr_v1->dcd_table.preamble.barker == DCD_BARKER))

(quoted diff) +8 -0
+
+ ? ? ? ? ? ? return IMXIMAGE_V1;
+
+ ? ? /* Try to detect V2 */
+ ? ? if ((fhdr_v2->header.tag == IVT_HEADER_TAG) &&
+ ? ? ? ? ? ? (hdr_v2->dcd_table.header.tag == DCD_HEADER_TAG))
+
+ ? ? ? ? ? ? return IMXIMAGE_V2;

These two need braces.

Could you please state clear where it need brace? Thanks,

Quoted 17 lines

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Administration: An ingenious abstraction ?in ?politics, ?designed ?to receive the kicks and cuffs due to the premier or president.
- Ambrose Bierce
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#4 lore raw

PATCH v4 1/1 imximage: Add MX53 boot image support

Hi, Wolfgang,

2011/1/19 Jason Liu <[email protected]>:

Quoted 13 lines

Hi, Wolfgang,

2011/1/19 Wolfgang Denk <[email protected]>:

Quoted 10 lines

Dear Jason Liu,

Quoted 7 lines · In message <[email protected]> you wrote:

This patch add the MX53 boot image support.

This patch has been tested on Freescale MX53EVK board and MX51EVK board.

[snip]

Quoted 19 lines
Quoted 6 lines
Quoted 5 lines

?- Return failure to upper call if met errors for function ?- Add comments for function set_dcd_rst_v1 alike, ?- Re-orgnize code to avoid deep nesting,
---

...

Quoted 12 lines

Review

Quoted 10 lines

+ ? ? if ((fhdr_v1->app_code_barker == APP_CODE_BARKER) &&
+ ? ? ? ? ? ? (hdr_v1->dcd_table.preamble.barker == DCD_BARKER))

(quoted diff) +8 -0
+
+ ? ? ? ? ? ? return IMXIMAGE_V1;
+
+ ? ? /* Try to detect V2 */
+ ? ? if ((fhdr_v2->header.tag == IVT_HEADER_TAG) &&
+ ? ? ? ? ? ? (hdr_v2->dcd_table.header.tag == DCD_HEADER_TAG))
+
+ ? ? ? ? ? ? return IMXIMAGE_V2;

These two need braces.

Quoted 1 line

Could you please state clear where it need brace? Thanks,

Do you mean the I need add the braces as the following?

? ? if ((fhdr_v1->app_code_barker == APP_CODE_BARKER) &&
? ? ? ? ? ? (hdr_v1->dcd_table.preamble.barker == DCD_BARKER)) {

   ? ? ? ?  return IMXIMAGE_V1;
    }
Quoted 19 lines
Quoted 18 lines

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Administration: An ingenious abstraction ?in ?politics, ?designed ?to receive the kicks and cuffs due to the premier or president.
- Ambrose Bierce
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#5 lore raw

PATCH v4 1/1 imximage: Add MX53 boot image support

Dear Jason Liu,

Quoted 7 lines · In message <[email protected]> you…

Do you mean the I need add the braces as the following?

    if ((fhdr_v1->app_code_barker == APP_CODE_BARKER) &&
             (hdr_v1->dcd_table.preamble.barker == DCD_BARKER)) {
            return IMXIMAGE_V1;
    }

Right. And especially with the blank lines you had before.

Best regards,

Wolfgang Denk

Signature · 7 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Winners never talk about glorious victories. That's  because  they're
the  ones  who  see  what the battlefield looks like afterwards. It's
only the losers who have glorious victories.
                                      - Terry Pratchett, _Small Gods_
#6 lore raw

PATCH v4 1/1 imximage: Add MX53 boot image support

Hi, Wolfgang,

2011/1/20 Wolfgang Denk <[email protected]>:

Quoted 4 lines

Dear Jason Liu,

Quoted 1 line · In message <[email protected]> you…
Quoted 8 lines
Quoted 6 lines

Do you mean the I need add the braces as the following?

? ? if ((fhdr_v1->app_code_barker == APP_CODE_BARKER) && ? ? ? ? ? ? ?(hdr_v1->dcd_table.preamble.barker == DCD_BARKER)) { ? ? ? ? ? ? return IMXIMAGE_V1;
? ? }

Right. And especially with the blank lines you had before.

Yes, but can we just change to the following since it just one statement, if ((fhdr_v1->app_code_barker == APP_CODE_BARKER) &&
? ? ? ? ? ? ?(hdr_v1->dcd_table.preamble.barker == DCD_BARKER)) ? ? ? ? ? ? return IMXIMAGE_V1;

Some checkpatch will give a warning, say, no need to add braces for only one statement, something like that.

Quoted 14 lines

Best regards,

Wolfgang Denk

--
DENX Software Engineering GmbH, ? ? MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Winners never talk about glorious victories. That's ?because ?they're the ?ones ?who ?see ?what the battlefield looks like afterwards. It's only the losers who have glorious victories.
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?- Terry Pratchett, _Small Gods_