diff --git a/.gitignore b/.gitignore index 9f93021..83f6e8d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ -vagrant_ansible_inventory_default -freetzsrc/* +*~ +.vagrant +config +images diff --git a/.vagrant/machines/default/virtualbox/action_provision b/.vagrant/machines/default/virtualbox/action_provision deleted file mode 100644 index fedf041..0000000 --- a/.vagrant/machines/default/virtualbox/action_provision +++ /dev/null @@ -1 +0,0 @@ -1391388729 \ No newline at end of file diff --git a/.vagrant/machines/default/virtualbox/action_set_name b/.vagrant/machines/default/virtualbox/action_set_name deleted file mode 100644 index 885a3c0..0000000 --- a/.vagrant/machines/default/virtualbox/action_set_name +++ /dev/null @@ -1 +0,0 @@ -1391388700 \ No newline at end of file diff --git a/.vagrant/machines/default/virtualbox/id b/.vagrant/machines/default/virtualbox/id deleted file mode 100644 index a955eec..0000000 --- a/.vagrant/machines/default/virtualbox/id +++ /dev/null @@ -1 +0,0 @@ -72295a09-a60e-45be-9771-205f9a1ccfad \ No newline at end of file diff --git a/README.md b/README.md index 638eed7..0d80e9e 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,93 @@ freetz-vagrant ============== -a Vagrant development environment for freetz +Set up a build environment for [Freetz](http://freetz.org/), a firmware-extension (modification) for +the AVM Fritz!Box, using [Vagrant](http://www.vagrantup.com/) and +[Ansible](http://www.ansible.com/). Usage ============== -1. Clone repo -2. cd freetz-vagrant -3. vagrant up -4. vagrant ssh -5. cd /freetz/src -6. make menuconfig +Install necessary software +-- + +1. Install VirtualBox from http://www.vagrantup.com/ +2. Install Vagrant from http://www.vagrantup.com/ +3. Install Ansible from http://www.ansible.com/ + +Note: you can use Vagrant with other desktop virtualization software, see + the Vagrant documentation for detail. + +Bring up the virtual machine +-- + +1. Clone this repo +2. Edit Vagrantfile to adjust the Subversion URL (stable or trunk) +3. If you have a Freetz `.config`, place it in the top-level directory +(alongside the `Vagrantfile`) as `config`. +4. Provision the VM with `vagrant up`. Depending on the speed of your +internet connection, this will take between 5 and 30 minutes, and will +download about 500 MB for the image, and about 150 MB for the necessary +packages. +5. Enter the VM with `vagrant ssh` +6. Run the Freetz build + +```bash +cd freetz +make menuconfig +make +``` + +Running `make` will download all necessary tools, the selected original AVM +firmware that will be modified, the package sources, etc., and +build the packages. Depending on the speed of your internet connection and +your computer, this will take about 30 minutes and download about 100 MB. + +If everything works, the `make` command should output something like: + +``` +STEP 3: PACK + checking for left over Subversion directories + integrate freetz info file into image +packing var.tar +creating filesystem image + SquashFS block size: 64 kB (65536 bytes) +merging kernel image + kernel image size: 13.4 MB, max 15.4 MB, free 2.0 MB (2104832 bytes) + Aproximately maximal time for the answering machine: 14 min, 41 sec (881 sec) +packing images/7240_06.05-freetz-devel-13365.de_20150818-143843.image + image file size: 14.4 MB +done. + +FINISHED + +real 9m31.012s +user 7m53.560s +sys 1m2.584s +``` + + +Saving the image and configuration +-- + +The final firmware image is available in the `images` directory (in +`~/freetz/images` inside the VM, and `./images` on the host). + +The Freetz configuration file `.config` is stored in the top level +directory as `config`. When you ssh into the VM, a symlink is automatically +created at `~/freetz/.config`. Running `menuconfig` will replace this +symlink with the new configuration file. When you log out, that file will +automatically be copied back. + + +Cleaning up +-- + +After the image has been built, you can destroy the VM: + +```bash +vagrant destroy +``` + +This will remove the VM including it's virtual hard disk, and all downloaded +files. diff --git a/Vagrantfile b/Vagrantfile index 53f80ed..1ddb98d 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,19 +1,18 @@ Vagrant.configure("2") do |config| - config.vm.box = "debian7.2" - config.vm.box_url = "https://dl.dropboxusercontent.com/u/197673519/debian-7.2.0.box" + config.vm.box = "opscode-debian-8.1" + config.vm.box_url = "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_debian-8.1_chef-provisionerless.box" + config.vm.hostname = "freetz" - config.vm.network :private_network, ip: "192.168.57.111" + config.vm.provider :virtualbox do |v| + v.memory = 512 + v.cpus = 2 + v.customize ["modifyvm", :id, "--name", "freetz"] + end - config.vm.provider :virtualbox do |v| - v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] - v.customize ["modifyvm", :id, "--memory", 512] - v.customize ["modifyvm", :id, "--name", "freetz-vm"] - end - - config.vm.synced_folder "./freetzsrc", "/freetz" - - config.vm.provision "ansible" do |ansible| - ansible.playbook = "ansible/provision.yml" - end + config.vm.provision "ansible" do |ansible| + ansible.playbook = "ansible/provision.yml" + #ansible.extra_vars = { freetz_svn_url: 'http://svn.freetz.org/branches/freetz-stable-2.0' } + ansible.extra_vars = { freetz_svn_url: 'http://svn.freetz.org/trunk' } + end end diff --git a/ansible/tasks/apt.yml b/ansible/tasks/apt.yml index 23d4cf7..bd5a1d5 100644 --- a/ansible/tasks/apt.yml +++ b/ansible/tasks/apt.yml @@ -2,5 +2,5 @@ apt: update_cache=yes cache_valid_time=3600 tags: apt -- name: upgrade a server +- name: upgrade packages to current version apt: upgrade=full diff --git a/ansible/tasks/apt.yml~ b/ansible/tasks/apt.yml~ new file mode 100644 index 0000000..e5ad683 --- /dev/null +++ b/ansible/tasks/apt.yml~ @@ -0,0 +1,6 @@ +- name: update apt cache + apt: update_cache=yes cache_valid_time=3600 + tags: apt + +- name: upgrade app packages to current version + apt: upgrade=full diff --git a/ansible/tasks/freetz.yml b/ansible/tasks/freetz.yml index 8720dcf..4ff7d03 100644 --- a/ansible/tasks/freetz.yml +++ b/ansible/tasks/freetz.yml @@ -15,4 +15,14 @@ # along with this program. If not, see . --- - name: clone freetz repo - subversion: repo=http://svn.freetz.org/trunk dest=/freetz/src + subversion: repo={{ freetz_svn_url }} dest=freetz + sudo: no +- name: link images directory to shared vagrant directory + file: src=/vagrant/images dest=freetz/images state=link + sudo: no +- name: On login, symlink /vagrant/config to ~/freetz/config if it does not exist + lineinfile: dest=.profile state=present insertafter=EOF line='if [ ! -L ~/freetz/.config ]; then mv ~/freetz/.config ~/freetz/.config.old; ln -s /vagrant/config ~/freetz/.config; fi' + sudo: no +- name: On logout, copy ~/freetz/config to /vagrant/config if it is newer + lineinfile: dest=.bash_logout state=present insertafter=EOF line='if [ ! -L ~/freetz/.config ]; then cp -u ~/freetz/.config /vagrant/config; fi' + sudo: no diff --git a/ansible/tasks/packages.yml b/ansible/tasks/packages.yml index b304619..8caab7b 100644 --- a/ansible/tasks/packages.yml +++ b/ansible/tasks/packages.yml @@ -19,52 +19,55 @@ - name: General | Install required packages. action: apt pkg={{ item }} state=latest with_items: - - python-pycurl - - python-apt - - python-pip - - python-software-properties - - git-core - ack-grep - - ngrep - - iotop - - htop - - di - - zsh - - vim - - tmux - - wget - - openssh-server - ack-grep - - unzip - - imagemagick - - mktemp - - patchutils - - libusb-dev - - xz-utils - - perl - - build-essential - autoconf - automake - - libtool - - libncurses5-dev - - lib32ncurses5-dev - - libc6-dev-i386 - - gcc-multilib - - zlib1g-dev - - flex - bison - - patch - - texinfo - - tofrodos + - build-essential + - bzip2 + - di + - fastjar + - flex + - gawk + - gcc-multilib - gettext + - git-core + - htop + - imagemagick + - iotop - jam - - pkg-config - - fastjar - - realpath + - lib32ncurses5-dev + - libacl1-dev + - libc6-dev-i386 + - libcap-dev + - libncurses5-dev + - libreadline6-dev - libstring-crc32-perl - - gawk + - libtool + - libtool-bin + - libusb-dev + - mktemp + - ngrep + - openssh-server + - patch + - patchutils + - perl + - pkg-config - python + - python-apt + - python-pip + - python-pycurl + - python-software-properties + - realpath + - ruby - subversion - - bzip2 - - libacl1-dev - - libcap-dev + - texinfo + - tmux + - tofrodos + - unzip + - vim + - wget + - xz-utils + - zlib1g-dev + - zsh diff --git a/images/.gitkeep b/images/.gitkeep new file mode 100644 index 0000000..e69de29