mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-11-29 06:31:28 +01:00
dtoc: Move the main logic into the dtb_platdata file
Collect the main logic of dtoc into a function and put it into dtb_platdata. This will allow tests to use this function instead of duplicating the code themselves. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
56e0bbe057
commit
fa0ea5b09e
@ -422,3 +422,32 @@ class DtbPlatdata(object):
|
|||||||
nodes_to_output.remove(req_node)
|
nodes_to_output.remove(req_node)
|
||||||
self.output_node(node)
|
self.output_node(node)
|
||||||
nodes_to_output.remove(node)
|
nodes_to_output.remove(node)
|
||||||
|
|
||||||
|
|
||||||
|
def run_steps(args, dtb_file, include_disabled, output):
|
||||||
|
"""Run all the steps of the dtoc tool
|
||||||
|
|
||||||
|
Args:
|
||||||
|
args: List of non-option arguments provided to the problem
|
||||||
|
dtb_file: Filename of dtb file to process
|
||||||
|
include_disabled: True to include disabled nodes
|
||||||
|
output: Name of output file
|
||||||
|
"""
|
||||||
|
if not args:
|
||||||
|
raise ValueError('Please specify a command: struct, platdata')
|
||||||
|
|
||||||
|
plat = DtbPlatdata(dtb_file, include_disabled)
|
||||||
|
plat.scan_dtb()
|
||||||
|
plat.scan_tree()
|
||||||
|
plat.setup_output(output)
|
||||||
|
structs = plat.scan_structs()
|
||||||
|
plat.scan_phandles()
|
||||||
|
|
||||||
|
for cmd in args[0].split(','):
|
||||||
|
if cmd == 'struct':
|
||||||
|
plat.generate_structs(structs)
|
||||||
|
elif cmd == 'platdata':
|
||||||
|
plat.generate_tables()
|
||||||
|
else:
|
||||||
|
raise ValueError("Unknown command '%s': (use: struct, platdata)" %
|
||||||
|
cmd)
|
||||||
|
|||||||
@ -49,20 +49,5 @@ parser.add_option('-o', '--output', action='store', default='-',
|
|||||||
help='Select output filename')
|
help='Select output filename')
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
if not args:
|
dtb_platdata.run_steps(args, options.dtb_file, options.include_disabled,
|
||||||
raise ValueError('Please specify a command: struct, platdata')
|
options.output)
|
||||||
|
|
||||||
plat = dtb_platdata.DtbPlatdata(options.dtb_file, options.include_disabled)
|
|
||||||
plat.scan_dtb()
|
|
||||||
plat.scan_tree()
|
|
||||||
plat.setup_output(options.output)
|
|
||||||
structs = plat.scan_structs()
|
|
||||||
plat.scan_phandles()
|
|
||||||
|
|
||||||
for cmd in args[0].split(','):
|
|
||||||
if cmd == 'struct':
|
|
||||||
plat.generate_structs(structs)
|
|
||||||
elif cmd == 'platdata':
|
|
||||||
plat.generate_tables()
|
|
||||||
else:
|
|
||||||
raise ValueError("Unknown command '%s': (use: struct, platdata)" % cmd)
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user