summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@amd.com>2024-07-12 19:40:20 -0600
committerMark Hatle <mark.hatle@amd.com>2024-11-21 10:43:44 -0600
commit243255523394f47a7ab4b1d3e5f90af6608614fb (patch)
tree2f6cea1d61d52c4c200b2ed5ba75b1cabf38cf01
parent19aa29fa4596db12b0b15743a7a6356bd00dda2d (diff)
downloadmeta-xilinx-243255523394f47a7ab4b1d3e5f90af6608614fb.tar.gz
meta-xilinx-core: qemu-xilinx-multiarch-helper-native fix default help
Code change is based on the discussion with Corey Thompson on the meta-xilinx@lists.yoctoproject.org mailing list. It was pointed out that the default help behavior did not match what runqemu was expecting from the actual qemu execution. We need to properly handle the user asking from help information or improperly invoking the binary with correct return codes. The new behavior will ensure that incorrect arguments results in a non-zero return code with an error message or basic help text. If the user passes -h, -help or --help (matching qemu's behavior) will report the basic help text, and then invoke the APU, PMU or PLM qemu as appropriate to augment and provide the full set of arguments. Signed-off-by: Mark Hatle <mark.hatle@amd.com>
-rw-r--r--meta-xilinx-core/recipes-devtools/qemu/files/qemu-system-aarch64-multiarch39
1 files changed, 35 insertions, 4 deletions
diff --git a/meta-xilinx-core/recipes-devtools/qemu/files/qemu-system-aarch64-multiarch b/meta-xilinx-core/recipes-devtools/qemu/files/qemu-system-aarch64-multiarch
index f310edfa..77b13aa2 100644
--- a/meta-xilinx-core/recipes-devtools/qemu/files/qemu-system-aarch64-multiarch
+++ b/meta-xilinx-core/recipes-devtools/qemu/files/qemu-system-aarch64-multiarch
@@ -35,14 +35,45 @@ if '-bootbin' in APU_args:
35if PMU_args and PLM_args: 35if PMU_args and PLM_args:
36 sys.exit("\nError: -pmu-args can not be used with -plm-args\n") 36 sys.exit("\nError: -pmu-args can not be used with -plm-args\n")
37 37
38if ('--help' in APU_args) or (not PMU_args and not PLM_args): 38help_options = ['-h', '-help', '--help']
39 print("AMD FPGA QEMU multiarch wrapper\nVersion 2024.1\n\nUsage:") 39def help(status):
40 print("AMD FPGA QEMU multiarch wrapper\nVersion 2024.2\n\nUsage:")
40 print(f" {sys.argv[0]} <APU options> [-pmu-args <pmu options>]") 41 print(f" {sys.argv[0]} <APU options> [-pmu-args <pmu options>]")
41 print(f" {sys.argv[0]} <APU options> [-plm-args <plm options>]\n") 42 print(f" {sys.argv[0]} <APU options> [-plm-args <plm options>]\n")
42 sys.exit(1) 43 if status == 0:
44 print(f"\n")
45 if set(PMU_args).intersection(set(help_options)):
46 print(f"PMU Options:\n")
47 pmu_args_s = ' '.join(PMU_args)
48 help_cmd = f'{binpath}/qemu-system-microblazeel {pmu_args_s}'
49 elif set(PLM_args).intersection(set(help_options)):
50 print(f"PLM Options:\n")
51 plm_args_s = ' '.join(PLM_args)
52 help_cmd = f'{binpath}/qemu-system-microblazeel {plm_args_s}'
53 else:
54 if not set(APU_args).intersection(set(help_options)):
55 APU_args.append('-help')
56 print(f"APU Options:\n")
57 print(f" -bootbin <boot.bin> - Use a boot.bin instead of individual firmware, device trees and bootloader\n")
58 apu_args_s = ' '.join(APU_args)
59 help_cmd = f'{binpath}/qemu-system-aarch64 {apu_args_s}'
60
61 print(f"{help_cmd}\n")
62 process = subprocess.Popen(help_cmd, shell=True, stderr=subprocess.PIPE)
63 status = process.wait()
64 sys.exit(status)
65
66if set(APU_args).intersection(set(help_options)) or set(PMU_args).intersection(set(help_options)) or set(PLM_args).intersection(set(help_options)):
67 help(0)
68
69if not PMU_args and not PLM_args:
70 help(1)
43 71
44if PMU_args: 72if PMU_args:
45 PMU_rom = PMU_args[PMU_args.index('-kernel')+1] 73 try:
74 PMU_rom = PMU_args[PMU_args.index('-kernel')+1]
75 except:
76 PMU_rom = ""
46 77
47 if not os.path.exists(PMU_rom): 78 if not os.path.exists(PMU_rom):
48 sys.exit(f'\nERROR: Missing PMU ROM: {PMU_rom}' 79 sys.exit(f'\nERROR: Missing PMU ROM: {PMU_rom}'