Difference between revisions of "QEMU"

From postmarketOS
Jump to: navigation, search
(fix broken links)
 
(12 intermediate revisions by 5 users not shown)
Line 1: Line 1:
=== Building and starting a qemu image ===
+
=== Building and starting a QEMU image ===
 +
 
 +
<syntaxhighlight lang="shell-session">
 +
$ pmbootstrap init  # Choose a qemu-* device (x86_64: amd64, arm: vexpress-soc)
 +
$ pmbootstrap install --no-fde
 +
$ pmbootstrap qemu --image-size=2G
 +
</syntaxhighlight>
  
<pre class="shell">pmbootstrap init  # Choose a qemu-* device (x86_64: amd64, arm: vexpress-soc)
 
pmbootstrap install
 
pmbootstrap qemu</pre>
 
 
''Note: The <code>amd64</code> version is recommended if you don't know which one to choose. See the device specific pages (links below) for the differences.''
 
''Note: The <code>amd64</code> version is recommended if you don't know which one to choose. See the device specific pages (links below) for the differences.''
  
=== Increase partition size ===
+
The <code>--image-size=2G</code> parameter will increase the image size to 2GB, so you don't instantly run out of space (by default the image size is as small as possible). Check out <code>pmbootstrap qemu --help</code> for more options, such as performance tweaks.
 +
 
 +
=== QEMU on Debian stretch ===
 +
{{note|This is only needed if you want to use <code>--host-qemu</code>, otherwise Alpine's QEMU will be used.}}
 +
{{note|This also applies to '''Ubuntu''' Artful and below, Bionic likely will not have it enabled either - [https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1553999 Launchpad bug.]}}
  
By default, the size in the image is almost as small as possible. This is, because the initramfs will resize it to the full available space of the partition on first boot on a real device. This does not work in qemu, because we never put it on a real partition. So use the following command to increase the image file (the initramfs will adjust the partitions in the image automatically).
+
QEMU on Debian does not include SDL-support by default. To use pmbootstrap on Debian you have to do the following:
 +
# Ensure that /etc/apt/sources.list contains a deb-src line for Debian buster or later.
 +
# <code>sudo apt-get build-dep libvirglrenderer-dev/buster</code> (install build dependencies for libvirglrenderer)
 +
# <code>fakeroot apt-get -b source libvirglrenderer-dev/buster</code> (download and build libvirglrenderer)
 +
# <code>sudo dpkg -i libvirglrenderer0_0.6.0-2_amd64.deb libvirglrenderer-dev_0.6.0-2_amd64.deb</code> (install it)
 +
# <code>sudo apt-get build-dep qemu/buster</code>
 +
# <code>fakeroot apt-get -b source qemu/buster</code>
 +
# Install the appropriate qemu Debian packages which have been created in the current directory.
  
<pre class="shell">pmbootstrap flasher export # exports a symlink to the qemu system image/prints the path
 
truncate -s +200M /path/to/qemu.img # replace 200M accordingly</pre>
 
 
=== See also ===
 
=== See also ===
 +
* [[QEMU_amd64_(qemu-amd64)|QEMU for x86_64]]
 +
* [[QEMU_ARM_(qemu-vexpress)|QEMU for arm]]
 +
* [[QEMU_aarch64_(qemu-aarch64)|QEMU for aarch64]]
 +
* [[Troubleshooting:QEMU]]
 +
* {{MR|1612}} Use Alpine's QEMU rather than host system QEMU
  
* [[qemu-amd64-(QEMU-for-x86_64)|Qemu for x86_64]]
+
[[Category:Technical Reference]]
* [[qemu-vexpress-(Qemu-with-vexpress-soc)|Qemu for arm]]
 

Latest revision as of 10:59, 27 December 2018

Building and starting a QEMU image

$ pmbootstrap init  # Choose a qemu-* device (x86_64: amd64, arm: vexpress-soc)
$ pmbootstrap install --no-fde
$ pmbootstrap qemu --image-size=2G

Note: The amd64 version is recommended if you don't know which one to choose. See the device specific pages (links below) for the differences.

The --image-size=2G parameter will increase the image size to 2GB, so you don't instantly run out of space (by default the image size is as small as possible). Check out pmbootstrap qemu --help for more options, such as performance tweaks.

QEMU on Debian stretch

This is only needed if you want to use --host-qemu, otherwise Alpine's QEMU will be used.
This also applies to Ubuntu Artful and below, Bionic likely will not have it enabled either - Launchpad bug.

QEMU on Debian does not include SDL-support by default. To use pmbootstrap on Debian you have to do the following:

  1. Ensure that /etc/apt/sources.list contains a deb-src line for Debian buster or later.
  2. sudo apt-get build-dep libvirglrenderer-dev/buster (install build dependencies for libvirglrenderer)
  3. fakeroot apt-get -b source libvirglrenderer-dev/buster (download and build libvirglrenderer)
  4. sudo dpkg -i libvirglrenderer0_0.6.0-2_amd64.deb libvirglrenderer-dev_0.6.0-2_amd64.deb (install it)
  5. sudo apt-get build-dep qemu/buster
  6. fakeroot apt-get -b source qemu/buster
  7. Install the appropriate qemu Debian packages which have been created in the current directory.

See also