From 5f2c4e0129bf644dbde3c75119406eceaded2aa2 Mon Sep 17 00:00:00 2001 From: Eugeniy Paltsev Date: Fri, 20 Mar 2020 19:38:17 +0300 Subject: CMD: random: fix return code As of today 'random' command return 1 (CMD_RET_FAILURE) in case of successful execution and 0 (CMD_RET_SUCCESS) in case of bad arguments. Fix that. NOTE: we remove printing usage information from command body so it won't print twice. Signed-off-by: Eugeniy Paltsev Reviewed-by: Simon Glass --- cmd/mem.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cmd/mem.c b/cmd/mem.c index 0bfb6081e7..009b7b58f3 100644 --- a/cmd/mem.c +++ b/cmd/mem.c @@ -1144,10 +1144,8 @@ static int do_random(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) unsigned char *buf8; unsigned int i; - if (argc < 3 || argc > 4) { - printf("usage: %s []\n", argv[0]); - return 0; - } + if (argc < 3 || argc > 4) + return CMD_RET_USAGE; len = simple_strtoul(argv[2], NULL, 16); addr = simple_strtoul(argv[1], NULL, 16); @@ -1174,7 +1172,8 @@ static int do_random(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) unmap_sysmem(start); printf("%lu bytes filled with random data\n", len); - return 1; + + return CMD_RET_SUCCESS; } #endif -- cgit v1.2.1 From e282c422e0b9a64dc53f7f1e55309639bc645f38 Mon Sep 17 00:00:00 2001 From: Rasmus Villemoes Date: Tue, 24 Mar 2020 13:57:40 +0100 Subject: tools: fw_env: use erasesize from MEMGETINFO ioctl We have a board with several revisions. The older ones use a nor flash with 64k erase size, while the newer have a flash with 4k sectors. The environment size is 8k. Currently, we have to put a column containing 0x10000 (64k) in fw_env.config in order for it to work on the older boards. But that ends up wasting quite a lot of time on the newer boards that could just erase the 8k occupied by the environment - strace says the 64k erase takes 0.405 seconds. With this patch, as expected, that's about an 8-fold better, at 0.043 seconds. Having different fw_env.config files for the different revisions is highly impractical, and the correct information is already available right at our fingertips. So use the erasesize returned by the MEMGETINFO ioctl when the fourth and fifth columns (sector size and #sectors, respectively) are absent or contain 0, a case where the logic previously used to use the environment size as erase size (and consequently computed ENVSECTORS(dev) as 1). As I'm only testing this on a NOR flash, I'm only changing the logic for that case, though I think it should be possible for the other types as well. Signed-off-by: Rasmus Villemoes --- tools/env/fw_env.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c index 381739d28d..8734663cd4 100644 --- a/tools/env/fw_env.c +++ b/tools/env/fw_env.c @@ -1647,6 +1647,9 @@ static int check_device_config(int dev) goto err; } DEVTYPE(dev) = mtdinfo.type; + if (DEVESIZE(dev) == 0 && ENVSECTORS(dev) == 0 && + mtdinfo.type == MTD_NORFLASH) + DEVESIZE(dev) = mtdinfo.erasesize; if (DEVESIZE(dev) == 0) /* Assume the erase size is the same as the env-size */ DEVESIZE(dev) = ENVSIZE(dev); -- cgit v1.2.1 From 38c4f6eb740e576f3d41c8183660c1b3228fc734 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 21 Apr 2020 12:11:58 +0200 Subject: doc: specify that xelatex is used as Latex engine Building the pdf documentation on readthedocs.org fails with pdflatex. Signed-off-by: Heinrich Schuchardt --- doc/conf.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/conf.py b/doc/conf.py index 8bb27ad9e2..93250a6aee 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -31,6 +31,8 @@ from load_config import loadConfig # If your documentation needs a minimal Sphinx version, state it here. needs_sphinx = '1.3' +latex_engine = 'xelatex' + # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. -- cgit v1.2.1 From f56149893538b34dbd905ee3f756628cf41358bd Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 21 Apr 2020 12:11:59 +0200 Subject: Add .readthedocs.yml readthedocs.org allows to automatically generate and publish the HTML documentation for the U-Boot project. Add a file controlling building https://u-boot.readthedocs.io/. Signed-off-by: Heinrich Schuchardt --- .readthedocs.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .readthedocs.yml diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 0000000000..f3fb5ed51b --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,19 @@ +# .readthedocs.yml +# Read the Docs configuration file +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Build documentation in the docs/ directory with Sphinx +sphinx: + configuration: docs/conf.py + +# Optionally build your docs in additional formats such as PDF and ePub +formats: [] + +# Optionally set the version of Python and requirements required to build your docs +# python: +# version: 3.7 +# install: +# - requirements: docs/requirements.txt -- cgit v1.2.1 From 6d687355591efbfe6db427bbac8a78fb9172e057 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 20 Apr 2020 17:38:31 +0200 Subject: doc: sphinx: refresh parse-headers.pl from Linux Copy parse-headers.pl from Linux kernel tree: * fix the parameter description %s/--man/--usage/ * fix a documentation reference Signed-off-by: Heinrich Schuchardt --- doc/sphinx/parse-headers.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/sphinx/parse-headers.pl b/doc/sphinx/parse-headers.pl index d4f38262eb..c518050ffc 100755 --- a/doc/sphinx/parse-headers.pl +++ b/doc/sphinx/parse-headers.pl @@ -344,7 +344,7 @@ enums and defines and create cross-references to a Sphinx book. B [] [] -Where can be: --debug, --help or --man. +Where can be: --debug, --help or --usage. =head1 OPTIONS @@ -382,7 +382,7 @@ ioctl. The EXCEPTIONS_FILE contain two rules to allow ignoring a symbol or to replace the default references by a custom one. -Please read doc/doc-guide/parse-headers.rst at the Kernel's +Please read Documentation/doc-guide/parse-headers.rst at the Kernel's tree for more details. =head1 BUGS -- cgit v1.2.1 From cc3860f66f682f17fd2ef4b31dbb9b7d864b53e1 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 20 Apr 2020 17:40:57 +0200 Subject: lib: zlib: fix formatting, reference Provide a valid reference for the deflate format. Reformat the ALGORITHM and REFERENCES comments. Signed-off-by: Heinrich Schuchardt --- lib/zlib/trees.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/lib/zlib/trees.c b/lib/zlib/trees.c index a0078d08ee..3e09517ed0 100644 --- a/lib/zlib/trees.c +++ b/lib/zlib/trees.c @@ -7,27 +7,28 @@ /* * ALGORITHM * - * The "deflation" process uses several Huffman trees. The more - * common source values are represented by shorter bit sequences. + * The "deflation" process uses several Huffman trees. The more + * common source values are represented by shorter bit sequences. * - * Each code tree is stored in a compressed form which is itself - * a Huffman encoding of the lengths of all the code strings (in - * ascending order by source values). The actual code strings are - * reconstructed from the lengths in the inflate process, as described - * in the deflate specification. + * Each code tree is stored in a compressed form which is itself + * a Huffman encoding of the lengths of all the code strings (in + * ascending order by source values). The actual code strings are + * reconstructed from the lengths in the inflate process, as + * described in the deflate specification. * * REFERENCES * - * Deutsch, L.P.,"'Deflate' Compressed Data Format Specification". - * Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc + * Deutsch, P. + * RFC 1951, DEFLATE Compressed Data Format Specification version 1.3 + * https://tools.ietf.org/html/rfc1951, 1996 * - * Storer, James A. - * Data Compression: Methods and Theory, pp. 49-50. - * Computer Science Press, 1988. ISBN 0-7167-8156-5. + * Storer, James A. + * Data Compression: Methods and Theory, pp. 49-50. + * Computer Science Press, 1988. ISBN 0-7167-8156-5. * - * Sedgewick, R. - * Algorithms, p290. - * Addison-Wesley, 1983. ISBN 0-201-06672-6. + * Sedgewick, R. + * Algorithms, p290. + * Addison-Wesley, 1983. ISBN 0-201-06672-6. */ /* @(#) $Id$ */ -- cgit v1.2.1 From d497821ebf302754ff4cd7265e5945c996e8fc34 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Mon, 20 Apr 2020 20:48:40 +0200 Subject: test: test_fs error message For non-root users mkfs.vfat is not in the search path at least on Debian. Hence when running 'make tests' a message indicates that file system tests have been skipped: SKIPPED [13] test/py/tests/test_fs/conftest.py:340: Setup failed for filesystem: fat16 This message is not really helpful as the executed program is not indicated. Provide a more complete message like SKIPPED [13] test/py/tests/test_fs/conftest.py:340: Setup failed for filesystem: fat16. Command 'mkfs.vfat -F 16 build-sandbox/persistent-data/3GB.fat16.img' returned non-zero exit status 127. Signed-off-by: Heinrich Schuchardt --- test/py/tests/test_fs/conftest.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/py/tests/test_fs/conftest.py b/test/py/tests/test_fs/conftest.py index 1949f91619..ee82169c2a 100644 --- a/test/py/tests/test_fs/conftest.py +++ b/test/py/tests/test_fs/conftest.py @@ -335,8 +335,9 @@ def fs_obj_basic(request, u_boot_config): md5val.append(out.split()[0]) umount_fs(mount_dir) - except CalledProcessError: - pytest.skip('Setup failed for filesystem: ' + fs_type) + except CalledProcessError as err: + pytest.skip('Setup failed for filesystem: ' + fs_type + \ + '. {}'.format(err)) return else: yield [fs_ubtype, fs_img, md5val] -- cgit v1.2.1 From 7683b11098ded5087138d84e2e85078335a0cb72 Mon Sep 17 00:00:00 2001 From: Arnaud Ferraris Date: Wed, 22 Apr 2020 12:43:44 +0200 Subject: fs: ext4: skip journal state if fs has metadata_csum As u-boot doesn't support the metadata_csum feature, writing to a filesystem with this feature enabled will fail, as expected. However, during the process, a journal state check is performed, which could result in: - a fs recovery if the fs wasn't umounted properly - the fs being marked dirty Both these cases result in a superblock change, leading to a mismatch between the superblock checksum and its contents. Therefore, Linux will consider the filesystem heavily corrupted and will require e2fsck to be run manually to boot. By bypassing the journal state check, this patch ensures the superblock won't be corrupted if the filesystem has metadata_csum feature enabled. Signed-off-by: Arnaud Ferraris --- fs/ext4/ext4_journal.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/ext4/ext4_journal.c b/fs/ext4/ext4_journal.c index 3559daf11d..f8524e5a99 100644 --- a/fs/ext4/ext4_journal.c +++ b/fs/ext4/ext4_journal.c @@ -409,6 +409,9 @@ int ext4fs_check_journal_state(int recovery_flag) char *temp_buff1 = NULL; struct ext_filesystem *fs = get_fs(); + if (le32_to_cpu(fs->sb->feature_ro_compat) & EXT4_FEATURE_RO_COMPAT_METADATA_CSUM) + return 0; + temp_buff = zalloc(fs->blksz); if (!temp_buff) return -ENOMEM; -- cgit v1.2.1 From 421de7fec831902fb9b88651446cc80ae4045d45 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Wed, 22 Apr 2020 14:18:25 +0200 Subject: net: tftp: Add help for CONFIG_TFTP_BLOCKSIZE Add help message for the CONFIG_TFTP_BLOCKSIZE default value, as explain in tftp.c before migration in commit b618b3707633 ("net: Convert CONFIG_TFTP_BLOCKSIZE to Kconfig") Signed-off-by: Patrick Delaunay --- net/Kconfig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/Kconfig b/net/Kconfig index 96bbce1778..ac6d0cf8a6 100644 --- a/net/Kconfig +++ b/net/Kconfig @@ -44,5 +44,9 @@ config TFTP_BLOCKSIZE default 1468 help Default TFTP block size. + The MTU is typically 1500 for ethernet, so a TFTP block of + 1468 (MTU minus eth.hdrs) provides a good throughput with + almost-MTU block sizes. + You can also activate CONFIG_IP_DEFRAG to set a larger block. endif # if NET -- cgit v1.2.1 From 31d275b095e2c8c5607ab0e95e8342be7071ddf6 Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Wed, 22 Apr 2020 14:18:26 +0200 Subject: net: tftp: remove TFTP_MTU_BLOCKSIZE Remove the unneeded define TFTP_MTU_BLOCKSIZE. Since the KConfig migration done by commit b618b3707633 ("net: Convert CONFIG_TFTP_BLOCKSIZE to Kconfig"), CONFIG_TFTP_BLOCKSIZE is always defined and can be used directly to avoid confusion (fallback to 1468 in code is never used). Signed-off-by: Patrick Delaunay --- net/tftp.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/net/tftp.c b/net/tftp.c index 585eb6ef0c..be24e63075 100644 --- a/net/tftp.c +++ b/net/tftp.c @@ -133,14 +133,9 @@ static char tftp_filename[MAX_LEN]; * almost-MTU block sizes. At least try... fall back to 512 if need be. * (but those using CONFIG_IP_DEFRAG may want to set a larger block in cfg file) */ -#ifdef CONFIG_TFTP_BLOCKSIZE -#define TFTP_MTU_BLOCKSIZE CONFIG_TFTP_BLOCKSIZE -#else -#define TFTP_MTU_BLOCKSIZE 1468 -#endif static unsigned short tftp_block_size = TFTP_BLOCK_SIZE; -static unsigned short tftp_block_size_option = TFTP_MTU_BLOCKSIZE; +static unsigned short tftp_block_size_option = CONFIG_TFTP_BLOCKSIZE; static inline int store_block(int block, uchar *src, unsigned int len) { -- cgit v1.2.1 From 0015e6defe66022b38c4fe0e2c793728ab2c3cdd Mon Sep 17 00:00:00 2001 From: Patrick Delaunay Date: Thu, 23 Apr 2020 09:39:08 +0200 Subject: Makefile: copy SPL_FIT_SOURCE in build directory Copy the .its source file selected by CONFIG_SPL_FIT_SOURCE in builddir and in a file named "u-boot.its". This patch avoid compilation issue when CONFIG_SPL_FIT_SOURCE is used and KBUILD_OUTPUT is defined, in buildman for example. Signed-off-by: Patrick Delaunay Tested-by: Marek Vasut Acked-by: Marek Vasut --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b8a4b5058a..863ddd9528 100644 --- a/Makefile +++ b/Makefile @@ -1322,7 +1322,9 @@ endif # Boards with more complex image requirements can provide an .its source file # or a generator script ifneq ($(CONFIG_SPL_FIT_SOURCE),"") -U_BOOT_ITS = $(subst ",,$(CONFIG_SPL_FIT_SOURCE)) +U_BOOT_ITS := u-boot.its +$(U_BOOT_ITS): $(subst ",,$(CONFIG_SPL_FIT_SOURCE)) + $(call if_changed,copy) else ifneq ($(CONFIG_SPL_FIT_GENERATOR),"") U_BOOT_ITS := u-boot.its -- cgit v1.2.1