diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..b8f8791f30 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.vagrant/ +output/ +ubuntu-*-cloudimg-console.log diff --git a/README.md b/README.md index ba51c0fbb4..baf95879f0 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ http://www.armbian.com Supported build environments: - [Ubuntu Xenial 16.04 x64](http://archive.ubuntu.com/ubuntu/dists/xenial-updates/main/installer-amd64/current/images/netboot/mini.iso) guest inside a [VirtualBox](https://www.virtualbox.org/wiki/Downloads) or other virtualization software, +- [Ubuntu Xenial 16.04 x64](http://archive.ubuntu.com/ubuntu/dists/xenial-updates/main/installer-amd64/current/images/netboot/mini.iso) guest managed by [Vagrant](https://www.vagrantup.com/). This uses Virtualbox (as above) but does so in an easily repeatable way, - [Ubuntu Xenial 16.04 x64](http://archive.ubuntu.com/ubuntu/dists/xenial-updates/main/installer-amd64/current/images/netboot/mini.iso) inside a [Docker](https://www.docker.com/), [systemd-nspawn](https://www.freedesktop.org/software/systemd/man/systemd-nspawn.html) or other container environment [(example)](https://github.com/igorpecovnik/lib/pull/255#issuecomment-205045273). Building full OS images inside containers may not work, so this option is mostly for the kernel compilation, - [Ubuntu Xenial 16.04 x64](http://archive.ubuntu.com/ubuntu/dists/xenial-updates/main/installer-amd64/current/images/netboot/mini.iso) running natively on a dedicated PC or a server, - [Ubuntu Trusty 14.04 x64](http://archive.ubuntu.com/ubuntu/dists/trusty-updates/main/installer-amd64/current/images/netboot/mini.iso) may still be used for the kernel compilation but it is not recommended, @@ -15,12 +16,12 @@ Supported build environments: - superuser rights (configured `sudo` or root access). **Execution** - + apt-get -y install git git clone https://github.com/igorpecovnik/lib --depth 1 cp lib/compile.sh . ./compile.sh - + You will be prompted with a selection menu for a build option, a board name, a kernel branch and an OS release. Please check the documentation for [advanced options](https://docs.armbian.com/Developer-Guide_Build-Options/) and [additional customization](https://docs.armbian.com/Developer-Guide_User-Configurations/). Build process uses caching for the compilation and the debootstrap process, so consecutive runs with similar settings will be much faster. @@ -28,15 +29,58 @@ Build process uses caching for the compilation and the debootstrap process, so c ## How to change a kernel configuration? Edit `compile.sh` and set - + KERNEL_CONFIGURE="yes" - + or pass this option as a command line parameter like ./compile.sh KERNEL_CONFIGURE=yes to display the kernel configuration menu during the compilation process +## Quick Start with Vagrant + +First, you'll need to [install vargrant](https://www.vagrantup.com/downloads.html) on your host box. You'll also need to install a plug-in that will enable us to resize the primary storage device. Without it, Vagrant images are too small to build Armbian. + + vagrant plugin install vagrant-disksize + +Now we'll need to [install git](https://git-scm.com/downloads) and check out the Armbian code. While this might seem obvious, we'll rely on it being there when we use Vagrant. + + # Check out the code. + git clone --depth 1 https://github.com/igorpecovnik/lib.git lib + + # Make the Vagrant box available. This might take a while but only needs to be done once. + vagrant box add ubuntu/xenial64 + + # If the box gets updated by the folks at HashiCorp, we'll want to update our copy too. + # This only needs done once and a while. + vagrant box update + + # Finally! Let's bring the box up. This might take a minute or two. + cd lib + vagrant up + + # When the box has been installed we can get access via ssh. + vagrant ssh + +Once it's finally up and you're logged in, it works much like any of the other install (note: these commands are run on the *guest* box). + + cp lib/compile.sh . + sudo ./compile.sh + +There are two directories that are mapped from the host to the guest: + +* You'll find the git repo is shared, and +* The *output* directory is also shared (makes it easy to preserve cache, downloads, and IOSs between builds). It also makes them easily accessible on your host box. + +Wrap up your vagrant box when no longer needed (log out of the guest before running these on the host system): + + # Shutdown, but leave the box around for more building at a later time: + vagrant halt + + # Trash the box and remove all the related storage devices. + vagrant destroy + More info: - [Documentation](http://www.armbian.com/using-armbian-tools/) diff --git a/Vagrantfile b/Vagrantfile index d5e1621f53..63d532bd20 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,73 +1,39 @@ # -*- mode: ruby -*- # vi: set ft=ruby : -# All Vagrant configuration is done below. The "2" in Vagrant.configure -# configures the configuration version (we support older styles for -# backwards compatibility). Please don't change it unless you know what -# you're doing. Vagrant.configure(2) do |config| - # The most common configuration options are documented and commented below. - # For a complete reference, please see the online documentation at - # https://docs.vagrantup.com. - # Every Vagrant development environment requires a box. You can search for - # boxes at https://atlas.hashicorp.com/search. - config.vm.box = "ubuntu/xenial64" + # What box should we base this build on? + config.vm.box = "ubuntu/xenial64" - # Disable automatic box update checking. If you disable this, then - # boxes will only be checked for updates when the user runs - # `vagrant box outdated`. This is not recommended. - config.vm.box_check_update = true + ####################################################################### + # THIS REQUIRES YOU TO INSTALL A PLUGIN. RUN THE COMMAND BELOW... + # + # $ vagrant plugin install vagrant-disksize + # + ####################################################################### - # Create a forwarded port mapping which allows access to a specific port - # within the machine from a port on the host machine. In the example below, - # accessing "localhost:8080" will access port 80 on the guest machine. - # config.vm.network "forwarded_port", guest: 80, host: 8080 + # Default images are not big enough to build Armbian. + config.disksize.size = "40GB" - # Create a private network, which allows host-only access to the machine - # using a specific IP. - # config.vm.network "private_network", ip: "192.168.33.10" + # So we don't have to download the code a 2nd time. + config.vm.synced_folder ".", "/home/ubuntu/lib" - # Create a public network, which generally matched to bridged network. - # Bridged networks make the machine appear as another physical device on - # your network. - config.vm.network "public_network" + ####################################################################### + # We could sync more folders (that seems like the best way to go), + # but in many cases builds fail because hardlinks are not supported. + # So, a more failproof approach is to just use a larger disk. - # Share an additional folder to the guest VM. The first argument is - # the path on the host to the actual folder. The second argument is - # the path on the guest to mount the folder. And the optional third - # argument is a set of non-required options. - config.vm.synced_folder ".", "/vagrant/lib" - config.vm.synced_folder "./output", "/vagrant/output", create: true + # Share folders with the host to make it easy to get our images out. + config.vm.synced_folder "./output", "/home/ubuntu/output", create: true - # Provider-specific configuration so you can fine-tune various - # backing providers for Vagrant. These expose provider-specific options. - # Example for VirtualBox: - # - config.vm.provider "virtualbox" do |vb| - # Display the VirtualBox GUI when booting the machine - vb.gui = true + config.vm.provider "virtualbox" do |vb| + vb.name = "Armbian Builder" + vb.gui = true - # Customize the amount of memory on the VM: - vb.memory = "8192" - vb.cpus = "4" - end - # - # View the documentation for the provider you are using for more - # information on available options. + # Tweak these to fit your needs. + vb.memory = "8192" + vb.cpus = "4" - # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies - # such as FTP and Heroku are also available. See the documentation at - # https://docs.vagrantup.com/v2/push/atlas.html for more information. - # config.push.define "atlas" do |push| - # push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME" - # end - - # Enable provisioning with a shell script. Additional provisioners such as - # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the - # documentation for more information about their specific syntax and use. - # config.vm.provision "shell", inline: <<-SHELL - # sudo apt-get update - # sudo apt-get install -y apache2 - # SHELL -end \ No newline at end of file + end +end