summaryrefslogtreecommitdiff
path: root/tools
AgeCommit message (Collapse)AuthorFilesLines
2021-12-28Merge tag 'efi-2022-01-rc4-4' of ↵Tom Rini1-0/+2
https://source.denx.de/u-boot/custodians/u-boot-efi Pull request for efi-2022-01-rc4-4 UEFI: * allow for more than 16 KiB UEFI variable size when using StMM Others: * make watchdog sysreset compatible with separate poweroff driver * avoid OpenSSL deprecation warnings
2021-12-26tools: avoid OpenSSL deprecation warningsHeinrich Schuchardt1-0/+2
Our Gitlab CI buildsystem is set up to treat warnings as errors. With OpenSSL 3.0 a lot of deprecation warnings occur. With the patch compatibility with OpenSSL 1.1.1 is declared. In the long run we should upgrade our code to use the current API. A -Wdiscarded-qualifiers warning is muted by casting. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2021-12-24rockchip: mkimage: Add support for rk3568 SoCKever Yang1-0/+1
rk3568 is the first SoC which supports idb header v2. Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2021-12-24rockchip: mkimage: Add support for idb header V2Yi Liu1-28/+158
Rockchip BootRom supports new idb header v2 instead of legacy version. Add support for it so that we can generate image for new SoCs. Signed-off-by: Yi Liu <liuyi@rock-chips.com> Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2021-12-24rockchip: mkimage: Add image header versionKever Yang1-12/+17
We are going to have more than one version header, add the version in the header info. Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2021-12-24rockchip: mkimage: rename RK_SIGNATURE to RK_MAGICKever Yang1-5/+5
The first 4byte of idbimage is a magic number instead of signature, correct it. Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
2021-12-20fw_setenv: Unbreak fw_setenv caused by buggy MEMISLOCKED useJoakim Tjernlund1-7/+8
Commit "fw_setenv: lock the flash only if it was locked before" checks for Locked status with uninitialized erase data. Address by moving the test for MEMISLOCKED. Fixes: 8a726b852502 ("fw_setenv: lock the flash only if it was locked before") Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>
2021-11-15arm64: relocate-rela: Add support for ld.lldAlistair Delva1-3/+17
Cap end of relocations by the binary size. Linkers like to insert some auxiliary sections between .rela.dyn and .bss_start. These sections don't make their way to the final binary, but reloc_rela still tries to relocate them, resulting in attempted read past the end of file. When linking U-Boot with ld.lld, the STATIC_RELA feature (enabled by default on arm64) breaks the build. After this patch, U-Boot can be linked successfully with and without CONFIG_STATIC_RELA. Originally-from: Elena Petrova <lenaptr@google.com> Signed-off-by: Alistair Delva <adelva@google.com> Cc: David Brazdil <dbrazdil@google.com> Cc: Scott Wood <scottwood@freescale.com> Cc: Tom Rini <trini@konsulko.com>
2021-11-14Dockerfile, CI: Update to latest "focal" tagTom Rini1-1/+1
Signed-off-by: Tom Rini <trini@konsulko.com>
2021-11-14Dockerfile: build swtpmHeinrich Schuchardt1-0/+28
For testing the TPM drivers and the EFI_TCG2_PROTOCOL we need the tool swtpm. Once we move to Ubuntu Impish we can take libtpms from package libtpms-dev. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2021-11-14binman: Fix replace subcommand help and commentsJan Kiszka2-4/+4
Fix some copy&paste artifacts. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2021-11-13binman: Support updating the dtb in an ELF fileSimon Glass9-2/+216
WIth EFI we must embed the devicetree in an ELF image so that it is loaded as part of the executable file. We want it to include the binman definition in there also, which in some cases cannot be created until the ELF (u-boot) is built. Add an option to binman to support writing the updated dtb to the ELF file u-boot.out This is useful with the EFI app, which is always packaged as an ELF file. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-11-13binman: Tidy up comments on _DoTestFile()Simon Glass1-0/+5
The comment for this function is missing an argument and the return value. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-11-13binman: Support reading the offset of an ELF-file symbolSimon Glass6-5/+131
Binman needs to be able to update the contents of an ELF file after it has been build. To support this, add a function to locate the position of a symbol's contents within the file. Fix the comments on bss_data.c and Symbol while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-11-13binman: Report an error if test files fail to compileSimon Glass1-2/+6
At present any error from the 'make' command is silently swallowed by the test system. Fix this by showing it when detected. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-11-13patman: Use a ValueError exception if tools.Run() failsSimon Glass1-1/+1
The Exception base class is a very vague and could be confusing to the test system. Use the more specific ValueError exception instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-11-12Create a new boot/ directorySimon Glass1-9/+9
Quite a lot of the code in common/relates to booting and images. Before adding more it seems like a good time to move the code into its own directory. Most files with 'boot' or 'image' in them are moved, except: - autoboot.c which relates to U-Boot automatically running a script - bootstage.c which relates to U-Boot timing Drop the removal of boot* files from the output directory, since this interfers with the symlinks created by tools and there does not appear to be any such file from my brief testing. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Artem Lapkin <email2tema@gmail.com> Tested-by: Artem Lapkin <email2tema@gmail.com>
2021-11-10tools: kwbimage: Properly set srcaddr in kwbimage v0Pali Rohár1-0/+22
Field srcaddr in kwbimage v0 needs to be adjusted similarly like in v1. Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2021-11-10tools: kwbimage: Properly calculate and align kwbimage v0 header sizePali Rohár1-8/+16
Kwbimage v0 has similar alignment requirements as v1. Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2021-11-10tools: kwbimage: Fill the real header size into the main headerPali Rohár1-0/+9
Fill the real header size without padding into the main header This allows to reduce final image when converting image to another format which does not need additional padding. Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2021-11-10tools: kwbimage: Align kwbimage header to proper sizePali Rohár1-5/+22
Currently kwbimage header is always aligned to 4096 bytes. But it does not have to be aligned to such a high value. The header needs to be just 4-byte aligned, while some image types have additional alignment restrictions. This change reduces size of kwbimage binaries by removing extra padding between header and data part. Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2021-11-10tools: kwbimage: Do not put final image padding to the image data sizePali Rohár1-9/+21
This change allows to convert image from one format to another without need to include unnecessary padding (e.g. when target image format has smaller alignment requirement as source image format). Do it by storing real image data size without padding to the kwbimage header. Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2021-11-10tools: kwbimage: Align final UART image to 128 bytesPali Rohár1-0/+3
xmodem block size is 128 bytes, therefore it is possible to transfer only images with size multiple of 128 bytes. kwboot automatically pads image with zero bytes at the end to align it to 128 bytes boundary. Do this padding when generating image to allow uploading with other xmodem tools or older kwboot versions. Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2021-11-10tools: kwbimage: Remove unused enums and prototypesPali Rohár2-23/+1
There are more unused enums and function prototypes. Remove them. The function kwbimage_check_params() does not return enum kwbimage_cmd_types, but a boolean value returned as int. Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2021-11-10tools: kwbimage: Fix validation of kwbimage v0Pali Rohár1-37/+43
kwbimage v0 sldo has 32-bit data checksum at the end like kwbimage v1. Use same data checksum validation for both v0 and v1 image types. Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2021-11-10tools: kwbimage: Set BOOT_FROM by default to SPIPali Rohár1-17/+15
kwbimage must have valid blockid member instead of zero value. Thus if config file does not contain BOOT_FROM command, use by default the value for SPI booting (which is probably the most common). Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2021-11-10tools: kwbimage: Explicitly set version also for kwbimage v0Pali Rohár2-1/+3
For documentation purposes update struct main_hdr_v0 to include information where version of the image must be stored. For kwbimage v0 it obviously must be 0. By default all image header memory is initialized to zero, therefore this change has no functional effect. Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2021-11-10tools: kwbimage: Add support for new commands UART_PORT and UART_MPPPali Rohár1-1/+19
These two commands allow to specify custom setting of UART port used for printing BootROM messages. Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2021-11-10tools: kwboot: Always print kwboot versionPali Rohár1-1/+2
It is useful to see kwboot version in the boot log output for debugging purposes. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Stefan Roese <sr@denx.de>
2021-11-10tools: kwboot: Fix sending Kirkwood v0 imagesPali Rohár1-6/+19
Properly calculate and align image header size to xmodem block size. Kirkwood v0 images do not have stored total size of header in header structure itself like it is for v1 images. So kwbheader_size() calculates size by traversing image structure itself. Aligning is done in kwboot by putting zero padding bytes between the header and data part. Signed-off-by: Pali Rohár <pali@kernel.org> Tested-by: Tony Dinh <mibodhi@gmail.com> Reviewed-by: Stefan Roese <sr@denx.de>
2021-11-03tools: kwboot: Do not send magic seq when changing baudrate back to 115200Pali Rohár1-55/+60
After successful transfer of whole image only two things can happen: - BootROM starts execution of data block, which changes UART baudrate back to 115200 Bd, - board crashes and causes CPU reset In both cases UART baudrate is reset to the default speed. So there is no need to send special magic sequence to inform kwboot that baudrate is going to be reset and kwboot does not need to wait for this event and can do it immediately after BootROM acknowledges end of xmodem transfer. Move ARM code for sending magic sequence from main baudrate change section to binhdr_pre section which is executed only before changing baudrate from the default value of 115200 Bd to some new value. Remove kwboot code waiting for magic sequence after successful xmodem transfer. Rationale: sometimes when using very high UART speeds, magic sequence is damaged and kwboot fails at this last stage. Removal of this magic sequence makes booting more stable. Data transfer protocol (xmodem) is using checksums and retransmit, so it already deals with possible errors on transfer line. Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2021-11-03tools: kwboot: Do not use stack when setting baudrate back to default valuePali Rohár1-47/+65
The ARM code we inject into the image to change baudrate back to the default value of 115200 Baud, which is run after successful UART transfer of the whole image, cannot use stack as at this stage stack pointer is not initialized yet. Stack can only be used when BootROM is executing binary header, to preserve state of registers, since BootROM expects that. Change the ARM baudrate code to not use stack at all and put binary header specific pre + post code (which stores and restores registers) into separate arrays. The baudrate change code now jumps at it's end and expects that there is either code which returns to the BootROM or jumps to the original exec address. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2021-11-03tools: kwboot: Replace ARM mov + movt instruction pair by mov + orrPali Rohár1-2/+2
Older Armada SoCs have custom ARMv5te compatible core which does not support movt instruction. So replace mov + movt instruction pair used for immediate move construction by mov + orr instructions which are supported also by ARMv5te. After this change kwboot ARM code should be compatible with any 32-bit ARM core compatible by ARMv2 or new. At least GNU AS does not throw any error or warning. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2021-11-03tools: kwboot: Increase delay after changing baudrate in ARM codePali Rohár1-9/+9
Increase loop cycles from 600000 to 2998272, which should increase delay from 1ms to about 5ms on 1200 MHz CPU. The Number 2998272 was chosen as the nearest value around 3000000 which can be encoded into one ARM mov instruction. It avoids usage of movt instruction which is not supported by ARMv5te cores. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2021-11-03tools: kwboot: Do not call tcdrain() after each sent packetPali Rohár1-5/+8
Kwboot puts each xmodem packet to kernel queue, then waits until all bytes of that packet are transmitted over UART and then waits for xmodem reply until it is received into kernel queue. If some reply is received during the time we are waiting until all bytes are transmitted, then kernel puts them into the queue and returns it to kwboot in next read() call. So there is no need to wait (with tcdrain() function) until all bytes from xmodem packet are transmitted over UART, since any reply received either during that time or after is returned to kwboot with the next read(). Therefore do not call tcdrain() after each xmodem packet sent. Instead directly wait for any reply after putting xmodem packet into write kernel queue. This change could speed up xmodem transfer in case tcdrain() function waits for a longer time. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2021-11-03tools: kwboot: Fix sending retry of last header packetPali Rohár1-5/+2
After the trasfer of last header packet, it is possible that baudrate change pattern is received, and also that NAK byte is received so that the packet should be sent again. Thus we should not clear the baudrate change state when sending retry of that packet. Move code for initializing state variables from kwboot_xm_recv_reply() to kwboot_xm_sendblock(). Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2021-11-03tools: kwboot: Resend first 3 xmodem retry packets immediatelyPali Rohár1-3/+10
Currently when kwboot receive some garbage reply which does not understand, it waits 1s before it tries to resend packet again. The most common error on UART is that receiver sees some bit flipped which results in invalid reply. This behavior slows down xmodem transfer over UART as basically on every error kwboot is waiting one second. To fix this, try to resend xmodem packet for first 3 attempts immediately without any delay. If broken reply is received also after the 3 attempts, continue retrying with 1s delay like it was before. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2021-11-03tools: kwboot: Change retry loop from decreasing to increasingPali Rohár1-4/+4
This patch does not change behavior of the code, just allows to implement new changes more easily. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2021-11-03tools: kwboot: Calculate real used space in kwbimage header when calling ↵Pali Rohár1-3/+14
kwboot_img_grow_hdr() Size of the header stored in kwbimage may be larger than real used size in the kwbimage header. If there is unused space in kwbimage header then use it for growing it. So update code to calculate used space of kwbimage header. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2021-11-03tools: kwboot: Do not modify kwbimage header before increasing its sizePali Rohár1-3/+6
This ensures that kwboot_img_grow_hdr() function still sees valid kwbimage header. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2021-11-03tools: kwboot: Simplify code for aligning image headerPali Rohár1-3/+2
Expression (hdrsz % KWBOOT_XM_BLKSZ) is non-zero therefore expression (KWBOOT_XM_BLKSZ - hdrsz % KWBOOT_XM_BLKSZ) is always less than value KWBOOT_XM_BLKSZ. So there is no need to add another modulo. Also rename variable `offset` to `grow` which better describes what is stored in this variable. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2021-11-03tools: kwboot: Show verbose message when waiting for baudrate change magicPali Rohár1-1/+1
It is hard to debug why kwboot is failing when the last message is 'Finishing transfer' and no additional output. So show verbose message when kwboot finished transfer and is waiting for baudrate change magic sequence. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2021-11-03tools: kwboot: Correctly set configuration of UART for BootROM messagesPali Rohár1-0/+11
For kwbimage v1, tell BootROM to send BootROM messages to UART port number 0 (used also for UART booting) with default baudrate (which should be 115200) and do not touch UART MPP configuration. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2021-11-03tools: kwboot: Recalculate 4-byte data checksum after injecting baudrate codePali Rohár1-0/+3
If data part of image is modified, update 4-byte data checksum. It looks like A385 BootROM does not verify this checksum for image loaded via UART, but we do not know if other BootROMs are also ignoring it. It is always better to provide correct checksum. Signed-off-by: Pali Rohár <pali@kernel.org> [ refactored ] Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2021-11-03tools: kwboot: Inject baudrate change back code after data partPali Rohár1-41/+31
Some vendor U-Boot kwbimage binaries (e.g. those for A375) have load address set to zero. Therefore it is not possible to inject code which changes baudrate back to 115200 Bd before the data part. So instead inject it after the data part and change kwbimage execution address to that offset. Also store original execution address into baudrate change code, so after it changes baudrate back to 115200 Bd, it can jump to orignal address. Signed-off-by: Pali Rohár <pali@kernel.org> [ refactored ] Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2021-11-03tools: kwboot: Validate 4-byte image data checksumPali Rohár1-0/+34
Data part of the image contains 4-byte checksum. Validate it when processing the image. Signed-off-by: Pali Rohár <pali@kernel.org> [ refactored ] Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2021-11-03tools: kwboot: Reserve enough space for patching kwbimage in memoryPali Rohár1-1/+3
SPI image header and data parts do not have to be aligned to 128 byte xmodem block size. So reserve additional memory for aligning header part and additional memory for aligning data part. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2021-11-03tools: kwboot: Fix initialization of tty devicePali Rohár1-0/+1
Explicitly disable 2 stop bits by clearing CSTOPB flag, disable modem control flow by clearing CRTSCTS flag and do not send hangup after closing device by clearing HUPCL flag. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2021-11-03tools: kwboot: Initialize rfds to zeroPali Rohár1-0/+1
Explicitly zero out the rfds fd_set with FD_ZERO() before using it. Signed-off-by: Pali Rohár <pali@kernel.org> Reviewed-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
2021-10-31patman: Add "postfix" support to patch subjectsSean Anderson5-4/+19
In some communities, it may be necessary to append something after PATCH in the subject line. For example, the Linux networking subsystem expects [1] patch subject prefixes like [RFC PATCH net-next 0/99]. This adds support for such "postfix"s to patman. Although entirely cosmetic, it is still nice to have. [1] https://www.kernel.org/doc/html/latest/networking/netdev-FAQ.html#how-do-i-indicate-which-tree-net-vs-net-next-my-patch-should-be-in Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Simon Glass <sjg@chromium.org>