Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/bitcraze/bitcraze-vm
Browse files Browse the repository at this point in the history
  • Loading branch information
ataffanel committed Apr 8, 2021
2 parents 87f3871 + b0754c7 commit 3bcc755
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 115 deletions.
79 changes: 19 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,47 +5,35 @@ It's also used for tracking issues and improvements.

The Bitcraze VM contains everything you need for running the Bitcraze projects and doing development for them. It's a great way to quickly get started without having the hassle of installing dependencies and setting up the development environment.

Here is a list of what's included:
Here is a non-exhaustive list of what's included:

* Xubuntu 14.04.4 pre-configured
* Xubuntu 20.04 pre-configured
* VirtualBox guest additions pre-installed
* UDEV rules and pre-configured USB filtering for the Crazyradio and it's bootloader (NRF BOOT)
* udev rules and pre-configured USB filtering for the Crazyradio and it's bootloader (NRF BOOT)
* Most of our projects pre-cloned
* gnu-arm-none-eabi toolchain and build tools
* pyusb, pygame and pyqt
* PyQtGraph
* Qt4 and QtDesigner
* QTCreator
* Firefox
* KiCad
* Eclipse for compiling/debugging/flashing (pre-configured for BusBlaster)
* gedit
* vscode prepared for compiling/debugging/flashing the Crazyflie firmware
* SDCC 3.2 for compiling of Crazyradio firmware
* EmbSys RegView for Eclipse

For more info see our [wiki](https://wiki.bitcraze.se/projects:virtualmachine:index/ "Bitcraze VM Wiki").

# How to build the Bitcraze VM

## Pre-requisites

* This script has only been tested on a Linux machine, therefore it's recommended to use Linux to build the Bitcraze VM
* VirtualBox must be installed (tested with version 5.0.14)
* VirtualBox must be installed as well as the VirtualBox Extension Pack
* [Packer](https://www.packer.io) (can be installed with `apt install packer`)

## Local build

1. Run ```createBitcrazeVM.sh```
2. Wait 40-60 minutes depending on machine and internet connection speed

### What does createBitcrazeVM.sh do?

1. Download the ISO file (currently Xubuntu-14.04.4-desktop-i386.iso) if it does not already exist.
2. Download the following files if they do not already exist:
* ```gcc-arm-none-eabi-<version>-linux.tar.bz2```
* ```eclipse-cpp-<version>-linux-gtk.tar.gz```
* ```pycharm-community-<version>.tar.gz```
3. Install [Packer](https://www.packer.io) if it is not already installed.
4. Run the two [Packer](https://www.packer.io) templates
* Create the VM and run a preseeded installation (```bitcrazeVM_xubuntu-14.04.4-desktop_createVM.json```)
* Provision the VM (```bitcrazeVM_xubuntu-14.04.4-desktop_provisionVM.json```)
Run the two [Packer](https://www.packer.io) templates
* Create the VM and run a preseeded installation (```bitcrazeVM_createVM.json```)
* Provision the VM (```bitcrazeVM_provisionVM.json```)

### Why are there two packer templates?

Expand All @@ -55,44 +43,14 @@ This saves a lot of time.

### What do the packer templates do?

#### bitcrazeVM_xubuntu-14.04.4-desktop_createVM.json
#### bitcrazeVM_createVM.json

1. Create a VirtualBox image
1. Download an ISO and create a VirtualBox image
2. Start the so-called "preseeding", which automatically runs the Ubuntu installer
3. Export VM image to OVA file

#### bitcrazeVM_xubuntu-14.04.4-desktop_provisionVM.json

1. Copy the following files into the VirtualBox image:
* Desktop shortcuts and readme file
* Desktop background image and Crazyflie client icon
* Update script (```update_all_projects.sh```)
* GCC ARM toolchain (```gcc-arm-none-eabi-<version>-linux.tar.bz2```)
* Eclipse (```eclipse-cpp-<version>-linux-gtk.tar.gz```)
* PyCharm (```pycharm-community-<version>.tar.gz```)
2. Provision the image (```provision.sh```)
* Install packages
* Install VirtualBoxGuestAdditions
* Add udev rules for Crazyradio and Crazyflie
* Clone the Bitcraze Git repositories
* Setup GCC ARM toolchain
* Extract PyCharm and Eclipse
* Setup update script
* Set desktop background image
* Clean up VM image
* Export VM image to OVA file

### What needs to be done after the VM has been created and provisioned?

Some steps still have to be done manually:

1. Import the generated OVA file (e.g. ```output-virtualbox-ovf/BitcrazeVM.ova```) into VirtualBox (File -> Import appliance...)
2. Start the Bitcraze VM
3. Open a terminal
4. Setting up PyCharm
* Run ```pycharm.sh``` to set up PyCharm (installs start menu entry and desktop shortcut?)
5. Setting up Eclipse (Work in progress)
* See the [Bitcraze VM wiki](https://wiki.bitcraze.io/projects:virtualmachine:create_vm#setting_up_eclipse) for more information
#### bitcrazeVM_provisionVM.json
Copy the files specified in the JSON template to the VM and run the `provision.sh` script so setup the image.

### Help! Something does not work.

Expand All @@ -107,10 +65,11 @@ The Bitcraze VM can either be downloaded via torrent or via direct download.

Installing
----------
The virtual appliance can be imported into the virtual machine manager of your choice:
The virtual appliance can be imported into [VirtualBox](https://www.virtualbox.org/ "VirtualBox").

* [VirtualBox](https://www.virtualbox.org/ "VirtualBox")
It can be used with oter virtual machine manager however setting up the guest addition might be required. The following have been tested

* [Gnome Boxes](https://wiki.gnome.org/Apps/Boxes)
* [VM Player](http://www.vmware.com/products/player/ "WM Player")

Using the virtual machine
Expand All @@ -121,4 +80,4 @@ User: bitcraze
Pass: crazyflie
```

For more information on debugging, building, flashing and updating to the latest version have a look at the [Bitcraze VM Wiki](http://wiki.bitcraze.se/projects:virtualmachine:index/ "Bitcraze VM Wiki")
For more information on debugging, building, flashing and updating to the latest version have a look at our [Documentation](https://www.bitcraze.io/documentation/tutorials/getting-started-with-crazyflie-2-x/#inst-comp "Getting started with the Crazyflie 2.X")
72 changes: 17 additions & 55 deletions contentForVM/desktop/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,33 @@ The purpose of this virtual machine is to quickly get started with development
and usage of various Bitcraze projects. It has all of the requirements for
running and developing pre-installed as well as some other useful tools.

NOTE: This file contains instructions on how to do some common tasks. These may
change over time so please have a look at http://wiki.bitcraze.se for up-to-date
instructions.
For more information about how to get Started with the Crazyflie and other
Bitcraze project, you can look at https://bitcraze.io/start.

The virtual machine
-------------------

* The username is: bitcraze
* The password is: crazyflie
* The virtual machine has 30GB drive and 1 GB of RAM
* The virtual machine is using Xubuntu 14.04.4 LTS
* The virtual machine has 30GB drive and 2 GB of RAM
* The virtual machine is using Xubuntu 20.04 LTS Core (minimal) install.

Installed software
------------------
The following software has been pre-installed (besides basic setup)
* Virtualbox guest additions
* gnu-arm-none-eabi and build tools
* Git
* gitg
* PyCharm
* Oracle Java JRE (for PyCharm)
* pyusb, pygame and pyqt
* PyQtGraph
* Qt4 and Qt Designer
* KDE Marble with Python-bindings
Here is a non-exhaustive list of what's included:
* Xubuntu 20.04 pre-configured
* VirtualBox guest additions pre-installed
* udev rules and pre-configured USB filtering for the Crazyradio and it's bootloader (NRF BOOT)
* Most of our projects pre-cloned
* QTCreator
* Firefox
* KiCad
* Eclipse with compiling/debugging/flashing
* Leafpad
* EmbSys RegView for Eclipse
* dfu-util
* vscode prepared for compiling/debugging/flashing the Crazyflie firmware
* SDCC 3.2 for compiling of Crazyradio firmware

System tweaks
-------------
The udev rules to access the Crazyradio and the NRF bootloader have been added
to the udev configuration. They have also been added to the Virtual Box pre-set
filters.
For a more detailed description of what is being installed on top of an Xubuntu
core install, you can look at the provision.sh script in the Bitcraze VM git
repos: https://github.com/bitcraze/bitcraze-vm/tree/master/provision.sh

Projects
--------
Expand All @@ -59,15 +50,10 @@ How to run the Crazyflie PC client
----------------------------------
The Crazyflie PC client can be run by using the following command:

python3 /home/bitcraze/projects/crazyflie-pc-client/bin/cfclient
python3 -m cfclient.gui

Or by using the shortcut on the desktop.

PLEASE NOTE!! If no other input device is passed to the VM the
"VirtualBox USB Tablet" device will be used. Do not connect to the Crazyflie
using this device, since the thrust will then be controlled by the mouse
movements on the screen.

How to update to the latest versions of the repositories
--------------------------------------------------------
Updating to the latest versions of all the repositories can be done
Expand All @@ -76,27 +62,3 @@ by using the following command:
/home/bitcraze/bin/update_all_projects.sh

Or using the shortcut on the desktop.

How to update the Crazyradio firmware
-------------------------------------
Download the latest firmware and run the following commands:

cd /home/bitcraze/projects/crazyradio-firmware
python usbtools/launchBootloader.py

If you have not activated the USB filter for the NRF bootloader, pass the newly
found "NRF BOOT" USB device to the virtual machine and then run the following
command:

python usbtools/nrfbootload.py flash new_firmware_file.bin

How to build the Crazyflie firmware
-----------------------------------
A version of the Crazyflie firmware that is upgradable using the Crazyradio
bootloader can be built using the following commands:

cd /home/bitcraze/projects/crazyflie-firmware
make CLOAD=1 DEBUG=0

This firmware can then be downloaded to the Crazyflie using the cfclient or the
"Flash using radio" make target in Eclipse.

0 comments on commit 3bcc755

Please sign in to comment.