Building a virtual machineA virtual machine (VM) is a completely isolated guest operating system installation within a normal host operating system. Modern virtual machines are implemented with either software emulation or hardware virtualization or (in the most cases) both together.
Wouldn't it be nice to put everything we have done so far in a virtual machine and run it on any computer we like (my MacBook Pro for example). Let us find out if it is possible. We will start by choosing a virtualization product.
Choosing a virtualization product
There are several virtualization products to choose from. Here are four examples:
After taking a closer look at the alternatives I decided to go for VirtualBox.
VirtualBox is a powerful x86 and AMD64/Intel64 virtualization product for enterprise as well as home use. Not only is VirtualBox a feature rich, high performance product for enterprise customers, it is also the only professional solution that is freely available as Open Source Software under the terms of the GNU General Public License (GPL) version 2. Here is the User Guide and here are some How To tutorials.
Installing VirtualBoxFor information on how to install and setup VirtualBox see Using VirtualBox Part 1-3 in this blog.
We will install Debian 6.0.3 (Squeeze) in our virtual machine. For more information see www.debian.org. We are free to use any other Linux OS we prefer, but it will be harder to follow this guide with another Linux OS running. Both Xilinx and PetaLogix are recommending RedHat Enterprise or Cent OS.Fixes to Debian 6.0.3
The Debian installation will not work right out of the box. Here are a few things we have to fix:
- Changing default shell
- Adding missing packages
- Adding gmake
- Replace Acroread PDF reader
Changing default shellDebian uses dash as their default shell. Most of the PetaLogix scripts are written to use bash as the default shell. You can find out what the default shell is by executing the following command:
--> ls -al /bin/sh
If the /bin/sh links to dash use this command to change from dash to bash:
--> sudo dpkg-reconfigure dash
Adding missing packages
The Debian OS doesn't include all the software we need but it can easily be added using the command: sudo apt-get install <package>. Here is one example:
--> sudo apg-get install gawk
PetaLogix and Xilinx uses gmake for running their makefiles. Debian call their the gmake program make. To add the gmake program we just execute the following command:
--> sudo ln -s /usr/bin/make /usr/bin/gmake
Xilinx supports only the Acroread program for displaying PDF files. Acroread is not installed in Debian and is not part of the normal repository. Instead we can use evince or xpdf.
--> sudo ln -s /usr/bin/evince /usr/bin/acroread
Connecting USB ports
Our LX9 MicroBoard has two USB ports. They are recognized by their names and when we connect our board to the host computer they will show up in the VirtualBox USB settings window. We will add them to the USB Device Filter list (click the icon with the + to the right) which will make the USB ports always connected in our virtual machine.
Shared folders makes it possible to move files between our host computer and the guest. We will setup a directory called Shared that will be shared with our guest OS.
We will use the Bridged Adapter network setup. More information about networking will follow later on in this tutorial.
Use this command to start VirtualBox:
--> virtualbox &
Select the virtual machine to run and click the Start button. This is what it looks like when the Debian Linux is running in our virtual machine.
Installing Xilinx Design Suite
We will install the lastest version of Design Suite (13.3). Follow the instruction in part 51 to install the Xilinx software.
Installing PetaLinux SDK
Follow the instruction in part 73 to install the PetaLinux SDK.
Setting up TFTP and NFS servers
Follow the instruction in part 74 to install and start TFTP and NFS servers.
Mounting shared file system
Use the following command to mount the shared file system in directory Host in our guest OS:
--> sudo mount -t vboxsf -o uid=1000,gid=1000 Shared ~/Host
Fixing problems with permissions
I ran into some problems when using the usb ports from the guest OS. I don't really understand why but here are some fixes to the problems. There may be other ways to solve it.
When trying to connect to ttyUSB0 I got the following error message. There seems to be some problems with the file permissions.
This is what the file permissions looks like for the file ttyUSB0:
One easy fix is to add us to the unix group dialout. Let's open System->Administration->Users and Groups:
Click Manage Groups and select dialout.
Click the Properties button and mark our name . We must have root permissions.
Click OK and we are done. Logout and login for the changes to take affect.
Adding a group using a Linux command
There is a much easier way using the usermod command:
--> sudo /usr/sbin/usermod -a -G dialout svan
When starting iMPACT we get the following error message:
Starting with 10.1 Service Pack 1, the libusb package can be used to connect to the Platform Cable USB on the Linux platforms. This package replaces the functionality provided by the Jungo windrvr6 module. The use of libusb provides an alternative approach for users who encounter problems during the building and installation of the existing driver solution.
Here is a listing of the USB device nodes. We have no write permission.
Writing udev rules
udev is targeted at Linux kernels 2.6 and beyond to provide a userspace solution for a dynamic /dev directory, with persistent device naming. The previous /dev implementation, devfs, is now deprecated, and udev is seen as the successor. The udev rules can be found in the directory: /etc/udev/rules.d
Editing udev rules
The rules file for our JTAG to USB connection is called 52-diligent-usb.rules. We will edit this file and add a group statement (GROUP="plugdev") like this:
After restarting our guest the permission looks like this:
Running Xilinx Platform Studio XPS
We can configure the FPGA from XPS.
PetaLinux console in the virtual machine
We will start GTKterm and setup the port configuration. When we press the program button on the MicroBoard the PetaLinux will boot and display the login screen on the console in the virtual machine.
Writing our first application program
Follow the instructions in part 77-78 on how to write an application program in c.
Explore new things
Our virtual machine is up and running. We are all set and ready for new adventures.
Top Previous Next