| 783 | raise RuntimeError(msg) |
| 784 | |
| 785 | |
| 786 | def parse_arguments(): |
| 787 | parser = ArgumentParser(description='Boot a Linux kernel in QEMU') |
| 788 | |
| 789 | parser.add_argument( |
| 790 | '-a', |
| 791 | '--architecture', |
| 792 | choices=SUPPORTED_ARCHES, |
| 793 | help="The architecture to boot. If omitted, value will be guessed based on 'vmlinux' if available. Possible values are: %(choices)s", |
| 794 | metavar='ARCH', |
| 795 | ) |
| 796 | parser.add_argument('--efi', action='store_true', help='Boot kernel via UEFI (x86_64 only)') |
| 797 | parser.add_argument( |
| 798 | '-g', |
| 799 | '--gdb', |
| 800 | action='store_true', |
| 801 | help="Start QEMU with '-s -S' then launch gdb on 'vmlinux'", |
| 802 | ) |
| 803 | parser.add_argument( |
| 804 | '--gdb-bin', |
| 805 | default='gdb-multiarch', |
| 806 | help='gdb binary to use for debugging (default: gdb-multiarch)', |
| 807 | ) |
| 808 | parser.add_argument( |
| 809 | '--gh-json-file', |
| 810 | help='Use file for downloading rootfs images, instead of querying GitHub API directly', |
| 811 | ) |
| 812 | parser.add_argument( |
| 813 | '-I', |
| 814 | '--initrd', |
| 815 | help='Initial ramdisk to use (default: Download ramdisk from ClangBuiltLinux/boot-utils releases)', |
| 816 | ) |
| 817 | parser.add_argument( |
| 818 | '-k', |
| 819 | '--kernel-location', |
| 820 | required=True, |
| 821 | help='Absolute or relative path to kernel image or build folder.', |
| 822 | ) |
| 823 | parser.add_argument('--append', help='Append items to kernel cmdline', nargs='+') |
| 824 | parser.add_argument( |
| 825 | '--no-kvm', |
| 826 | action='store_true', |
| 827 | help='Do not use KVM for accelration even when supported.', |
| 828 | ) |
| 829 | parser.add_argument( |
| 830 | '-i', |
| 831 | '--interactive', |
| 832 | '--shell', |
| 833 | action='store_true', |
| 834 | help='Instead of immediately shutting down machine, spawn a shell.', |
| 835 | ) |
| 836 | parser.add_argument( |
| 837 | '-m', |
| 838 | '--memory', |
| 839 | help="Value for '-m' QEMU option (default: generally '512m', depends on machine)", |
| 840 | ) |
| 841 | parser.add_argument( |
| 842 | '-M', |