MCPcopy Create free account
hub / github.com/ClangBuiltLinux/boot-utils / main

Function main

boot-qemu.py:861–945  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

859 return parser.parse_args()
860
861
862def main():
863 args = parse_arguments()
864
865 if not (kernel_location := Path(args.kernel_location).resolve()).exists():
866 msg = f"Supplied kernel location ('{kernel_location}') does not exist!"
867 raise FileNotFoundError(msg)
868
869 if not (arch := args.architecture):
870 arch = guess_arch(kernel_location)
871
872 arch_to_runner = {
873 'arm': ARMV7QEMURunner,
874 'arm32_v5': ARMV5QEMURunner,
875 'arm32_v6': ARMV6QEMURunner,
876 'arm32_v7': ARMV7QEMURunner,
877 'arm64': ARM64QEMURunner,
878 'arm64be': ARM64BEQEMURunner,
879 'loongarch': LoongArchQEMURunner,
880 'm68k': M68KQEMURunner,
881 'mips': MIPSQEMURunner,
882 'mipsel': MIPSELQEMURunner,
883 'ppc32': PowerPC32QEMURunner,
884 'ppc32_mac': PowerPC32MacQEMURunner,
885 'ppc64': PowerPC64QEMURunner,
886 'ppc64le': PowerPC64LEQEMURunner,
887 'riscv': RISCVQEMURunner,
888 's390': S390QEMURunner,
889 'sparc64': Sparc64QEMURunner,
890 'x86': X86QEMURunner,
891 'x86_64': X8664QEMURunner,
892 }
893 runner: QEMURunner = arch_to_runner[arch]()
894
895 if kernel_location.is_file():
896 if args.gdb and kernel_location.name != 'vmlinux':
897 msg = 'Debugging with gdb requires a kernel build folder to locate vmlinux'
898 raise RuntimeError(
899 msg,
900 )
901 runner.kernel = kernel_location
902 else:
903 runner.kernel_dir = kernel_location
904
905 if args.append:
906 runner.cmdline += args.append
907
908 if args.efi:
909 runner.efi = runner.supports_efi
910 if not runner.efi:
911 utils.yellow(f"EFI boot requested on unsupported architecture ('{arch}'), ignoring...")
912
913 if args.gdb:
914 runner.gdb = True
915 runner.gdb_bin = args.gdb_bin
916
917 if args.gh_json_file:
918 runner.gh_json_file = Path(args.gh_json_file).resolve()

Callers 1

boot-qemu.pyFile · 0.70

Calls 3

guess_archFunction · 0.85
parse_argumentsFunction · 0.70
runMethod · 0.45

Tested by

no test coverage detected