aboutsummaryrefslogtreecommitdiff
path: root/lib/lzma
AgeCommit message (Collapse)AuthorFilesLines
2023-12-21lib: Remove <common.h> inclusion from these filesWIP/2023-12-21-header-inclusion-cleanupTom Rini2-2/+0
After some header file cleanups to add missing include files, remove common.h from all files in the lib directory. This primarily means just dropping the line but in a few cases we need to add in other header files now. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
2023-07-14lzma: Fix decompression speed regressionChristophe Leroy1-14/+4
Uncompressing a 1.7Mbytes FIT image on U-boot 2023.04 takes approx 7s on a powerpc 8xx. The same on U-boot 2023.07-rc6 takes approx 28s unless watchdog is disabled. During that decompression, LzmaDec_DecodeReal() calls schedule 1.6 million times, that is every 4µs in average. In the past it used to be a call to WATCHDOG_RESET() which was just calling hw_watchdog_reset(). But the combination of commit 29caf9305b6 ("cyclic: Use schedule() instead of WATCHDOG_RESET()") and commit 26e8ebcd7cb ("watchdog: mpc8xxx: Make it generic") results in an heavier processing. However, there is absolutely no point in calling schedule() that often. By moving and keeping only one call to schedule() in the main loop the number of calls is reduced to 1.2 million which is still too much. So add logic to only call schedule every 1024 times. That leads to a call to schedule approx every 6ms which is still far enough to entertain the watchdog which has a 1s timeout on powerpc 8xx. powerpc 8xx being one of the slowest targets we have today in U-boot, and most other watchdogs having a timeout of one minutes instead of one second like the 8xx, this fix should not have negative impact on other targets. Fixes: 29caf9305b6 ("cyclic: Use schedule() instead of WATCHDOG_RESET()") Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-09-18cyclic: Use schedule() instead of WATCHDOG_RESET()Stefan Roese2-9/+9
Globally replace all occurances of WATCHDOG_RESET() with schedule(), which handles the HW_WATCHDOG functionality and the cyclic infrastructure. Signed-off-by: Stefan Roese <sr@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Tom Rini <trini@konsulko.com> [am335x_evm, mx6cuboxi, rpi_3,dra7xx_evm, pine64_plus, am65x_evm, j721e_evm]
2022-04-06lzma: Tidy up the function prototypeSimon Glass2-4/+17
This should use a const pointer for the input stream. Fix this and also add a proper comment. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-03treewide: Use 16-bit Unicode stringsSimon Glass1-2/+2
At present we use wide characters for Unicode but this is not necessary. Change the code to use the 'u' literal instead. This helps to fix build warnings for sandbox on the Raspberry Pi. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
2020-05-18common: Drop log.h from common headerSimon Glass1-0/+1
Move this header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-05-07SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini3-7/+3
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
2015-01-14lzma: fix buffer bound check error furtherSimon Glass1-2/+2
Commit 4d3b8a0d fixed a problem with lzma decompress where it would run out of bytes to decompress. The algorithm needs to know how many uncompressed bytes it is expected to produce. However, the fix introduced a potential buffer overrun, and causes the compression test to fail (test_compression command in sandbox). The correct fix seems to be to use the minimum of the expected number of uncompressed bytes and the amount of output space available. That way things work normally when there is enough space, and return an error (without overrunning available space) when there is not. Signed-off-by: Antonios Vamporakis <ant@area128.com> CC: Kees Cook <keescook@chromium.org> CC: Simon Glass <sjg@chromium.org> CC: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> CC: Luka Perkov <luka@openwrt.org> Signed-off-by: Simon Glass <sjg@chromium.org>
2014-06-11LzmaTools: don't self assign valuesJeroen Hofstee1-2/+2
It seems the code tries to trick the compiler the argument is actually used. However compilers became too smart to fool them so easily an now warn. Gcc and clang don't seem to emit a warning when the argument is unused. If so it should be decorated with unused / (void). Signed-off-by: Jeroen Hofstee <jeroen@myspectrum.nl>
2014-02-19kbuild: use Linux Kernel build scriptsMasahiro Yamada1-1/+1
Now we are ready to switch over to real Kbuild. This commit disables temporary scripts: scripts/{Makefile.build.tmp, Makefile.host.tmp} and enables real Kbuild scripts: scripts/{Makefile.build,Makefile.host,Makefile.lib}. This switch is triggered by the line in scripts/Kbuild.include -build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build.tmp obj +build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj We need to adjust some build scripts for U-Boot. But smaller amount of modification is preferable. Additionally, we need to fix compiler flags which are locally added or removed. In Kbuild, it is not allowed to change CFLAGS locally. Instead, ccflags-y, asflags-y, cppflags-y, CFLAGS_$(basetarget).o, CFLAGS_REMOVE_$(basetarget).o are prepared for that purpose. Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Tested-by: Gerhard Sittig <gsi@denx.de>
2014-01-14lzma: fix buffer bound check errorAntonios Vamporakis1-1/+4
Variable uncompressedSize references the space available, while outSizeFull is the actual expected uncompressed size. Using the wrong value causes LzmaDecode to return SZ_ERROR_INPUT_EOF. Problem was introduced in commit afca294. While at it add additional debug message. Signed-off-by: Antonios Vamporakis <ant@area128.com> CC: Kees Cook <keescook@chromium.org> CC: Simon Glass <sjg@chromium.org> CC: Daniel Schwierzeck <daniel.schwierzeck@gmail.com> CC: Luka Perkov <luka@openwrt.org>
2013-11-17lib: descend into sub directories only when it is necessaryMasahiro Yamada1-1/+1
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
2013-10-31lib: convert makefiles to Kbuild styleMasahiro Yamada1-23/+1
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
2013-09-03lzma: correctly bounds-check output bufferKees Cook1-2/+6
The output buffer size must be correctly passed to the lzma decoder or there is a risk of overflowing memory during decompression. Switching to the LZMA_FINISH_END mode means nothing is left in an unknown state once the buffer becomes full. Signed-off-by: Kees Cook <keescook@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
2013-07-24Add GPL-2.0+ SPDX-License-Identifier to source filesWolfgang Denk3-51/+3
Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Fixup common/cmd_io.c] Signed-off-by: Tom Rini <trini@ti.com>
2012-12-06lzma: update to lzma sdk 9.20Stefan Reinauer5-34/+91
Updated code taken from latest lzma sdk release 9.20 at http://downloads.sourceforge.net/sevenzip/lzma920.tar.bz2 This generates quite a lot of checkpatch warnings, but I guess we need to keep the code style as is to avoid a massive job each time we update this. Signed-off-by: Stefan Reinauer <reinauer@google.com> Signed-off-by: Simon Glass <sjg@chromium.org>
2012-03-28lzma: fix printf warningsMike Frysinger1-2/+2
Fix size_t printf format warnings: LzmaTools.c: In function 'lzmaBuffToBuffDecompress': LzmaTools.c:110:5: warning: format '%x' expects type 'unsigned int', but argument 2 has type 'SizeT' LzmaTools.c:111:5: warning: format '%x' expects type 'unsigned int', but argument 2 has type 'SizeT' Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-10-27GCC4.6: Squash warnings in LzmaTools.cMarek Vasut1-7/+7
LzmaTools.c: In function 'lzmaBuffToBuffDecompress': LzmaTools.c:70:5: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'unsigned char *' LzmaTools.c:71:5: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'unsigned char *' LzmaTools.c:72:5: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'unsigned char *' LzmaTools.c:73:5: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'unsigned char *' LzmaTools.c:74:5: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'unsigned char *' LzmaTools.c:110:5: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'SizeT' LzmaTools.c:111:5: warning: format '%lx' expects type 'long unsigned int', but argument 2 has type 'SizeT' Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Cc: Wolfgang Denk <wd@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Mike Frysinger <vapier@gentoo.org>
2011-08-04Convert ISO-8859 files to UTF-8Albert ARIBAUD1-1/+1
There was a mix of UTF-8 and ISO-8859 files in the U-Boot source tree, which could cause issues with the patchwork review system. This commit converts all ISO-8859 files to UTF-8. Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
2010-11-17Switch from archive libraries to partial linkingSebastien Carlier1-2/+2
Before this commit, weak symbols were not overridden by non-weak symbols found in archive libraries when linking with recent versions of binutils. As stated in the System V ABI, "the link editor does not extract archive members to resolve undefined weak symbols". This commit changes all Makefiles to use partial linking (ld -r) instead of creating library archives, which forces all symbols to participate in linking, allowing non-weak symbols to override weak symbols as intended. This approach is also used by Linux, from which the gmake function cmd_link_o_target (defined in config.mk and used in all Makefiles) is inspired. The name of each former library archive is preserved except for extensions which change from ".a" to ".o". This commit updates references accordingly where needed, in particular in some linker scripts. This commit reveals board configurations that exclude some features but include source files that depend these disabled features in the build, resulting in undefined symbols. Known such cases include: - disabling CMD_NET but not CMD_NFS; - enabling CONFIG_OF_LIBFDT but not CONFIG_QE. Signed-off-by: Sebastien Carlier <sebastien.carlier@gmail.com>
2010-04-13Rename lib_generic/ to lib/Peter Tyser11-0/+2580
Now that the other architecture-specific lib directories have been moved out of the top-level directory there's not much reason to have the '_generic' suffix on the common lib directory. Signed-off-by: Peter Tyser <ptyser@xes-inc.com>