From 60911104f39b0fc3936a038d87e4a7c6dbe4fe33 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Fri, 14 Apr 2017 10:53:56 +0900 Subject: tools: moveconfig: remove GCC prefix of obsolete architecture Recently, U-Boot removed support for these architectures. Signed-off-by: Masahiro Yamada --- tools/moveconfig.py | 7 ------- 1 file changed, 7 deletions(-) (limited to 'tools') diff --git a/tools/moveconfig.py b/tools/moveconfig.py index 228d098d854..dcca0ecb5eb 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -199,28 +199,21 @@ SLEEP_TIME=0.03 # Most of them are available at kernel.org # (https://www.kernel.org/pub/tools/crosstool/files/bin/), except the following: # arc: https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases -# blackfin: http://sourceforge.net/projects/adi-toolchain/files/ # nds32: http://osdk.andestech.com/packages/nds32le-linux-glibc-v1.tgz # nios2: https://sourcery.mentor.com/GNUToolchain/subscription42545 # sh: http://sourcery.mentor.com/public/gnu_toolchain/sh-linux-gnu -# -# openrisc kernel.org toolchain is out of date, download latest one from -# http://opencores.org/or1k/OpenRISC_GNU_tool_chain#Prebuilt_versions CROSS_COMPILE = { 'arc': 'arc-linux-', 'aarch64': 'aarch64-linux-', 'arm': 'arm-unknown-linux-gnueabi-', 'avr32': 'avr32-linux-', - 'blackfin': 'bfin-elf-', 'm68k': 'm68k-linux-', 'microblaze': 'microblaze-linux-', 'mips': 'mips-linux-', 'nds32': 'nds32le-linux-', 'nios2': 'nios2-linux-gnu-', - 'openrisc': 'or1k-elf-', 'powerpc': 'powerpc-linux-', 'sh': 'sh-linux-gnu-', - 'sparc': 'sparc-linux-', 'x86': 'i386-linux-', 'xtensa': 'xtensa-linux-' } -- cgit v1.2.3 From 546a6f3a9b48fb891e5530528cc0696564438760 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Fri, 14 Apr 2017 19:47:50 -0400 Subject: buildman: Allow 'gnueabihf' toolchains for ARM Many toolchains for ARM use the 'gnueabihf' suffix rather than just 'gnueabi', so allow these to be used, but with a lower priority than 'gnueabi' ones. Cc: Simon Glass Signed-off-by: Tom Rini Reviewed-by: Simon Glass --- tools/buildman/toolchain.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py index 47788762016..5cf97ac8148 100644 --- a/tools/buildman/toolchain.py +++ b/tools/buildman/toolchain.py @@ -120,8 +120,9 @@ class Toolchain: Priority of toolchain, PRIORITY_CALC=highest, 20=lowest. """ priority_list = ['-elf', '-unknown-linux-gnu', '-linux', - '-none-linux-gnueabi', '-uclinux', '-none-eabi', - '-gentoo-linux-gnu', '-linux-gnueabi', '-le-linux', '-uclinux'] + '-none-linux-gnueabi', '-none-linux-gnueabihf', '-uclinux', + '-none-eabi', '-gentoo-linux-gnu', '-linux-gnueabi', + '-linux-gnueabihf', '-le-linux', '-uclinux'] for prio in range(len(priority_list)): if priority_list[prio] in fname: return PRIORITY_CALC + prio -- cgit v1.2.3 From ddc6a9de057e0fd0b46ba21d16a50a8d24351ef6 Mon Sep 17 00:00:00 2001 From: "xypron.glpk@gmx.de" Date: Sat, 15 Apr 2017 13:05:40 +0200 Subject: tools/env: avoid memory leak in fw_setenv If realloc fails we should release the old buffer. Signed-off-by: Heinrich Schuchardt Reviewed-by: Tom Rini Reviewed-by: Simon Glass --- tools/env/fw_env.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tools') diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c index 299e0c9608b..28616561830 100644 --- a/tools/env/fw_env.c +++ b/tools/env/fw_env.c @@ -473,6 +473,7 @@ int fw_setenv(int argc, char *argv[], struct env_opts *opts) int i; size_t len; char *name, **valv; + char *oldval; char *value = NULL; int valc; int ret; @@ -507,11 +508,13 @@ int fw_setenv(int argc, char *argv[], struct env_opts *opts) if (value) value[len - 1] = ' '; + oldval = value; value = realloc(value, len + val_len + 1); if (!value) { fprintf(stderr, "Cannot malloc %zu bytes: %s\n", len, strerror(errno)); + free(oldval); return -1; } -- cgit v1.2.3 From 17873341af56847382495f3d9f5a4121aeb9a03b Mon Sep 17 00:00:00 2001 From: Philipp Tomsich Date: Wed, 19 Apr 2017 15:09:04 +0200 Subject: rockchip: mkimage: remove (left-over) assignment w/o effect [coverity] An assignment (of a value to itself) was left over (after removing and addition from the line) from moving the common padding code into rkcommon_vrec_header. This change removes this to avoid a spurious warning in static code analysis (i.e. Coverity). Signed-off-by: Philipp Tomsich Reported-by: Coverity (CID: 161418) Reviewed-by: Tom Rini --- tools/rkcommon.c | 1 - 1 file changed, 1 deletion(-) (limited to 'tools') diff --git a/tools/rkcommon.c b/tools/rkcommon.c index 6cdb749c4ca..b34373e8fcd 100644 --- a/tools/rkcommon.c +++ b/tools/rkcommon.c @@ -227,5 +227,4 @@ void rkcommon_vrec_header(struct image_tool_params *params, /* Allocate, clear and install the header */ tparams->hdr = malloc(tparams->header_size); memset(tparams->hdr, 0, tparams->header_size); - tparams->header_size = tparams->header_size; } -- cgit v1.2.3 From d27e35f2564f751a3cc47daa5ab9897f04401a40 Mon Sep 17 00:00:00 2001 From: "xypron.glpk@gmx.de" Date: Wed, 3 May 2017 22:40:11 +0200 Subject: relocate-rela: add missing va_end() va_start must always be matched by va_end. The problem was indicated by cppcheck. Signed-off-by: Heinrich Schuchardt --- tools/relocate-rela.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/relocate-rela.c b/tools/relocate-rela.c index 3c9d134ac26..df968eb5fd1 100644 --- a/tools/relocate-rela.c +++ b/tools/relocate-rela.c @@ -27,9 +27,11 @@ static void debug(const char *fmt, ...) { va_list args; - va_start(args, fmt); - if (debug_en) + if (debug_en) { + va_start(args, fmt); vprintf(fmt, args); + va_end(args); + } } static bool supported_rela(Elf64_Rela *rela) -- cgit v1.2.3 From f59a3b21f60190793dc3cee97338c2f6ee9f2336 Mon Sep 17 00:00:00 2001 From: "xypron.glpk@gmx.de" Date: Thu, 4 May 2017 22:26:42 +0200 Subject: tools: sunxi: avoid read after end of string The evaluation of option -c is incorrect: According to the C99 standard endptr in the first strtol is always set as &endptr is not NULL. So the first part of the or condition is always true. If all digits in optarg are valid endptr will point to the closing \0 and the second strtol will read beyond the end of the string optarg points to. Signed-off-by: Heinrich Schuchardt Acked-by: Boris Brezillon --- tools/sunxi-spl-image-builder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/sunxi-spl-image-builder.c b/tools/sunxi-spl-image-builder.c index d538a388131..a367f117740 100644 --- a/tools/sunxi-spl-image-builder.c +++ b/tools/sunxi-spl-image-builder.c @@ -433,7 +433,7 @@ int main(int argc, char **argv) break; case 'c': info.ecc_strength = strtol(optarg, &endptr, 0); - if (endptr || *endptr == '/') + if (*endptr == '/') info.ecc_step_size = strtol(endptr + 1, NULL, 0); break; case 'p': -- cgit v1.2.3 From 85edfc1f6fdf1630c00dc57a63ab66d51608092e Mon Sep 17 00:00:00 2001 From: Chris Packham Date: Tue, 2 May 2017 21:30:46 +1200 Subject: tools: moveconfig: extract helper function for user confirmation Avoid repetitive code dealing with asking the user for confirmation. Signed-off-by: Chris Packham Reviewed-by: Simon Glass --- tools/moveconfig.py | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) (limited to 'tools') diff --git a/tools/moveconfig.py b/tools/moveconfig.py index dcca0ecb5eb..f8d485703f8 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -435,6 +435,20 @@ def extend_matched_lines(lines, matched, pre_patterns, post_patterns, extend_pre matched += extended_matched matched.sort() +def confirm(options, prompt): + if not options.yes: + while True: + choice = raw_input('{} [y/n]: '.format(prompt)) + choice = choice.lower() + print choice + if choice == 'y' or choice == 'n': + break + + if choice == 'n': + return False + + return True + def cleanup_one_header(header_path, patterns, options): """Clean regex-matched lines away from a file. @@ -502,15 +516,8 @@ def cleanup_headers(configs, options): configs: A list of CONFIGs to remove. options: option flags. """ - if not options.yes: - while True: - choice = raw_input('Clean up headers? [y/n]: ').lower() - print choice - if choice == 'y' or choice == 'n': - break - - if choice == 'n': - return + if not confirm(options, 'Clean up headers?'): + return patterns = [] for config in configs: @@ -582,16 +589,8 @@ def cleanup_extra_options(configs, options): configs: A list of CONFIGs to remove. options: option flags. """ - if not options.yes: - while True: - choice = (raw_input('Clean up CONFIG_SYS_EXTRA_OPTIONS? [y/n]: '). - lower()) - print choice - if choice == 'y' or choice == 'n': - break - - if choice == 'n': - return + if not confirm(options, 'Clean up CONFIG_SYS_EXTRA_OPTIONS?'): + return configs = [ config[len('CONFIG_'):] for config in configs ] -- cgit v1.2.3 From ca43834d66f08ed7244c26ef8edbe1a9ee2b8e8c Mon Sep 17 00:00:00 2001 From: Chris Packham Date: Tue, 2 May 2017 21:30:47 +1200 Subject: tools: moveconfig: cleanup whitelist entries After moving to KConfig and removing from all headers options should be removed from config_whitelist.txt so the build starts complaining if someone adds them back. Acked-by: Masahiro Yamada Signed-off-by: Chris Packham Reviewed-by: Simon Glass --- tools/moveconfig.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tools') diff --git a/tools/moveconfig.py b/tools/moveconfig.py index f8d485703f8..2361a430dc8 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -600,6 +600,25 @@ def cleanup_extra_options(configs, options): cleanup_one_extra_option(os.path.join('configs', defconfig), configs, options) +def cleanup_whitelist(configs, options): + """Delete config whitelist entries + + Arguments: + configs: A list of CONFIGs to remove. + options: option flags. + """ + if not confirm(options, 'Clean up whitelist entries?'): + return + + with open(os.path.join('scripts', 'config_whitelist.txt')) as f: + lines = f.readlines() + + lines = [x for x in lines if x.strip() not in configs] + + with open(os.path.join('scripts', 'config_whitelist.txt'), 'w') as f: + f.write(''.join(lines)) + + ### classes ### class Progress: @@ -1296,6 +1315,7 @@ def main(): if configs: cleanup_headers(configs, options) cleanup_extra_options(configs, options) + cleanup_whitelist(configs, options) if options.commit: subprocess.call(['git', 'add', '-u']) -- cgit v1.2.3 From f90df596a87bcec97873c247f1948190355539a9 Mon Sep 17 00:00:00 2001 From: Chris Packham Date: Tue, 2 May 2017 21:30:48 +1200 Subject: tools: moveconfig: cleanup README entires The Kconfig description replaces the description in the README file so as options are migrated they can be removed from the README. Signed-off-by: Chris Packham Reviewed-by: Simon Glass --- tools/moveconfig.py | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'tools') diff --git a/tools/moveconfig.py b/tools/moveconfig.py index 2361a430dc8..95ef352f05f 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -618,6 +618,46 @@ def cleanup_whitelist(configs, options): with open(os.path.join('scripts', 'config_whitelist.txt'), 'w') as f: f.write(''.join(lines)) +def find_matching(patterns, line): + for pat in patterns: + if pat.search(line): + return True + return False + +def cleanup_readme(configs, options): + """Delete config description in README + + Arguments: + configs: A list of CONFIGs to remove. + options: option flags. + """ + if not confirm(options, 'Clean up README?'): + return + + patterns = [] + for config in configs: + patterns.append(re.compile(r'^\s+%s' % config)) + + with open('README') as f: + lines = f.readlines() + + found = False + newlines = [] + for line in lines: + if not found: + found = find_matching(patterns, line) + if found: + continue + + if found and re.search(r'^\s+CONFIG', line): + found = False + + if not found: + newlines.append(line) + + with open('README', 'w') as f: + f.write(''.join(newlines)) + ### classes ### class Progress: @@ -1316,6 +1356,7 @@ def main(): cleanup_headers(configs, options) cleanup_extra_options(configs, options) cleanup_whitelist(configs, options) + cleanup_readme(configs, options) if options.commit: subprocess.call(['git', 'add', '-u']) -- cgit v1.2.3