From 005fcec22038866b9beba6fab4fab6a135c31b3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ant=C3=B3nio=20Meireles?= Date: Fri, 19 Apr 2019 16:11:23 +0100 Subject: [PATCH] consume libvirt's host bundled UEFI bios by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: António Meireles --- Makefile | 8 ++------ README.md | 12 ++++++++++++ Vagrantfile.template.rb | 6 +++--- extras/test/Vagrantfile | 1 - packer.conf.libvirt.json | 5 ++--- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 912daa1..4f8b7c3 100644 --- a/Makefile +++ b/Makefile @@ -64,7 +64,7 @@ define buildBaseImg endef define imgToVMDK - qemu-img convert -p -C -t none -T none media/$(OSV)-$1-factory.img -O vmdk media/$(OSV)-$1-factory.vmdk + qemu-img convert -p -C media/$(OSV)-$1-factory.img -O vmdk media/$(OSV)-$1-factory.vmdk endef define vmxBuilder @@ -141,10 +141,6 @@ help: @echo "To target a specific one add 'VERSION=...' to your make invocation" @echo -media/OVMF.fd: - @mkdir -p media - @curl -sSL $(CLR_BASE_URL)/image/OVMF.fd -o media/OVMF.fd - $(foreach T,$(PROVIDERS),$(eval $(IMGtarget))) $(foreach T,$(PROVIDERS),$(eval $(VMDKtarget))) @@ -171,7 +167,7 @@ all: $(PROVIDERS) ## Packer Builds All providers boxes $(foreach T,$(PROVIDERS),$(eval $(PROVIDERtarget))) -boxes/libvirt/$(NV).libvirt.box: $(call mediaFactory,libvirt).img media/OVMF.fd +boxes/libvirt/$(NV).libvirt.box: $(call mediaFactory,libvirt).img $(call pack,libvirt) boxes/virtualbox/$(NV).virtualbox.box: $(call mediaFactory,virtualbox)/$(NV).ova diff --git a/README.md b/README.md index adc146c..1c99047 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,18 @@ vagrant up config.vm.provision :set_timezone, timezone: 'Asia/Dili' ``` +- The boxes expect the UEFI bios to be found on the host filesystem, where libvirt sits, at + `/usr/share/qemu/OVMF.fd` which is its canonical location on major OSs. + + If you are consuming the boxes over a OS that has `OVMF.fd` placed elsewhere please adapt your + `Vagrantfile` accordingly: + + ```ruby + config.vm.provider :libvirt do |libvirt, override| + libvirt.loader = '/NON_DEFAULT_LOCATION/OVMF.fd' + end + ``` + ## Vagrant Cloud This project Vagrant boxes are hosted on **Vagrant Cloud** at diff --git a/Vagrantfile.template.rb b/Vagrantfile.template.rb index 7f6287e..515d0b2 100644 --- a/Vagrantfile.template.rb +++ b/Vagrantfile.template.rb @@ -14,8 +14,7 @@ ].each do |plugin| next if Vagrant.has_plugin?(plugin[:name], plugin[:version]) - verb = 'install' - verb = 'update' if Vagrant.has_plugin?(plugin[:name]) + verb = Vagrant.has_plugin?(plugin[:name]) ? 'update' : 'install' system("vagrant plugin #{verb} #{plugin[:name]}", chdir: '/tmp') || exit! need_restart = true end @@ -67,7 +66,8 @@ end end config.vm.provider 'libvirt' do |libvirt| - libvirt.loader = File.join(File.dirname(__FILE__), 'OVMF.fd') + # XXX: this is the default location in ClearLinux and Debian + libvirt.loader = "/usr/share/qemu/OVMF.fd" libvirt.driver = 'kvm' libvirt.cpu_mode = 'host-passthrough' libvirt.nested = true diff --git a/extras/test/Vagrantfile b/extras/test/Vagrantfile index 158191e..283c9c4 100644 --- a/extras/test/Vagrantfile +++ b/extras/test/Vagrantfile @@ -10,7 +10,6 @@ Vagrant.configure(2) do |config| libvirt.username = username libvirt.socket = '/var/run/libvirt/libvirt-sock' libvirt.storage_pool_path = '/home/clear/.local/share/libvirt/images' - libvirt.loader = '/usr/share/qemu/OVMF.fd' override.ssh.forward_agent = true override.ssh.proxy_command = "ssh -q -W %h:%p -l #{username} -x #{host}" end diff --git a/packer.conf.libvirt.json b/packer.conf.libvirt.json index fddc280..ddc87b3 100644 --- a/packer.conf.libvirt.json +++ b/packer.conf.libvirt.json @@ -24,7 +24,7 @@ "qemuargs": [ [ "-bios", - "media/OVMF.fd" + "/usr/share/qemu/OVMF.fd" ] ], "iso_checksum_type": "none", @@ -67,8 +67,7 @@ "compression_level": 9, "vagrantfile_template": "Vagrantfile.template.rb", "include": [ - "info.json", - "media/OVMF.fd" + "info.json" ] } ]