[PATCH v2 0/6] misc: Various misc patches

This series includes some minor tools updates and conversion of CONFIG_MISC_INIT_F to Kconfig.
Changes in v2: - Add new patch to adjust detection of 64-bit properties - Drop the reg_val temporary var - Add two new tests
Simon Glass (6): dtoc: Show driver warnings once at the end dtoc: Adjust detection of 64-bit properties dtoc: Improve handling of reg properties log: Fix up debug_cond() when LOG is enabled moveconfig: Handle binary files cleanly Convert CONFIG_MISC_INIT_F to Kconfig
common/Kconfig | 6 ++++ configs/MPC8349ITXGP_defconfig | 1 + configs/MPC8349ITX_LOWBOOT_defconfig | 1 + configs/MPC8349ITX_defconfig | 1 + configs/kmcoge4_defconfig | 1 + configs/sandbox64_defconfig | 2 +- configs/sandbox_defconfig | 1 + configs/sandbox_flattree_defconfig | 2 +- configs/sandbox_spl_defconfig | 2 ++ configs/tools-only_defconfig | 1 + include/configs/MPC8349ITX.h | 2 -- include/configs/kmp204x.h | 2 -- include/configs/sandbox.h | 2 -- include/log.h | 11 ++++--- scripts/config_whitelist.txt | 1 - tools/dtoc/dtb_platdata.py | 20 ++++++++----- tools/dtoc/src_scan.py | 15 ++++++---- tools/dtoc/test/dtoc_test_noprops.dts | 21 +++++++++++++ tools/dtoc/test/dtoc_test_single_reg.dts | 30 +++++++++++++++++++ tools/dtoc/test_dtoc.py | 25 ++++++++++++---- tools/dtoc/test_src_scan.py | 38 ++++++++++++------------ tools/moveconfig.py | 16 ++++++++-- 22 files changed, 149 insertions(+), 52 deletions(-) create mode 100644 tools/dtoc/test/dtoc_test_noprops.dts create mode 100644 tools/dtoc/test/dtoc_test_single_reg.dts

At present warnings are shown as soon as they are discovered in the source scannner. But the function that detects them may be called multiple times.
Collect all the warnings and show them at the end.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
tools/dtoc/dtb_platdata.py | 6 ++++-- tools/dtoc/src_scan.py | 15 +++++++++------ tools/dtoc/test_dtoc.py | 2 +- tools/dtoc/test_src_scan.py | 38 ++++++++++++++++++------------------- 4 files changed, 33 insertions(+), 28 deletions(-)
diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index b5c449ebb47..27e88e75173 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -1186,8 +1186,7 @@ def run_steps(args, dtb_file, include_disabled, output, output_dirs, phase, raise ValueError('Must specify either output or output_dirs, not both')
if not scan: - scan = src_scan.Scanner(basedir, warning_disabled, drivers_additional, - phase) + scan = src_scan.Scanner(basedir, drivers_additional, phase) scan.scan_drivers() do_process = True else: @@ -1217,4 +1216,7 @@ def run_steps(args, dtb_file, include_disabled, output, output_dirs, phase, plat.out_header(outfile) outfile.method(plat) plat.finish_output() + + if not warning_disabled: + scan.show_warnings() return plat diff --git a/tools/dtoc/src_scan.py b/tools/dtoc/src_scan.py index 114212cfe2d..2db96884c85 100644 --- a/tools/dtoc/src_scan.py +++ b/tools/dtoc/src_scan.py @@ -188,7 +188,6 @@ class Scanner: key: Driver alias declared with DM_DRIVER_ALIAS(driver_alias, driver_name) value: Driver name declared with U_BOOT_DRIVER(driver_name) - _warning_disabled: true to disable warnings about driver names not found _drivers_additional (list or str): List of additional drivers to use during scanning _of_match: Dict holding information about compatible strings @@ -206,7 +205,7 @@ class Scanner: _phase: The phase of U-Boot that we are generating data for, e.g. 'spl' or 'tpl'. None if not known """ - def __init__(self, basedir, warning_disabled, drivers_additional, phase=''): + def __init__(self, basedir, drivers_additional, phase=''): """Set up a new Scanner """ if not basedir: @@ -217,7 +216,7 @@ class Scanner: self._drivers = {} self._driver_aliases = {} self._drivers_additional = drivers_additional or [] - self._warning_disabled = warning_disabled + self._missing_drivers = set() self._of_match = {} self._compat_to_driver = {} self._uclass = {} @@ -268,9 +267,7 @@ class Scanner: aliases_c.remove(compat_c) return compat_c, aliases_c
- if not self._warning_disabled: - print('WARNING: the driver %s was not found in the driver list' - % (compat_list_c[0])) + self._missing_drivers.add(compat_list_c[0])
return compat_list_c[0], compat_list_c[1:]
@@ -578,6 +575,12 @@ class Scanner: self._drivers[driver.name] = driver self._of_match.update(of_match)
+ def show_warnings(self): + """Show any warnings that have been collected""" + for name in sorted(list(self._missing_drivers)): + print('WARNING: the driver %s was not found in the driver list' + % name) + def scan_driver(self, fname): """Scan a driver file to build a list of driver names and aliases
diff --git a/tools/dtoc/test_dtoc.py b/tools/dtoc/test_dtoc.py index 1912a8723f2..62fcab74178 100755 --- a/tools/dtoc/test_dtoc.py +++ b/tools/dtoc/test_dtoc.py @@ -104,7 +104,7 @@ def setup():
# Disable warnings so that calls to get_normalized_compat_name() will not # output things. - saved_scan = src_scan.Scanner(None, True, False) + saved_scan = src_scan.Scanner(None, False) saved_scan.scan_drivers()
def copy_scan(): diff --git a/tools/dtoc/test_src_scan.py b/tools/dtoc/test_src_scan.py index 0af86dcf0c3..d6da03849f9 100644 --- a/tools/dtoc/test_src_scan.py +++ b/tools/dtoc/test_src_scan.py @@ -48,7 +48,7 @@ class TestSrcScan(unittest.TestCase):
def test_simple(self): """Simple test of scanning drivers""" - scan = src_scan.Scanner(None, True, None) + scan = src_scan.Scanner(None, None) scan.scan_drivers() self.assertIn('sandbox_gpio', scan._drivers) self.assertIn('sandbox_gpio_alias', scan._driver_aliases) @@ -59,8 +59,7 @@ class TestSrcScan(unittest.TestCase): def test_additional(self): """Test with additional drivers to scan""" scan = src_scan.Scanner( - None, True, - [None, '', 'tools/dtoc/test/dtoc_test_scan_drivers.cxx']) + None, [None, '', 'tools/dtoc/test/dtoc_test_scan_drivers.cxx']) scan.scan_drivers() self.assertIn('sandbox_gpio_alias2', scan._driver_aliases) self.assertEqual('sandbox_gpio', @@ -77,7 +76,7 @@ class TestSrcScan(unittest.TestCase): with open(driver_fn, 'wb+') as fout: fout.write(b'\x81')
- scan = src_scan.Scanner(None, True, [driver_fn]) + scan = src_scan.Scanner(None, [driver_fn]) with test_util.capture_sys_output() as (stdout, _): scan.scan_drivers() self.assertRegex(stdout.getvalue(), @@ -126,7 +125,7 @@ class TestSrcScan(unittest.TestCase): # Mock out scan_driver and check that it is called with the # expected files with mock.patch.object(src_scan.Scanner, "scan_driver") as mocked: - scan = src_scan.Scanner(indir, True, None) + scan = src_scan.Scanner(indir, None) scan.scan_drivers() self.assertEqual(2, len(mocked.mock_calls)) self.assertEqual(mock.call(fname_list[0]), @@ -141,7 +140,7 @@ class TestSrcScan(unittest.TestCase): """Test scanning of a driver""" fname = os.path.join(OUR_PATH, '..', '..', 'drivers/i2c/tegra_i2c.c') buff = tools.ReadFile(fname, False) - scan = src_scan.Scanner(None, False, None) + scan = src_scan.Scanner(None, None) scan._parse_driver(fname, buff) self.assertIn('i2c_tegra', scan._drivers) drv = scan._drivers['i2c_tegra'] @@ -165,14 +164,15 @@ class TestSrcScan(unittest.TestCase): # get_normalized_compat_name() uses this to check for root node node.parent = FakeNode()
- scan = src_scan.Scanner(None, False, None) + scan = src_scan.Scanner(None, None) with test_util.capture_sys_output() as (stdout, _): name, aliases = scan.get_normalized_compat_name(node) self.assertEqual('rockchip_rk3288_grf', name) self.assertEqual([], aliases) - self.assertEqual( - 'WARNING: the driver rockchip_rk3288_grf was not found in the driver list', - stdout.getvalue().strip()) + self.assertEqual(1, len(scan._missing_drivers)) + self.assertEqual({'rockchip_rk3288_grf'}, scan._missing_drivers) + #'WARNING: the driver rockchip_rk3288_grf was not found in the driver list', + #stdout.getvalue().strip())
i2c = 'I2C_UCLASS' compat = {'rockchip,rk3288-grf': 'ROCKCHIP_SYSCON_GRF', @@ -211,7 +211,7 @@ U_BOOT_DRIVER(i2c_tegra) = { .of_match = tegra_i2c_ids, }; ''' - scan = src_scan.Scanner(None, False, None) + scan = src_scan.Scanner(None, None) with self.assertRaises(ValueError) as exc: scan._parse_driver('file.c', buff) self.assertIn( @@ -232,7 +232,7 @@ U_BOOT_DRIVER(i2c_tegra) = { .of_match = of_match_ptr(tegra_i2c_ids), }; ''' - scan = src_scan.Scanner(None, False, None) + scan = src_scan.Scanner(None, None) scan._parse_driver('file.c', buff) self.assertIn('i2c_tegra', scan._drivers) drv = scan._drivers['i2c_tegra'] @@ -261,7 +261,7 @@ U_BOOT_DRIVER(testing) = { DM_HEADER(<asm/clk.h>) }; ''' - scan = src_scan.Scanner(None, False, None) + scan = src_scan.Scanner(None, None) scan._parse_driver('file.c', buff) self.assertIn('testing', scan._drivers) drv = scan._drivers['testing'] @@ -293,7 +293,7 @@ UCLASS_DRIVER(i2c) = { };
''' - scan = src_scan.Scanner(None, False, None) + scan = src_scan.Scanner(None, None) scan._parse_uclass_driver('file.c', buff) self.assertIn('UCLASS_I2C', scan._uclass) drv = scan._uclass['UCLASS_I2C'] @@ -325,7 +325,7 @@ UCLASS_DRIVER(i2c) = { };
''' - scan = src_scan.Scanner(None, False, None) + scan = src_scan.Scanner(None, None) with self.assertRaises(ValueError) as exc: scan._parse_uclass_driver('file.c', buff) self.assertIn("file.c: Cannot parse uclass ID in driver 'i2c'", @@ -340,7 +340,7 @@ struct some_struct1 { uint nmsgs; }; ''' - scan = src_scan.Scanner(None, False, None) + scan = src_scan.Scanner(None, None) scan._basedir = os.path.join(OUR_PATH, '..', '..') scan._parse_structs('arch/arm/include/asm/file.h', buff) self.assertIn('some_struct1', scan._structs) @@ -371,7 +371,7 @@ struct another_struct { output = tools.GetOutputFilename('output.h') tools.WriteFile(output, b'struct this is a test \x81 of bad unicode')
- scan = src_scan.Scanner(None, False, None) + scan = src_scan.Scanner(None, None) with test_util.capture_sys_output() as (stdout, _): scan.scan_header(output) self.assertIn('due to unicode error', stdout.getvalue()) @@ -411,7 +411,7 @@ U_BOOT_DRIVER(%s) = { .of_match = test_ids, }; ''' % name - scan = src_scan.Scanner(None, False, None, phase) + scan = src_scan.Scanner(None, None, phase) scan._parse_driver('file1.c', driver1) self.assertIn(name, scan._drivers) drv1 = scan._drivers[name] @@ -476,7 +476,7 @@ U_BOOT_DRIVER(%s) = {
def test_sequence(self): """Test assignment of sequence numnbers""" - scan = src_scan.Scanner(None, False, None, '') + scan = src_scan.Scanner(None, None, '') node = FakeNode() uc = src_scan.UclassDriver('UCLASS_I2C') node.uclass = uc

At present warnings are shown as soon as they are discovered in the source scannner. But the function that detects them may be called multiple times.
Collect all the warnings and show them at the end.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
tools/dtoc/dtb_platdata.py | 6 ++++-- tools/dtoc/src_scan.py | 15 +++++++++------ tools/dtoc/test_dtoc.py | 2 +- tools/dtoc/test_src_scan.py | 38 ++++++++++++++++++------------------- 4 files changed, 33 insertions(+), 28 deletions(-)
Applied to u-boot-dm, thanks!

At present an empty size is considered to be a 64-bit value. This does not seem useful and wastes space. Limit the 64-bit detection to where one or both of the addr/size is two cells or more.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v2: - Add new patch to adjust detection of 64-bit properties
tools/dtoc/dtb_platdata.py | 6 +++--- tools/dtoc/test_dtoc.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index 27e88e75173..1711ac57c25 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -467,6 +467,8 @@ class DtbPlatdata(): if reg.type != fdt.Type.INT: raise ValueError("Node '%s' reg property is not an int" % node.name) + if not isinstance(reg.value, list): + reg.value = [reg.value] if len(reg.value) % total: raise ValueError( "Node '%s' reg property has %d cells " @@ -474,13 +476,11 @@ class DtbPlatdata(): (node.name, len(reg.value), num_addr, num_size)) reg.num_addr = num_addr reg.num_size = num_size - if num_addr != 1 or num_size != 1: + if num_addr > 1 or num_size > 1: reg.type = fdt.Type.INT64 i = 0 new_value = [] val = reg.value - if not isinstance(val, list): - val = [val] while i < len(val): addr = fdt_util.fdt_cells_to_cpu(val[i:], reg.num_addr) i += num_addr diff --git a/tools/dtoc/test_dtoc.py b/tools/dtoc/test_dtoc.py index 62fcab74178..25a3bd943c4 100755 --- a/tools/dtoc/test_dtoc.py +++ b/tools/dtoc/test_dtoc.py @@ -293,7 +293,7 @@ struct dtd_sandbox_i2c { }; struct dtd_sandbox_pmic { \tbool\t\tlow_power; -\tfdt64_t\t\treg[2]; +\tfdt32_t\t\treg[1]; }; struct dtd_sandbox_spl_test { \tconst char * acpi_name; @@ -341,7 +341,7 @@ U_BOOT_DRVINFO(i2c_at_0) = { */ static struct dtd_sandbox_pmic dtv_pmic_at_9 = { \t.low_power\t\t= true, -\t.reg\t\t\t= {0x9, 0x0}, +\t.reg\t\t\t= {0x9}, }; U_BOOT_DRVINFO(pmic_at_9) = { \t.name\t\t= "sandbox_pmic", @@ -721,7 +721,7 @@ struct dm_test_pdata __attribute__ ((section (".priv_data"))) \t.dtplat = { \t\t.ping_add\t\t= 0x5, \t\t.ping_expect\t\t= 0x5, -\t\t.reg\t\t\t= {0x5, 0x0}, +\t\t.reg\t\t\t= {0x5}, \t}, }; #include <dm/test.h>

At present an empty size is considered to be a 64-bit value. This does not seem useful and wastes space. Limit the 64-bit detection to where one or both of the addr/size is two cells or more.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v2: - Add new patch to adjust detection of 64-bit properties
tools/dtoc/dtb_platdata.py | 6 +++--- tools/dtoc/test_dtoc.py | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-)
Applied to u-boot-dm, thanks!

This existing code assumes that a reg property is larger than one cell, but this is not always the case. Fix this assumption.
Also if a node's parent is missing the #address-cells and #size-cells properties we use 2 as a default for each. But this should not happen in practice. More likely the properties were removed for SPL due to there being no 'u-boot,dm-pre-reloc' property, or similar. Add a warning for this as the failure can be very confusing.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v2: - Drop the reg_val temporary var - Add two new tests
tools/dtoc/dtb_platdata.py | 8 +++++-- tools/dtoc/test/dtoc_test_noprops.dts | 21 +++++++++++++++++ tools/dtoc/test/dtoc_test_single_reg.dts | 30 ++++++++++++++++++++++++ tools/dtoc/test_dtoc.py | 17 +++++++++++++- 4 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 tools/dtoc/test/dtoc_test_noprops.dts create mode 100644 tools/dtoc/test/dtoc_test_single_reg.dts
diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index 1711ac57c25..d6139acd06c 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -440,6 +440,9 @@ class DtbPlatdata(): Number of size cells for this node """ parent = node.parent + if parent and not parent.props: + raise ValueError("Parent node '%s' has no properties - do you need u-boot,dm-spl or similar?" % + parent.path) num_addr, num_size = 2, 2 if parent: addr_prop = parent.props.get('#address-cells') @@ -471,9 +474,10 @@ class DtbPlatdata(): reg.value = [reg.value] if len(reg.value) % total: raise ValueError( - "Node '%s' reg property has %d cells " + "Node '%s' (parent '%s') reg property has %d cells " 'which is not a multiple of na + ns = %d + %d)' % - (node.name, len(reg.value), num_addr, num_size)) + (node.name, node.parent.name, len(reg.value), num_addr, + num_size)) reg.num_addr = num_addr reg.num_size = num_size if num_addr > 1 or num_size > 1: diff --git a/tools/dtoc/test/dtoc_test_noprops.dts b/tools/dtoc/test/dtoc_test_noprops.dts new file mode 100644 index 00000000000..e6fdd11b83d --- /dev/null +++ b/tools/dtoc/test/dtoc_test_noprops.dts @@ -0,0 +1,21 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Test device tree file for dtoc + * + * Copyright 2017 Google, Inc + */ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + i2c@0 { + pmic@9 { + compatible = "sandbox,pmic"; + u-boot,dm-pre-reloc; + reg = <9>; + low-power; + }; + }; +}; diff --git a/tools/dtoc/test/dtoc_test_single_reg.dts b/tools/dtoc/test/dtoc_test_single_reg.dts new file mode 100644 index 00000000000..804b67855be --- /dev/null +++ b/tools/dtoc/test/dtoc_test_single_reg.dts @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Test device tree file for dtoc + * + * Copyright 2017 Google, Inc + */ + +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + i2c@0 { + compatible = "sandbox,i2c"; + u-boot,dm-pre-reloc; + #address-cells = <1>; + #size-cells = <0>; + pmic@9 { + compatible = "sandbox,pmic"; + u-boot,dm-pre-reloc; + reg = <9>; + low-power; + + gpio { + compatible = "sandbox,gpio"; + }; + }; + }; +}; diff --git a/tools/dtoc/test_dtoc.py b/tools/dtoc/test_dtoc.py index 25a3bd943c4..32d892c15ba 100755 --- a/tools/dtoc/test_dtoc.py +++ b/tools/dtoc/test_dtoc.py @@ -1462,7 +1462,7 @@ U_BOOT_DRVINFO(test3) = { with self.assertRaises(ValueError) as exc: self.run_test(['struct'], dtb_file, output) self.assertIn( - "Node 'spl-test' reg property has 3 cells which is not a multiple of na + ns = 1 + 1)", + "Node 'spl-test' (parent '/') reg property has 3 cells which is not a multiple of na + ns = 1 + 1)", str(exc.exception))
def test_add_prop(self): @@ -1824,3 +1824,18 @@ U_BOOT_DRVINFO(spl_test2) = { self.assertEqual( 'Warning: Cannot find header file for struct dm_test_uc_priv', stdout.getvalue().strip()) + + def test_missing_props(self): + """Test detection of a parent node with no properties""" + dtb_file = get_dtb_file('dtoc_test_noprops.dts', capture_stderr=True) + output = tools.GetOutputFilename('output') + with self.assertRaises(ValueError) as exc: + self.run_test(['struct'], dtb_file, output) + self.assertIn("Parent node '/i2c@0' has no properties - do you need", + str(exc.exception)) + + def test_single_reg(self): + """Test detection of a parent node with no properties""" + dtb_file = get_dtb_file('dtoc_test_single_reg.dts') + output = tools.GetOutputFilename('output') + self.run_test(['struct'], dtb_file, output)

This existing code assumes that a reg property is larger than one cell, but this is not always the case. Fix this assumption.
Also if a node's parent is missing the #address-cells and #size-cells properties we use 2 as a default for each. But this should not happen in practice. More likely the properties were removed for SPL due to there being no 'u-boot,dm-pre-reloc' property, or similar. Add a warning for this as the failure can be very confusing.
Signed-off-by: Simon Glass sjg@chromium.org ---
Changes in v2: - Drop the reg_val temporary var - Add two new tests
tools/dtoc/dtb_platdata.py | 8 +++++-- tools/dtoc/test/dtoc_test_noprops.dts | 21 +++++++++++++++++ tools/dtoc/test/dtoc_test_single_reg.dts | 30 ++++++++++++++++++++++++ tools/dtoc/test_dtoc.py | 17 +++++++++++++- 4 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 tools/dtoc/test/dtoc_test_noprops.dts create mode 100644 tools/dtoc/test/dtoc_test_single_reg.dts
Applied to u-boot-dm, thanks!

At present debug() statements can cause debuf output to appear when LOG is enabled but DEBUG is not. This is not intended and it seems that the condition is wrong.
Fix it.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
include/log.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/include/log.h b/include/log.h index ed7ba6d705a..f5288c549b8 100644 --- a/include/log.h +++ b/include/log.h @@ -234,11 +234,14 @@ int _log_buffer(enum log_category_t cat, enum log_level_t level, #define _SPL_BUILD 0 #endif
-#if !_DEBUG && CONFIG_IS_ENABLED(LOG) +#if CONFIG_IS_ENABLED(LOG)
-#define debug_cond(cond, fmt, args...) \ -({ \ - log(LOG_CATEGORY, LOGL_DEBUG, fmt, ##args); \ +#define debug_cond(cond, fmt, args...) \ +({ \ + if (cond) \ + log(LOG_CATEGORY, \ + (enum log_level_t)(LOGL_FORCE_DEBUG | _LOG_DEBUG), \ + fmt, ##args); \ })
#else /* _DEBUG */

At present debug() statements can cause debuf output to appear when LOG is enabled but DEBUG is not. This is not intended and it seems that the condition is wrong.
Fix it.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
include/log.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
Applied to u-boot-dm, thanks!

Some files are not actually source code and thus can produce unicode errors. Report this and continue.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
tools/moveconfig.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/tools/moveconfig.py b/tools/moveconfig.py index 9514d9a00cb..1ac30c00281 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -12,6 +12,10 @@ config options from headers to Kconfig (defconfig).
This tool intends to help this tremendous work.
+Installing +---------- + +You may need to install 'python3-asteval' for the 'asteval' module.
Usage ----- @@ -573,7 +577,11 @@ def cleanup_empty_blocks(header_path, options): """ pattern = re.compile(r'^\s*#\s*if.*$\n^\s*#\s*endif.*$\n*', flags=re.M) with open(header_path) as f: - data = f.read() + try: + data = f.read() + except UnicodeDecodeError as e: + print("Failed on file %s': %s" % (header_path, e)) + return
new_data = pattern.sub('\n', data)
@@ -596,7 +604,11 @@ def cleanup_one_header(header_path, patterns, options): options: option flags. """ with open(header_path) as f: - lines = f.readlines() + try: + lines = f.readlines() + except UnicodeDecodeError as e: + print("Failed on file %s': %s" % (header_path, e)) + return
matched = [] for i, line in enumerate(lines):

Some files are not actually source code and thus can produce unicode errors. Report this and continue.
Signed-off-by: Simon Glass sjg@chromium.org ---
(no changes since v1)
tools/moveconfig.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
Applied to u-boot-dm, thanks!

This converts the following to Kconfig: CONFIG_MISC_INIT_F
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Stefan Roese sr@denx.de ---
(no changes since v1)
common/Kconfig | 6 ++++++ configs/MPC8349ITXGP_defconfig | 1 + configs/MPC8349ITX_LOWBOOT_defconfig | 1 + configs/MPC8349ITX_defconfig | 1 + configs/kmcoge4_defconfig | 1 + configs/sandbox64_defconfig | 2 +- configs/sandbox_defconfig | 1 + configs/sandbox_flattree_defconfig | 2 +- configs/sandbox_spl_defconfig | 2 ++ configs/tools-only_defconfig | 1 + include/configs/MPC8349ITX.h | 2 -- include/configs/kmp204x.h | 2 -- include/configs/sandbox.h | 2 -- scripts/config_whitelist.txt | 1 - 14 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/common/Kconfig b/common/Kconfig index 482f1235347..0e36dfd2368 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -527,6 +527,12 @@ config LAST_STAGE_INIT U-Boot calls last_stage_init() before the command-line interpreter is started.
+config MISC_INIT_F + bool "Execute pre-relocation misc init" + help + Enabling this option calls the 'misc_init_f' function in the init + sequence just before DRAM is inited. + config MISC_INIT_R bool "Execute Misc Init" default y if ARCH_KEYSTONE || ARCH_SUNXI || MPC85xx diff --git a/configs/MPC8349ITXGP_defconfig b/configs/MPC8349ITXGP_defconfig index 28e4ebf06f5..92f2093bb65 100644 --- a/configs/MPC8349ITXGP_defconfig +++ b/configs/MPC8349ITXGP_defconfig @@ -154,6 +154,7 @@ CONFIG_SYS_EXTRA_OPTIONS="SYS_TEXT_BASE=0xFE000000" CONFIG_BOOTDELAY=6 CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="root=/dev/nfs rw nfsroot=:/nfsroot/rootfs ip=::::mpc8349emitxgp:eth0:off console=ttyS0,115200" +CONFIG_MISC_INIT_F=y CONFIG_MISC_INIT_R=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="MPC8349E-mITX-GP> " diff --git a/configs/MPC8349ITX_LOWBOOT_defconfig b/configs/MPC8349ITX_LOWBOOT_defconfig index 46f7afc071f..cf1e90d6190 100644 --- a/configs/MPC8349ITX_LOWBOOT_defconfig +++ b/configs/MPC8349ITX_LOWBOOT_defconfig @@ -153,6 +153,7 @@ CONFIG_OF_STDOUT_VIA_ALIAS=y CONFIG_BOOTDELAY=6 CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="root=/dev/nfs rw nfsroot=:/nfsroot/rootfs ip=::::mpc8349emitx:eth0:off console=ttyS0,115200" +CONFIG_MISC_INIT_F=y CONFIG_MISC_INIT_R=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="MPC8349E-mITX> " diff --git a/configs/MPC8349ITX_defconfig b/configs/MPC8349ITX_defconfig index 1f70b756b0c..733e5d35996 100644 --- a/configs/MPC8349ITX_defconfig +++ b/configs/MPC8349ITX_defconfig @@ -152,6 +152,7 @@ CONFIG_OF_STDOUT_VIA_ALIAS=y CONFIG_BOOTDELAY=6 CONFIG_USE_BOOTARGS=y CONFIG_BOOTARGS="root=/dev/nfs rw nfsroot=:/nfsroot/rootfs ip=::::mpc8349emitx:eth0:off console=ttyS0,115200" +CONFIG_MISC_INIT_F=y CONFIG_MISC_INIT_R=y CONFIG_HUSH_PARSER=y CONFIG_SYS_PROMPT="MPC8349E-mITX> " diff --git a/configs/kmcoge4_defconfig b/configs/kmcoge4_defconfig index ddc8f8a7f98..462e5677964 100644 --- a/configs/kmcoge4_defconfig +++ b/configs/kmcoge4_defconfig @@ -20,6 +20,7 @@ CONFIG_AUTOBOOT_STOP_STR=" " CONFIG_BOARD_EARLY_INIT_F=y CONFIG_BOARD_EARLY_INIT_R=y CONFIG_LAST_STAGE_INIT=y +CONFIG_MISC_INIT_F=y CONFIG_HUSH_PARSER=y CONFIG_CMD_ASKENV=y CONFIG_CMD_GREPENV=y diff --git a/configs/sandbox64_defconfig b/configs/sandbox64_defconfig index cfda83474b6..4648808d516 100644 --- a/configs/sandbox64_defconfig +++ b/configs/sandbox64_defconfig @@ -20,8 +20,8 @@ CONFIG_BOOTSTAGE_STASH_SIZE=0x4096 CONFIG_CONSOLE_RECORD=y CONFIG_CONSOLE_RECORD_OUT_SIZE=0x1000 CONFIG_PRE_CONSOLE_BUFFER=y -CONFIG_LOG_SYSLOG=y CONFIG_DISPLAY_BOARDINFO_LATE=y +CONFIG_MISC_INIT_F=y CONFIG_CMD_CPU=y CONFIG_CMD_LICENSE=y CONFIG_CMD_BOOTZ=y diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig index 713708e01c2..c9515a44783 100644 --- a/configs/sandbox_defconfig +++ b/configs/sandbox_defconfig @@ -25,6 +25,7 @@ CONFIG_LOG=y CONFIG_LOG_SYSLOG=y CONFIG_LOG_ERROR_RETURN=y CONFIG_DISPLAY_BOARDINFO_LATE=y +CONFIG_MISC_INIT_F=y CONFIG_ANDROID_AB=y CONFIG_CMD_CPU=y CONFIG_CMD_LICENSE=y diff --git a/configs/sandbox_flattree_defconfig b/configs/sandbox_flattree_defconfig index 4401f33f0ba..b68f938cb37 100644 --- a/configs/sandbox_flattree_defconfig +++ b/configs/sandbox_flattree_defconfig @@ -17,8 +17,8 @@ CONFIG_BOOTSTAGE_STASH=y CONFIG_BOOTSTAGE_STASH_SIZE=0x4096 CONFIG_CONSOLE_RECORD=y CONFIG_CONSOLE_RECORD_OUT_SIZE=0x1000 -CONFIG_LOG_SYSLOG=y CONFIG_DISPLAY_BOARDINFO_LATE=y +CONFIG_MISC_INIT_F=y CONFIG_CMD_CPU=y CONFIG_CMD_LICENSE=y CONFIG_CMD_BOOTZ=y diff --git a/configs/sandbox_spl_defconfig b/configs/sandbox_spl_defconfig index ac71cab5f1e..0e40b17c624 100644 --- a/configs/sandbox_spl_defconfig +++ b/configs/sandbox_spl_defconfig @@ -11,6 +11,7 @@ CONFIG_SPL_SYS_MALLOC_F_LEN=0x8000 CONFIG_SPL=y CONFIG_BOOTSTAGE_STASH_ADDR=0x0 CONFIG_DEFAULT_DEVICE_TREE="sandbox" +CONFIG_TARGET_SANDBOX_SPL=y CONFIG_SANDBOX_SPL=y CONFIG_DEBUG_UART=y CONFIG_DISTRO_DEFAULTS=y @@ -27,6 +28,7 @@ CONFIG_BOOTSTAGE_STASH_SIZE=0x4096 CONFIG_CONSOLE_RECORD=y CONFIG_CONSOLE_RECORD_OUT_SIZE=0x1000 CONFIG_DISPLAY_BOARDINFO_LATE=y +CONFIG_MISC_INIT_F=y CONFIG_HANDOFF=y CONFIG_SPL_BOARD_INIT=y CONFIG_SPL_ENV_SUPPORT=y diff --git a/configs/tools-only_defconfig b/configs/tools-only_defconfig index a853abf2b8f..e16f702f00a 100644 --- a/configs/tools-only_defconfig +++ b/configs/tools-only_defconfig @@ -4,6 +4,7 @@ CONFIG_DEFAULT_DEVICE_TREE="sandbox" CONFIG_ANDROID_BOOT_IMAGE=y CONFIG_FIT=y CONFIG_FIT_SIGNATURE=y +CONFIG_MISC_INIT_F=y # CONFIG_CMD_BOOTD is not set # CONFIG_CMD_BOOTM is not set # CONFIG_CMD_ELF is not set diff --git a/include/configs/MPC8349ITX.h b/include/configs/MPC8349ITX.h index f50cdd717cb..586c1e9ae84 100644 --- a/include/configs/MPC8349ITX.h +++ b/include/configs/MPC8349ITX.h @@ -39,8 +39,6 @@ #ifndef __CONFIG_H #define __CONFIG_H
-#define CONFIG_MISC_INIT_F - /* * On-board devices */ diff --git a/include/configs/kmp204x.h b/include/configs/kmp204x.h index 90e3702bd80..af3b03be490 100644 --- a/include/configs/kmp204x.h +++ b/include/configs/kmp204x.h @@ -177,8 +177,6 @@ unsigned long get_board_sys_clk(unsigned long dummy); #define CONFIG_SYS_BR1_PRELIM CONFIG_SYS_QRIO_BR_PRELIM /* QRIO Base Address */ #define CONFIG_SYS_OR1_PRELIM CONFIG_SYS_QRIO_OR_PRELIM /* QRIO Options */
-#define CONFIG_MISC_INIT_F - #define CONFIG_HWCONFIG
/* define to use L1 as initial stack */ diff --git a/include/configs/sandbox.h b/include/configs/sandbox.h index e0708fe5739..bbb7d12ad14 100644 --- a/include/configs/sandbox.h +++ b/include/configs/sandbox.h @@ -130,6 +130,4 @@
#define CONFIG_SYS_SATA_MAX_DEVICE 2
-#define CONFIG_MISC_INIT_F - #endif diff --git a/scripts/config_whitelist.txt b/scripts/config_whitelist.txt index 85857a746ca..b693925d20a 100644 --- a/scripts/config_whitelist.txt +++ b/scripts/config_whitelist.txt @@ -1030,7 +1030,6 @@ CONFIG_MIPS_HUGE_TLB_SUPPORT CONFIG_MIPS_MT_FPAFF CONFIG_MIRQ_EN CONFIG_MISC_COMMON -CONFIG_MISC_INIT_F CONFIG_MIU_1BIT_INTERLEAVED CONFIG_MIU_2BIT_21_7_INTERLEAVED CONFIG_MIU_2BIT_INTERLEAVED

This converts the following to Kconfig: CONFIG_MISC_INIT_F
Signed-off-by: Simon Glass sjg@chromium.org Reviewed-by: Stefan Roese sr@denx.de ---
(no changes since v1)
common/Kconfig | 6 ++++++ configs/MPC8349ITXGP_defconfig | 1 + configs/MPC8349ITX_LOWBOOT_defconfig | 1 + configs/MPC8349ITX_defconfig | 1 + configs/kmcoge4_defconfig | 1 + configs/sandbox64_defconfig | 2 +- configs/sandbox_defconfig | 1 + configs/sandbox_flattree_defconfig | 2 +- configs/sandbox_spl_defconfig | 2 ++ configs/tools-only_defconfig | 1 + include/configs/MPC8349ITX.h | 2 -- include/configs/kmp204x.h | 2 -- include/configs/sandbox.h | 2 -- scripts/config_whitelist.txt | 1 - 14 files changed, 16 insertions(+), 9 deletions(-)
Applied to u-boot-dm, thanks!
participants (1)
-
Simon Glass