VM: QEMU: Running DragonOS inside a VM with SDR Capability

In this guide we run DragonOS inside the QEMU environment and test out SDR dongle capabilities.

VM: QEMU: Running DragonOS inside a VM with SDR Capability
Linux Rocks Every Day

In the above example we have DragonOS running inside Backbox (while the SDR Software-Defined-Radio dongle is playing FM radio..) Nice!  DragonOS is loaded in RF tools, and will require some study in terms of all the stuff it can do. For now we have our standard entry-level dongle.   Running DragonOS in a VM has some real advantages.

  • We do not have to worry about hard drive splitting and grub configs
  • QEMU is natively quick enough to run this VM with SDR processing. Don't bother trying with virtual box or other junk VM sims they cannot compare.

Please note: When DragonOS installs it seems to always have some slow boot times with blank screens.  Since Backbox is effectively Ubuntu anyone running flavor Ubuntu can follow:

Give your machine  the usual update:

sudo apt update -y && sudo apt upgrade -y

Now install your qemu

sudo apt install qemu-kvm virt-manager virtinst libvirt-clients bridge-utils libvirt-daemon-system -y

qemu - quick emulator is crazee powerful - but it requires some expertise in the command-line.  To make this easy lets break this down into three easy steps.

  1. Make your qemu drive:
qemu-img create disk.img 60G

It will make a raw format (very-fast) 60 Gigabyte image.

2. Now you want to go find the DragonOS ISO. (here) Because it looks like at this time it's very popular sadly this took me overnight to download..

Once you finally have it you can use a typical iso burner to burn and boot it to a USB (if you are in Windows)  From there you can boot it and run it off your USB stick.

3. Now that you have your .iso downloaded (and this will work for any x86 iso really) you want to make two files we will make executable boot.sh and run.sh

  • boot.sh will be for the initial installation of DragonOS to the disk.img
  • Put the following inside it.
  • --enable-kvm will enable kvm mode for most newer CPU's, and may need enabling inside your bios.  It makes a major difference in speed and performance.
  • - boot d -cdrom bb.iso  We are specifying that we want this VM to book the bb.iso of the virtual -cdrom (in DragonOS case it will be much longer iso filename.  (It is easier to just rename your file to bb.iso)
  • -m 8G  Assign 8G of ram to this VM.
  • -drive format=raw,file=disk.img  We are specifying a drive of format raw, and the file that will make this drive will be disk.img
  • -smp 6  Give this VM 6 virtual symmetrical processors. It it wise to leave the 'father' OS at least 2 cores so it does not freeze above it.
qemu-system-x86_64 --enable-kvm -boot d -cdrom bb.iso -m 8G -drive format=raw,file=disk.img -smp 6
chmod +x boot.sh

And to run it from your local directory you need to preceed it with a ./

./boot.sh

You will get their booting logo:

You will now have a virtual DragonOS in a window in your screen! Remember we are running the virtual .iso file booted similar to live-usb we will need to install it.

Clicking the Install DragonOS FocalX:

And language settings:

It has been my experience that downloading vendor software can give you headaches I leave it checked off:

Which drive to install?

Note!  QEMU only allows the VM to see the virtual 60G disk.img that you gave it you are safe to wipe and reinstall it as you please - it is a VM.

Set your time zone:

Now you must create one user for this VM - it will have superuser privileges by default:

After that it is a matter of watching it install:

Finally we can reboot.

Part II: run.sh

Now for the run.sh script we can set as:

qemu-system-x86_64 --enable-kvm -m 8G -drive format=raw,file=disk.img -smp 6 -soundhw all -vga virtio -device usb-ehci,id=ehci -device usb-host,hostbus=5,hostaddr=3

--enable-kvm : Again enabling kvm allows proper cpu virtualization

-m 8G : Set for 8G of ram

-drvie format=raw,file=disk.img   : We are using the disk.img in mode raw.

-smp 6  : dedicate 6 cores to this VM

-soundhw all  : enable all sound cards / devices available

-vga virtio : Use the virtual driver

-device usb-ehci,id=ehci:  We are telling QEMU to map the ehci USB 2.0 controller to the VM under the label ehci

-device usb-host,hostbus=5,hostaddr=3 : This is giving the VM access to the RealTek dongle.

?? How did we know that?

lsusb

We can see Bus 005 Device 003.  This was initially confusing because the actual USB address is 0bda:2838 (but don't put that just the 3 from Device 003.

Linux Rocks Every Day