TotalTaxAmount / roborio-vm

Scripts to create QEMU virtual machine from the RoboRIO image file
4 stars 1 forks source link

QEMU RoboRIO ARM Virtual Machine

This is a set of scripts that extracts the files for National Instruments Real Time Linux from the RoboRIO image zipfile, creates an image from them, and provides a script that allows you to run them via the QEMU emulator.

What can you use this for? Well, if you need to compile packages that are difficult to cross compile or build on a resource constrained system, or do testing that requires an ARM platform but does not require actual NI hardware.. this might be for you.

Tested with:

It probably works on other Linux distributions, and may even work with OSX if you adjust the scripts to work there.

Requirements

For creating an image:

For running the created image:

Creating the Virtual Machine root filesystem

First, you need the image zipfile that is distributed with the FRC Update Suite. On a windows machine with the RoboRIO imaging program installed, you can find it at:

C:\Program Files (x86)\National Instruments\LabVIEW 2015\project\roboRIO Tool\FRC Images

Copy the zipfile to your Linux host, and run the following:

sudo ./create_rootfs.sh /path/to/FRC_roboRIO_*.zip

Give it a few minutes, enter in your password when prompted, and at the end you should end up with an image file and a kernel file. This only needs to be done once.

Running the Virtual Machine

Simple command (remove not_build if you are using a custom version of qemu):

./run_vm.sh not_build

At the moment there are a lot of error messages, but eventually it will finish starting and you can login via the console or via SSH.

To SSH into your VM, you can execute the following:

ssh admin@localhost -p 10022

Or, you can setup an SSH alias by adding this to .ssh/config:

Host roborio-vm
  User admin
  Hostname 127.0.0.1
  Port 10022

Then you can login using the following:

ssh roborio-vm

Snapshots

QEMU has good support for snapshots and other such things. When the rootfs is created, an initial snapshot is created in case you want to revert the VM back to a 'pristine' state. To do so:

qemu-img snapshot -a initial roborio.img

There is now also a reset.sh command that you can run to do this.

Known issues

Building QEMU from source

Download latest version of QEMU, and...

tar -xf qemu-2.6.1.tar.bz2
cd qemu-2.6.1
mkdir build
cd build
../configure --target-list=arm-softmmu --enable-fdt
make
make install

Versions of QEMU that I've had work for me:

Versions known to not work:

Contributing new changes

This is intended to be a project that all members of the FIRST community can quickly and easily contribute to. If you find a bug, or have an idea that you think others can use:

  1. Fork this git repository to your github account
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push -u origin my-new-feature)
  5. Create new Pull Request on github

Authors

These scripts are not endorsed or associated with Xilinx, FIRST Robotics, or National Instruments.