forked from MamMark/ubuntu_dev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path01_Update_VM_Boxes
242 lines (205 loc) · 8.08 KB
/
01_Update_VM_Boxes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
# ubuntu_dev/ - Contains Vagrantfiles for building Linux VM machines for software development
Three primary boxes are built for development purposes:
1. Basic
2. arm_msp
3. tag_dev
x. msp430 (used to get built, now deprecated)
These boxes represent three stages of operating system libraries and
development tools integration. Basic includes the base operating system and
much of the additional linux packages added. Currently, we only install the
toolchain for the TI MSP432 and ARM Cortex-M4F based processor.
(The previous cpu, the msp430, has been deprecated).
The tag_dev VM uses the arm_msp box and builds a default environment that
can be used for tag development. It uses default dot-files and installs
the two development repositories in a well known location.
## The following directories build machines
#### basic/ For building Linux from bento/ubuntu-16.04 64 bit box image to
include libraries needed for the project (note: ubuntu/xenial64 and
cloud-images.ubuntu.com/xenial images were not functional as of Dec 1st,
2016)
#### msp430/ DEPRECATED
For building TI-MSP430 software, including Vagrantfiles and other scripts
#### arm_msp/
For building TI-MSP432 (ARM Cortex-M4F) software.
#### common/
Common scripts and other shared files
#### tag_dev
Template for default development environment.
## General Notes
dkms
apt-get install dkms
VirtualBox
VirtualBox ExtPack
VirtualBox Guest Additions
https://www.virtualbox.org/wiki/Linux_Downloads
vagrant https://releases.hashicorp.com/vagrant/
vagrant-vbguest
vagrant plugin install vagrant-vbguest
### Install current version of VirtualBox
### Add these Vagrant plugins
```
vagrant plugin install vagrant-vbguest
```
### Published vagrant boxes can be found on http://tinyprod.net/boxes/
### Example on how to install a previously built and published box
```
curl -O -L "http://tinyprod.net/boxes/ubuntu_dev-arm_msp_2017-08-05.box"
vagrant box add ubuntu_dev/arm-msp ubuntu_dev-basic_2017-08-05.box --force
```
vagrant box add http://tinyprod.net/boxes/ubuntu_dev-arm_msp.json
```
**NOTE: when using Apple MAC OSX for host machine, care needs to be taken
with file names since MAC has case-insensitive naming but Linux is
case-sensative.**
### Uploading new box images requires an account on tinyprod.net that has
write permission to the boxes directory.
```
### Global provisioning statements are added to your ~/.vagrant.d/Vagrantfile
See https://github.com/geerlingguy/drupal-vm/issues/681 for bogus tty error msg workaround
```
Vagrant.configure("2") do |config|
config.vm.boot_timeout = 700
# Fixes "stdin: is not a tty" and "mesg: ttyname failed : Inappropriate ioctl for device" messages --> mitchellh/vagrant#1673
device.vm.provision :shell , inline: "(grep -q 'mesg n' /root/.profile && sed -i '/mesg n/d' /root/.profile && echo 'Ignore the previous error, fixing this now...') || exit 0;"
# ... other stuff
end
```
###
User should explicitly set the timezone for the VM.
tag-dev by default sets the timezone to the west coast of the United
States. If you need a different timezone, change America/Los_Angeles
to the appropriate Ubuntu timezone selection.
```
$set_timezone = <<SCRIPT
/bin/rm -f /etc/localtime
echo America/Los_Angeles > /etc/timezone
dpkg-reconfigure --frontend noninteractive tzdata
SCRIPT
```
The following line then invokes the above script.
```
config.vm.provider "virtualbox" do |vb, override|
override.vm.provision :shell, inline: $set_timezone
end
```
## Managing Vagrant Boxes
Provides instructions on how to build and publish boxes for use by others.
### Instructions to make the Vagrant boxes The following instructions can
be used to create a box defined for development purposes and made available
on tinyprod.net for general user access. A box can be used by a tag-dev
Vagrantfile or other Vagrantfiles as their starting point.
#### variables for boxing ubuntu_dev-basic
```
export INAME=basic
```
#### variables for ubuntu_dev-msp430
```
export INAME=msp430
```
#### Variables for ubuntu_dev-arm_msp
```
export INAME=arm_msp
```
### General boxing rules using variables for specific box definition
The following rules are used to create a box.
#### Package new box and add it to local repo.
```
if [ ! -e ~/Boxes ] ; then mkdir ~/Boxes ; fi
export BASE_NAME=ubuntu_dev-$INAME
export TARGET=~/Boxes
export IMAGE_NAME=$BASE_NAME.`date +%Y-%m-%d`
export OBOX=$TARGET/$IMAGE_NAME.box
export OSUMS=$TARGET/$IMAGE_NAME.sha256
rm -f {$OBOX,$OSUMS}
vagrant destroy -f
vagrant up --provider=virtualbox
vagrant package --output $OBOX
export CHECKSUM=`shasum -a 256 $OBOX`
echo $CHECKSUM >> $OSUMS
echo $CHECKSUM
<<fix up the json file, see below>>
scp -P 23456 {$BASE_NAME.json,$OSUMS,$OBOX} tinyprod.net:/var/www/boxes/
vagrant box add ubuntu_dev/$INAME $BASE_NAME.json --force
```
### command to retrieve a box from tinyprod
A specific box can be retrieved manually from tinyprod.net.
```
vagrant box add http://tinyprod.net/boxes/ubuntu_dev-arm_msp.json
or
wget --quiet http://tinyprod.net/boxes/ubuntu_dev-arm_msp.2017-08-05.box
vagrant box add ubuntu-dev/arm_msp ubuntu_dev-arm_msp.2017-08-05.box
```
### Add this to Vagrantfile to load specific box version, and verify
checksum Use these instructions to refer to one of the boxes on
tinyprod.net in your own Vagrantfiles.
```
config.vm.box = "ubuntu_dev/arm_msp"
config.vm.box_version='0.6.0'
config.vm.box_url = 'http://www.tinyprod.net/boxes/ubuntu_dev-arm_msp.json'
config.vm.box_download_checksum = '8a0509dcb39866054bcfc8cacfc35dd720a67f37315e3f77f2d9c8904d8e13d2'
config.vm.box_download_checksum_type = 'sha256'
config.vm.box_check_update = true
```
### EDIT the {basic,arm_msp}.json file with the new version
BOX name and CHECKSUM produced by steps above (example below)
Use these instructions to specify which box to be retrieved by Vagrant when downloading a box
automatically.
```
{
"name": "ubuntu_dev/arm_msp",
"description": "Ubuntu based TI ARM/MSP432 toolchain",
"short_description": "Ubuntu Xenial64 TI MSP432/ARM Development box",
"versions": [{
"version": "0.6.0",
"status": "active",
"providers": [{
"name": "virtualbox",
"description_html": "<p>TI ARM/MSP Development Environment</p>",
"description_markdown": "TI ARM/MSP Development Environment",
"url": "http://www.tinyprod.net/boxes/ubuntu_dev-arm_msp.2017-08-05.box",
"checksum_type": "sha256",
"checksum": "8a0509dcb39866054bcfc8cacfc35dd720a67f37315e3f77f2d9c8904d8e13d2"
},{
"version": "0",
"providers": [{
"name": "virtualbox",
"url": "http://www.tinyprod.net/boxes/ubuntu_dev_basic_2015-10-22.box"
"checksum_type": "sha256",
"checksum": "9d6684c82c1cfa8ba4304f428c4918f956869b1eca70f5b5b08ddd8cdb7c1499"
}]
}]
}
```
### Replace this line to use a local box file
Sometimes you might want to refer to a box stored locally, for example to test a new box.
```
"url": "file:///Users/danome/Boxes/ubuntu_dev-basic.2017-01-04.box"
```
Then build and run basic. This will check for correct VirtualBox Guest Additions and
install if out of sync.
```
$ vagrant up
```
### Vagrant Development Box releases:
```
basic: 0.2.0 updated to current VBox Guest additions
0.3.0 update to Ubuntu 14.04.5, Vbox client 5.0.26
update packages for CCS dependencies
0.3.1 add firefox for CCS
0.4.0 update to 64 bit
0.4.1 16.04 64bit using bento box
0.6.0 16.04 Ubuntu 64 bit bento + additions
initial release for Phase 0 testing
msp430: 0.2.0 includes flasher, TI toolchain 4.0.1.0
0.3.0 on basic 0.3.0
0.3.1 basic 0.3.1, add flasher 1.3.10 (MSPDEBUG 3.8.1.0)
0.4.0 update to 64 bit
deprecated
arm_msp: 0.3.0 adds arm/msp432 toolchain and tools to msp430
0.3.1 msp430 box 0.3.1, add CCS network installer
0.4.0 update to 64 bit
0.4.1 add xds110/dfu vid/pid for usb for flashing xds110 pod
0.4.2 cleaned up arm includes, add JLink, OpenOCD
0.6.0 16.04, remove unused tools.
initial release for Phase 0 testing
```