Files
seL4/tools/hardware/outputs/compat_strings.py
Ivan-Velickovic 1cbaeb97f0 platform_gen: only generate regions that are used
Right now the `platform_gen.json` and `platform_gen.yaml` files contain
regions that are not actually used by the kernel. This is fine for
`platform_gen.h` because they are guarded by #ifdefs with kernel config
defines but the same approach does not work for YAML and JSON.

So, this patch changes the Python scripts that generate this files so
that they only generate the regions that actually end up being used.

Signed-off-by: Ivan-Velickovic <i.velickovic@unsw.edu.au>
2025-02-10 12:48:13 +11:00

32 lines
1.0 KiB
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.config import Config
from hardware.fdt import FdtParser
from hardware.utils.rule import HardwareYaml
from typing import Dict
def run(tree: FdtParser, hw_yaml: HardwareYaml, config: Config,
kernel_config_dict: Dict[str, str], 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(hw_yaml.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'))