5 qemu-sanity-check - run a simple sanity check on qemu and the Linux kernel
9 qemu-sanity-check [options]
13 B<qemu-sanity-check> is a short shell script that test-boots a Linux
14 kernel under qemu, making sure it boots up to userspace. The idea is
15 to test the Linux kernel and/or qemu to make sure they are working.
17 You can use the command on its own:
21 In this case, the script will look for a suitable qemu binary on the
22 C<$PATH> and the latest Linux kernel in F</boot> (or
23 F</lib/modules/VERSION/vmlinuz> on some distros) and try to boot that
26 You can also specify a qemu binary or a Linux kernel (either or both
27 options can be omitted):
29 qemu-sanity-check --qemu=/path/to/qemu --kernel=/path/to/vmlinuz
33 KVM (C<kvm> or C<qemu-kvm>) can be used in place of qemu.
37 No kernel modules or special drivers are required except as noted
38 below. The test uses an initramfs containing a static binary, so the
39 kernel is B<not> required to locate block devices, use virtio, mount
42 The kernel B<must> support only the following, compiled in (not as
49 A serial port (usually: C<CONFIG_SERIAL_8250=y>)
53 Initrd/initramfs (C<CONFIG_BLK_DEV_INITRD=y>)
63 Display short help message and exit.
69 =item B<--accel>=kvm:tcg
71 This sets the C<-machine accel=...> parameter which is passed to
74 If not set, then C<kvm:tcg> is the default, which means to try to use
75 KVM (hardware-assisted virtualization), and fall back to software
76 emulation if KVM is not possible.
78 Other typical values of this parameter are: C<tcg>, which means to
79 force software emulation. C<kvm>, which means to force KVM and fail
80 if KVM is unavailable.
84 Set the qemu I<--cpu> option. If not set then a suitable default is
85 picked depending on the architecture and whether KVM is available.
86 You can also use I<--cpu=> to let qemu pick the default.
90 =item B<--initrd>=INITRD
92 Use the initramfs image named F<INITRD> instead of the default.
96 =item B<--kernel>=VMLINUZ
98 Use the kernel image F<VMLINUZ> instead of searching for the latest
99 kernel installed in F</boot>.
103 =item B<--machine>=MACHINE
105 Set the qemu I<-m> (machine type) option. If not set then a suitable
106 default is picked depending on the architecture. You can also use
107 I<--machine=> to let qemu pick the default.
113 Use the qemu (or KVM) binary F<QEMU> instead of searching C<$PATH> for
118 =item B<--timeout>=TIMEOUT
120 Specify a timeout instead of the default which is C<10m> (10 minutes).
122 The syntax for the C<TIMEOUT> is described in full in the man page for
129 Print extra debugging information.
135 Display version and exit.
141 The exit status is 0 if the Linux kernel booted as far as userspace
142 under qemu; or if the I<--help> or I<--version> options were used.
144 The exit status is 1 if the kernel boot failed under qemu.
146 The exit status is 2 if the script itself failed (eg. incorrect
147 command line options were used, a suitable kernel could not be found).
153 =item B<@libdir@/qemu-sanity-check/initrd>
155 The default location for the small initramfs image that is used to
156 test that userspace has been reached.
167 Richard W.M. Jones <rjones@redhat.com>
171 (C) Copyright 2013-2020 Red Hat Inc.
173 This program is free software; you can redistribute it and/or modify
174 it under the terms of the GNU General Public License as published by
175 the Free Software Foundation; either version 2 of the License, or
176 (at your option) any later version.
178 This program is distributed in the hope that it will be useful,
179 but WITHOUT ANY WARRANTY; without even the implied warranty of
180 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
181 GNU General Public License for more details.
183 You should have received a copy of the GNU General Public License along
184 with this program; if not, write to the Free Software Foundation, Inc.,
185 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.