Building Linux and Android guests

QNX hypervisors support Linux guests, provided these guests are built for virtual hardware the hypervisor can present to the guest in a VM.

Building Linux guests

The information below is only an outline of what you need to do to implement a Linux guest in a QNX hypervisor system. Refer to your Linux documentation for information about how to configure and build your Linux system.

When you build non-QNX guests to run in a QNX virtualized environment, you must build them for the appropriate hardware architecture, and configure the VMs in which they will run to match their expectations.

To implement a Linux OS as a guest, you need to do the following:

  1. Get from your favorite Linux source a Linux build environment appropriate for building your Linux OS, and configure it.
  2. Follow your Linux instructions to build the guest in your Linux work directory.
  3. Write a VM configuration file (e.g., linuxvm1.qvmconf) that assembles in a VM the components your Linux OS will expect to find on the platform where it will run.

    See Configuration file for VM hosting a Linux guest (example) below for an example of a configuration file for a VM hosting a Linux guest.

  4. When you have built your Linux guest, you may include it in a new hypervisor disk image, which you can transfer to your target.

Adding drivers, applications and utilities

To be useful in a virtualized environment, your Linux guest will probably need to include some additional drivers, applications and utilities. For example:

Making command-line arguments available to a Linux guest

You start Linux guests the same way you start QNX guests: start the VM, either through the command line, or by adding to the hypervisor host startup routine the instructions for starting the hosting qvm process instance (see Starting and using guests).

When you start your Linux guest, however, you will probably need to provide it with some commandline arguments. To do this, you can use the qvm cmdline configuration option to hand the startup arguments to the Linux kernel (see cmdline in the “VM Configuration Reference” chapter). For example, we might use the following to tell the Linux kernel where to find the console:

Booting Linux guests

To boot from disk, a Linux guest needs to know in which partition the root filesystem is installed (i.e., the filesystem that gets mounted at location /). When you have this information, you can specify the information with a command-line argument in the VM configuration file. For example:

cmdline
    root=/dev/vda1

where vda1 refers to the first virtio-blk vdev entry in the configuration for the VM.

See Making command-line arguments available to a Linux guest above.

If you use a virtio-blk device for your disk, remember that in Linux these devices present as /dev/vda*, /dev/vdb*, etc.

If your device is a pass-through device, you will need to know its device entry (probably /dev/hda*) and make it known to the Linux guest so it can boot.

Configuration file for VM hosting a Linux guest (example)

Below is an example of a *.qvmconf file for a Linux guest. Note the use of the reserve and rom options for the regions where OSs designed to run on x86 platforms expect to find a VGA device and the BIOS.

# A minimalist VM configuration for
# a Linux guest on an x86 system
ram 0,0xa0000
reserve loc 0xa0000,0x20000
rom 0xc0000,0x40000
ram 1m,1023 cpu
cpu
load ./linux
initrd load ./initrd.gz
cmdline "pmtmr=0
	nolapic_timer tasks=standard pkgsel/language-pack-patterns=
	pkgsel/install-language-support=false console=ttyS0,115200n8
	reboot=t root=/dev/vda1"
vdev ioapic
        loc 0xf8000000
        intr apic
        name myioapic
vdev ser8250
	intr myioapic:4
vdev timer8254
	intr myioapic:0
vdev mc146818
	reg 0x0b,0x02
vdev shmem
vdev virtio-net
        peer /dev/vdevpeers/vp0
		peerfeats 0x00007fc3
        loc pci:0:1
        name guest_to_host
vdev virtio-blk
        hostdev /dev/hd1t131
vdev pckeyboard
vdev 8259
	loc 0x20
vdev 8259
	loc 0xa0
vdev hpet
        loc 0xf8008000
        intr myioapic:0,myioapic:8,myioapic:10
pass loc pci:0:2.0=pci:0:2.0
pass loc pci:0x8086/0x5aa8
vdev pci-dummy clone pci:0:31.0

Building and including Android guests

To build an Android guest, you need:

Follow the outline instructions for building a Linux guest, adapted for your Android OS.

Note: Remember that your Android guest must be built for the architecture and board you are using, and that your hosting VM must be configured to match the guest's expectations.