summaryrefslogtreecommitdiffstats
path: root/scripts/imx
Commit message (Collapse)AuthorAgeFilesLines
* imx-usb-loader: add prefix '0x' for hex valueStefan Lengfeld2017-05-171-1/+1
| | | | | Signed-off-by: Stefan Lengfeld <contact@stefanchrist.eu> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx/mxs remove mxs-usb-loaderOleksij Rempel2017-03-091-0/+7
| | | | | | | ... and use imx-usb-loader instead Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx imx-usb-loader: add support for imx23 and imx28Oleksij Rempel2017-03-091-1/+84
| | | | | | | This code was rewrtitten from mxs-usb-loader. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx imx-usb-loader: warn if device was excluded by path optionOleksij Rempel2017-03-061-0/+2
| | | | | | | notify user about the reason why device was ignored by imx-usb-loader. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx imx-usb-loader: add usb path supportOleksij Rempel2017-03-031-13/+86
| | | | | | | | | In some cases we need to work with more than one device attached to one host. For this situation we need path filter to make sure we talk with proper device. Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx-usb-loader: implement DCD v2 check commandAlexander Kurz2017-02-222-2/+109
| | | | | | | | | | | | The DCD v2 check command supported by i.MX53 and later SoC polls a given memory location as long as a given condition is true. Enable imx-usb-loader to perform this check. When the timeout is hit, imx-usb-loader returns an error. For practical reasons the timeout computation will differ from the native implementation, since performing check commands via USB will be much slower compared to native processing. Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX: Add i.MX7 base architecture supportJuergen Borleis2017-01-201-0/+1
| | | | | Signed-off-by Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* imx-usb-loader: add i.MX7S supportJuergen Borleis2017-01-191-0/+7
| | | | Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
* imx-usb-loader: this table is used internally only, so keep it staticJuergen Borleis2017-01-191-1/+1
| | | | Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
* imx-usb-loader: let constant data be constJuergen Borleis2017-01-191-7/+7
| | | | Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
* scripts: imx imx-usb-loader: add i.MX6SL supportAlexander Kurz2017-01-101-0/+7
| | | | | | | Add the i.MX6SL USB id to the list of known ids. Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx imx-usb-loader: sort USB id listAlexander Kurz2017-01-101-28/+28
| | | | | | | For better readability sort the list of known USB ids by VID and PID. Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/vybrid'Sascha Hauer2016-11-141-0/+1
|\
| * i.MX: scripts: Add "vf610" soc to imx-imageAndrey Smirnov2016-11-111-0/+1
| | | | | | | | | | | | | | Needed in order to support Vybrid SoCs. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | scripts imx-image: add DCD NOP command supportAlexander Kurz2016-11-074-0/+41
|/ | | | | | | | The DCD NOP command is available for all flash header v2 devices (i.MX28, 50, 53, 6 and 7). Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/imx'Sascha Hauer2016-09-134-71/+129
|\
| * scripts: imx: add support for i.MX50Alexander Kurz2016-09-123-1/+5
| | | | | | | | | | | | | | | | Add imximg support for i.MX50 processors which use the i.MX flash header v2 format. Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * scripts: imx-usb-loader: cleanup DCD v2 processingAlexander Kurz2016-09-052-47/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | Re-Implement the DCD v2 processing. Processing for the DCD write command went into a separate function enabling the over-all DCD processing to handle check, nop and unlock commands as well. The trivial NOP command is supported right away. Further changes: put in some data consistancy checks and error handling, do structured member access and proper endianess handling and direct error messages to stderr. Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * scripts: imx-usb-loader: structured DCD v1 element accessAlexander Kurz2016-08-222-8/+17
| | | | | | | | | | | | | | DCD v1 elements are encoded little endian. Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * scripts: imx-usb-loader: enable DCD 16-bit write for hdr v1Alexander Kurz2016-08-221-7/+2
| | | | | | | | | | | | | | Do some cleanup which enables DCDv1 16 bit write access as side effect. Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * scripts: imx-image: DCD check command for v2 onlyAlexander Kurz2016-08-221-0/+5
| | | | | | | | | | | | | | | | | | | | DCD check command is currently implemented for imximg v2 only. This command may also be available for v1 as mentioned in IMX35RM as DCD-address-type "wait/read", but due to the lack of further details it will be not supported. Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * scripts: imx-usb-loader: do DCD only once, cleanupAlexander Kurz2016-08-221-9/+6
| | | | | | | | | | | | | | | | | | Only the first encountered DCD block should be processed, optional DCD processing may be switched off by command option. Clean up the corresponding logic. Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | i.MX: scripts: Fix a bug in imx-imageAndrey Smirnov2016-09-051-1/+1
|/ | | | | | | | | | In order to clear a bitmask, "Set" bit has to be '0' and "Mask" bit '1'. Since "Set" is bit 4 and "Mask" is bit 3 this leaves us with a overal or-mask of 1 << 3. Orginal code was doing the inverse and setting bit #4 to '1' bit #3 to '0'. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx-usb-loader: split off topic-code into functionsAlexander Kurz2016-07-181-67/+92
| | | | | | | | | Improve code understandability: extract the "jump application" Serial Download Protocol access method and file-to-buffer reader functionality out of do_irom_download(). Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx-usb-loader: structured protocol accessAlexander Kurz2016-07-181-67/+65
| | | | | | | | Do some cleanup and access the elements of Serial Download Protocol messages in endianess-portable manner using proper typed struct members. Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx-usb-loader: remove useless variableAlexander Kurz2016-07-181-3/+1
| | | | | | | Remove a variable raising complexity for no reason. Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx-usb-loader: remove useless codeAlexander Kurz2016-07-181-46/+3
| | | | | | | | | The configuration interface for struct usb_work is not implemented here leaving the options set on fixed settings or even uninitialized. Do some cleanup and remove those half-cooked dead code passages. Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx-usb-loader: const function argsAlexander Kurz2016-07-181-12/+17
| | | | | Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx: const function argumentsAlexander Kurz2016-07-183-9/+11
| | | | | Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX: central SOC type definitionAlexander Kurz2016-07-043-8/+11
| | | | | | | | | Move the definition of iMX CPU types to an individual file to allow on-purpose inclusion. Eliminate magic number CPU type encoding in the scripts/imx subdir using the new include file. Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx-image: super_root_key command depends on header_version 1Alexander Kurz2016-07-041-1/+1
| | | | | | | | | The Super Root Key pointer exclusively exists in flash header version 1 which is used for i.MX25, i.MX35 and i.MX51 SOC as described in freescales AN4547 document. Simplify the code a little bit. Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/imx'Sascha Hauer2016-05-095-18/+94
|\
| * scripts: imx-usb-loader: support set_bits/clear_bitsSascha Hauer2016-04-281-6/+39
| | | | | | | | | | | | | | Now that we can use set_bits/clear_bits in the DCD tables, add support for this in the imx-usb-loader aswell. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * scripts: imx-usb-loader: make debug output more usefulSascha Hauer2016-04-281-3/+4
| | | | | | | | | | | | | | | | - print write_memory message only in verbose mode, but in all cases when memory is written - print more information about the DCD section just executed Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * scripts: imx: support set_bits/clear_bitsSascha Hauer2016-04-285-9/+51
| | | | | | | | | | | | | | The i.MX SoCs support setting bits and clearing bits in their DCD table. This adds commands for these in the imx-image tool. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | scripts: imx-image: Fix image size in flash header for i.MX35Alexander Stein2016-04-141-3/+4
|/ | | | | | | | | | The i.MX35 needs additional 0x1000 byte. This quirk moved to the wrong location during refactoring of imx-image for v2016.03.0. Fixes: adade597593442 ""scripts: imx: Allow to create signed images") Signed-off-by: Daniel Krueger <daniel.krueger@systec-electronic.com> Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx: imx-image: Fix image size for HABv3 imagesSascha Hauer2016-04-061-3/+4
| | | | | | | When the image contains CSF data we must add CSF_LEN to the image size pointer. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx-usb-loader: Do not zero out boot_data_ptrSascha Hauer2016-02-041-2/+0
| | | | | | | | This shouldn't be necessary. So far it didn't hurt either, but now this invalidates the signature of the image, so keep the image unmodified. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx-image: Allow to create HAB signed images suitable for USB uploadSascha Hauer2016-02-041-6/+54
| | | | | | | | | | | | | | | | | | | | | For USB upload we must execute the DCD table manually and invalidate the DCD table in the uploaded image afterwards to prevent the ROM from executing the DCD data again. Doing this changes the image and thus also invalidates the signature. To make HAB signed images suitable for USB upload possible we add an option to create HAB signed images suitable for USB upload. With this option the image is created like this: - The image is created like usual, but with already invalidated DCD data (DCD length is set to zero) - This image is then signed using the CST - After this the DCD data is made valid (Set DCD length to the real length) imx-usb-loader now finds valid DCD data, executes it and by invalidating the DCD data it restores the state the image had during signing. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx-image: Factor out a read_file functionSascha Hauer2016-02-041-16/+30
| | | | | | | The same code will be used a second time in a followup patch, so factor out a common function. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx-usb-loader: Use dcd len to invalidate dcd dataSascha Hauer2016-02-041-1/+1
| | | | | | | | | We invalidate the dcd data in the uploaded image since we already processed it manually. To do so we have set the dcd pointer to 0. Doing it this way prevents the ROM from executing the HAB code in debug mode. Use the dcd length instead to invalidate the dcd data. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx: Allow to create signed imagesSascha Hauer2016-02-043-21/+167
| | | | | | | | | | | | | | | | This patch allows to call CST directly from imx-image to create signed images. CST is called whenever the config file contains the hab <str> commands which means a CSF is generated. Calling CST requires some quirks. First of all CST returns successfully whenever a CSF exists, no matter is the CSF actually contains something sensible or not. So to detect if CST has been called successfully we have to check if it generated output, not if it returned successfully. Then CST uses csfsig.bin as a temporary file which breaks when the tool is called multiple times at once, something which often happens in parallel builds. We therefore have to lock accesses to this file using flock(). Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx: Create CSF files from imx config fileSascha Hauer2016-02-042-1/+109
| | | | | | | | | | | | | | | | | | | | | | | This is the first step to support creating signed images directly with the imx-image tool. i.MX images must be signed using the Freescale CST tool. CST needs informations already present in the imx-image tool, so it's convenient to call CST directly from imx-image. CST takes CSF files (Command Sequence Files) as input. This patch supports generating CSF files from the imx-image configuration file. This adds three new commands to the config file: hab <str>: All options to the hab command are directly passed through to the CSF. hab_blocks: This generates the "Blocks =" line in the CSF. This is the place where the CSF needs information which is contained in the imx-image tool: The image size, the image filename and the load address. super_root_key <file>: For HABv3 the super root key hash is needed in the i.MX flash header. This command is used to specify the path to the super root key. Needed for HABv3 only. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx-image: Support adding a Super Root Key to the imageSascha Hauer2016-02-043-0/+135
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx-image: pass config data to add_header_*Sascha Hauer2016-02-041-4/+10
| | | | | | | Now that we have a config data struct we can pass it to add_header_* to reduce the argument count. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx-image: move more variables to context dataSascha Hauer2016-02-042-11/+13
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx: Drop double checkSascha Hauer2016-02-021-3/+0
| | | | | | We have the same "if (*line == '\0')" check twice. Remove one of them. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx-usb-loader: Add -s and -i optionsSascha Hauer2016-02-021-1/+36
| | | | | | | | | | | | | | | | | | | Normally imx-usb-loader interprets and executes the DCD table from an uploaded image and invalidates the DCD before uploading the image itself to prevent the i.MX ROM code from executing it again. With HAB signed images this is not possible since invalidating the DCD table modifies the image which also makes the signature invalid. To support this usecase add two new options to imx-usb-loader: The -i option allows to pass in an external config file which can be used to setup SDRAM. The DCD table in the image can then be made empty so that the ROM does not see a second SDRAM setup. The -s option allows to skip interpreting the DCD table in the image. This may when some setup stuff is still in the images DCD table but shall be executed by the ROM and not by imx-usb-loader. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx: make libusb variables globalSascha Hauer2016-02-021-91/+81
| | | | | | | No need to pass the libusb context through from function to function. Make them globally visible. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx: move config file parser to separate fileSascha Hauer2016-02-024-329/+352
| | | | | | | To make the config parser usable by imx-usb-loader also move it to a separate file. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>