Using the course virtual machine¶
The safe option for programming in this course is to use the course virtual machine. It contains the software required for the course and has been tested with the course exercises and development tools.
A virtual machine (VM) allows you to run another operating system inside your computer. The operating system of your physical computer is called the host, while the operating system running inside the virtual machine is called the guest.
In this course, we use VirtualBox as the virtualization environment.
The course virtual machine is based on the Linux Lite Linux distribution and includes the main software required for the course:
- C compiler (
gcc) - Code::Blocks
- Visual Studio Code and development extensions
- text editor
- Y86 assembly tools
- Git
- tools required later for programming the embedded device
The current software installed in the virtual machine, the download links and the version history can be found on Virtual machine: download and history.
Important: Files stored inside the virtual machines used on university workstations may be removed between sessions. Always keep a copy of your work outside the virtual machine.
Using the virtual machine¶
There are two main options:
- Use the virtual machine on a university workstation, where VirtualBox is already installed.
- Install VirtualBox on your own computer and use the same course virtual machine.
Using a university workstation¶
VirtualBox is already installed on the university workstations.
To use the course virtual machine:
- Download the latest virtual machine
.ovafile from Virtual machine: download and history. - If a copy is available on the university network, you can copy the
.ovafile from there instead of downloading it from the Internet. - Open VirtualBox.
- Import the
.ovafile. - Open the virtual machine settings and check that USB 3.0 is enabled under Settings > USB.
- Start the virtual machine.
You can now use the development tools installed in the Linux virtual machine.
Using the virtual machine on your own computer¶
You can also use the same course virtual machine on your own computer.
The course virtual machine is not supported on modern Mac computers.
You need to install:
- VirtualBox
- the VirtualBox Extension Pack
- the course virtual machine
- Guest Additions inside the virtual machine, if they are not already installed
1. Installing VirtualBox¶
Download and install VirtualBox for your operating system.
The VirtualBox manual contains additional installation information if needed.
2. Installing the VirtualBox Extension Pack¶
The VirtualBox Extension Pack is installed on the host computer and adds additional VirtualBox functionality. For this course, the most relevant feature is extended USB support.
- Go to the VirtualBox Downloads page.
- Download the VirtualBox Extension Pack corresponding to your VirtualBox installation.
- Open VirtualBox.
- Open Tools > Extensions.
- Select Install and choose the downloaded
.vbox-extpackfile. - Follow the installation instructions.
You can check that the Extension Pack is installed from:
Tools > Extensions
You can also normally install it by double-clicking the downloaded
.vbox-extpack file.The Extension Pack is installed on the host computer, not inside the virtual machine.
3. Importing the course virtual machine¶
Once VirtualBox and the Extension Pack are installed:
- Download the latest
.ovafile from Virtual machine: download and history. - Open VirtualBox.
- Import the
.ovafile. - Open Settings > USB and check that USB 3.0 is enabled.
- Start the virtual machine.
From this point, you can follow the same instructions as when using the virtual machine on a university workstation.
4. VirtualBox Guest Additions¶
Guest Additions are different from the Extension Pack.
Guest Additions are installed inside the guest operating system. They improve the integration between your computer and the virtual machine and enable features such as:
- shared folders
- shared clipboard
- drag and drop between host and guest
- improved display integration
If Guest Additions are already installed in the course virtual machine, you do not need to install them again.
If they are not installed, or the integration features are not working:
Start the course virtual machine.
From the VirtualBox window menu, select:
From the VirtualBox window menu, select:
Devices > Insert Guest Additions CD image...
The Guest Additions virtual CD will appear inside Linux.
- Open a terminal in the virtual machine.
- Navigate to the mounted Guest Additions CD.
- Run the Linux Guest Additions installer:
sudo sh ../VBoxLinuxAdditions.run
Restart the virtual machine after the installation.
On some Linux systems, additional packages required for building kernel modules may need to be installed before Guest Additions can be installed.
In short:
Extension Pack → installed on the host; provides additional VirtualBox functionality such as extended USB support.
Guest Additions → installed in the guest; provides better integration between the host and the virtual machine.
Guest Additions → installed in the guest; provides better integration between the host and the virtual machine.
Transferring files between systems¶
Files stored inside the virtual machine may be removed or become inaccessible when the virtual machine is reset, replaced or used on another computer. You should therefore keep your code outside the virtual machine as well.
There are several ways to transfer your code and other files between the host computer and the virtual machine.
Git¶
Git is the recommended option for this course.
Store your project in GitHub, GitLab or another Git service. You can then use
git pull and git push to move your work between computers while also keeping a remote copy of your code.You can also use the University of Oulu GitLab service at version.oulu.fi. It is only accessible from the university network or through VPN.
See Git Memo for the basic Git workflow used in this course.
Shared folders¶
VirtualBox can make a directory from the host computer directly accessible from the guest. This is useful if you repeatedly need to access the same files from both systems. Shared folders require Guest Additions inside the virtual machine. You can configure them from the virtual machine settings:
Settings > Shared Folders
Add a directory from your host computer and, if appropriate, enable Auto-mount.
Drag and drop / Copy and paste¶
If Guest Additions are installed, VirtualBox can also share files and clipboard contents directly between the host and guest.
To enable drag and drop:
Devices > Drag and Drop > Bidirectional
To enable copying and pasting:
Devices > Shared Clipboard > Bidirectional
These options are convenient, although they do not always work reliably.
USB drive or cloud storage¶
You can also transfer files using:
- a USB memory stick
- OneDrive
- Google Drive
- Dropbox
- email???
These methods work, but Git is normally a better choice for programming projects because it also provides version control.
SCP¶
You can also transfer files between the university Windows workstation and the virtual machine using
scp.On a university workstation, you can run
scp from Git Bash.To copy a file from the Windows host to the virtual machine:
scp -P 2222 <file_to_send> linuxlite@localhost:/path/to/destination
To copy a file from the virtual machine to the Windows host:
scp -P 2222 linuxlite@localhost:/path/to/file <destination>
You will need the password of the virtual-machine user. Ask the course staff if you do not know it.
Storing persistent files on university workstations¶
On university workstations, you can store files persistently on your
K: drive.