summaryrefslogtreecommitdiffstats
path: root/scripts
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'for-next/socfpga'Sascha Hauer2022-08-111-0/+8
|\
| * scripts: socfgpa_xml_to_config: document pincfgSteffen Trumtrar2022-08-081-0/+8
| | | | | | | | | | | | Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Link: https://lore.barebox.org/20220801120708.2511165-1-s.trumtrar@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2022-08-111-1/+7
|\ \
| * | kbuild: make FIT public key overwritableStefano Manni2022-08-091-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The path to the public key used to verify FIT images can be specified with Kconfig variable. For a better build system integration we also want to be able to specify the path in environment variables. Signed-off-by: Stefano Manni <stefano.manni@gmail.com> Link: https://lore.barebox.org/02bcbd486b7f41e5dc86bf9d228dcbf6e1fe9957.camel@gmail.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | Merge branch 'for-next/imx'Sascha Hauer2022-08-111-85/+90
|\ \ \
| * | | 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>
* | | kbuild: pbl: use same compression algo for both barebox and DTBAhmad Fatoum2022-07-161-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | lzop hasn't seen any activity since 2017 and has been recently removed from OpenEmbedded, which is unfortunate as we unconditionally use LZO for compressing device trees that are referenced via __dtb_z_. To make barebox easier to integrate, use the same compression algorithm for both barebox and compressed DTB. Note that the decompressor code will be in the image twice: Once in PBL in uncompressed form to decompress barebox proper and once in compressed form to decompress the DTB. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220713095730.1878941-6-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | kbuild: gen-dtb-s: use Makefile.lib instead of duplicating cmd_lzoAhmad Fatoum2022-07-143-9/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We call lzop in two places: in gen-dtb-s to generate a compressed device tree symbol and in Makefile.lib, which is used everywhere else. Replace the duplication in gen-dtb-s by compressing the DT outside with the existing cmd_lzo command. This will come in handy later when extending gen-dtb-s to support multiple compression formats. No functional change intended. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220713095730.1878941-4-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | | pbl: make USE_COMPRESSED_DTB a PBL-only featureAhmad Fatoum2022-07-141-1/+1
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All in-tree boards that reference __dtb_z_ symbols are already multi-image capable and allow us to compress barebox proper by having the prebootloader decompress it using the algorithm specified by the CONFIG_IMAGE_COMPRESSION_* option. DTB on the other hand, is handled specially and the optional compression is always using LZO. It makes sense to use the same CONFIG_IMAGE_COMPRESSION_* options for the DT too to make build system integration easier. To avoid special casing non-PBL support which lacks this options, just drop USE_COMPRESSED_DTB there. If linking barebox for your downstream board is broken by this: - If not multi-image capable, consider porting it to use ENTRY_FUNCTION(_WITHSTACK) instead - If you are using __dtb_z_* in barebox proper, use normal __dtb_ and compress barebox as a whole instead with CONFIG_IMAGE_COMPRESSION_* Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220713095730.1878941-2-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | checkpatch: don't warn about %peAhmad Fatoum2022-07-111-1/+1
|/ | | | | | | | | | | We have been supporting %pe since commit 91084b450226 ("vsprintf: add %pe format specifier for printing symbolic error names"). checkpatch.pl was still warning about this, fix that. Reported-by: Johannes Zink <j.zink@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220708110012.410905-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2022-06-294-8/+0
|\
| * treewide: Remove duplicate incudesAlexander Shiyan2022-06-104-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix warning fwterated by checkincludes.pl: ./net/nfs.c: libgen.h is included more than once. ./net/ifup.c: globalvar.h is included more than once. ./crypto/rsa.c: asm/types.h is included more than once. ./lib/decompress_unlz4.c: linux/decompress/mm.h is included more than once. ./scripts/stb_image.h: stdio.h is included more than once. ./scripts/kwbimage.c: unistd.h is included more than once. ./scripts/common.c: sys/types.h is included more than once. ./scripts/bareboximd.c: sys/types.h is included more than once. ./scripts/bareboximd.c: sys/mman.h is included more than once. ./fs/pstore/ram_core.c: linux/rslib.h is included more than once. ./fs/pstore/fs.c: fs.h is included more than once. ./fs/pstore/fs.c: linux/pstore.h is included more than once. ./fs/nfs.c: fs.h is included more than once. ./fs/uimagefs.c: fs.h is included more than once. ./fs/fs.c: command.h is included more than once. ./arch/sandbox/board/hostfile.c: linux/err.h is included more than once. ./arch/sandbox/board/devices.c: mach/linux.h is included more than once. ./arch/sandbox/os/common.c: signal.h is included more than once. ./arch/arm/boards/zii-imx51-rdu1/board.c: envfs.h is included more than once. ./arch/arm/boards/imx233-olinuxino/imx23-olinuxino.c: generated/mach-types.h is ./arch/arm/mach-stm32mp/ddrctrl.c: mach/stm32.h is included more than once. ./arch/arm/mach-imx/cpu_init.c: common.h is included more than once. ./arch/arm/mach-imx/imx8m.c: mach/imx8m-ccm-regs.h is included more than once. ./common/efi/payload/init.c: efi.h is included more than once. ./common/state/backend_format_raw.c: common.h is included more than once. ./common/state/backend_format_raw.c: crc.h is included more than once. ./common/hush.c: libbb.h is included more than once. ./drivers/spi/atmel-quadspi.c: linux/clk.h is included more than once. ./drivers/spi/atmel-quadspi.c: linux/err.h is included more than once. ./drivers/net/virtio.c: net.h is included more than once. ./drivers/net/phy/phy.c: linux/phy.h is included more than once. ./drivers/net/cpsw.c: net.h is included more than once. ./drivers/virtio/virtio_pci_common.h: linux/list.h is included more than once. ./drivers/usb/host/ohci-hcd.c: dma.h is included more than once. ./drivers/usb/gadget/fsl_udc.c: dma.h is included more than once. ./drivers/nvmem/eeprom_93xx46.c: spi/spi.h is included more than once. ./drivers/nvmem/eeprom_93xx46.c: of.h is included more than once. ./drivers/video/imx-ipu-v3/imx-ldb.c: linux/clk.h is included more than once. ./drivers/video/imx-ipu-v3/imx-hdmi.c: linux/clk.h is included more than once. ./drivers/video/omap.c: common.h is included more than once. ./drivers/mtd/nand/nand_s3c24xx.c: asm/sections.h is included more than once. ./drivers/clk/imx/clk-imx6sx.c: linux/clk.h is included more than once. ./drivers/clk/imx/clk-imx6sl.c: linux/clk.h is included more than once. ./commands/bootm.c: of.h is included more than once. Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com> Link: https://lore.barebox.org/20220607051957.2497-1-eagle.alexander923@gmail.com 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>
* crypto: simplify $(srctree)/ handling and remove config_filename macroSascha Hauer2022-05-041-49/+0
| | | | | | | | | The config_filename macro has been dropped from mainline in b8c96a6b466c ("certs: simplify $(srctree)/ handling and remove config_filename macro"). Adopt the mechanism it has been replaced with for barebox. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* rsatoc: Add option to print dts outputSascha Hauer2022-05-041-25/+78
| | | | | | Add -d option to generate output in dts format rather than C. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* rsatoc: fix compiler warningsSascha Hauer2022-05-041-3/+3
| | | | | | | | Fixes: scripts/rsatoc.c:189:5: warning: no previous prototype for ‘rsa_get_params’ [-Wmissing-prototypes] Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: remove non-existent bareboxstate binaries from .gitignoreAhmad Fatoum2022-03-281-2/+0
| | | | | | | | | barebox builds no tools with these names. The normal barebox-state utility comes from dt-utils, so drop the unnecessary entries. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220318152851.729901-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: constify write_full input bufferAhmad Fatoum2022-03-282-2/+2
| | | | | | | | Buffer written is read-only, so align prototype with <libfile.h>. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220318144924.497993-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/stm32'Sascha Hauer2022-03-141-0/+39
|\
| * scripts: add tool to adjust bl33 load address in existing FIPAhmad Fatoum2022-02-231-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of rebuilding TF-A with a (newer) barebox, an existing image can be repacked: fiptool update fip.bin --nt-fw images/barebox-dt-2nd.img \ --hw-config build/arch/arm/dts/stm32mp157c-dk2.dtb This may fail at runtime though, because the STM32MP default is to place BL33 at the very start of RAM. The script introduced here offers an alternative to rebuilding TF-A with adjust FW_CONFIG: ./scripts/fiptool_fwconfig -l 0xc0001000 mmcblk0p3 This will have barebox loaded 4096 bytes into the STM32MP SDRAM. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220220124736.3052502-7-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2022-03-142-2/+2
|\ \
| * | kbuild: dtc: use env to resolve echoRouven Czerwinski2022-02-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Posix does not mandate to have binaries within a certain path, but rather that the utilities may be available. Use env to resolve and call echo from PATH. Fixes: 2ae7ac7ab2f1 ("kbuild: dtc: Allow adding device tree fragments via config") Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Link: https://lore.barebox.org/20220120074733.176041-1-r.czerwinski@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | Kbuild: use printf for as-instrRouven Czerwinski2022-02-211-1/+1
| |/ | | | | | | | | | | | | | | Instead of hard coding /bin/echo, port the upstream printf formatting. Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de> Link: https://lore.barebox.org/20220120084650.183704-1-r.czerwinski@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / scripts: bareboximd: Fix -c optionSascha Hauer2022-02-281-3/+6
|/ | | | | | | | | | | | | | | | | Using mmap in read_file doesn't work when the same file is written afterwards with write_file. This problem was fixed in 738601e125 ("scripts/common: fix write_file when opened with mmap"). Using mmap in read_file was removed in 07b87a0908 ("scripts/common: Do not mmap in read_file_2()") but then re-introduced for bareboximd in 013e8ea757 ("scripts: bareboximd: Use mmap when possible"). I'll put my brown paper bag on for this :( This patch fixes the issue by explicitly avoiding mmap when the file is written later as done with the -c option to bareboximd Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reported-by: Andrej Picej <andrej.picej@norik.com> Tested-by: Andrej Picej <andrej.picej@norik.com>
* Merge branch 'for-next/qoi'Sascha Hauer2022-02-184-0/+7825
|\
| * scripts: Add qoiconv to convert png to qoiJules Maselbas2022-01-204-0/+7825
| | | | | | | | | | | | | | | | | | ImageMagick will eventually support the qoi image format, in the mean time add qoiconv, a png to qoi image conversion program. Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu> Link: https://lore.barebox.org/20220117230235.13549-4-jmaselbas@kalray.eu Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2022-02-183-66/+42
|\ \
| * | compressed dtb: Make sure they are only available when supportedSascha Hauer2022-02-141-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A board has to select CONFIG_USE_COMPRESSED_DTB either directly or through arch specific options when it uses compressed dtbs. This is easily forgotten. barebox compiles fine, but during runtime the decompression code is missing and barebox won't start. As this happens in the PBL possibly without output this may be unnecessarily hard to debug. Make sure compilation fails when a board uses compressed dtbs but didn't select CONFIG_USE_COMPRESSED_DTB. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | kbuild: replace $(H) with $(pound)Masahiro Yamada2022-02-081-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | scripts/Kbuild.include defines 'pound', which is equivalent to 'H'. pound := \# Replace $(H) with $(pound), and remove the 'H' definition. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Link: https://lore.barebox.org/20220207134923.1775891-1-masahiroy@kernel.org Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | setlocalversion: update to Linux 5.16Masahiro Yamada2022-02-081-64/+39
| |/ | | | | | | | | | | | | | | | | | | It has been a long time since this script was updated. Now resync it with Linux 5.16. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Link: https://lore.barebox.org/20220207134707.1775213-1-masahiroy@kernel.org Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/dts'Sascha Hauer2022-02-181-1/+1
|\ \
| * | build: Include dts/include/ after include/Sascha Hauer2022-01-281-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | dts/include/ contains Kernel upstream dt-binding include files. includes are searched for in this directory before our own include directories are used. This becomes a problem when we have files existing in the barebox include directory which then appear in dts/include/ due to a dts update. Make sure that we still use the barebox files in this case so that we can later drop the barebox custom file explicitly along with the fixes that might be needed to use the upstream file. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Revert "scripts/common: fix write_file when opened with mmap"Sascha Hauer2022-02-111-11/+4
| | | | | | | | | | | | | | | | | | | | mmap() is no longer used in read_file_2(), so this patch is no longer necessary. This reverts commit 738601e1258c55953284ee10801b26b9977918c2. Link: https://lore.barebox.org/20220211094230.1807262-3-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | scripts: bareboximd: Use mmap when possibleSascha Hauer2022-02-111-0/+34
| | | | | | | | | | | | | | | | | | Using mmap() in read_file_2 was dropped in the last patch, bring it back in a bareboximd specific function here. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20220211094230.1807262-2-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | scripts/common: Do not mmap in read_file_2()Sascha Hauer2022-02-111-28/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using mmap() in read_file_2() leads to problems because there are cases where the buffer returned from read_file_2() is modified and then written back to the same file. This doesn't work when the original file has been mmapped instead of being read into an allocated buffer. Using mmap() was introduced for a usecase where the system is very tight in memory and bareboximd ran out of memory. Support for this usecase is removed here, we'll bring it back in the next patch. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Link: https://lore.barebox.org/20220211094230.1807262-1-s.hauer@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | scripts/common: fix write_file when opened with mmapAndrej Picej2022-01-311-4/+11
|/ | | | | | | | | | | | | | | | | | | | | | | | Usage of bareboximd with -c option (Create checksum for FILE and write it to the crc32 tag) was broken. Possibly by applying 2154de1cf36c (bareboximd: Use mmap when possibly). The script fails with: $ ./scripts/bareboximd -c images/<barebox-image.img> Cannot write to images/<barebox-mage.img>: Bad address CRC: write crc token to images/<barebox-image.img> failed: -14 Bad address This has to do with the usage of "mmap" and "open" with O_TRUNC flag which truncates the file length to 0. Writing to files fails with: EFAULT (14) buf is outside your accessible address space. Remove the truncate flag and truncate manually after writing the data. This fixes the bareboximd script, which is now again usable with -c option. Signed-off-by: Anze Lesnik <anze.lesnik@norik.com> Signed-off-by: Andrej Picej <andrej.picej@norik.com> Link: https://lore.barebox.org/20220128080033.167251-1-andrej.picej@norik.com Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: add SPDX-License-Identifier for .gitignoreAhmad Fatoum2022-01-055-0/+10
| | | | | | | | | 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-056-0/+12
| | | | | | | | | | | | | | | 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/kwboot: Fix normalizing timevalUwe Kleine-König2021-12-071-5/+4
| | | | | | | | | | | | | | | If tv.tv_usec is 1000000 the structure needs normalizing, too. So the right check would be: if (tv.tv_usec >= 1000000) { ... But as normalizing doesn't destroy anything even for smaller values, just do it unconditionally to simplify a bit. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.barebox.org/20211130160308.316863-1-u.kleine-koenig@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* scripts: Kconfig: fix typoUlrich Ölmann2021-11-171-1/+1
| | | | | | Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de> Link: https://lore.barebox.org/20211115170505.1564052-1-u.oelmann@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/scripts-common-library'Sascha Hauer2021-11-1514-364/+675
|\