def METHOD_NAME(tree: fdt.FdtParser, hardware: rule.HardwareYaml, config: config.Config, args: argparse.Namespace):
    devices = tree.get_elfloader_devices()
    cpu_info = get_elfloader_cpus(tree, devices)
    max_reg = 1
    device_info = []
    for dev in devices:
        obj = {
            'compat': hardware.get_matched_compatible(dev),
            'path': dev.path,
            'regions': dev.get_regions()
        }
        max_reg = max(len(obj['regions']), max_reg)
        device_info.append(obj)
    device_info.sort(key=lambda a: a['compat'])
    template = Environment(loader=BaseLoader, trim_blocks=True,
                           lstrip_blocks=True).from_string(HEADER_TEMPLATE)
    template_args = dict(builtins.__dict__, **{
        'cpus': cpu_info,
        'devices': device_info,
        'max_reg': max_reg,
        'uses_psci': any([c['enable_method'] == 'psci' for c in cpu_info])
    })
    data = template.render(template_args)
    args.elfloader_out.write(data)
    args.elfloader_out.close()