@@ -37,6 +37,7 @@ def __init__(self, machine):
3737 self .callback = None
3838 self .extra_args = []
3939 self .qemu_path = None
40+ self .qemu_cmd = None
4041 self .login = False
4142 self .prompt = None
4243 self .user = 'root'
@@ -77,6 +78,7 @@ def configure_from_args(self, orig_args):
7778 parser .add_argument ('--kernel-path' , type = str , help = 'Path to kernel (vmlinux)' )
7879 parser .add_argument ('--modules-path' , type = str , help = 'Path to modules tarball' )
7980 parser .add_argument ('--cap' , dest = 'machine_caps' , type = str , default = [], action = 'append' , help = 'Machine caps' )
81+ parser .add_argument ('--qemu-path' , dest = 'qemu_path' , type = str , help = 'Path to qemu bin directory' )
8082 args = parser .parse_args (orig_args )
8183
8284 if args .gdb :
@@ -125,6 +127,9 @@ def configure_from_args(self, orig_args):
125127 if args .modules_path :
126128 self .modules_tarball = args .modules_path
127129
130+ if args .qemu_path :
131+ self .qemu_path = args .qemu_path
132+
128133 self .compat_rootfs = args .compat_rootfs
129134 self .use_vof = args .use_vof
130135 self .quiet = args .quiet
@@ -171,13 +176,14 @@ def apply_defaults(self):
171176 if self .cpu :
172177 self .cpuinfo .insert (0 , f'cpu\\ s+: { self .cpu } ' )
173178
174- if self .qemu_path is None :
179+ if self .qemu_cmd is None :
175180 if self .machine_is ('pseries' ) or self .machine_is ('powernv' ):
176- self .qemu_path = 'qemu-system-ppc64'
181+ self .qemu_cmd = 'qemu-system-ppc64'
177182 else :
178- self .qemu_path = 'qemu-system-ppc'
183+ self .qemu_cmd = 'qemu-system-ppc'
179184
180- self .qemu_path = get_qemu (self .qemu_path )
185+ if self .qemu_path :
186+ self .qemu_cmd = f'{ self .qemu_path } /{ self .qemu_cmd } '
181187
182188 if self .smp is None :
183189 if self .machine_is ('mac99' ): # Doesn't support SMP
@@ -240,7 +246,7 @@ def apply_defaults(self):
240246 self .prompt = "/ #"
241247
242248 if self .initrd is None and len (self .drives ) == 0 and self .cloud_image is None :
243- if self .compat_rootfs or self .qemu_path .endswith ('qemu-system-ppc' ):
249+ if self .compat_rootfs or self .qemu_cmd .endswith ('qemu-system-ppc' ):
244250 subarch = 'ppc'
245251 elif get_endian (self .vmlinux ) == 'little' :
246252 subarch = 'ppc64le'
@@ -338,14 +344,14 @@ def __set_spectre_v2_caps(self):
338344 self .machine_caps += ['cap-ccf-assist=off' ]
339345
340346 def cmd (self ):
341- logging .info ('Using qemu version %s.%s "%s"' % get_qemu_version (self .qemu_path ))
347+ logging .info ('Using qemu version %s.%s "%s"' % get_qemu_version (self .qemu_cmd ))
342348
343349 machine = self .machine
344350 if len (self .machine_caps ):
345351 machine = ',' .join ([machine ] + self .machine_caps )
346352
347353 l = [
348- self .qemu_path ,
354+ self .qemu_cmd ,
349355 '-nographic' ,
350356 '-vga' , 'none' ,
351357 '-M' , machine ,
@@ -387,17 +393,6 @@ def qemu_monitor_shutdown(p):
387393 p .send ('quit' )
388394
389395
390- def get_qemu (name = 'qemu-system-ppc64' ):
391- # This looks for QEMU_SYSTEM_PPC64 or QEMU_SYSTEM_PPC in the environment
392- qemu = get_env_var (name .upper ().replace ('-' , '_' ))
393- if qemu is None :
394- # Defer to $PATH search
395- qemu = name
396-
397- logging .debug (f'Using qemu { qemu } for { name } ' )
398- return qemu
399-
400-
401396def get_root_disk_path ():
402397 path = get_env_var ('ROOT_DISK_PATH' , None )
403398 if path is not None :
0 commit comments