Commit Graph

37 Commits

Author SHA1 Message Date
James Le Cuirot
16563bb411
Fix the initrd option in the QEMU launcher script
It was -R, but this was already taken by the read-only pflash option, so
use -r instead.

Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
2024-08-16 17:04:07 +01:00
Kai Lueke
5e7b4b6b3d qemu_template.sh: Allow parameters for kernel and initrd
With the PXE script it is easy to boot different versions from one
folder without any copies because the kernel and PXE initrd are always
"fresh".
Instead of only supporting hardcoded file names, support parameters for
the kernel and initrd file to be used.
2024-04-04 16:53:08 +09:00
Kai Lueke
9d3200bc47 build_library/qemu_template.sh: Add notes for swtpm init commands
For the swtpm version in Ubuntu some init command is required first.
2024-04-04 16:53:08 +09:00
Kai Lueke
71866e4824 qemu_template.sh: Allow parameters for VM pflash firmware
The qemu UEFI and regular qemu script only differ by having a default
value for the firmware. If one tries to switch between different
firmwares one normally would modify the script.
Make it easier to switch boot modes and use custom firmwares by
supporting a flag to set the pflash contents.
2024-04-04 12:55:37 +09:00
Kai Lueke
48780dc375 qemu_template.sh: Add support for attaching a software TPM
For testing TPM2-backed rootfs encryption it is handy to have a software
TPM option for the qemu script.
Add a flag for a software TPM with swtpm like kola also does. The user
has to specify a folder for the secret state and this won't be removed
because the same store should be able to be passed when booting the VM
again after shutdown.
2024-04-04 12:55:37 +09:00
Kai Lueke
4d5e46432a qemu_template.sh: Allow parameters for VM image and memory
When testing multiple images one always has to copy them to the
expected file name, and when trying to run two VMs this means one needs
to either use separate directories or modify the qemu script. One also
needs to modify the qemu script to bump the memory for K8s or for LUKS.

Support parameters for the VM image name and the VM memory.
2024-04-04 12:55:37 +09:00
Jeremi Piotrowski
6ff9f8b098 Add support for secure boot in qemu_template.sh
We have an existing qemu_uefi_secure format definition, but it is
necessary to update it so that it actually works. Qemu needs to be
passed the correct flags to enable SMM, we need to switch to the Q35
machine, and we need to copy over the secboot variant of the OVMF
firmware.
2024-02-26 12:01:09 +01:00
Martin Borgman
1a42fd4a5f Make qemu_template.sh work on MacOS
Make qemu_template.sh work on MacOS

Line 14; The nproc command is only available on systems with GNU coreutils installed. The getconf _NPROCESSORS_ONLN alternative will work on a wider range of UNIX systems.
Line 114; The mktemp syntax used only works on GNU implementation.
Line 159; added hvf (MacOS) and tcg (no acceleration) options as a fallback. By doing this qemu-system-x86_64 will try to use kvm, but when it fails try hvf, and when that fails switch to the tcg accelerator.
2022-06-22 15:18:09 +02:00
Mathieu Tortuyaux
35387cfdff
build_lib/qemu_tmpl: fix short-form warning
starting from qemu-6.0.0, options with short-form are deprecated.

```
$ ./flatcar_production_qemu.sh
qemu-system-x86_64: -fsdev local,id=conf,security_model=none,readonly,path=/tmp/flatcar-configdrive.gyqmdrQqfA: warning: short-form boolean option 'readonly' deprecated
Please use readonly=on instead
```

See this commit: ccd3b3b811

Signed-off-by: Mathieu Tortuyaux <mathieu@kinvolk.io>
2021-07-16 16:04:50 +02:00
Vincent Batts
d46b95ba29
Merge pull request #91 from kinvolk/vbatts/arm
qemu_template: use more cpus for ARM if available
2020-12-15 08:29:10 -05:00
Vincent Batts
ed7de96c1f
qemu_template: shell lint and update
Signed-off-by: Vincent Batts <vbatts@kinvolk.io>
2020-09-16 10:30:07 -04:00
Vincent Batts
a97df50696
qemu_template: use more cpus for ARM if available
But don't hog all `VM_NCPUS`, as we are still emulating them

Signed-off-by: Vincent Batts <vbatts@kinvolk.io>
2020-09-15 17:39:35 -04:00
Thilo Fromm
56341ea725 qemu_template.sh: update naming CoreOS -> Flatcar 2020-05-15 15:25:27 +02:00
Flatcar Buildbot
c7bbb2b1e2 2345.0.0 2019-12-04 14:59:11 +01:00
Flatcar Buildbot
1dad511f69 2317.0.1 2019-11-07 19:40:01 +01:00
David Michael
2467923d56 Remove arm64 from supported board operations 2018-10-25 16:00:09 +00:00
Benjamin Gilbert
1717709dbf build_library: avoid obsolete QEMU -net syntax
It's been deprecated since QEMU 0.12. Fixes warning on QEMU startup:

    qemu-system-x86_64: -net nic,vlan=0,model=virtio: 'vlan' is deprecated. Please use 'netdev' instead.
2018-05-15 17:33:27 -04:00
Benjamin Gilbert
72bd0b175b build_library: attach virtio-rng-pci device to QEMU VMs
Pass /dev/urandom through to QEMU VMs. (Not /dev/random, to avoid
draining the host's entropy.) This speeds initialization of VM entropy.
2018-05-15 17:22:24 -04:00
Dongsu Park
52214f533b build_library: fix a bug when setting a CDROM image
Setting `$VM_CDROM` in the qemu script does not work as expected when
installing Container Linux from the given bootable CDROM image. That's
probably because qemu-system-x86_64 expects another boot option `-boot
order=d` to be able to boot from the given CDROM drive. Let's specify
specify a `-boot` as well as `-drive` option for the given CDROM drive.
2018-03-12 21:38:42 +01:00
Geoff Levand
e76030e0e9 build_library: Update qemu script to run on arm64 machines
Signed-off-by: Geoff Levand <geoff@infradead.org>
2017-07-28 14:39:53 -07:00
Geoff Levand
5e94a55069 build_library: Add missing die function
Signed-off-by: Geoff Levand <geoff@infradead.org>
2017-07-28 14:39:53 -07:00
Alex Crawford
c93416caf2 build_library: support ignition in qemu template 2016-11-22 19:17:42 -08:00
Nick Owens
e0524264b9 build_library: generate pflash files for qemu_uefi from edk2-armvirt 2016-04-21 10:45:15 -07:00
Andrej Rosano
8ba400eca7 Add arm64 qemu image support
Allows image_to_vm.sh to build also arm64 qemu images.

Signed-off-by: Andrej Rosano <andrej@inversepath.com>
2015-09-17 14:16:18 +02:00
Michael Marineau
810ba021b7 vm_image_util: add qemu_uefi image type for easier testing 2014-11-05 15:53:17 -08:00
Michael Marineau
1a8b197659 qemu: adjust the meaning of the -s (simple) flag
My primary use case for this flag is to fix booting with UEFI firmware
which can have problems when mixed with KVM, adding kexec into the mix
doesn't help matters either. The current version of OVMF can boot from
virtio drives just fine so that is now enabled and KVM is disabled.

So the -s option can also mean sloooooooow but boots!
2014-09-07 09:58:51 -07:00
Michael Marineau
2a004f0081 qemu: set DHCP hostname based on image name and version
Provides an easy way to test this setting hostname from DHCP, most other
systems rely on it.
2014-07-21 16:43:48 -07:00
Michael Marineau
12c0008ad9 feat(qemu_template): Add support for user-provided configs.
A custom cloud config can be provided directly via -u or as an existing
config drive image via -c.
2014-04-11 18:06:18 -07:00
Michael Marineau
150ab005e0 feat(qemu_template): Provide SSH keys via config drive
Moving away from our old behavior of loading 'authorized_keys' on virtfs
volumes. Still using virtfs to avoid depending on mkisofs or similar.
2014-04-11 18:06:18 -07:00
Michael Marineau
0d0c7c7578 fix(qemu_template): Replace getopts with simple pattern matching.
The use of getopts was leading to conflicts between this script's short
options and qemu's long options. For example -serial was getting
interpreted as -s -- erial which is not very helpful.
2014-04-11 18:06:18 -07:00
Alex Polvi
0d3cd4b417 feat(iso): add iso image format to image_to_vm 2014-03-31 15:49:57 -07:00
Michael Marineau
11aabd7bd0 fix(vm_image_util): Do not generate a machine UUID.
If QEMU is given a uuid systemd will detect that and in turn use it for
the machine-id. This made the bug causing the machine-id to be always
re-generated on boot harder to notice since it didn't happen on QEMU.
2014-03-25 14:23:23 -07:00
Michael Marineau
066bd23df8 feat(vm_image_util): Rework the qemu wrapper script to work for PXE
Now the script can be used with a disk image or a kernel/initrd.
Using a disk with the PXE kernel should work too but haven't tried it.
2014-03-22 22:28:10 -07:00
Jeremiah Orem
84b94c97f7 qemu_template: == is a bashism, change to =. 2014-02-07 00:17:14 -08:00
Michael Marineau
12e0f8dddd fix(qemu): Enable all available CPU features and SMP by default 2014-01-17 00:23:24 -08:00
Michael Marineau
c6f20655db fix(qemu_template): Fix getopts usage in qemu wrapper script.
Previously shifts were added into the getopts loop to work around
differences between different sh implementations but that causes getopts
to end the loop early. Instead use an intermediate variable to work
around inconsistent OPTIND behavior and explicitly check for the --
separator. Tested in bash, dash, and ash.
2013-10-08 13:35:10 -07:00
Michael Marineau
0f84e3b05f feat(image_to_vm): Add new and improved qemu wrapper script.
This one is more automagical and sets up ssh keys from ssh-agent and the
user's home directory by default. Also adds an option for setting the
ssh port so it can be something other than 2222. Script should be
sufficiently portable, tested in bash, dash, and ash.
2013-08-18 19:43:07 -04:00