This commit also converts our own copyright headers to directly use SPDX, but leaves all other copyright header intact, only adding the SPDX ident. As far as possible this commit also merges multiple Data61 copyright statements/headers into one for consistency.
30 lines
944 B
Python
30 lines
944 B
Python
#
|
|
# Copyright 2020, Data61, CSIRO (ABN 41 687 119 230)
|
|
#
|
|
# SPDX-License-Identifier: GPL-2.0-only
|
|
#
|
|
|
|
''' generate a text file with matched compatible strings from the device tree '''
|
|
import argparse
|
|
|
|
from hardware import config, fdt
|
|
from hardware.utils import rule
|
|
|
|
|
|
def run(tree: fdt.FdtParser, hardware: rule.HardwareYaml, config: config.Config,
|
|
args: argparse.Namespace):
|
|
if not args.compat_strings_out:
|
|
raise ValueError('You need to specify a compat-strings-out to use compat strings output')
|
|
chosen = tree.get_kernel_devices()
|
|
|
|
compatibles = set()
|
|
for dev in chosen:
|
|
compatibles.add(hardware.get_matched_compatible(dev))
|
|
|
|
args.compat_strings_out.write(';'.join(sorted(compatibles)) + ';\n')
|
|
args.compat_strings_out.close()
|
|
|
|
|
|
def add_args(parser):
|
|
parser.add_argument('--compat-strings-out',
|
|
help='output file for compat strings list', type=argparse.FileType('w'))
|