Commit Graph

21 Commits

Author SHA1 Message Date
Peng Fan 3e0a71c157 tools: imximage: add set bit command
Add set bit command support.
Usage: SET_BIT 4 [address] [bitmask]

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Reviewed-by: Stefano Babic <sbabic@denx.de>
2017-03-19 17:30:15 +01:00
Peng Fan b55e4f48db tools: imximage: add plugin support
Add plugin support for imximage.

Define CONFIG_USE_IMXIMG_PLUGIN in defconfig to enable using plugin.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Eric Nelson <eric@nelint.com>
Cc: Ye Li <ye.li@nxp.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2016-10-24 10:57:16 +02:00
Troy Kisky 61903b759a imximage: fix commands other than write_data
When CHECK_BITS_SET was added, they forgot to add
a new command table, and instead overwrote the
previous table.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
Tested-by: Fabio Estevam <fabio.estevam@freescale.com>
2015-10-07 13:43:15 +02:00
Adrian Alonso 0b7f7c339c imx: imximage: add new CHECK/CLR BIT command
* Extend imximage DCD version 2 to support DCD commands
  CMD_WRITE_CLR_BIT 4 [address] [mask bit] means:
    while ((*address & ~mask) != 0);
  CMD_CHECK_BITS_SET 4 [address] [mask bit] means:
    while ((*address & mask) != mask);
  CMD_CHECK_BITS_CLR 4 [address] [mask bit] means:
    *address = *address & ~mask;
* Add set_dcd_param_v2 helper function to set DCD
  command parameters

Signed-off-by: Adrian Alonso <aalonso@freescale.com>
Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
2015-07-26 12:07:14 +02:00
Albert ARIBAUD \(3ADEV\) 699279cac0 tools: mkimage: fix imximage header size
imximage header size is 4-byte, not 8-byte aligned.
This produces .imx images that a Vybrid cannot boot
on.

Fix by adding a "padding" field in header.

Signed-off-by: Albert ARIBAUD (3ADEV) <albert.aribaud@3adev.fr>
2015-07-10 10:12:59 +02:00
Ye.Li 9598f8c30c imx: imximage: Add QuadSPI boot support
Add QuadSPI boot support to imximage tool.

Note: The QuadSPI configuration parameters at offset 0x400 are not
included in this patch. Need other tools to generate the parameters
part.

Signed-off-by: Ye.Li <B37916@freescale.com>
2015-02-10 12:48:49 +01:00
Fabio Estevam 021e79c853 tools: imximage: Fix the maximum DCD size for mx53/mx6
According to mx53 and mx6 reference manuals:

"The maximum size of the DCD limited to 1768 bytes."

As each DCD entry consists of 8 bytes, we have a total of 1768 / 8 = 221, and
excluding the first entry, which is the header leads to 220 as the maximum
number for DCD size.

Reported-by: Jonas Karlsson <jonas.d.karlsson@gmail.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Nitin Garg <nitin.garg@freescale.com>
Acked-by: Nitin Garg <nitin.garg@freescale.com>
2014-09-09 16:23:00 +02:00
Wolfgang Denk 3765b3e7bd Coding Style cleanup: remove trailing white space
Signed-off-by: Wolfgang Denk <wd@denx.de>
2013-10-14 16:06:53 -04:00
Stefano Babic 0187c985aa tools: add support for setting the CSF into imximage
Add support for setting the CSF (Command Sequence File) pointer
which is used for HAB (High Assurance Boot) in the imximage by
adding e.g.

CSF 0x2000

in the imximage.cfg file.

This will set the CSF pointer accordingly just after the padded
data image area. The boot_data.length is adjusted with the
value from the imximage.cfg config file.

The resulting u-boot.imx can be signed with the FSL HAB tooling.
The generated CSF block needs to be appended to the u-boot.imx.

Signed-off-by: Stefano Babic <sbabic@denx.de>
2013-08-31 15:06:29 +02:00
Stefano Babic 377e367a85 tools: dynamically allocate imx_header in imximage
Change to dynamically allocate the imx_header to correctly
allocate the IVT, Boot Data and DCD at correct locations
depending on the boot media.

Also check that the Image Vector Table Offset + IVT +
Boot Data + DCD <= Initial Load Region Size.

Previously struct imx_header was always 4096 bytes and was
not dealing correctly with the Image Vector Table Offset.

Now, the memory allocation looks for e.g. SD boot like this

 Storage   u-boot.imx                             RAM
 Device

 00000000                                         177ff000 <--------------
                                                                         |
 00000400  00000000  d1 00 20 40 IVT.header       177ff400 <-------      |
 00000404  00000004  00 00 80 17 IVT.entry        177ff404 -----------   |
 00000408  00000008  00 00 00 00 IVT.reserved1    177ff408        |  |   |
 0000040C  0000000C  2c f4 7f 17 IVT.dcd          177ff40C ------ |  |   |
 00000410  00000010  20 f4 7f 17 IVT.boot         177ff410 ---- | |  |   |
 00000414  00000014  00 f4 7f 17 IVT.self         177ff414 --------  |   |
 00000418  00000018  00 00 00 00 IVT.csf          177ff418    | |    |   |
 0000041C  0000001C  00 00 00 00 IVT.reserved2    177ff41C    | |    |   |
 00000420  00000020  00 f0 7f 17 BootData.start   177ff420 <--- |    | ---
 00000424  00000024  00 60 03 00 BootData.length  177ff424      |    |
 00000428  00000028  00 00 00 00 BootData.plugin  177ff428      |    |
 0000042C  0000002C  d2 03 30 40 DCD.header       177ff42C <-----    |
 ...                                                                 |
 00001000  00000c00  13 00 00 ea U-Boot Start     17800000 <----------

While at it also remove the unused #define HEADER_OFFSET.

Signed-off-by: Stefano Babic <sbabic@denx.de>
2013-08-31 15:06:28 +02:00
Stefano Babic 4655d40f34 tools: imx_header should not include flash_offset
Doing a  make distclean; make mx6qsabresd_config; make
and      hexdump -C u-boot.imx | less

 ...
 00000360  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 *
 000003f0  00 00 00 00 00 00 00 00  00 00 00 00 00 04 00 00  |................|
                                                ^^^^^^^^^^^
 00000400  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 *
 00001000  13 00 00 ea 14 f0 9f e5  14 f0 9f e5 14 f0 9f e5  |...ê.ð.å.ð.å.ð.å|
 ...

shows the flash_offset value being written into the final
generated image, wich is not correct.

Instead create flash_offset as static variable such that the
generated image is "clean".

 00000360  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
 *
 00001000  13 00 00 ea 14 f0 9f e5  14 f0 9f e5 14 f0 9f e5  |...ê.ð.å.ð.å.ð.å|

Signed-off-by: Stefano Babic <sbabic@denx.de>
2013-08-31 15:06:28 +02:00
Wolfgang Denk 1a4596601f Add GPL-2.0+ SPDX-License-Identifier to source files
Signed-off-by: Wolfgang Denk <wd@denx.de>
[trini: Fixup common/cmd_io.c]
Signed-off-by: Tom Rini <trini@ti.com>
2013-07-24 09:44:38 -04:00
Marek Vasut 895d996676 imx: Align the imximage header and payload to multiples of 4k
The MX53 ROM loads the data from NAND in multiples of pages and
supports maximum page size of 4k. Thus, align the image and header
to 4k to be safe from ROM bugs.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert ARIBAUD <albert.u.boot@aribaud.net>
Cc: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Scott Wood <scottwood@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Tom Rini <trini@ti.com>
2013-05-05 17:45:04 +02:00
Marek Vasut 6cb83829a0 tools: arm: imx: Implement BOOT_OFFSET command for imximage
Implement BOOT_OFFSET command for imximage. This command is parallel
to current BOOT_FROM command, but allows more flexibility in configuring
arbitrary image header offset. Also add an imximage.cfg with default
offset values into arm/arch/imx-common/ so the board-specific imximage.cfg
can include this file to avoid magic constants.

The syntax of BOOT_OFFSET command is "BOOT_OFFSET <u32 offset>".

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Albert ARIBAUD <albert.u.boot@aribaud.net>
Cc: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Scott Wood <scottwood@freescale.com>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Tom Rini <trini@ti.com>
Acked-by: Stefano Babic <sbabic@denx.de>
Acked-by: Stefan Roese <sr@denx.de>
2013-04-28 11:18:03 +02:00
Troy Kisky ad0826dcd8 imximage: change parameters to set_imx_hdr
Call with the value the function will use
instead of going through a pointer.

Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
2012-10-20 17:13:02 +02:00
Dirk Behme 49d3e27211 imximage: Remove overwriting of flash_offset
The flash header supports different flash offsets for different
boot devices. E.g. parallel NOR or OneNAND use a different offset
than FLASH_OFFSET_STANDARD (== 0x400).

The flash offset is correctly read from the configuration in
parse_cfg_cmd(). But is then overwritten wrongly in set_imx_hdr_v1/2().

Fix this by removing this overwriting. Use the flash offset
correctly read from the configuration, instead.

If there is no flash_offset read from the configuration file, i.e.
the BOOT_FROM tag is missing, exit with an error message.

Signed-off-by: Dirk Behme <dirk.behme@de.bosch.com>
CC: Jason Liu <liu.h.jason@gmail.com>
CC: Stefano Babic <sbabic@denx.de>
Tested-by: Stefano Babic <sbabic@denx.de>
2012-03-27 09:41:14 +02:00
Dirk Behme 19b409c007 imximage: Add support for i.MX6
The i.MX6 processor can boot from NOR flash and SATA disks,
additionally. Add the flash offsets for these additional
boot modes.

Signed-off-by: Dirk Behme <dirk.behme@de.bosch.com>
Signed-off-by: Fabio Estevam <festevam@gmail.com>
CC: Stefano Babic <sbabic@denx.de>
CC: Jason Liu <jason.hui@linaro.org>
Acked-by: Jason Liu <jason.hui@linaro.org>
2012-02-12 10:11:25 +01:00
Loïc Minier 13d72f02ef Drop config.h include in tools/imximage.h
"make tools-all" should allow building tools such as mkimage and the new
imximage without any config, but imximage.c currently fails to build
with:
imximage.h:27:20: error: config.h: No such file or directory

config.h is not needed in imximage.h nor in imximage.c, and imximage.h
is only included from imximage.c, so drop this include to fix the build.

Signed-off-by: Loc Minier <loic.minier@linaro.org>
2011-04-12 22:58:31 +02:00
Liu Hui-R64343 8a1edd7d54 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.

Signed-off-by: Jason Liu <r64343@freescale.com>
2011-02-02 00:54:42 +01:00
Stefano Babic 5b28e913f4 mkimage: SEGFAULT with imximage on 64 bit systems
Running mkimage to generate an imximage produces a SEGFAULT
on 64 bit machines due to pointer arithmetic limited to 32 bit.

Signed-off-by: Stefano Babic <sbabic@denx.de>
Acked-by: Kim Phillips <kim.phillips@freescale.com>
2010-02-24 00:04:03 +01:00
Stefano Babic 8edcde5e4e mkimage: Add Freescale imx Boot Image support (imximage)
This patch adds support for "imximage" (MX Boot Image)
to the mkimage utility. The imximage is used on the Freescales's
MX.25, MX.35 and MX.51 processors.

Further details under doc/README.imximage.

This patch was tested on a Freescale mx51evk board.

Signed-off-by: Stefano Babic <sbabic@denx.de>
2010-01-25 23:58:29 +01:00