Skip to contentSkip to conversation

support/misc: Adding Vagrant file for provisioning

RFC Superseded Angelo Compagnucci 3 participants 4 messages Sep 10, 2015 – Sep 11, 2015

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

RFC v2 1/1 support/misc: Adding Vagrant file for provisioning

This patch adds a Vagrant file to buildroot. With this file you can provision a complete buildroot developing environment in minutes on all major platforms.

---
Changelog:

v1->v2:
* Autodetecting of latest buildroot version from CHANGES file.
* Better documentation

 docs/manual/getting.txt    | 14 ++++++++++++++
 docs/website/download.html | 16 ++++++++++++++++
 support/misc/Vagrantfile   | 47 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 77 insertions(+)
 create mode 100644 support/misc/Vagrantfile
docs/manual/getting.txt +14 -0
index 3437f93..8b3ebb0 100644
@@ -10,6 +10,20 @@ November. Release numbers are in the format YYYY.MM, so for example
 
 Release tarballs are available at http://buildroot.org/downloads/[].
 
+An official Vagrantfile is distributed within buildroot for your needs.
+If you want to setup an isolated buildroot environment on Linux or
+Mac Os X, paste this line onto your terminal:
+
+--------------------
+curl -O http://git.buildroot.net/buildroot/tree/support/misc/Vagrantfile; vagrant up
+--------------------
+
+If you are on windows, paste this into your powershell:
+
+--------------------
+Invoke-WebRequest http://git.buildroot.net/buildroot/tree/support/misc/Vagrantfile -OutFile Vagrantfile; vagrant up
+--------------------
+
 If you want to follow development, you can use the daily snapshots or
 make a clone of the Git repository. Refer to the
 http://buildroot.org/download[Download page] of the Buildroot website
docs/website/download.html +16 -0
index ef87b1c..7d3fd1b 100644
@@ -32,6 +32,22 @@ This and earlier releases (and their PGP signatures) can always be downloaded fr
 
 <p>
 
+<p>
+An official Vagrantfile is distributed within buildroot for your needs.
+If you want to setup an isolated buildroot environment on Linux or
+Mac Os X, paste this line onto your terminal:
+
+<pre>
+curl -O http://git.buildroot.net/buildroot/tree/support/misc/Vagrantfile; vagrant up
+</pre>
+
+If you are on windows, paste this into your powershell:
+
+<pre>
+Invoke-WebRequest http://git.buildroot.net/buildroot/tree/support/misc/Vagrantfile -OutFile Vagrantfile; vagrant up
+</pre>
+</p>
+
 You can also obtain daily snapshots of the latest Buildroot source tree if you
 want to follow development, but cannot or do not wish to use Git.
 
support/misc/Vagrantfile new file +47 -0

47 lines not on this page · raw message

Signature · 1 line
1.9.1
#1 lore raw

Hi Angelo,

Quoted 80 lines · Angelo Compagnucci

This patch adds a Vagrant file to buildroot. With this file you can provision a complete buildroot developing environment in minutes on all major platforms.

---
Changelog:

v1->v2:
* Autodetecting of latest buildroot version from CHANGES file.
* Better documentation

 docs/manual/getting.txt    | 14 ++++++++++++++
 docs/website/download.html | 16 ++++++++++++++++
 support/misc/Vagrantfile   | 47 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 77 insertions(+)
 create mode 100644 support/misc/Vagrantfile
docs/manual/getting.txt +14 -0
index 3437f93..8b3ebb0 100644
@@ -10,6 +10,20 @@ November. Release numbers are in the format YYYY.MM, so for example
 
 Release tarballs are available at http://buildroot.org/downloads/[].
 
+An official Vagrantfile is distributed within buildroot for your needs.
+If you want to setup an isolated buildroot environment on Linux or
+Mac Os X, paste this line onto your terminal:
+
+--------------------
+curl -O http://git.buildroot.net/buildroot/tree/support/misc/Vagrantfile; vagrant up
+--------------------
+
+If you are on windows, paste this into your powershell:
+
+--------------------
+Invoke-WebRequest http://git.buildroot.net/buildroot/tree/support/misc/Vagrantfile -OutFile Vagrantfile; vagrant up
+--------------------
+
 If you want to follow development, you can use the daily snapshots or
 make a clone of the Git repository. Refer to the
 http://buildroot.org/download[Download page] of the Buildroot website
docs/website/download.html +16 -0
index ef87b1c..7d3fd1b 100644
@@ -32,6 +32,22 @@ This and earlier releases (and their PGP signatures) can always be downloaded fr
 
 <p>
 
+<p>
+An official Vagrantfile is distributed within buildroot for your needs.
+If you want to setup an isolated buildroot environment on Linux or
+Mac Os X, paste this line onto your terminal:
+
+<pre>
+curl -O http://git.buildroot.net/buildroot/tree/support/misc/Vagrantfile; vagrant up
+</pre>
+
+If you are on windows, paste this into your powershell:
+
+<pre>
+Invoke-WebRequest http://git.buildroot.net/buildroot/tree/support/misc/Vagrantfile -OutFile Vagrantfile; vagrant up
+</pre>
+</p>
+
 You can also obtain daily snapshots of the latest Buildroot source tree if you
 want to follow development, but cannot or do not wish to use Git.
 
support/misc/Vagrantfile new file +4 -0
new file mode 100644
index 0000000..36cb3e0
@@ -0,0 +1,47 @@
+################################################################################
+#
+# Vagrantfile
+#

support/misc/Vagrantfile line 14

Quoted 10 lines
support/misc/Vagrantfile new file +10 -0
+################################################################################
+
+### Change here for more memory/cores or different version ###
+VM_MEMORY=1024
+VM_CORES=1
+
+require 'open-uri'
+open("http://git.buildroot.net/buildroot/plain/CHANGES") do |f|
+  BUILDROOT_VERSION=f.read.lines.first.split(",")[0]
+end

As it is now, CHANGES will be redownloaded every time a vagrant command is issued. Can this be moved into $script so that it's only executed once during provisioning? This bit could be written in shell with something like:

curl -s http://git.buildroot.net/buildroot/plain/CHANGES | head -1
| awk -F ',' '{print $1}'

Though, I'm not sure if there's a better way to determine the current released Buildroot version.

support/misc/Vagrantfile line 21

Quoted 7 lines
support/misc/Vagrantfile new file +7 -0
+
+$sudo_script = <<SCRIPT
+sudo apt-get update
+sudo apt-get -y install build-essential libncurses5-dev \
+  git bzr cvs mercurial subversion
+sudo apt-get -y autoremove
+SCRIPT

Some apt warnings can be suppressed by exporting DEBIAN_FRONTEND=noninteractive

Quoted 33 lines
support/misc/Vagrantfile new file +26 -1
+
+$script = <<SCRIPT
+echo "Downloading buildroot #{BUILDROOT_VERSION}"
+wget -q -c http://buildroot.org/downloads/buildroot-#{BUILDROOT_VERSION}.tar.gz
+tar axf buildroot-#{BUILDROOT_VERSION}.tar.gz
+SCRIPT
+
+Vagrant.configure("2") do |config|
+  config.vm.box = "ubuntu/trusty64"
+
+  config.vm.provider :vmware_fusion do |v, override|
+    v.vmx['displayname'] = 'Buildroot #{BUILDROOT_VERSION}'
+    v.vmx["memsize"] = VM_MEMORY
+    v.vmx["numvcpus"] = VM_CORES
+  end
+
+  config.vm.provider :virtualbox do |v, override|
+    v.name = "Buildroot"
+    v.customize ["modifyvm", :id, "--name", "Buildroot #{BUILDROOT_VERSION}"]
+    v.customize ["modifyvm", :id, "--memory", VM_MEMORY]
+    v.customize ["modifyvm", :id, "--cpus", VM_CORES]
+  end
+
+  config.vm.provision "shell", inline: $sudo_script
+  config.vm.provision "shell", privileged: false, inline: $script
+end
--

1.9.1

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

Signature · 2 lines
Gabe Evans | Co-Founder & CTO
hashrabbit.co ? angel.co/hashrabbit ? github.com/gevans
#2 lore raw

Gabe, Angelo,

Quoted 10 lines · Gabe Evans

support/misc/Vagrantfile line 14

Quoted 4 lines
support/misc/Vagrantfile new file +4 -0
+require 'open-uri'
+open("http://git.buildroot.net/buildroot/plain/CHANGES") do |f|
+  BUILDROOT_VERSION=f.read.lines.first.split(",")[0]
+end

As it is now, CHANGES will be redownloaded every time a vagrant command is issued. Can this be moved into $script so that it's only executed once during provisioning? This bit could be written in shell with something like:

Quoted 5 lines

curl -s http://git.buildroot.net/buildroot/plain/CHANGES | head -1
| awk -F ',' '{print $1}'

Though, I'm not sure if there's a better way to determine the current released Buildroot version.

Does it make sense for this provisioning script to randomly pick-up the latest Buildroot version? Angelo is selling this provisioning script as a way for several users to have an identical, reproducible, build environment. But if it randomly picks up the latest Buildroot version, it kind of defeats that purpose.

So shouldn't the Buildroot version simply be hardcoded in the script and/or passed as argument in some way?

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#3 lore raw

Dear Thomas Petazzoni,

2015-09-11 11:34 GMT+02:00 Thomas Petazzoni
<[email protected]>:

Quoted 17 lines

Gabe, Angelo,

Quoted 13 lines · Gabe Evans

support/misc/Vagrantfile line 14

Quoted 4 lines
support/misc/Vagrantfile new file +4 -0
+require 'open-uri'
+open("http://git.buildroot.net/buildroot/plain/CHANGES") do |f|
+  BUILDROOT_VERSION=f.read.lines.first.split(",")[0]
+end

As it is now, CHANGES will be redownloaded every time a vagrant command is issued. Can this be moved into $script so that it's only executed once during provisioning? This bit could be written in shell with something like:

curl -s http://git.buildroot.net/buildroot/plain/CHANGES | head -1
| awk -F ',' '{print $1}'

Quoted 8 lines
Quoted 2 lines

Though, I'm not sure if there's a better way to determine the current released Buildroot version.

Does it make sense for this provisioning script to randomly pick-up the latest Buildroot version? Angelo is selling this provisioning script as a way for several users to have an identical, reproducible, build environment. But if it randomly picks up the latest Buildroot version, it kind of defeats that purpose.

I have a script in the workings that downloads and install the latest buildroot version only on provisioning phase and only if forced to redo.

Quoted 2 lines

So shouldn't the Buildroot version simply be hardcoded in the script and/or passed as argument in some way?

Having the version hardcoded is better, but we should keep it updated each new buildroot version.

Vagrantfile is a textfile, you can use as base for your own personalization. If a corporate environment wants to stick with some options, they usually copy and modify it to accommodate their needs.

IMO Vagrantfile shipped with buildroot should give the fastest way to have a working buildroot setup, then changing here and there is up to the user.

Sincerely, Angelo.

Quoted 6 lines

Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

Signature · 1 line
Profile: http://it.linkedin.com/in/compagnucciangelo