Skip to content

Commit c34da3c

Browse files
committed
qemu: Convert QEMU_SYSTEM_PPC(64) to --qemu-path
1 parent d612edb commit c34da3c

12 files changed

Lines changed: 19 additions & 34 deletions

File tree

lib/qemu.py

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -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-
401396
def get_root_disk_path():
402397
path = get_env_var('ROOT_DISK_PATH', None)
403398
if path is not None:

scripts/boot/qemu-44x

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
# $ ~/src/ci-scripts/scripts/boot/qemu-44x
66
#
77
# Optional:
8-
# export QEMU_SYSTEM_PPC=~/src/qemu/ppc-softmmu/qemu-system-ppc
98
# export ROOT_DISK_PATH=~/some/directory
109
# Expects ppc-rootfs.cpio.gz in ROOT_DISK_PATH
1110

scripts/boot/qemu-e500mc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
# $ ~/src/ci-scripts/scripts/boot/qemu-e500mc
1111
#
1212
# Optional:
13-
# export QEMU_SYSTEM_PPC=~/src/qemu/ppc-softmmu/qemu-system-ppc
1413
# export ROOT_DISK_PATH=~/some/directory
1514
#
1615
# Expects ROOT_DISK_PATH to contain:
@@ -30,7 +29,7 @@ def main():
3029
qconf = QemuConfig('ppce500')
3130
qconf.configure_from_env()
3231
qconf.configure_from_args(sys.argv[1:])
33-
qconf.qemu_path = 'qemu-system-ppc'
32+
qconf.qemu_cmd = 'qemu-system-ppc'
3433
qconf.mem = '2G'
3534
qconf.smp = 1
3635
qconf.cpu = 'e500mc'

scripts/boot/qemu-g3beige

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# $ ~/src/ci-scripts/scripts/boot/qemu-g3beige
1414
#
1515
# Optional:
16-
# export QEMU_SYSTEM_PPC=~/src/qemu/ppc-softmmu/qemu-system-ppc
1716
# export ROOT_DISK_PATH=~/some/directory
1817
# Expects ppc-rootfs.cpio.gz in ROOT_DISK_PATH
1918

scripts/boot/qemu-g5

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
# $ ~/src/ci-scripts/scripts/boot/qemu-g5
1212
#
1313
# Optional:
14-
# export QEMU_SYSTEM_PPC64=~/src/qemu/ppc64-softmmu/qemu-system-ppc64
1514
# export ROOT_DISK_PATH=~/some/directory
1615
# Expects ppc64-rootfs.cpio.gz in ROOT_DISK_PATH
1716

@@ -30,7 +29,7 @@ def main():
3029
qconf.configure_from_env()
3130
qconf.configure_from_args(sys.argv[1:])
3231
qconf.machine_caps += ['via=pmu']
33-
qconf.qemu_path = 'qemu-system-ppc64'
32+
qconf.qemu_cmd = 'qemu-system-ppc64'
3433

3534
qconf.apply_defaults()
3635

scripts/boot/qemu-mac99

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# $ ~/src/ci-scripts/scripts/boot/qemu-mac99
1313
#
1414
# Optional:
15-
# export QEMU_SYSTEM_PPC=~/src/qemu/ppc-softmmu/qemu-system-ppc
1615
# export ROOT_DISK_PATH=~/some/directory
1716
# Expects ppc-rootfs.cpio.gz in ROOT_DISK_PATH
1817

scripts/boot/qemu-powernv

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
# $ ~/src/ci-scripts/scripts/boot/qemu-powernv
66
#
77
# Optional:
8-
# export QEMU_SYSTEM_PPC64=~/src/qemu/ppc64-softmmu/qemu-system-ppc64
9-
#
108
# export ROOT_DISK_PATH=~/some/directory
119
# Expects ppc64[le]-rootfs.cpio.gz in ROOT_DISK_PATH
1210

scripts/boot/qemu-ppc64e

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
# $ ~/src/ci-scripts/scripts/boot/qemu-ppc64e
1010
#
1111
# Optional:
12-
# export QEMU_SYSTEM_PPC64=~/src/qemu/ppc64-softmmu/qemu-system-ppc64
1312
# export ROOT_DISK_PATH=~/some/directory
1413
#
1514
# Expects ROOT_DISK_PATH to contain either:
@@ -34,7 +33,7 @@ def main():
3433
qconf.cpu = 'e5500'
3534
qconf.configure_from_env()
3635
qconf.configure_from_args(sys.argv[1:])
37-
qconf.qemu_path = 'qemu-system-ppc64'
36+
qconf.qemu_cmd = 'qemu-system-ppc64'
3837
qconf.mem = '4G'
3938
qconf.smp = 2
4039

scripts/boot/qemu-pseries

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
# $ ~/src/ci-scripts/scripts/boot/qemu-pseries
66
#
77
# Optional:
8-
# export QEMU_SYSTEM_PPC64=~/src/qemu/ppc64-softmmu/qemu-system-ppc64
9-
#
108
# export ROOT_DISK_PATH=~/some/directory
119
# Expects ppc64[le]-rootfs.cpio.gz in ROOT_DISK_PATH
1210

scripts/test/qemu-cpu-hotplug

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def test(name, cpu, machine):
2525
qconf.callback = test_cpuhotplug
2626
qconf.apply_defaults()
2727

28-
if cpu == 'POWER10' and not qemu_supports_p10(qconf.qemu_path):
28+
if cpu == 'POWER10' and not qemu_supports_p10(qconf.qemu_cmd):
2929
return None
3030

3131
return qemu_main(qconf)

0 commit comments

Comments
 (0)