···178 else if final.isLoongArch64 then "loongarch"
179 else final.parsed.cpu.name;
180000000181 qemuArch =
182 if final.isAarch32 then "arm"
183 else if final.isS390 && !final.isS390x then null
···178 else if final.isLoongArch64 then "loongarch"
179 else final.parsed.cpu.name;
180181+ # https://source.denx.de/u-boot/u-boot/-/blob/9bfb567e5f1bfe7de8eb41f8c6d00f49d2b9a426/common/image.c#L81-106
182+ ubootArch =
183+ if final.isx86_32 then "x86" # not i386
184+ else if final.isMips64 then "mips64" # uboot *does* distinguish between mips32/mips64
185+ else final.linuxArch; # other cases appear to agree with linuxArch
186+187 qemuArch =
188 if final.isAarch32 then "arm"
189 else if final.isS390 && !final.isS390x then null
···1import ast
2import sys
034"""
5This program takes all the Machine class methods and prints its methods in
···4041"""
4243-assert len(sys.argv) == 2
000000004445-with open(sys.argv[1], "r") as f:
46- module = ast.parse(f.read())
4748-class_definitions = (node for node in module.body if isinstance(node, ast.ClassDef))
0004950-machine_class = next(filter(lambda x: x.name == "Machine", class_definitions))
51-assert machine_class is not None
0005253-function_definitions = [
54- node for node in machine_class.body if isinstance(node, ast.FunctionDef)
55-]
56-function_definitions.sort(key=lambda x: x.name)
5758-for f in function_definitions:
59- docstr = ast.get_docstring(f)
60- if docstr is not None:
61- args = ", ".join((a.arg for a in f.args.args[1:]))
62- args = f"({args})"
6364- docstr = "\n".join((f" {l}" for l in docstr.strip().splitlines()))
6566- print(f"{f.name}{args}\n\n:{docstr[1:]}\n")
0
···1import ast
2import sys
3+from pathlib import Path
45"""
6This program takes all the Machine class methods and prints its methods in
···4142"""
4344+45+def main() -> None:
46+ if len(sys.argv) != 2:
47+ print(f"Usage: {sys.argv[0]} <path-to-test-driver>")
48+ sys.exit(1)
49+50+ module = ast.parse(Path(sys.argv[1]).read_text())
51+52+ class_definitions = (node for node in module.body if isinstance(node, ast.ClassDef))
5354+ machine_class = next(filter(lambda x: x.name == "Machine", class_definitions))
55+ assert machine_class is not None
5657+ function_definitions = [
58+ node for node in machine_class.body if isinstance(node, ast.FunctionDef)
59+ ]
60+ function_definitions.sort(key=lambda x: x.name)
6162+ for function in function_definitions:
63+ docstr = ast.get_docstring(function)
64+ if docstr is not None:
65+ args = ", ".join(a.arg for a in function.args.args[1:])
66+ args = f"({args})"
6768+ docstr = "\n".join(f" {line}" for line in docstr.strip().splitlines())
0006970+ print(f"{function.name}{args}\n\n:{docstr[1:]}\n")
00007107273+if __name__ == "__main__":
74+ main()
···54# guess may not align with u-boot's nomenclature correctly, so it can
55# be overridden.
56# See https://gitlab.denx.de/u-boot/u-boot/-/blob/9bfb567e5f1bfe7de8eb41f8c6d00f49d2b9a426/common/image.c#L81-106 for a list.
57-, uInitrdArch ? stdenvNoCC.hostPlatform.linuxArch
5859# The name of the compression, as recognised by u-boot.
60# See https://gitlab.denx.de/u-boot/u-boot/-/blob/9bfb567e5f1bfe7de8eb41f8c6d00f49d2b9a426/common/image.c#L195-204 for a list.
···54# guess may not align with u-boot's nomenclature correctly, so it can
55# be overridden.
56# See https://gitlab.denx.de/u-boot/u-boot/-/blob/9bfb567e5f1bfe7de8eb41f8c6d00f49d2b9a426/common/image.c#L81-106 for a list.
57+, uInitrdArch ? stdenvNoCC.hostPlatform.ubootArch
5859# The name of the compression, as recognised by u-boot.
60# See https://gitlab.denx.de/u-boot/u-boot/-/blob/9bfb567e5f1bfe7de8eb41f8c6d00f49d2b9a426/common/image.c#L195-204 for a list.