Skip to content

Commit

Permalink
aavmf: add aavmf and aavmf_vars_template paramters
Browse files Browse the repository at this point in the history
It is convenient for us to select the aavmf for different guests, such
as 32-bit guest or 64-bit guest.

Signed-off-by: Zheng Xiang <[email protected]>
  • Loading branch information
zhengxiang93 committed May 23, 2018
1 parent 2fd4986 commit 248b314
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions virttest/qemu_devices/qcontainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -874,17 +874,22 @@ def get_aavmf_vars(params):
devices = []
devices.append(qdevices.QStringDevice('machine', cmdline=cmd))
# EFI pflash
aavmf_code = ("-drive file=/usr/share/AAVMF/AAVMF_CODE.fd,"
"if=pflash,format=raw,unit=0,readonly=on")
aavmf = params.get("aavmf")
if not aavmf:
aavmf = "/usr/share/AAVMF/AAVMF_CODE.fd"
aavmf_code = ("-drive file=%s,if=pflash,format=raw,unit=0,readonly=on", aavmf)
devices.append(qdevices.QStringDevice('AAVMF_CODE',
cmdline=aavmf_code))
aavmf_vars_template = params.get("aavmf_vars_template")
if not aavmf_vars_template:
aavmf_vars_template = "/usr/share/AAVMF/AAVMF_VARS.fd"
aavmf_vars = get_aavmf_vars(params)
if not os.path.exists(aavmf_vars):
logging.warn("AAVMF variables file '%s' doesn't exist, "
"recreating it from the template (this should "
"only happen when you install the machine as "
"there is no default boot in EFI!)", aavmf_vars)
shutil.copy2('/usr/share/AAVMF/AAVMF_VARS.fd', aavmf_vars)
shutil.copy2(aavmf_vars_template, aavmf_vars)
aavmf_vars = ("-drive file=%s,if=pflash,format=raw,unit=1"
% aavmf_vars)
devices.append(qdevices.QStringDevice('AAVMF_VARS',
Expand Down Expand Up @@ -924,17 +929,22 @@ def get_aavmf_vars(params):
devices = []
devices.append(qdevices.QStringDevice('machine', cmdline=cmd))
# EFI pflash
aavmf_code = ("-drive file=/usr/share/AAVMF/AAVMF_CODE.fd,"
"if=pflash,format=raw,unit=0,readonly=on")
aavmf = params.get("aavmf")
if not aavmf:
aavmf = "/usr/share/AAVMF/AAVMF_CODE.fd"
aavmf_code = ("-drive file=%s,if=pflash,format=raw,unit=0,readonly=on", aavmf)
devices.append(qdevices.QStringDevice('AAVMF_CODE',
cmdline=aavmf_code))
aavmf_vars_template = params.get("aavmf_vars_template")
if not aavmf_vars_template:
aavmf_vars_template = "/usr/share/AAVMF/AAVMF_VARS.fd"
aavmf_vars = get_aavmf_vars(params)
if not os.path.exists(aavmf_vars):
logging.warn("AAVMF variables file '%s' doesn't exist, "
"recreating it from the template (this should "
"only happen when you install the machine as "
"there is no default boot in EFI!)", aavmf_vars)
shutil.copy2('/usr/share/AAVMF/AAVMF_VARS.fd', aavmf_vars)
shutil.copy2(aavmf_vars_template, aavmf_vars)
aavmf_vars = ("-drive file=%s,if=pflash,format=raw,unit=1"
% aavmf_vars)
devices.append(qdevices.QStringDevice('AAVMF_VARS',
Expand Down

0 comments on commit 248b314

Please sign in to comment.