summaryrefslogtreecommitdiffstats
path: root/scripts/imx
Commit message (Collapse)AuthorAgeFilesLines
* scripts: imx-image: make read_file behaviour consistentSascha Hauer2019-02-111-13/+11
| | | | | | | | | | When read_file fails then it exits the program in most cases. Let's exit the program when stat() fails aswell, so that we *always* exit the program on failure. Drop all error handling for read_file since that's no longer necessary and rename the function to xread_file to make clear it won't fail. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx-image: Be more informative on open errorsSascha Hauer2019-02-111-4/+12
| | | | | | | | When opening a file fails then consistently print a message which file we cannot open and why. In one place no error checking was done at all, so add this. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* kbuild: rename HOSTLOADLIBES_* to HOSTLDLIBS_*Masahiro Yamada2019-01-031-2/+2
| | | | | | | | | | This is needed to resync kconfig to the latest Linux. Refer to Linux commit 8377bd2b9ee1 ("kbuild: Rename HOST_LOADLIBES to KBUILD_HOSTLDLIBS"). Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx-image: fix build with OpenSSL < 1.1.0Lucas Stach2018-12-071-0/+8
| | | | | | | | | | When adding support for OpenSSL 1.1.x it was missed that EVP_PKEY_get0_RSA is only available with that version. Earlier versions don't provide a fully equivalent function, so add it to the compatibility helpers. Fixes: 542a50d4eb (scripts: imx-image: fix build with OpenSSL 1.1.x) Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx-image: Add support for max_load_size optionSascha Hauer2018-11-302-1/+22
| | | | | | | | | | | | | When an image is loaded to SRAM we can normally only load a part of the full image, limited by the available space in SRAM. We currently load the pblb image which is the executable part of the PBL without the compressed barebox payload. We are going to link the compressed barebox image into the pbl image though, so we can't see the desired load size from outside the image anymore. This adds a max_load_size option to set this size explicitly. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx-image: Fix typos in commentsSascha Hauer2018-11-301-2/+2
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx-image: fix first instruction in i.MX8MQ headerLucas Stach2018-11-092-1/+7
| | | | | | | | | | | | | | | The instruction being patched in was a branch to 0x24000, instead of the intended 0x9000. This doesn't matter when starting the image from a regular boot source, but breaks starting the image via bootm, as we rely on the jump in the first header instruction taking us to the actual code. As the code offset changes depending on the presence of the signed HDMI firmware, compute the offet dynamically while building the image. Fixes: 6d2132a9ded7 (scripts: imx-image: Add i.MX8MQ support) Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx-usb-loader: list_imx_device_types(): move variable declaration ↵Marc Kleine-Budde2018-10-261-1/+3
| | | | | | | | | | | | | | | | out of for() loop On older compilers this causes the following error: | scripts/imx/imx-usb-loader.c: In function 'list_imx_device_types': | scripts/imx/imx-usb-loader.c:252:2: error: 'for' loop initial declarations are only allowed in C99 mode | for (int i = 0; i < ARRAY_SIZE(imx_ids); i++) { | ^ | scripts/imx/imx-usb-loader.c:252:2: note: use option -std=c99 or -std=gnu99 to compile your code Fixes: bcc2df673cdb ("scripts: imx-usb-loader: allow use of unknown USB IDs") Reported-by: Niklas Reisser <Niklas.Reisser@de.bosch.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/imx-hab'Sascha Hauer2018-09-112-12/+221
|\
| * scripts: imx: Support encrypted boot with HABv4Marcin Niestroj2018-09-042-11/+174
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | .imxcfg configuration files support few more commands, all starting with "hab_encrypt" string. That way it is possible to easily ignore these commands, when image encryption was not requested. Hence, we can use single .imxcfg file to generate signed and encrypted images in the same build. Images are encrypted in place by Freescale Code Signing Tool (cst), using Data Encryption Key (DEK). This key needs to be encapsulated by processor's hardware encryption engine to produce DEK blob, which is unique for each device. DEK blob needs to be part of CSF area, so we make enough space on the end of image to simply append it later, e.g. during device flash procedure. Introduced code was developed and tested on NXP i.MX6UL platform. Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * scripts: imx: add optional argument to hab_blocks commandMarcin Niestroj2018-09-041-3/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | hab_blocks command is used to specify image authentication blocks for HAB. Currently it was configured to authenticate full barebox image. However in case of booting from SD card and adding MBR partition table, HAB authentication fails, as final boot image is modified. Add an optional argument to hab_blocks command, to select between 3 types of authentication areas: - full: whole barebox image will be authenticated (this is default to keep compatibility), - from-dcdofs: image area up to dcdofs is not authenticated, so any changes up to dcdofs are possible, - skip-mbr: image area from 440 to 512 bytes is excluded from beeing authenticated, which allows to add / modify MBR partition table after building barebox image. Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * scripts imx-image: add support for newer versions of "cst"Marc Kleine-Budde2018-09-041-1/+22
| | | | | | | | | | | | | | | | | | Older versions of "cst" want to read the CSF from STDIN, while newer versions want to read the CSF from a file. Sadly, the "-i" option doesn't understand "-i -" to read from STDIN, so we give it "/dev/stdin" instead. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | scripts: imx-usb-loader: make i.MX6SoloX better to typeRoland Hieber2018-09-071-1/+1
| | | | | | | | | | | | | | | | Now that users can select the device type on the command line, having a name without whitespace makes input for that device type easier. Signed-off-by: Roland Hieber <r.hieber@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | scripts: imx-usb-loader: allow use of unknown USB IDsRoland Hieber2018-09-071-7/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some vendors fuse their devices so that the IMX USB ROM loader identifies itself with a different Vendor and Product ID on USB enumeration. Currently, imx-usb-loader will refuse to detect and work with such devices, so let's teach it. Because we cannot easily detect the device type from the USB ID in this case, introduce the new command line parameter -d <type> to specify the device type to use on the device path specified with -p <path>, even if the VID/PID pair of that device is unknown. The device name is sourced from the "name" field of the imx_ids array of known devices at the top of the file. Using "-d list" will print a list of known device types. Using -d without -p will not do anything useful, except generate a warning. Signed-off-by: Roland Hieber <r.hieber@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | scripts: imx-usb-loader: fail early if the USB device path does not matchRoland Hieber2018-09-071-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | find_imx_dev() loops through all USB devices, tries to open them, and then compares the chosen device path (given with -p on the command line) to the path of the currently opened device. The device path can be checked earlier, opening the device is not neccessary. We fail early here because in the next commit we want to enable the user to force using a device by specifying its path. Opening every single device available on the system then leads to unnecessary error messages for all devices that do not match the provided path. Signed-off-by: Roland Hieber <r.hieber@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | scripts: imx-usb-loader: rename imx_device() to imx_device_by_usb_id()Roland Hieber2018-09-071-2/+3
| | | | | | | | | | | | | | | | Make its purpose more clear when we introduce other similar functions in one of the next commits. Signed-off-by: Roland Hieber <r.hieber@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | scripts: imx: Add support for signed HDMI firmwareAndrey Smirnov2018-09-042-5/+69
|/ | | | | | | | | | | | | | Boot header on i.MX8MQ SoC allows embedding signed HDMI firmware images that are used by mask ROM code during the very early stages of boot. Since providing that firmware appear to be necessary to enable SoC's HDMI/DP functionality extend imx-image tool to support this feature. To do that add code implementing "signed_hdmi_firmware" keyword, which allows users to specify a path to a binary blob containing all of the necessary headers and footers as well firmware data and code sections (this is how such images are provieded by NXP) Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: i.MX: Move i.MX header definitions to mach-imxAndrey Smirnov2018-08-092-113/+2
| | | | | | | | Move i.MX header definitions from scripts to mach-imx in order to make it available to both script and bootloader code. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx-image: fix build with OpenSSL 1.1.xLucas Stach2018-07-131-20/+20
| | | | | | | | | | | OpenSSL 1.1.x made some of the types opaque, so peeking inside directly doesn't work anymore. Use the correct accessors instead. I've dropped the algorithm check, as EVP_PKEY_get0_RSA() already verifies that the pubkey is RSA and returns NULL if it isn't. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx-image: Add i.MX8MQ supportSascha Hauer2018-06-153-13/+66
| | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx-image: Share the code to write barebox headerAndrey Smirnov2018-06-151-22/+20
| | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx-image: Use a loop to create multiple header copiesAndrey Smirnov2018-06-151-6/+3
| | | | | | | | Use a loop to create multiple header copies on i.MX35 to avoid code duplication. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2018-06-111-2/+2
|\
| * scripts: create a separate section for host toolsUwe Kleine-König2018-06-111-2/+2
| | | | | | | | | | | | | | | | | | | | This allows to enable host tools even if they are not needed for the current configuration to improve compile coverage and simplify packaging these tools. The conversion doesn't cover all tools available but can be extended later. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | scripts: imx-image: Limit v2 header size to HEADER_LENAndrey Smirnov2018-06-111-12/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Given the following: 1. Assembly code, namely "b 0x1000" instruction, in bb_header[] assumes that i.MX image header occupies first HEADER_LEN bytes and bootloader executable is located right after. 2. Code in imx_image_size() assumes that i.MX image header is HEADER_LEN bytes 3. Original code handling v2 header allocated more than HEADER_LEN buffer to store IVT + boot data + DCD. However, the code writing that buffer to disk is only set up to use first HEADER_LEN bytes and to silently discard the rest as a side effect. Let's be conservative and limit total size of v2 header to not exceed Inital Load Region (4K or HEADER_LEN) to match what's being done for v1. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | scripts: imx-image: Drop error return from write_dcd()Andrey Smirnov2018-06-111-7/+3
| | | | | | | | | | | | | | | | | | Write_dcd() exits early in case of failure, so there's no realy reason to have it return a error code as a result. Drop it and simplify the caller code. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | imx-usb-loader: dump memory bytewise on verification mismatchSascha Hauer2018-05-241-24/+2
| | | | | | | | | | | | | | | | | | dump_long only prints the full words and does not print the unaligned rest. This means that some bytes (and maybe actually the interesting ones) may not be printed. Use dump_bytes instead which does not have this problem. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | imx-usb-loader: Fix verify for non word aligned lengthsSascha Hauer2018-05-241-2/+3
| | | | | | | | | | | | | | | | | | Verifying the uploaded image fails when the length is not word aligned. This is because read_memory reads full words, so the input length must be word aligned. Align the length up to 4 bytes so that we do not pass unaligned lengths to read_memory. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | imx-usb-loader: Align uploaded file lengthSascha Hauer2018-05-241-1/+5
|/ | | | | | | | At least i.MX25 does not properly upload a non word aligned file length. Align the uploaded length to word length to make sure the end of the file is also transferred properly. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i.MX/DCD compiler and interpreter: logic is differentJuergen Borleis2018-03-264-50/+28
| | | | | | | | | | | Reading the manual more carefully discovers a different logic for the DCD 'check' command. They use the term "until". In order to get the manual and the software in sync, this change switches to the term "until" as well. Changing must happen at compiler and interpreter level to make it work. Signed-off-by: Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx imx-usb-loader: Fix last transfer error messageSascha Hauer2017-09-261-1/+1
| | | | | | | | | | | When doing memory read transfers there will always be 64 bytes transferred, even when less bytes are requested. This is expected and there is a test skipping the error message in this case. The test is wrong though since cnt is not decremented and will never be equal to rem. Fix the test so that verifying memory does not give a bogus error message. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx imx-usb-loader: Add support for i.MX6ullSascha Hauer2017-09-261-0/+7
| | | | | | Same as other i.MX6 variants, just add the product id. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts/imx: fix out-of-bounds access for big DCD tablesUwe Kleine-König2017-08-151-4/+8
| | | | | | | | | | | add_header_v2 might need a buffer that is bigger than HEADER_LEN (0x1000) as MAX_DCD * sizeof(u32) (i.e. the maximal size of the dcd table alone) is already 0x1000. Additionally add_header_v2 adds padding (usually 0x400) and a struct imx_flash_header_v2 (48). So expand the buffer size accordingly for v2. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* 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>