From 4d9dbb1fbb7c47ebb4390d6aaa35aa4254db06d4 Mon Sep 17 00:00:00 2001 From: Chris Packham Date: Wed, 30 Jan 2019 20:23:16 +1300 Subject: moveconfig: add a second pass for empty #if/#endif blocks Moveconfig already attempts to remove empty #if/#endif blocks when there is a matching CONFIG_ being moved. Add a second pass which covers files without a match. Signed-off-by: Chris Packham --- tools/moveconfig.py | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'tools') diff --git a/tools/moveconfig.py b/tools/moveconfig.py index caa81ac2ed7..1a214c56054 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -545,6 +545,28 @@ def confirm(options, prompt): return True +def cleanup_empty_blocks(header_path, options): + """Clean up empty conditional blocks + + Arguments: + header_path: path to the cleaned file. + options: option flags. + """ + pattern = re.compile(r'^\s*#\s*if.*$\n^\s*#\s*endif.*$\n*', flags=re.M) + with open(header_path) as f: + data = f.read() + + new_data = pattern.sub('\n', data) + + show_diff(data.splitlines(True), new_data.splitlines(True), header_path, + options.color) + + if options.dry_run: + return + + with open(header_path, 'w') as f: + f.write(new_data) + def cleanup_one_header(header_path, patterns, options): """Clean regex-matched lines away from a file. @@ -626,8 +648,9 @@ def cleanup_headers(configs, options): continue for filename in filenames: if not fnmatch.fnmatch(filename, '*~'): - cleanup_one_header(os.path.join(dirpath, filename), - patterns, options) + header_path = os.path.join(dirpath, filename) + cleanup_one_header(header_path, patterns, options) + cleanup_empty_blocks(header_path, options) def cleanup_one_extra_option(defconfig_path, configs, options): """Delete config defines in CONFIG_SYS_EXTRA_OPTIONS in one defconfig file. -- cgit v1.3.1 From 45b7f5b408181c7c5c9bbb01d258f9fa2a8825e5 Mon Sep 17 00:00:00 2001 From: "Andrew F. Davis" Date: Fri, 1 Feb 2019 15:04:58 -0600 Subject: armv7R: K3: am654: Fix order of debug elements in x509 template The first element in the debug section is expected to be debugUID. ROM will not parse this correctly when out of order, fix this here. Signed-off-by: Andrew F. Davis Reviewed-by: Tom Rini Reviewed-by: Lokesh Vutla --- tools/k3_x509template.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/k3_x509template.txt b/tools/k3_x509template.txt index bd3a9ab0560..f176ff3ad2f 100644 --- a/tools/k3_x509template.txt +++ b/tools/k3_x509template.txt @@ -42,7 +42,7 @@ # salt = FORMAT:HEX,OCT:TEST_IMAGE_KEY_DERIVE_SALT [ debug ] + debugUID = FORMAT:HEX,OCT:0000000000000000000000000000000000000000000000000000000000000000 debugType = INTEGER:4 coreDbgEn = INTEGER:0 coreDbgSecEn = INTEGER:0 - debugUID = FORMAT:HEX,OCT:0000000000000000000000000000000000000000000000000000000000000000 -- cgit v1.3.1