summaryrefslogtreecommitdiffstats
path: root/scripts
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'for-next/scripts-common-library'Sascha Hauer2021-11-1514-364/+675
|\
| * scripts: add target tool for rk-usb-loaderAhmad Fatoum2021-11-104-0/+12
| | | | | | | | | | | | | | | | Having rk-usb-loader as a target tool as well makes it easy to cross-compile it. Add the boilerplate. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * scripts: Add rk-usb-loader toolSascha Hauer2021-11-106-31/+376
| | | | | | | | | | | | | | | | | | This adds a tool suitable for bootstrapping barebox on Rockchip RK3568 SoCs. It has been tested on this SoC only. It might or might not work with minor adjustments on other SoCs. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Tested-by: Michael Riesch <michael.riesch@wolfvision.net>
| * scripts/common: Add write_full() and read_full()Sascha Hauer2021-11-104-58/+43
| | | | | | | | | | | | | | We have different implementations of read_full() and write_full() in our host tools, use a common implementation for these. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * scripts/common: Add write_file()Sascha Hauer2021-11-014-51/+36
| | | | | | | | | | | | | | | | write_file() is used once, but can be used in socfpga_mkimage.c as well. Move function to a common place and use it in the SoCFPGA image tool. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * scripts: Add common library functionsSascha Hauer2021-11-016-217/+138
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * scripts: Add Kconfig option for most host toolsSascha Hauer2021-10-122-9/+72
| | | | | | | | | | | | | | | | | | Host tools were often only compiled depending on the architecture which needs them. This patch adds explicit options for most tools mainly to be able to compile test them without having to compile for each architecture. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | include: move ARRAY_AND_SIZE to <linux/kernel.h>Ahmad Fatoum2021-11-011-0/+1
| | | | | | | | | | | | | | | | | | | | Linux defines this macro at multiple places. We define it once, but in <common.h>, which is a bit heavy weight. Move it next to the ARRAY_SIZE() definition. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211030141739.2207431-5-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | scripts: <linux/bitops.h>: fix references to undefined __BITS_PER_LONGAhmad Fatoum2021-11-014-11/+20
| | | | | | | | | | | | | | | | | | No where do we define __BITS_PER_LONG, but we know about BITS_PER_LONG. Fix it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211030141739.2207431-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | include: <linux/bitops.h>: discard left-over hweight codeAhmad Fatoum2021-11-014-8/+1
|/ | | | | | | | | | There are no definitions for __sw_hweight*, so no point in keeping the prototypes around. The scripts version of the header also ultimately tries to access non-existing normal headers, so fix that up as well. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20211030141739.2207431-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/targettools'Sascha Hauer2021-10-0711-2/+94
|\
| * scripts: allow building USB loader tools for target as wellAhmad Fatoum2021-10-0210-1/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: omap3-usb-loader: make proper use of pkg-config --cflagsAhmad Fatoum2021-10-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pkg-config --cflags libusb-1.0 should ensure <libusb.h> would be found. Command's output is used to compile omap3-usb-loader.c, but because the file does #include <libusb-1.0/libusb.h>, it will probably not find the header in the directory added to search path by pkg-config and depend on other directories in the search path. Fix this. We already expect users to have proper pkg-config files, so linking works, so it's not too much to ask to expect the pkg-config file that should already exist to yield proper --cflags as well. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210917174127.23345-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * common: add new menu for target toolsAhmad Fatoum2021-10-021-0/+30
| | | | | | | | | | | | | | | | | | | | We have four target tools and will add 3 more in a follow up commit. Add a new menu to collect them. Acked-by: Roland Hieber <rhi@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20210917174127.23345-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2021-10-073-12/+89
|\ \
| * | kbuild: dtc: Allow adding device tree fragments via configTrent Piepho2021-10-051-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces a config variable that allows adding additional fragments to the Barebox device tree(s). Example uses are adjusting the flash partition layout, adding barebox state variables, or adding an I2C device. These can be now be done with build configuration only, without needing to patch the existing dts files in the Barebox source. The advantage is greater when an external build system, such as Yocto or Buildroot, is being used to build Barebox. The build system can drop in a dts fragment to partition flash and build from unaltered Barebox source. This avoids the need for cumbersome maintenance of patch files to modify Barebox's source for each flash partition layout. Preprocessing the dts file gains another layer, where a generated dts source consisting of an include directive for the original dts source is followed by more includes for each fragment. This is piped to the existing preprocessor call on stdin to avoid another temporary file. cpp/dtc will correctly identify errors in the source files they occur in. The -MT option is used so the cpp auto-dependencies reference the original dts source and not the generated code passed on stdin. A preprocessor macro named after the base dts file, e.g. foo-bar.dts will define foo_bar_dts, will be defined so that the fragments can possibly operate differently based on which image's dts is being built. Signed-off-by: Trent Piepho <trent.piepho@igorinstitute.com> Link: https://lore.barebox.org/20210922181336.1350460-1-trent.piepho@igorinstitute.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | scripts: socfpga_import_preloader: make sdk optionalSteffen Trumtrar2021-08-231-11/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The commit a9b2e6089d82686564220013f14e9f0ffcc725e2 allowed generating everything needed in one step. This was however a bit too ambitious. The script now requires that the Altera Embedded SDK is always installed. There are situations where this is unwanted. Beef up the code a little bit to allow having the SDK as an optional argument and make the other input parameters location independent. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Link: https://lore.barebox.org/20210611080233.15141-1-s.trumtrar@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | scripts: bareboxenv: add erase hint if build as host-toolMarco Felsch2021-08-091-0/+6
| |/ | | | | | | | | | | | | | | | | | | The bareboxenv behviour is different if used as host-tool. As host-tool the erase is skipped which can confuse the user. Add a help note as hot fix. In the long term we should add the host-tool erase support as well. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Link: https://lore.barebox.org/20210806093337.10153-1-m.felsch@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>
* ARM: Rockchip: Add rkimage toolSascha Hauer2021-06-212-0/+263
| | | | | | | | | | | This adds a tool for generating "RKNS" type booting image for newer Rockchip SoCs. This image format is supported starting at least with RK3568. Older image types are not (yet) supported. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210615141641.31577-5-s.hauer@pengutronix.de Link: https://lore.barebox.org/20210621092802.27275-5-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/kconfig'Sascha Hauer2021-06-1630-1143/+924
|\
| * kconfig: update to Linux 5.13-rc1Masahiro Yamada2021-05-3130-1143/+924
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous sync was Linux 5.9-rc2. Resync scripts/kconfig/ with Linux 5.13-rc1. Highlights: - make header names in include/config/ and CONFIG symbols match (scripts/basic/fixdep.c was adjusted) - remove all 'option' syntax (common/Kconfig was adjusted) - introduce KCONFIG_DEFCONFIG_LIST instead of 'option defconfig_list' - bug fixes and cleanups of nconfig - drop Qt4 support from xconfig - bug fixes, improvements, cleanups of xconfig - print a short log for syncconfig Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Link: https://lore.barebox.org/20210530145842.2610109-2-masahiroy@kernel.org Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/compiler-warnings'Sascha Hauer2021-06-161-1/+1
|\ \ | |/ |/|
| * scripts: zynq_mkimage: Make locally used function staticSascha Hauer2021-05-181-1/+1
| | | | | | | | | | | | | | | | parse_config() is defined and used only in one file. Make it static. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20210517185424.32145-12-s.hauer@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>
* Merge branch 'for-next/misc'Sascha Hauer2021-05-172-3/+3
|\
| * scripts/spdxcheck.py: Use Python 3Antony Pavlov2021-05-032-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on this linux kernel commit: > commit d0259c42abff51b586496a0594933e394efefbc5 > Author: Bert Vermeulen <bert@biot.com> > Date: Thu Jan 21 09:54:12 2021 +0100 > > spdxcheck.py: Use Python 3 > > Python 2.x has been officially EOL'ed for some time, and in any case > the git module for it is hard to come by. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.barebox.org/20210416091404.92251-1-antonynpavlov@gmail.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>
* Merge branch 'for-next/misc'Sascha Hauer2021-04-157-624/+37
|\
| * bareboximd: Use mmap when possiblySascha Hauer2021-04-141-19/+34
| | | | | | | | | | | | | | | | | | It's hard to believe but there are systems out there that are so sparse with memory that they can't afford 1MiB of RAM to read a file into. Use mmap when possible and fall back to reading into an allocated buffer otherwise. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * common: add option for shipping KCONFIG_CONFIG as /env/data/configAhmad Fatoum2021-04-131-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | Add a new option that enables access to the barebox configuration file through /env/data/config. This can be useful in environments where a fatter barebox can be tolerated (like on an EFI system partition). It could also be used to conditionally skip tests on disabled functionality in the future. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Tested-by: Roland Hieber <rhi@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * x86: drop legacy (PC BIOS) boot in favor of EFIAhmad Fatoum2021-03-255-605/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | The 16-bit port has experienced bitrot and failed to compile with more recent linkers for at least a year. Fixing the linker error is insufficient to restore a barebox that can boot to shell. This continued breakage likely means that there are no users interested in updating. As new x86 projects should be using MACH_EFI_GENERIC anyway, retire support for 16-bit legacy boot (MACH_X86_GENERIC). Acked-by: Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@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>
* RISC-V: implement PBL and relocation supportAhmad Fatoum2021-03-235-0/+258
| | | | | | | | | | | | | | | | | Given that we only support a single RISC-V board, this puts us in a good position to make this a multi-image-only architecture. This commit adds the necessary bits. It's highly inspired by the ARM PBL support. Notable difference is that for relocations to be generated, it was necessary to compile with -fpic. The relocation code assumes the relocation entries to preprocessed. This is done at build-time by means of the prelink-riscv script imported from U-Boot. Actual migration to -fpic and prelinking is done along with porting erizo in a follow-up commit. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> 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>
* Kbuild: add compile_commands.json targetAhmad Fatoum2021-02-161-0/+237
| | | | | | | | | | | | | The JSON compilation database format specification describes a compile_commands.json file that lists how translation units are compiled by a build system. This makes integration of external tools, like IDEs, LSP servers and static analyzers easier. Import the Linux bits. The database can now be manually generated with make compile_commands.json. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: Replace license and copyright boilerplate by SPDX identifiersUwe Kleine-König2021-02-1647-686/+117
| | | | | | | | | 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>
* imd command: Document verbose optionSascha Hauer2020-12-071-0/+1
| | | | | | imd understands -v for verbose mode, document it in the options list. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mxs: always build mxsimage and mxsboot toolsRoland Hieber2020-11-092-10/+1
| | | | | | | | | Both tools are used unconditionally by images/Makefile.mxs. Always build them for ARCH_MXS, and remove their prompt in the host tools section, as they are not really useful as stand-alone tools. Signed-off-by: Roland Hieber <rhi@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/sandbox' into masterSascha Hauer2020-10-141-3/+3
|\
| * gen-dtb-s: support x86 and other platforms with 16-bit .wordAhmad Fatoum2020-10-121-3/+3
| | | | | | | | | | | | | | | | | | | | | | On ARM, .word is 32-bit as expected in the script, but on x86 it's 16-bit, which leads to truncation. .int on the other hand is 32-bit both on ARM and x86 and very likely all other platforms we support, so change the .word to .int. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc' into masterSascha Hauer2020-10-142-2/+2
|\ \
| * | scripts: kwboot: allow piping full buffer size at onceAhmad Fatoum2020-10-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While buf == _buf, their type and sizeof differ. The read syscall should have the buffer size as argument, but instead got the pointer's size. This likely doesn't change high-level behavior, because read was called in a loop, so fix this. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | scripts/dtc: only append to HOST_EXTRACFLAGS instead of overwritingUwe Kleine-König2020-10-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This corresponds to Linux commit 7e2521a85c98 (that currently sits in linux-next) with the same short log. When building with $ HOST_EXTRACFLAGS=-g make the expectation is that host tools are built with debug informations. This however doesn't happen if the Makefile assigns a new value to the HOST_EXTRACFLAGS instead of appending to it. So use += instead of := for the first assignment. 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/buildsystem-version' into masterSascha Hauer2020-10-141-0/+3
|\ \ \ | |_|/ |/| |
| * | Makefile: add buildsystem version variableSteffen Trumtrar2020-09-251-0/+3
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a new variable to store a buildsystem version information. The exact information that is stored here (git commit, git tag,...) is defined by the buildsystem. It is intended to have the possibility to get information about the exact barebox binary, environment and configuration. The variable is utilized the same as KERNELVERSION for linux: make BUILDSYSTEM_VERSION=$COMMITISH Via scripts/mkcompile_h this information is injected into the barebox codebase. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>