From Fedora Project Wiki

(Create the test case)
 
m
 
(12 intermediate revisions by 3 users not shown)
Line 2: Line 2:
  
 
|description=
 
|description=
Run Fedora ARM VM on your x86 machine via libvirt + KVM.
+
Run Fedora ARM VM on your x86 machine via libvirt + QEMU.
 
 
This is for the F20 feature: https://fedoraproject.org/wiki/Changes/Virt_ARM_on_x86
 
  
 
|setup=
 
|setup=
Line 13: Line 11:
 
=== Get the media ===
 
=== Get the media ===
  
This is one way to do it and the paths are only relevant for F20 alpha media. For some more info, see: [[ARM/F19/Installation#For_Versatile_Express_Emulation_with_QEMU]]
+
This is one way to do it and the paths are only relevant for F31 Minimal media. For some more info, see: [[Architectures/ARM/F28/Installation#For_Versatile_Express_Emulation_with_QEMU]]
  
* Download the [http://download.fedoraproject.org/pub/fedora/linux/releases/test/20-Alpha/Images/armhfp/Fedora-Minimal-armhfp-20-Alpha-4-sda.raw.xz F20 alpha minimal ARM image] to $HOME
+
* Download the latest arm disk image to $HOME:https://dl.fedoraproject.org/pub/fedora/linux/releases/31/Spins/armhfp/images/Fedora-Minimal-armhfp-31-1.9-sda.raw.xz
* Extract the disk image: <code>unar Fedora-Minimal-armhfp-20-Alpha-4-sda.raw.xz</code>. Delete the original compressed image
+
* Extract the disk image: <code>unxz Fedora-Minimal-armhfp-31-1.9-sda.raw.xz</code>. Delete the original compressed image
* Install virt-copy-out: <code>sudo yum install libguestfs-tools-c</code>
+
* Install virt-builder: <code>sudo dnf install libguestfs-tools-c</code>
* Copy /boot out of the disk image: <code>virt-copy-out -a Fedora-Minimal-armhfp-20-Alpha-4-sda.raw /boot .</code>
+
* Extract the kernel/initrd from the disk image: <code>virt-builder --get-kernel Fedora-Minimal-armhfp-31-1.9-sda.raw</code>
* Copy kernel, initrd, and dtb to the default libvirt image location: <code>sudo mv boot/vmlinuz-3.11.0-300.fc20.armv7hl+lpae boot/initramfs-3.11.0-300.fc20.armv7hl.img boot/dtb-3.11.0-300.fc20.armv7hl/vexpress-v2p-ca9.dtb /var/lib/libvirt/images</code>
+
* Get kernel args for the the image <code>virt-cat -a Fedora-Minimal-armhfp-31-1.9-sda.raw /etc/extlinux.conf</code>
* Delete the extracted 'boot' directory
+
* Copy the media to the the default libvirt image location: <code>sudo mv Fedora-Minimal-armhfp-31-1.9-sda.raw vmlinuz-*.armv7hl initramfs-*.armv7hl.img /var/lib/libvirt/images/</code>
* Move the extracted disk image to the default libvirt image location: <code>sudo mv Fedora-Minimal-armhfp-20-Alpha-4-sda.raw /var/lib/libvirt/images</code>
+
* Ensure qemu-system-arm is installed: <code>sudo dnf install qemu-system-arm</code>
  
=== Create the VM ===
+
=== Create the VM with virt-manager ===
  
* Ensure qemu-system-arm is installed: <code>sudo yum install qemu-system-arm</code>
 
 
* Start virt-manager, connect to 'QEMU', click the 'New VM' icon
 
* Start virt-manager, connect to 'QEMU', click the 'New VM' icon
* On the first page, under 'Architecture Options' select 'arm'. For machine type, select 'vexpress-a9'
+
* On the first page, under 'Architecture Options' select 'arm'. The 'virt-2.11' machine type needs to be selected for the VM to boot (BZ#1633328).
 
* Select the 'Import install' option, go to the next page
 
* Select the 'Import install' option, go to the next page
* Browse to the disk image, kernel, initrd, and dtb file we moved in the previous step.
+
* Browse to the disk image, kernel, and initrd we moved in the previous step.
* Set kernel args as: <code>console=ttyAMA0 rw root=/dev/vda3</code>
+
* Use the output of the virt-cat command to set the kernel args or use the generic args: <code>console=ttyAMA0 rw root=LABEL=_/ rootwait</code>
* Set the OS as Fedora 20.
+
* Set the OS as Fedora 31.
 
* Continue with the OS defaults, complete the install.
 
* Continue with the OS defaults, complete the install.
 
* The guest should shortly start booting, and you should see text console output. After a bit of a wait, it should hit a text mode 'initial setup' where you can set a root password.
 
* The guest should shortly start booting, and you should see text console output. After a bit of a wait, it should hit a text mode 'initial setup' where you can set a root password.
 +
 +
=== Create the VM with virt-install ===
 +
 +
Here's the relevant virt-install command:
 +
 +
<pre>
 +
sudo virt-install \
 +
    --name Fedora-Minimal-armhfp-31-1.9-sda --ram 4096 --arch armv7l --machine virt-2.11 --os-variant fedora31 --import \
 +
    --disk /var/lib/libvirt/images/Fedora-Minimal-armhfp-31-1.9-sda.raw \
 +
    --boot kernel=/var/lib/libvirt/images/vmlinuz-5.3.7-301.fc31.armv7hl,initrd=/var/lib/libvirt/images/initramfs-5.3.7-301.fc31.armv7hl.img,kernel_args="console=ttyAMA0 rw root=LABEL=_/ rootwait"
 +
</pre>
  
 
|results=
 
|results=
 
No obvious errors occur.
 
No obvious errors occur.
 
== More info ==
 
 
* [[ARM/F19/Installation#For_Versatile_Express_Emulation_with_QEMU]]
 
* https://fedoraproject.org/wiki/Changes/Virt_ARM_on_x86
 
 
}}
 
}}
  
 
[[Category:Virtualization Test Cases]]
 
[[Category:Virtualization Test Cases]]

Latest revision as of 17:01, 7 February 2020

Description

Run Fedora ARM VM on your x86 machine via libvirt + QEMU.

Setup

Functioning Fedora virt host.

How to test

Get the media

This is one way to do it and the paths are only relevant for F31 Minimal media. For some more info, see: Architectures/ARM/F28/Installation#For_Versatile_Express_Emulation_with_QEMU

  • Download the latest arm disk image to $HOME:https://dl.fedoraproject.org/pub/fedora/linux/releases/31/Spins/armhfp/images/Fedora-Minimal-armhfp-31-1.9-sda.raw.xz
  • Extract the disk image: unxz Fedora-Minimal-armhfp-31-1.9-sda.raw.xz. Delete the original compressed image
  • Install virt-builder: sudo dnf install libguestfs-tools-c
  • Extract the kernel/initrd from the disk image: virt-builder --get-kernel Fedora-Minimal-armhfp-31-1.9-sda.raw
  • Get kernel args for the the image virt-cat -a Fedora-Minimal-armhfp-31-1.9-sda.raw /etc/extlinux.conf
  • Copy the media to the the default libvirt image location: sudo mv Fedora-Minimal-armhfp-31-1.9-sda.raw vmlinuz-*.armv7hl initramfs-*.armv7hl.img /var/lib/libvirt/images/
  • Ensure qemu-system-arm is installed: sudo dnf install qemu-system-arm

Create the VM with virt-manager

  • Start virt-manager, connect to 'QEMU', click the 'New VM' icon
  • On the first page, under 'Architecture Options' select 'arm'. The 'virt-2.11' machine type needs to be selected for the VM to boot (BZ#1633328).
  • Select the 'Import install' option, go to the next page
  • Browse to the disk image, kernel, and initrd we moved in the previous step.
  • Use the output of the virt-cat command to set the kernel args or use the generic args: console=ttyAMA0 rw root=LABEL=_/ rootwait
  • Set the OS as Fedora 31.
  • Continue with the OS defaults, complete the install.
  • The guest should shortly start booting, and you should see text console output. After a bit of a wait, it should hit a text mode 'initial setup' where you can set a root password.

Create the VM with virt-install

Here's the relevant virt-install command:

sudo virt-install \
    --name Fedora-Minimal-armhfp-31-1.9-sda --ram 4096 --arch armv7l --machine virt-2.11 --os-variant fedora31 --import \
    --disk /var/lib/libvirt/images/Fedora-Minimal-armhfp-31-1.9-sda.raw \
    --boot kernel=/var/lib/libvirt/images/vmlinuz-5.3.7-301.fc31.armv7hl,initrd=/var/lib/libvirt/images/initramfs-5.3.7-301.fc31.armv7hl.img,kernel_args="console=ttyAMA0 rw root=LABEL=_/ rootwait"

Expected Results

No obvious errors occur.