Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Ubuntu 22.04 #64

Merged
merged 9 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
47 changes: 27 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,54 +7,59 @@ The Bitcraze VM contains everything you need for running the Bitcraze projects a

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

* Xubuntu 20.04 pre-configured
* Ubuntu live server 22.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
* vscode prepared for compiling/debugging/flashing the Crazyflie firmware
* SDCC 3.2 for compiling of Crazyradio firmware


Downloading
-----------
## Downloading

The Bitcraze VM can be downloaded via the [Github Release Page](https://github.com/bitcraze/bitcraze-vm/releases)

Installing
----------
The virtual appliance can be imported into [VirtualBox](https://www.virtualbox.org/ "VirtualBox"). You will need the extention package of virtual box to be able to use the USB device. Go to [Oracles download page](https://www.oracle.com/virtualization/technologies/vm/downloads/virtualbox-downloads.html?msclkid=be59f68fcf9f11ec801dcf4ea944dd1d) to install both virtual box and the expansion pack.
## Installing

The virtual appliance can be imported into [VirtualBox](https://www.virtualbox.org/ "VirtualBox"). You will need the
extention package of virtual box to be able to use the USB device. Go to
[Oracles download page](https://www.oracle.com/virtualization/technologies/vm/downloads/virtualbox-downloads.html?msclkid=be59f68fcf9f11ec801dcf4ea944dd1d)
to install both virtual box and the expansion pack.

It can be used with other virtual machine manager however setting up the guest addition might be required. The following have been tested
It can be used with other virtual machine managers, 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
-------------------------
After importing just run the machine. It logs in automatically but use the following credentials if needed:
## Using the virtual machine

After importing just run the machine. Log in with the following credentials:
```
User: bitcraze
Pass: crazyflie
```

In the virtual machine double click the **“update all projects”** icon on the desktop. This pulls down the latest source code from GitHub for all projects.
In the virtual machine double click the **“update all projects”** icon on the desktop. This pulls down the latest source
code from GitHub for all projects.

install hardware
-------------------------
## install hardware

Insert Crazyradio PA in a USB port.
Insert game controller in a USB port.

Optimizing for Use
-------------------------
For faster USB connection with the Crazyradio PA it is advised to filter the USB device at startup of the VM. Go to *settings->USB*, make sure that USB 3.0 is enabled and add a USB device filter for the Crazyflie PA, which should be called 'Bitcraze Crazyradio PA USB Dongle [9955]'.
## Optimizing for Use

Also just to be sure, install the guest addition pack from inside the VM by typing:
`sudo apt-get install virtualbox-guest-additions-iso`
For faster USB connection with the Crazyradio PA it is advised to filter the USB device at startup of the VM. Go to
*settings->USB*, make sure that USB 3.0 is enabled and add a USB device filter for the Crazyflie PA, which should be
called 'Bitcraze Crazyradio PA USB Dongle [9955]'.

For the rest of the performance of your VM, you can try to increase the base memory (Settings/System/Motherboard), the CPU's available (Settings/System/Processor), enable hardware acceleration and select Hyper-V (Settings/System/Acceleration) or increase the video memory with 3D acceleration enabled (Settings/Display/Screen). This requires some adjusting as this could be different per system you are running the VM from.
For the rest of the performance of your VM, you can try to increase the base memory (Settings/System/Motherboard), the
CPU's available (Settings/System/Processor), enable hardware acceleration and select Hyper-V (Settings/System/Acceleration)
or increase the video memory with 3D acceleration enabled (Settings/Display/Screen). This requires some adjusting as
this could be different per system you are running the VM from.

# How to build the Bitcraze VM image

Expand All @@ -70,6 +75,8 @@ For the rest of the performance of your VM, you can try to increase the base mem
1. Run ```createBitcrazeVM.sh```
2. Wait 40-60 minutes depending on machine and internet connection speed

The resulting .ova can be found in `output-virtualbox-ovf/BitcrazeVM.ova`.

### What does createBitcrazeVM.sh do?
Run the two [Packer](https://www.packer.io) templates
* Create the VM and run a preseeded installation (```bitcrazeVM_createVM.json```)
Expand Down
75 changes: 43 additions & 32 deletions bitcrazeVM_createVM.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,59 @@
"builders": [
{
"boot_command": [
"<esc><wait>",
"install auto=true priority=critical url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/preseed.cfg ",
"<enter><wait>"
"<esc><esc><esc><esc>e<wait>",
"<del><del><del><del><del><del><del><del>",
"<del><del><del><del><del><del><del><del>",
"<del><del><del><del><del><del><del><del>",
"<del><del><del><del><del><del><del><del>",
"<del><del><del><del><del><del><del><del>",
"<del><del><del><del><del><del><del><del>",
"<del><del><del><del><del><del><del><del>",
"<del><del><del><del><del><del><del><del>",
"<del><del><del><del><del><del><del><del>",
"<del><del><del><del><del><del><del><del>",
"<del><del><del><del><del><del><del><del>",
"<del><del><del><del><del><del><del><del>",
"<del><del><del><del><del><del><del><del>",
"<del><del><del><del><del><del><del><del>",
"<del><del><del><del><del><del><del><del>",
"linux /casper/vmlinuz --- autoinstall ds=\"nocloud-net;seedfrom=http://{{.HTTPIP}}:{{.HTTPPort}}/\"<enter><wait>",
"initrd /casper/initrd<enter><wait>",
"boot<enter>",
"<enter><f10><wait>"
],
"boot_wait": "4s",
"disk_size": "30000",
"memory": "2048",
"cpus": "2",
"disk_size": "40000",
"format": "ova",
"guest_additions_mode": "disable",
"guest_os_type": "Ubuntu_64",
"hard_drive_interface": "sata",
"http_directory": "http",
"iso_checksum": "md5:e5bf713621b43207dead707396da29f6",
"iso_url": "http://archive.ubuntu.com/ubuntu/dists/focal/main/installer-amd64/current/legacy-images/netboot/mini.iso",
"iso_checksum": "sha256:a4acfda10b18da50e2ec50ccaf860d7f20b389df8765611142305c0e911d16fd",
"iso_url": "https://releases.ubuntu.com/22.04/ubuntu-22.04.3-live-server-amd64.iso",
"shutdown_command": "echo {{user `password`}} | sudo -S shutdown -P now",
"ssh_password": "{{user `password`}}",
"ssh_timeout": "10000s",
"ssh_username": "{{user `user`}}",
"ssh_timeout": "1h",
"ssh_handshake_attempts": 420,
"type": "virtualbox-iso",
"virtualbox_version_file": ".vbox_version",
"vboxmanage": [
[
"modifyvm",
"{{.Name}}",
"--memory",
"1024",
"--vram",
"16",
"--mouse",
"usbtablet",
"--rtcuseutc",
"on",
"--audio",
"pulse",
"--audiocodec",
"ad1980",
"--usb",
"on",
"--usbohci",
"on",
"--nestedpaging",
"off"
],
["modifyvm", "{{.Name}}", "--audio", "pulse"],
["modifyvm", "{{.Name}}", "--audiocodec", "ad1980"],
["modifyvm", "{{.Name}}", "--usb", "on"],
["modifyvm", "{{.Name}}", "--usb-xhci", "on"],
["modifyvm", "{{.Name}}", "--vrde", "off"],
["modifyvm", "{{.Name}}", "--nictype1", "virtio"],
["modifyvm", "{{.Name}}", "--memory", "2048"],
["modifyvm", "{{.Name}}", "--cpus", "2"],
["modifyvm", "{{.Name}}", "--vram", "64"],
["modifyvm", "{{.Name}}", "--graphicscontroller", "vmsvga"],
["modifyvm", "{{.Name}}", "--mouse", "usbtablet"],
["modifyvm", "{{.Name}}", "--nestedpaging", "off"],
["modifyvm", "{{.Name}}", "--nat-localhostreachable1", "on"],
[
"storageattach",
"{{.Name}}",
Expand All @@ -54,9 +66,8 @@
"on",
"--discard",
"on"
],
["modifyvm", "{{.Name}}", "--nat-localhostreachable1", "on"]
],
]
],
"vboxmanage_post": [
[
"modifyhd",
Expand Down
75 changes: 23 additions & 52 deletions bitcrazeVM_provisionVM.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,19 @@
"ssh_username": "{{user `user`}}",
"type": "virtualbox-ovf",
"vboxmanage": [
[
"modifyvm",
"{{.Name}}",
"--cpus",
"2",
"--memory",
"2048",
"--vram",
"16",
"--mouse",
"usbtablet",
"--rtcuseutc",
"on",
"--audio",
"pulse",
"--audiocodec",
"ad1980",
"--usb",
"on",
"--usbxhci",
"on",
"--nestedpaging",
"off",
"--graphicscontroller",
"vmsvga"
],
["modifyvm", "{{.Name}}", "--audio", "pulse"],
["modifyvm", "{{.Name}}", "--audiocodec", "ad1980"],
["modifyvm", "{{.Name}}", "--usb", "on"],
["modifyvm", "{{.Name}}", "--usb-xhci", "on"],
["modifyvm", "{{.Name}}", "--vrde", "off"],
["modifyvm", "{{.Name}}", "--nictype1", "virtio"],
["modifyvm", "{{.Name}}", "--memory", "2048"],
["modifyvm", "{{.Name}}", "--cpus", "2"],
["modifyvm", "{{.Name}}", "--vram", "64"],
["modifyvm", "{{.Name}}", "--graphicscontroller", "vmsvga"],
["modifyvm", "{{.Name}}", "--mouse", "usbtablet"],
["modifyvm", "{{.Name}}", "--nestedpaging", "off"],
["modifyvm", "{{.Name}}", "--nat-localhostreachable1", "on"],
[
"storageattach",
"{{.Name}}",
Expand All @@ -48,52 +35,36 @@
"on",
"--discard",
"on"
],
["modifyvm", "{{.Name}}", "--nat-localhostreachable1", "on"]
]
],
"virtualbox_version_file": ".vbox_version",
"vm_name": "{{user `vm-name`}}"
}
],
"provisioners": [
{
"destination": "/home/bitcraze/update_all_projects.sh",
"source": "{{user `contentDir`}}/update_all_projects.sh",
"destination": "/home/bitcraze/update_all_projects.sh",
"type": "file"
},
{
"destination": "/home/bitcraze/Desktop",
"source": "{{user `contentDir`}}/desktop/",
"type": "file"
},
{
"destination": "/home/bitcraze/Pictures",
"source": "{{user `contentDir`}}/pictures/",
"type": "file"
},
{
"destination": "/home/bitcraze/{{user `gccFile`}}",
"source": "{{user `contentDir`}}/{{user `gccFile`}}",
"type": "file"
},
{
"destination": "/home/bitcraze/{{user `eclipseFile`}}",
"source": "{{user `contentDir`}}/{{user `eclipseFile`}}",
"source": "{{user `contentDir`}}/Desktop",
"destination": "/home/bitcraze",
"type": "file"
},
{
"destination": "/home/bitcraze/{{user `eclipsePrj`}}",
"source": "{{user `contentDir`}}/{{user `eclipsePrj`}}",
"source": "{{user `contentDir`}}/Pictures",
"destination": "/home/bitcraze",
"type": "file"
},
{
"destination": "/home/bitcraze/{{user `openocd`}}",
"source": "{{user `contentDir`}}/{{user `openocd`}}",
"type": "file"
"execute_command": "echo '{{user `password`}}' | {{ .Vars }} sh '{{ .Path }}'",
"script": "provision.sh",
"type": "shell"
},
{
"execute_command": "echo '{{user `password`}}' | {{ .Vars }} sudo -E -S sh '{{ .Path }}'",
"script": "provision.sh",
"script": "provision-sudo.sh",
"type": "shell"
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,17 @@ The virtual machine
* The username is: bitcraze
* The password is: crazyflie
* The virtual machine has 30GB drive and 2 GB of RAM
* The virtual machine is using Xubuntu 20.04 LTS Core (minimal) install.
* The virtual machine is using Ubuntu Live Server 22.04 LTS install.

Installed software
------------------
Here is a non-exhaustive list of what's included:
* Xubuntu 20.04 pre-configured
* Ubuntu 22.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
* vscode prepared for compiling/debugging/flashing the Crazyflie firmware
* SDCC 3.2 for compiling of Crazyradio firmware

Expand All @@ -35,7 +34,7 @@ repos: https://github.com/bitcraze/bitcraze-vm/tree/master/provision.sh

Projects
--------
The following projects have been pre-cloned into the /home/bitcraze/projects
The following projects have been pre-cloned into the /home/bitcraze/projects
directory:
* crazyflie-pc-client
* crazyflie-firmware
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,17 @@
Name=Visual Studio Code
Comment=Code Editing. Redefined.
GenericName=Text Editor
Exec=/usr/share/code/code --no-sandbox --unity-launch %F
Icon=/usr/share/pixmaps/com.visualstudio.code.png
Exec=code --force-user-env --unity-launch %F
Icon=/snap/code/current/meta/gui/vscode.png
Type=Application
StartupNotify=false
StartupWMClass=Code
Categories=Utility;TextEditor;Development;IDE;
Categories=TextEditor;Development;IDE;
MimeType=text/plain;inode/directory;application/x-code-workspace;
Actions=new-empty-window;
Keywords=vscode;

X-Desktop-File-Install-Version=0.24

Path=
Terminal=false

[Desktop Action new-empty-window]
Name=New Empty Window
Exec=/usr/share/code/code --no-sandbox --new-window %F
Icon=com.visualstudio.code
Exec=code --force-user-env --new-window %F
Icon=/snap/code/current/meta/gui/vscode.png
24 changes: 24 additions & 0 deletions contentForVM/Desktop/org.gnome.Terminal.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[Desktop Entry]
Name=Terminal
Comment=Use the command line
Keywords=shell;prompt;command;commandline;cmd;
TryExec=gnome-terminal
Exec=gnome-terminal
Icon=org.gnome.Terminal
Type=Application
Categories=GNOME;GTK;System;TerminalEmulator;
StartupNotify=true
StartupWMClass=Gnome-terminal
SingleMainWindow=false
OnlyShowIn=GNOME;Unity;
Actions=new-window;preferences;
X-ExecArg=--
X-Ubuntu-Gettext-Domain=gnome-terminal

[Desktop Action new-window]
Name=New Window
Exec=gnome-terminal --window

[Desktop Action preferences]
Name=Preferences
Exec=gnome-terminal --preferences