Skip to content

Instantly share code, notes, and snippets.

@jnaulty
Forked from tcr/Vagrantfile
Created November 29, 2015 02:39
Show Gist options
  • Save jnaulty/e04e10642bd6d43bf991 to your computer and use it in GitHub Desktop.
Save jnaulty/e04e10642bd6d43bf991 to your computer and use it in GitHub Desktop.
tessel 2 openwrt in packer

More notes

To release OSX of a CDC device (like Arduino)

sudo kextunload -b com.apple.driver.AppleUSBCDCECMData
sudo kextunload -b com.apple.driver.AppleUSBCDCACMControl
sudo kextunload -b com.apple.driver.AppleUSBCDCACMData
sudo kextunload -b com.apple.driver.AppleUSBCDCWCM
sudo kextunload -b com.apple.driver.AppleUSBCDC

To list USB devices virtualbox can forward:

VBoxManage list usbhost
{
"variables": {
},
"builders": [{
"boot_wait": "15s",
"boot_command": [
"<enter><wait>",
"passwd <<EOF<enter>tessel2<enter>tessel2<enter>EOF<enter>",
"sed -e '20,22c\\<enter> option input ACCEPT\\<enter> option output ACCEPT\\<enter> option forward ACCEPT' /etc/config/firewall > /root/firewall.tmp<enter>",
"mv /root/firewall.tmp /etc/config/firewall<enter>",
"fsync /etc/config/firewall<enter>",
"sed -e '9,9c\\<enter> option ifname eth1' /etc/config/network > /root/network.tmp<enter>",
"sed -e '17,17c\\<enter> option ifname eth0' /root/network.tmp > /root/network.tmp2<enter>",
"mv /root/network.tmp2 /etc/config/network<enter>",
"fsync /etc/config/network<enter>",
"/etc/init.d/network restart<enter>",
"printf \"#!/bin/ash\\npoweroff\\n\" > /usr/bin/shutdown<enter>",
"chmod +x /usr/bin/shutdown<enter>",
"opkg update<enter>",
"opkg install sudo<enter>"
],
"vboxmanage": [
["modifyvm", "{{.Name}}", "--nic1", "nat"],
["modifyvm", "{{.Name}}", "--nic2", "none"]
],
"type": "virtualbox-ovf",
"source_path": "tessel2-2015-03-10.ova",
"guest_additions_mode": "disable",
"ssh_username": "root",
"ssh_password": "tessel2",
"ssh_wait_timeout": "300s",
"shutdown_command": "<wait5>poweroff<enter>"
}],
"post-processors": [{
"type": "vagrant"
}]
}
# building
packer build packer.json
# older versions
vagrant box remove technicalmachine/tessel2
vagrant up
vagrant ssh
# type "tessel2" as the password
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.ssh.username = "root"
config.ssh.password = "tessel2"
config.ssh.shell = "ash"
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.box = "technicalmachine/tessel2"
# Add usb filter for Arduino
config.vm.provider :virtualbox do |vb|
vb.customize ['modifyvm', :id, '--usb', 'on']
vb.customize ['usbfilter', 'add', '0', '--target', :id, '--name', 'Arduino', '--vendorid', '0x2341', '--productid', '0x0043']
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment