summaryrefslogtreecommitdiff
path: root/scripts/imx
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'for-next/misc'Sascha Hauer2023-04-191-25/+24
|\
| * imx-usb-loader: don't depend on arpa/inet.h for endianness conversionAhmad Fatoum2023-04-111-25/+24
| | | | | | | | | | | | | | | | | | | | We already have <scripts/compiler.h>, which offers endianness conversion for non-Linux platforms like MacOS. Let's use that to reduce our dependency on external implementation-defined headers. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230411093844.1297004-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/imx-image'Sascha Hauer2023-04-192-11/+161
|\ \
| * | scripts: imx-image: add FlexSPI image supportMarco Felsch2023-04-042-1/+149
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By this commit board files can request building FlexSPI compatible images via the .imxcfg parameters: - flexspi_fcfbofs, - flexspi_ivtofs. If specified imx-image will build one image which can be deployed to eMMC/SD/QSPI using the appropriate update handlers. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20230228-v2023-02-0-topic-flexspi-v2-15-3d33126d2434@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | scripts: imx-image: header_v2: add header_len parameterMarco Felsch2023-04-041-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | Make header_len a parameter which is required for later on i.MX8MM FlexSPI image support. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20230228-v2023-02-0-topic-flexspi-v2-14-3d33126d2434@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | scripts: imx-image: header_v2: factor out offset parameterMarco Felsch2023-04-041-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make the offset variable a parameter to make it possible to write multiple ivt headers on multiple offsets. While on it use uint32_t to match the data.image_ivt_offset type. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20230228-v2023-02-0-topic-flexspi-v2-13-3d33126d2434@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | scripts: imx-image: convert flag variables into boolMarco Felsch2023-04-041-6/+6
| |/ | | | | | | | | | | | | | | Use 'bool' instead of 'int' for local true/false flag variables. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20230228-v2023-02-0-topic-flexspi-v2-12-3d33126d2434@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | scripts: imx: Ignore ';' and '\n' in quotesAlbert Schwarzkopf2023-04-111-2/+4
|/ | | | | | | | | | | | The current behaviour treats semicolons the same as end of line. This breaks when they are found inside quoted strings, as is the case for PKCS#11 URIs for example. Ignore newlines and semicolons in quotes when parsing commands. Signed-off-by: Albert Schwarzkopf <a.schwarzkopf@phytec.de> Link: https://lore.barebox.org/20230327084827.1854478-1-a.schwarzkopf@phytec.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/arm' into nextSascha Hauer2023-03-162-7/+7
|\
| * ARM: i.MX: Move mach header files to include/mach/imxSascha Hauer2023-03-062-7/+7
| | | | | | | | | | | | | | | | | | | | | | Currently arch specific headers can be included with #include <mach/xxx.h>. With upcoming multi-arch support this is no longer possible as there won't be a single mach anymore. Move all i.MX specific header files to include/mach/imx/ to prepare for multi-arch support. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | imx-usb-loader: Don't try to transfer more data than contained in the imageUwe Kleine-König2023-03-161-1/+1
|/ | | | | | | | | | | | | | | | On platforms that don't have a 2nd stage (in my case i.MX25) it usually happens the transfer limit for the first (and only) upload is bigger than the actual file length. Then it's the right thing to load the complete image (minus its header), but not more. This fixes a failure to boot via USB on i.MX25 that ends in dl_command err=-1, last_trans=0 Fixes: 3367ebc55ebe ("scripts: imx-usb-loader: simplify code flow for file size calculations") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.barebox.org/20230315183338.78433-1-u.kleine-koenig@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* imx-usb-loader: skip initial SDP_ERROR_STATUS query for SDPSAhmad Fatoum2022-10-041-4/+6
| | | | | | | | | | | | | | | | | | We do an initial do_status() every time, which fails for i.MX8MP and i.MX8MN: found i.MX8MP USB device [1fc9:0146] 4 in err=-9, last_trans=0 00 00 00 00 status failed If we instead skip it for SDPS (i.e. hid_endpoint), upload works as expected (tested on i.MX8M Nano). Reported-by: Hans Christian Lønstad <hcl@datarespons.no> Fixes: 23e2203150b6 ("imx-usb-loader: Add i.MX8MP support") Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220927173101.1696673-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx-usb-loader: add i.MX8MN supportAhmad Fatoum2022-08-081-0/+8
| | | | | | | | | | Add VID/PID for i.MX8MN imx-usb-loader support. Everything else is equivalent to the i.MX8MP, which also speaks SDPS instead of the older more complicated SDP. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220805080754.1622205-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* imx-usb-loader: drop some unnecessary castingSascha Hauer2022-08-081-13/+8
| | | | | | | | | Change the buffer pointer in transfer() to type void * to drop some unnecessary type casting from the callers. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20220714072722.2863571-13-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* imx-usb-loader: verify correct image lengthSascha Hauer2022-08-081-1/+1
| | | | | | | | | When verifying the uploaded file we may only check the already uploaded part of the image, not the whole image. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20220714072722.2863571-12-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* imx-usb-loader: simplify read_memory()Sascha Hauer2022-08-081-10/+3
| | | | | | | | | | | In read_memory() we transfer at maximum 64 bytes, so the returned number of actually sent bytes will never be greater than 64 and we can drop the corresponding checks. Then it is checked if there are really 64 bytes transferred. We don't do this elsewhere, so drop it here as well. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20220714072722.2863571-11-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* imx-usb-loader: Fix first stage lengthSascha Hauer2022-08-081-1/+1
| | | | | | | | | | | | | | | | On most SoCs the IVT header is not at the beginning of the image but at offset 0x400. As we skip the leading 0x400 bytes while uploading we can substract that offset from the image size we upload. This shouldn't make a difference now, but in future we might change the two-staged upload process: Now we upload the PBL once and afterwards the full image incuding the same PBL again. It would be more elegant to upload the PBL only once and only the rest of the image afterwards. If we do so, it it important to exactly upload the first stage so that barebox on the other end receives exactly the second stage at the offset it expects it to be. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20220714072722.2863571-10-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* imx-usb-loader: drop some castingSascha Hauer2022-08-081-6/+9
| | | | | | | | | Instead of casting 'bd' to struct imx_boot_data * multiple times use an extra variable for it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20220714072722.2863571-9-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* imx-usb-loader: Add i.MX8MP supportSascha Hauer2022-08-081-9/+28
| | | | | | | | | For the i.MX8MP NXP dropped the SDP protocol used on other SoCs. Instead the image is just sent straight to the device. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20220714072722.2863571-8-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* imx-usb-loader: rename mxs functionsSascha Hauer2022-08-081-6/+4
| | | | | | | | | | | | mxs_load_file() actually uploads a buffer, so rename accordingly. mxs_work() doesn't have a meaningful name at all, so rename to what it actually does, mxs_load_file(). While at it remove the unused libusb_device_handle * argument. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20220714072722.2863571-7-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* imx-usb-loader: Factor out common code to functionSascha Hauer2022-08-081-40/+29
| | | | | | | | | The code to send a buffer straight to an endpoint is implemented twice. Factor out the code to an extra function. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20220714072722.2863571-6-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx-usb-loader: simplify code flow for file size calculationsUwe Kleine-König2022-06-221-21/+16
| | | | | | | | | | | | | | | | | | | | | | | This change contains several changes that make the code flow easier to understand (in my eyes at least): - Rename max_length to firststage_len In some cases the image is loaded in two stages: First the PBL which is started after the PBL is loaded completely and then the whole image. So the size of the first stage isn't about some maximum. - Drop unintuitive total_size variable This variable used to be 0 in the one stage case and the filesize otherwise. Just use firststage_len for the first stage and use the filesize for the second stage (if needed). - Don't call the first stage size "fsize" in the debug output. - Add offset for second stage to debug output. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.barebox.org/20220617082414.323238-1-u.kleine-koenig@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* imx-usb-loader: Drop nearly unused struct usb_idUwe Kleine-König2022-06-221-34/+17
| | | | | | | | | | Only one of the two members of struct usb_id is actually used. So replace struct usb_id by a struct mach_id. Signed-off-by: Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de> Tested-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210813152245.15841-3-u.kleine-koenig@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: add SPDX-License-Identifier for .gitignoreAhmad Fatoum2022-01-051-0/+2
| | | | | | | | | Makes the files not appear when searching for files that lack SPDX-License-Identifier. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220103120539.1730644-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: add SPDX-License-Identifier for Kbuild/KconfigAhmad Fatoum2022-01-052-0/+4
| | | | | | | | | | | | | | | To verify only Kconfig/Makefile is touched: git show --numstat --format=oneline HEAD | grep -v 'Kconfig\|Makefile' will print only arch/powerpc/Kbuild. To verify nothing unexpected is added: git show -U0 | grep '^-[^-]\|^+[^+]' | sort -u Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220103120539.1730644-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: Add common library functionsSascha Hauer2021-11-012-100/+24
| | | | | | | | | | | | | Several functions are duplicated in different host tools. This patch starts collecting them in a single C file. We start with read_file() and read_file_2(), others follow in separate commits. It would be great to compile these functions in a separate library, but I don't know how this can be archieved in Kbuild. Instead, the C file is included where needed. Not nice, not beautiful, but at least enough to get something going. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/targettools'Sascha Hauer2021-10-074-0/+13
|\
| * scripts: allow building USB loader tools for target as wellAhmad Fatoum2021-10-024-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We currently build the USB loader tools only for the host (build) system, but it can be useful to cross compile them as well for the target. We already have some target tools, but support for those is easier, because they don't link against libraries. We use pkg-config to get cc and ld flags, but we always assume that pkg-config is for the host system and there is no well-defined way to request pkg-config for the target system. Support this by introducing a new CROSS_PKG_CONFIG. This will be consulted only for target tools and default to $(CROSS_COMPILE)pkgconfig. Users can override it as necessary, for example, with Yocto, pkg-config will be for the cross environment, so target tools can now be built with: export ARCH=sandbox CROSS_COMPILE=aarch64-linux-gnu- export CROSS_PKG_CONFIG=pkg-config scripts make targettools_defconfig make scripts Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210917174127.23345-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | scripts: imx: add i.MX8MN support to imx-imageAhmad Fatoum2021-10-051-0/+1
| | | | | | | | | | | | | | | | | | While soc imx8mm in the imxcfg would work too, it's less surprising to just tell imx-image about the new SoC. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211001100949.6891-8-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | ARM: i.MX: add i.MX8MN (Nano) SoC support boilerplateAhmad Fatoum2021-10-051-0/+1
|/ | | | | | | | | The Nano is basically a downsized mini. Add the necessary bits, so driver and board support can be added. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211001100949.6891-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* imx-image: Fix uninitialized add_barebox_headerTrent Piepho2021-05-271-1/+1
| | | | | | | | | | It's set to 1 if the -b option is used, but is neither initialized nor set to 0 if not. Since the barebox image building recipies only uses -b with this tool, it wasn't noticed. Signed-off-by: Trent Piepho <tpiepho@gmail.com> Link: https://lore.barebox.org/20210526065856.368345-1-trent.piepho@igorinstitute.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx-usb-loader: print USB VID/PID of excluded devicesBastian Krause2021-05-031-3/+5
| | | | | | | | | | On hosts with multiple USB devices connected, multiple "excluded by device path option" messages can be observed. Add the USB VID/PID to these messages to give them some additional value. Signed-off-by: Bastian Krause <bst@pengutronix.de> Link: https://lore.barebox.org/20210430115640.21011-2-bst@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx-usb-loader: print excluded USB device message only on verboseBastian Krause2021-05-031-1/+1
| | | | | | | | | | If a USB device path is specified, it is expected that other devices will be ignored. So print that message only on verbose > 0. Signed-off-by: Bastian Krause <bst@pengutronix.de> Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210430115640.21011-1-bst@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx: add support for additional hab BlocksDenis Osterland-Heim2021-03-301-2/+50
| | | | | | | | | | | | | | | | This allows to specifiy additional signed blocks in the format `offset+size@address` within the imximg. It is needed by the uuu tool, which loads the image different to the imx-usb-loader. It loads the DCD always to 0x910000 in the OCRAM. So this area have to be signed as well. In my case this needs `hab_blocks 0x42c+0x1f0@0x910000`. It supports to remove quotes to support Kconfig variable here. Signed-off-by: Denis Osterland-Heim <denis.osterland@diehl.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2021-03-231-3/+12
|\
| * scripts: imx-image: add error handling for pwriteRouven Czerwinski2021-03-161-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | Fixes the following compiler warning: scripts/imx/imx-image.c: In function ‘main’: scripts/imx/imx-image.c:988:3: warning: ignoring return value of ‘pwrite’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 988 | pwrite(outfd, bb_header, sizeof_bb_header, 0); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | scripts: imx-image: fix iMX35 header generationAlexander Kurz2021-03-111-1/+4
|/ | | | | | | | Two header copies exist in the iMX35 image. When writing the barebox_header, also write it to the second copy. Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: Replace license and copyright boilerplate by SPDX identifiersUwe Kleine-König2021-02-161-14/+2
| | | | | | | | | Convert the files that licensecheck can determine to be licensed under GPL-2.0-only or GPL-2.0-or-later and also convert the copyright statements to SPDX. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc' into masterSascha Hauer2020-09-252-2/+2
|\
| * scripts/imx: fix typo "unkown" -> "unknown"Uwe Kleine-König2020-09-181-1/+1
| | | | | | | | | | Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * scripts: Make locally used functions staticSascha Hauer2020-09-151-1/+1
| | | | | | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/license' into masterSascha Hauer2020-09-251-14/+3
|\ \
| * | scripts: convert imx-image and mxsimage to SPDXUwe Kleine-König2020-09-211-14/+3
| |/ | | | | | | | | | | | | | | | | To simplify automatic license and copyright determination use SPDX tags and remove the license boiler plate. Reviewed-by: Roland Hieber <rhi@pengutronix.de> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/kbuild' into masterSascha Hauer2020-09-251-4/+2
|\ \
| * | kbuild: introduce hostprogs-always-y and userprogs-always-yMasahiro Yamada2020-09-151-4/+2
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Linux commit faabed295cccc2aba2b67f2e7b309f2892d55004 You can use: hostprogs-always-y += foo as a shorthand for: hostprogs += foo always-y += foo Likewise, userprogs-always-y += foo as a shorthand for: userprogs += foo always-y += foo Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | scripts/imx-usb-loader: Drop duplicate definition of ALIGNUwe Kleine-König2020-09-231-2/+0
|/ | | | | | | | | | | | | | | This fixes: scripts/imx/imx-usb-loader.c:42: warning: "ALIGN" redefined #define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1)) In file included from scripts/imx/imx-usb-loader.c:35: scripts/include/linux/kernel.h:10: note: this is the location of the previous definition #define ALIGN(x, a) __ALIGN_MASK(x, (typeof(x))(a) - 1) Fixes: a876d16e6ad3 ("scripts: define ALIGN(x) in scripts' <linux/kernel.h>") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx-image: throw descriptive error on encountering dcdofsAhmad Fatoum2020-07-141-0/+9
| | | | | | | | | With dcdofs renamed to ivtofs, out-of-tree boards will start to fail. Make the migration easier by suggesting what needs to be changed on stderr. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx-image: Add i.MX8MP supportSascha Hauer2020-07-142-1/+9
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx-image: rename dcdofs to ivtofsSascha Hauer2020-07-142-2/+2
| | | | | | | | | This renames the dcdofs config option in the imx-image tool to ivtofs. dcdofs is a misnomer. The DCD (Device Configuration Data) is only one part of the data linked into the IVT (Image Vector Table), but the meaning of the option is really the latter, not the former. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: imx-image: rename image_dcd_offset to image_ivt_offsetSascha Hauer2020-07-142-15/+15
| | | | | | | | | image_dcd_offset is a misnomer, it should really be image_ivt_offset. The DCD (Device Configuration Data) is only one part of the data linked into the IVT (Image Vector Table), but the meaning of the variable is really the latter, not the former. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>