Commit 4d0a8d4e authored by Xiaowu Zhang's avatar Xiaowu Zhang

kwm: extend kvm 's buildout to include UEFI Secure boot

parent df1f2468
[buildout]
extends =
../make/buildout.cfg
../git/buildout.cfg
../util-linux/buildout.cfg
../ffmpeg/buildout.cfg
../bison/buildout.cfg
../flex/buildout.cfg
../m4/buildout.cfg
parts =
edk2
[acpica]
recipe = slapos.recipe.cmmi
url = https://acpica.org/sites/acpica/files/acpica-unix-20200717.tar.gz
md5sum = c9b17a05afc285c48ebb3a8cbab006f3
location = ${buildout:parts-directory}/${:_buildout_section_name_}
configure-command = :
#XXXX why acpica ends with empty folder
make-targets = ${make:location}/bin/make iasl
&& mv * ${:location}
environment =
PATH=${bison:location}/bin:${flex:location}/bin:${m4:location}/bin:%(PATH)s
[edk2-config]
recipe = slapos.recipe.template:jinja2
rendered = ${buildout:directory}/${:_buildout_section_name_}/target.txt
template = inline:
ACTIVE_PLATFORM = OvmfPkg/OvmfPkgX64.dsc
TARGET_ARCH = X64
TARGET = RELEASE
TOOL_CHAIN_CONF = Conf/tools_def.txt
TOOL_CHAIN_TAG = GCC5
MAX_CONCURRENT_THREAD_NUMBER = 1
BUILD_RULE_CONF = Conf/build_rule.txt
[edk2]
recipe = slapos.recipe.build
repository = https://github.com/tianocore/edk2.git
commit= 872f953262d68a11da7bc2fb3ded16df234b8700
location = ${buildout:parts-directory}/${:_buildout_section_name_}
path = ${buildout:parts-directory}/${:_buildout_section_name_}/Build/OvmfX64/RELEASE_GCC5/FV/OVMF.fd
git-binary = ${git:location}/bin/git
C_INCLUDE_PATH=${libuuid:location}/include
LIBRARY_PATH=${libuuid:location}/lib
PATH=${acpica:location}/generate/unix/bin:${nasm:location}/bin:%(PATH)s
rendered = ${edk2-config:rendered}
install =
import subprocess, os, shutil
env = {
'PATH':options['PATH'] + ':' + os.environ['PATH'],
'C_INCLUDE_PATH':options['C_INCLUDE_PATH'],
'LIBRARY_PATH':options['LIBRARY_PATH']
}
subprocess.check_call('bash -c "(git clone %s %s && cd %s && git reset --hard %s && git submodule update --init && make -C BaseTools && cp %s Conf/target.txt && . edksetup.sh && build -D SECURE_BOOT_ENABLE=TRUE) || (rm -fr %s; exit 1)"' %
(options['repository'], options['location'], options['location'], options['commit'], options['rendered'], options['location']), env=env, shell=True)
......@@ -15,11 +15,11 @@
[template]
filename = instance.cfg.in
md5sum = a7978940fb9cdcc4e1ec33015ba640ba
md5sum = 90932ecd41ef359d00c8998d01e0ca6c
[template-kvm]
filename = instance-kvm.cfg.jinja2
md5sum = 69749ef4be49b970af9548d68e6d8785
md5sum = 02e7e3cfecd0b25132f122b030051197
[template-kvm-cluster]
filename = instance-kvm-cluster.cfg.jinja2.in
......@@ -55,7 +55,7 @@ md5sum = 6328f99728284847b8dd1146aadeae1b
[template-kvm-run]
filename = template/template-kvm-run.in
md5sum = fa048a28da7362d570f5b6bd1e05d232
md5sum = fc0ddf276113b94a8d44456dfd4c4d61
[template-kvm-controller]
filename = template/kvm-controller-run.in
......
......@@ -398,6 +398,7 @@ ipv4 = ${slap-network-information:local-ipv4}
ipv6 = ${slap-network-information:global-ipv6}
vnc-ip = ${:ipv4}
vnc-port = 5901
edk2-path = {{ edk2_path }}
default-cdrom-iso = {{ debian_amd64_netinst_location }}
{% if virtual_hard_drive_url_enabled %}
......
......@@ -90,6 +90,7 @@ extra-context =
raw novnc_location ${noVNC:location}
raw netcat_bin ${netcat:location}/bin/netcat
raw python_executable ${buildout:executable}
raw edk2_path ${edk2:path}
raw python_eggs_executable ${buildout:bin-directory}/${python-with-eggs:interpreter}
raw qemu_executable_location ${qemu:location}/bin/qemu-system-x86_64
raw qemu_img_executable_location ${qemu:location}/bin/qemu-img
......
......@@ -12,6 +12,7 @@ extends =
../../component/pycurl/buildout.cfg
../../component/numpy/buildout.cfg
../../component/gzip/buildout.cfg
../../component/edk2/buildout.cfg
../../stack/slapos.cfg
../../stack/resilient/buildout.cfg
buildout.hash.cfg
......
......@@ -22,6 +22,7 @@ disk_type = {{ repr(parameter_dict["disk-type"]) }}
network_adapter = {{ repr(parameter_dict["network-adapter"]) }}
edk2_path = '{{ parameter_dict.get("edk2-path") }}'
socket_path = '{{ parameter_dict.get("socket-path") }}'
nbd_list = (('{{ parameter_dict.get("nbd-host") }}',
{{ parameter_dict.get("nbd-port") }}),
......@@ -62,7 +63,7 @@ cluster_doc_port = {{ parameter_dict.get("cluster-doc-port") }}
auto_ballooning = '{{ parameter_dict.get("auto-ballooning") }}' in ('true', 'True', '1')
vm_name = '{{ parameter_dict.get("name") }}'
# If a device (ie.: /dev/sdb) is provided, use it instead
# If a device (ie.: /dev/sdb) is provided, use it instead
# the disk_path with disk_format
disk_info_list = []
for disk_device_path in '{{ parameter_dict.get("disk-device-path", "") }}'.split():
......@@ -145,7 +146,7 @@ def getMapStorageList(disk_storage_dict, external_disk_number):
if id_list:
if not map_f_exist:
# shuffle the list to not write disk in data1, data2, ... everytime
# shuffle the list to not write disk in data1, data2, ... everytime
shuffle(id_list)
if external_disk_number < last_amount:
# Drop created disk is not allowed
......@@ -281,6 +282,7 @@ kvm_argument_list = [qemu_path,
'-boot', 'order=cd,menu=on',
'-qmp', 'unix:%s,server,nowait' % socket_path,
'-pidfile', pid_file_path, '-msg', 'timestamp=on',
'-bios', edk2_path,
'-D', logfile,
'-nodefaults',
# switch to tablet mode for the mouse to have it synced with a client, see https://wiki.gentoo.org/wiki/QEMU/Options#USB
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment