Repository : ssh://git@open-mesh.org/doc
On branch : master
commit bcdf6e25ca51456fcb7699093546b5725d1ad81d Merge: 8f519993 5d046308 Author: Sven Eckelmann sven@narfation.org Date: Thu Sep 28 16:56:17 2017 +0200
Merge branch 'backup-redmine/2017-09-28'
bcdf6e25ca51456fcb7699093546b5725d1ad81d batman-adv/Debian_batman-adv_AutoStartup.rst | 16 ++++++++-------- open-mesh/Download.rst | 28 ++++++++++++++++------------ open-mesh/Emulation_Debug.rst | 12 ++++++------ open-mesh/rc.local | 10 +++++----- 4 files changed, 35 insertions(+), 31 deletions(-)
diff --cc batman-adv/Debian_batman-adv_AutoStartup.rst index 7c3298a1,00000000..1b579a07 mode 100644,000000..100644 --- a/batman-adv/Debian_batman-adv_AutoStartup.rst +++ b/batman-adv/Debian_batman-adv_AutoStartup.rst @@@ -1,170 -1,0 +1,170 @@@ +Debian batman-adv AutoStartup +============================= + +This Page describes how to configure a Debian (or Derived Distribution +like Ubuntu, Mint, etc) so that batman-adv starts automatically on boot +up. First we'll start the the same "Simple mesh network" example from +the :doc:`B.A.T.M.A.N. Advanced quick start guide <Quick-start-guide>`. + +Simple mesh network +------------------- + +For this example it is assumed that your 'eth0' network interface is +already configured for you network, if not do this now. I will not cover +how to do this as this is not specific to batman-adv and is well covered +in the Debian, Ubuntu, Mint, etc documentation. + +Load the module +~~~~~~~~~~~~~~~ + +First we need to ensure that the batman-adv module is loaded before we +attempt to use it. +Edit /etc/modules and add the batman-adv to a new line in the file: + +:: + + sudo nano /etc/modules + +:: + + # /etc/modules: kernel modules to load at boot time. + # + # This file contains the names of kernel modules that should be loaded + # at boot time, one per line. Lines begining with '#' are ignored. + + batman-adv + +Configure the wlan adapter +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Next we want to configure the wlan adapter (wlan0 in this example), to +do this we need to configure the following settings: + +- mtu 1532 +- mode ad-hoc +- essid my-mesh-network +- ap 02:12:34:56:78:9A +- channel 1 + +As we won't be using any ip address on this interface it doesn't +actually matter whether you use inet or inet6, so where I have used +inet6 in this section, you can substitute inet if you wish. + +Edit /etc/network/interfaces and add or modify the wlan0 section: + +:: + + sudo nano /etc/network/interfaces + +If there is a section in this file for wlan0 already you may want to +comment it out (place '# ' at the beginning of each line), or just +replace with the lines below + +:: + + auto wlan0 + iface wlan0 inet6 manual + mtu 1532 + wireless-channel 1 + wireless-essid my-mesh-network + wireless-mode ad-hoc + wireless-ap 02:12:34:56:78:9A + +Configure the bat0 interface +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Finally we need to configure the 'bat0' interface, before we jump into +this you first need to determine your IP addressing configuration for +your mesh. For this example I will use two examples, first automatic +IPv6, and second manually configured IPv4 with address 192.168.123.3/24 +and default gateway of 192.168.123.1. + +You also need to find the location of batctl, usually this will be +/usr/sbin/batctl but use 'whereis batctl' to confirm. + +Again we edit /etc/network/interfaces this time we add or modify the +bat0 section: + +:: + + sudo nano /etc/network/interfaces + +For automatic IPv6 we would use the following: + +:: + + auto bat0 + iface bat0 inet6 auto - pre-up /usr/sbin/batctl if add dev eth0 - pre-up /usr/sbin/batctl if add dev wlan0 ++ pre-up /usr/sbin/batctl if add eth0 ++ pre-up /usr/sbin/batctl if add wlan0 + +For manual IPv4 we would use the following: + +:: + + auto bat0 + iface bat0 inet auto + address 192.168.123.3 + netmask 255.255.255.0 + gateway 192.168.123.1 - pre-up /usr/sbin/batctl if add dev eth0 - pre-up /usr/sbin/batctl if add dev wlan0 ++ pre-up /usr/sbin/batctl if add eth0 ++ pre-up /usr/sbin/batctl if add wlan0 + +If you have both IPv6 and IPv4 on your mesh then you can combine them, +it doesn't matter which order you put them in, just put the two pre-up +lines in the first iface stanza. + +:: + + auto bat0 + iface bat0 inet6 auto - pre-up /usr/sbin/batctl if add dev eth0 - pre-up /usr/sbin/batctl if add dev wlan0 ++ pre-up /usr/sbin/batctl if add eth0 ++ pre-up /usr/sbin/batctl if add wlan0 + iface bat0 inet auto + address 192.168.123.3 + netmask 255.255.255.0 + gateway 192.168.123.1 + +Thats it, now you can reboot your computer and when it starts up it +should join your mesh automatically. + +Connecting to 2 mesh networks +----------------------------- + +In this example the computer has 2 wifi adapters (wlan0 and wlan1) and +will connect to two batman-adv meshes (bat0 and bat1). + +As earlier load the batman-adv module in /etc/modules + +next configure your wireless lan interfaces + +:: + + auto wlan0 + iface wlan0 inet6 manual + mtu 1532 + wireless-channel 1 + wireless-essid my-mesh-network + wireless-mode ad-hoc + wireless-ap 02:12:34:56:78:9A + + auto wlan1 + iface wlan1 inet6 manual + mtu 1532 + wireless-channel 2 + wireless-essid my-mesh-network2 + wireless-mode ad-hoc + wireless-ap 02:12:34:56:78:9B + +then configure your batman-adv interfaces + +:: + + auto bat0 + iface bat0 inet6 auto - pre-up /usr/sbin/batctl -m bat0 if add dev wlan0 ++ pre-up /usr/sbin/batctl -m bat0 if add wlan0 + + auto bat1 + iface bat1 inet6 auto - pre-up /usr/sbin/batctl -m bat1 if add dev wlan1 ++ pre-up /usr/sbin/batctl -m bat1 if add wlan1 + diff --cc open-mesh/Download.rst index b31b59b6,00000000..bc05291a mode 100644,000000..100644 --- a/open-mesh/Download.rst +++ b/open-mesh/Download.rst @@@ -1,225 -1,0 +1,229 @@@ +Download B.A.T.M.A.N. +===================== + +We are currently working on different branches. To get the details about +the differences of these branches, see our :doc:`Branches Explained page <BranchesExplained>`. + +Please use the maint branch for your public infrastructure unless you +know exactly what you are doing and are prepared for the big unknown. + +.. _open-mesh-download-download-released-source-code: + +Download Released Source Code +----------------------------- + +- The latest version of :doc:`batman-adv </batman-adv/Wiki>` is - `batman-adv-2017.1.tar.gz https://downloads.open-mesh.org/batman/stable/sources/batman-adv/batman-adv-2017.1.tar.gz`__ - `md5 https://downloads.open-mesh.org/batman/stable/sources/batman-adv/batman-adv-2017.1.tar.gz.md5`__ - `sha1 https://downloads.open-mesh.org/batman/stable/sources/batman-adv/batman-adv-2017.1.tar.gz.sha1`__ - `asc https://downloads.open-mesh.org/batman/stable/sources/batman-adv/batman-adv-2017.1.tar.gz.asc`__ ++ `batman-adv-2017.3.tar.gz https://downloads.open-mesh.org/batman/stable/sources/batman-adv/batman-adv-2017.3.tar.gz`__ ++ `md5 https://downloads.open-mesh.org/batman/stable/sources/batman-adv/batman-adv-2017.3.tar.gz.md5`__ ++ `sha1 https://downloads.open-mesh.org/batman/stable/sources/batman-adv/batman-adv-2017.3.tar.gz.sha1`__ ++ `asc https://downloads.open-mesh.org/batman/stable/sources/batman-adv/batman-adv-2017.3.tar.gz.asc`__ +- The latest version of batctl (management and control tool for + batman-adv) is - `batctl-2017.1.tar.gz https://downloads.open-mesh.org/batman/stable/sources/batctl/batctl-2017.1.tar.gz`__ - `md5 https://downloads.open-mesh.org/batman/stable/sources/batctl/batctl-2017.1.tar.gz.md5`__ - `sha1 https://downloads.open-mesh.org/batman/stable/sources/batctl/batctl-2017.1.tar.gz.sha1`__ - `asc https://downloads.open-mesh.org/batman/stable/sources/batctl/batctl-2017.1.tar.gz.asc`__ ++ `batctl-2017.3.tar.gz https://downloads.open-mesh.org/batman/stable/sources/batctl/batctl-2017.3.tar.gz`__ ++ `md5 https://downloads.open-mesh.org/batman/stable/sources/batctl/batctl-2017.3.tar.gz.md5`__ ++ `sha1 https://downloads.open-mesh.org/batman/stable/sources/batctl/batctl-2017.3.tar.gz.sha1`__ ++ `asc https://downloads.open-mesh.org/batman/stable/sources/batctl/batctl-2017.3.tar.gz.asc`__ +- The latest version of alfred (Almighty Lightweight Fact Remote + Exchange Daemon) is - `alfred-2017.1.tar.gz https://downloads.open-mesh.org/batman/stable/sources/alfred/alfred-2017.1.tar.gz`__ - `md5 https://downloads.open-mesh.org/batman/stable/sources/alfred/alfred-2017.1.tar.gz.md5`__ - `sha1 https://downloads.open-mesh.org/batman/stable/sources/alfred/alfred-2017.1.tar.gz.sha1`__ - `asc https://downloads.open-mesh.org/batman/stable/sources/alfred/alfred-2017.1.tar.gz.asc`__ ++ `alfred-2017.3.tar.gz https://downloads.open-mesh.org/batman/stable/sources/alfred/alfred-2017.3.tar.gz`__ ++ `md5 https://downloads.open-mesh.org/batman/stable/sources/alfred/alfred-2017.3.tar.gz.md5`__ ++ `sha1 https://downloads.open-mesh.org/batman/stable/sources/alfred/alfred-2017.3.tar.gz.sha1`__ ++ `asc https://downloads.open-mesh.org/batman/stable/sources/alfred/alfred-2017.3.tar.gz.asc`__ + +- The latest stable version of batmand + (:ref:`unmaintained <open-mesh-BranchesExplained-batmand>`) is + `batman-0.3.2.tar.gz https://downloads.open-mesh.org/batman/releases/batman-0.3.2/batman-0.3.2.tar.gz`__ + `md5 https://downloads.open-mesh.org/batman/releases/batman-0.3.2/batman-0.3.2.tar.gz.md5`__ + `sha1 https://downloads.open-mesh.org/batman/releases/batman-0.3.2/batman-0.3.2.tar.gz.sha1`__ + `asc https://downloads.open-mesh.org/batman/releases/batman-0.3.2/batman-0.3.2.tar.gz.asc`__ +- The latest version of the vis server for the batmand (package not + needed for batman-adv) is + `vis-0.3.2.tar.gz https://downloads.open-mesh.org/batman/releases/batman-0.3.2/vis-0.3.2.tar.gz`__ + `md5 https://downloads.open-mesh.org/batman/releases/batman-0.3.2/vis-0.3.2.tar.gz.md5`__ + `sha1 https://downloads.open-mesh.org/batman/releases/batman-0.3.2/vis-0.3.2.tar.gz.sha1`__ + `asc https://downloads.open-mesh.org/batman/releases/batman-0.3.2/vis-0.3.2.tar.gz.asc`__ + +If you are wondering whether batman-adv or batmand might suit your setup +better, have a look at :doc:`this page </batman-adv/Wiki>`. Please note that +the development is focusing on batman-adv at the moment. + +To download previous release tarballs, simply check out our `download +section https://downloads.open-mesh.org/batman/releases/`__. + +If you find any bugs, please :doc:`let us know <Contribute>`! + +Git Repository Access +--------------------- + +Since we started integrating the batman-adv kernel module into the +mainline Linux tree, we maintain a git repository which contains the +batman-adv maintenance branches. More information can be found +:doc:`on our git page <UsingBatmanGit>`. +On overview about all the git repositories can be found on our `git +frontend https://git.open-mesh.org`__. We also host individual +repositories for development related to batman or meshing in general. +Feel free to contact us if you are interested in getting a repository +too. + +batman-adv in the Linux tree +---------------------------- + +Since linux 2.6.33 batman-adv is part of the official linux tree. You +can build batman-adv along with your linux binary by simply selecting +batman-adv in the Linux drivers section. If you use an older kernel or +want to have access to the latest features you can checkout our git +repository which still are backward compatible until 2.6.29. + +It follows an overview of linux versions and the batman-adv version they +contain, so that you can easily pick the compatible batctl packages: + +- linux 2.6.33 => batman-adv 0.2.0 (get batctl 0.2.0 from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ +- linux 2.6.34 => batman-adv 0.2.1 (get batctl 0.2.1 from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ +- linux 2.6.35 => batman-adv 2010.0.x (get batctl 2010.0.x from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ +- linux 2.6.36 => batman-adv 2010.1.x (get batctl 2010.1.x from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ +- linux 2.6.37 => batman-adv 2010.2.x (get batctl 2010.2.x from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ +- linux 2.6.38 => batman-adv 2011.0.x (get batctl 2011.0.x from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ +- linux 2.6.39 => batman-adv 2011.1.x (get batctl 2011.1.x from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ +- linux 3.0 => batman-adv 2011.2.x (get batctl 2011.2.x from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ +- linux 3.1 => batman-adv 2011.3.x (get batctl 2011.3.x from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ +- linux 3.2 => batman-adv 2011.4.x (get batctl 2011.4.x from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ +- linux 3.3 => batman-adv 2012.0.x (get batctl 2012.0.x from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ +- linux 3.4 => batman-adv 2012.1.x (get batctl 2012.1.x from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ +- linux 3.5 => batman-adv 2012.2.x (get batctl 2012.2.x from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ +- linux 3.6 => batman-adv 2012.3.x (get batctl 2012.3.x from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ +- linux 3.7 => batman-adv 2012.4.x (get batctl 2012.4.x from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ +- linux 3.8 => batman-adv 2013.0.x (get batctl 2013.0.x from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ +- linux 3.9 => batman-adv 2013.1.x (get batctl 2013.1.x from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ +- linux 3.10 => batman-adv 2013.2.x (get batctl 2013.2.x from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ +- linux 3.11 => batman-adv 2013.3.x (get batctl 2013.3.x from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ +- linux 3.12 => batman-adv 2013.4.x (get batctl 2013.4.x from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ +- linux 3.13 => batman-adv 2014.0.x (get batctl 2014.0.x from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ + NOTE: in-kernel version number is 2013.5.0 +- linux 3.14 => batman-adv 2014.1.x (get batctl 2014.1.x from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ +- linux 3.15 => batman-adv 2014.2.x (get batctl 2014.2.x from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ +- linux 3.16 => batman-adv 2014.3.x (get batctl 2014.3.x from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ +- linux 3.17-3.19 => batman-adv 2014.4.x (get batctl 2014.4.x from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ +- linux 4.0-4.1 => batman-adv 2015.0 (get batctl 2015.0 from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/`__ +- linux 4.2-4.3 => batman-adv 2015.1 (get batctl 2015.1 from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ +- linux 4.4 => batman-adv 2015.2 (get batctl 2015.2 from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ +- linux 4.5 => batman-adv 2016.0 (get batctl 2016.0 from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ +- linux 4.6 => batman-adv 2016.1 (get batctl 2016.1 from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ +- linux 4.7 => batman-adv 2016.2 (get batctl 2016.2 from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ +- linux 4.8 => batman-adv 2016.3 (get batctl 2016.3 from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ +- linux 4.9 => batman-adv 2016.4 (get batctl 2016.4 from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ +- linux 4.10 => batman-adv 2016.5 (get batctl 2016.5 from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ +- linux 4.11 => batman-adv 2017.0.1 (get batctl 2017.0 from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ +- linux 4.12 => batman-adv 2017.1 (get batctl 2017.1 from + `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ ++- linux 4.13 => batman-adv 2017.1 (get batctl 2017.2 from ++ `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ ++- linux 4.14 => batman-adv 2017.1 (get batctl 2017.3 from ++ `here https://downloads.open-mesh.org/batman/stable/sources/batctl/)`__ + +Arch Linux +---------- + +Batman-adv and Batctl are avaible in the +`AUR https://wiki.archlinux.org/index.php/AUR`__ as PKGBUILD: + +- `batctl https://aur.archlinux.org/packages/batctl/`__ - Latest + Batctl +- `batman-adv https://aur.archlinux.org/packages/batman-adv/`__ - + Latest Batman-adv +- `batman-adv-v14 https://aur.archlinux.org/packages/batman-adv-v14/`__ + - Last Batman-adv with compability-version 14 (2013.4) +- `batctl-v14 https://aur.archlinux.org/packages/batctl-v14/`__ - + Last Batctl with compability-version 14 (2013.4) + +Debian +------ + +Use apt-get (or any other dpkg frontend of choice) to install +B.A.T.M.A.N. onto your debian machine. Following packages are available: + +- `alfred https://packages.debian.org/sid/alfred`__ - batctl 2015.2 +- `batmand https://packages.debian.org/sid/batmand`__ - batman 0.3.2 +- `batctl https://packages.debian.org/sid/batctl`__ - batctl 2015.2 +- Debian Wheezy and all newer releases come with batman-adv as part of + the kernel, no need to re-install the module manually. For squeeze, + check: + + - `batman-adv-source https://packages.debian.org/squeeze/batman-adv-source`__ + - batman-advanced kernel 2010.0.0 module source for Debian Squeeze + (installable via + `module-assistant https://packages.debian.org/squeeze/module-assistant)`__ + - `batman-adv-dkms https://packages.debian.org/squeeze/batman-adv-dkms`__ + - batman-advanced kernel module 2010.0.0 dkms package for Debian + Squeeze to build new modules dynamically (half-automatic) + +- `linux https://packages.debian.org/source/unstable/linux`__ - + batman-advanced kernel module as `part of the + official https://bugs.debian.org/622361`__ kernel packages + +Similar packages are also available through `Ubuntu +universe https://help.ubuntu.com/community/Repositories/Ubuntu`__ . + +Gentoo +------ + +Use emerge to build B.A.T.M.A.N. on your gentoo machine. Following +ebuilds are available: + +- `net-misc/batctl https://packages.gentoo.org/packages/net-misc/batctl`__ +- `net-misc/batman-adv https://packages.gentoo.org/packages/net-misc/batman-adv`__ + +openSUSE +-------- + +- `network:utilities / + batctl https://build.opensuse.org/package/show?package=batctl&project=network%3Autilities`__ +- the batman-adv module is available as module in the official kernel + packages + +Building OpenWRT packages +------------------------- + +B.A.T.M.A.N. is also included in OpenWRT as a package. Download the +extra package feed, link the batman folder into your main OpenWRT svn +directory and use "make menuconfig" to select the B.A.T.M.A.N. flavor +you intend to use. This enables you to integrate B.A.T.M.A.N. seamlessly +into your builds (see :doc:`this page </batman-adv/Building-with-openwrt>` +for a detailed explanation). + +More information about how to build the OpenWRT toolchain is available +`here https://wiki.openwrt.org/doc/howto/build`__. diff --cc open-mesh/Emulation_Debug.rst index 96471346,00000000..4a6ca899 mode 100644,000000..100644 --- a/open-mesh/Emulation_Debug.rst +++ b/open-mesh/Emulation_Debug.rst @@@ -1,263 -1,0 +1,263 @@@ +Emulation Debug +=============== + +Create an Image +--------------- + +Download the fstab and rc.local file attached to this wiki page into +your directory before getting started. + +:: + + qemu-img create debian.img 8G - sudo mkfs.ext2 -F debian.img ++ sudo mkfs.ext4 -O '^has_journal' -F debian.img + sudo mkdir debian + sudo mount -o loop debian.img debian - sudo debootstrap jessie debian - sudo chroot debian apt-get update - sudo chroot debian apt-get install build-essential vim openssh-server \ ++ sudo debootstrap stretch debian ++ sudo chroot debian apt update ++ sudo chroot debian apt install build-essential vim openssh-server \ + pkg-config libnl-3-dev libnl-genl-3-dev libcap-dev + sudo mkdir debian/root/.ssh/ + ssh-add -L | sudo tee debian/root/.ssh/authorized_keys + sudo mkdir debian/host + sudo cp fstab debian/etc/fstab + sudo cp rc.local debian/etc/rc.local + sudo chmod a+x debian/etc/rc.local + sudo sed -i 's/^root:[^:]*:/root::/' debian/etc/shadow + + ## optionally: allow ssh logins without passwords - # sudo sed -i 's/^PermitRootLogin.*/PermitRootLogin yes/' debian/etc/ssh/sshd_config - # sudo sed -i 's/^PermitEmptyPasswords.*/PermitEmptyPasswords yes/' debian/etc/ssh/sshd_config ++ # sudo sed -i 's/^#PermitRootLogin.*/PermitRootLogin yes/' debian/etc/ssh/sshd_config ++ # sudo sed -i 's/^#PermitEmptyPasswords.*/PermitEmptyPasswords yes/' debian/etc/ssh/sshd_config + # sudo sed -i 's/^UsePAM.*/UsePAM no/' debian/etc/ssh/sshd_config + + ## optionally: enable autologin for user root + #sudo mkdir debian/etc/systemd/system/serial-getty@ttyS0.service.d/ + #sudo sh -c 'cat > debian/etc/systemd/system/serial-getty@ttyS0.service.d/autologin.conf << EOF + #[Service] + #ExecStart= + #ExecStart=-/sbin/agetty --autologin root -s %I 115200,38400,9600 vt102 + #EOF' + + sudo sh -c 'echo '''PATH="$PATH":/host/batctl/''' >> debian/etc/profile' + sudo umount debian + + + ## optionally: convert image to qcow2 + #sudo qemu-img convert -f raw -O qcow2 debian.img debian.qcow2 + #sudo mv debian.qcow2 debian.img + +Kernel compile +-------------- + +Any recent kernel can be used for the setup. The build result +``arch/x86/boot/bzImage`` has to be copied to the same directory as the +debian.img + +:: + + git clone git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git + cd linux-next + + # small configuration + + make allnoconfig + cat >> .config << EOF + CONFIG_SMP=y + CONFIG_EMBEDDED=n + CONFIG_EXPERT=n + CONFIG_MODULES=y + CONFIG_MODULE_UNLOAD=y + CONFIG_MODVERSIONS=y + CONFIG_MODULE_SRCVERSION_ALL=y + CONFIG_64BIT=y + CONFIG_X86_VSYSCALL_EMULATION=n + CONFIG_IA32_EMULATION=n + CONFIG_HW_RANDOM_VIRTIO=y + CONFIG_NET_9P_VIRTIO=y + CONFIG_SCSI_VIRTIO=y + CONFIG_VIRTIO_BALLOON=y + CONFIG_VIRTIO_BLK=y + CONFIG_VIRTIO_CONSOLE=y + CONFIG_VIRTIO_INPUT=y + CONFIG_VIRTIO_MMIO=y + CONFIG_VIRTIO_MMIO_CMDLINE_DEVICES=y + CONFIG_VIRTIO_NET=y + CONFIG_VIRTIO_PCI=y + CONFIG_VIRTIO_PCI_LEGACY=y + CONFIG_CRC16=y + CONFIG_LIBCRC32C=y + CONFIG_CRYPTO_SHA512=y + CONFIG_NET=y + CONFIG_INET=y + CONFIG_DEBUG_FS=y + CONFIG_IPV6=y + CONFIG_BRIDGE=y + CONFIG_VLAN_8021Q=y + CONFIG_WIRELESS=n + CONFIG_NET_9P=y + CONFIG_NETWORK_FILESYSTEMS=y + CONFIG_9P_FS=y + CONFIG_9P_FS_POSIX_ACL=y + CONFIG_9P_FS_SECURITY=y + CONFIG_BLOCK=y + CONFIG_BLK_DEV=y + CONFIG_EXT4_FS=y + CONFIG_EXT4_USE_FOR_EXT23=y + CONFIG_TTY=y + CONFIG_SERIAL_8250=y + CONFIG_SERIAL_8250_CONSOLE=y + CONFIG_HW_RANDOM=y + CONFIG_VHOST_RING=y + CONFIG_GENERIC_ALLOCATOR=y + CONFIG_SCSI_LOWLEVEL=y + CONFIG_SCSI=y + CONFIG_NETDEVICES=y + CONFIG_NET_CORE=y + CONFIG_DEVTMPFS=y + CONFIG_HYPERVISOR_GUEST=y + CONFIG_PARAVIRT=y + CONFIG_KVM_GUEST=y + CONFIG_BINFMT_ELF=y + CONFIG_BINFMT_SCRIPT=y + CONFIG_BINFMT_MISC=y + CONFIG_PCI=y + CONFIG_SYSVIPC=y + CONFIG_POSIX_MQUEUE=y + CONFIG_CROSS_MEMORY_ATTACH=y + CONFIG_UNIX=y + CONFIG_TMPFS=y + CONFIG_CGROUPS=y + CONFIG_BLK_CGROUP=y + CONFIG_CGROUP_CPUACCT=y + CONFIG_CGROUP_DEVICE=y + CONFIG_CGROUP_FREEZER=y + CONFIG_CGROUP_HUGETLB=y + CONFIG_CGROUP_NET_CLASSID=y + CONFIG_CGROUP_NET_PRIO=y + CONFIG_CGROUP_PERF=y + CONFIG_CGROUP_SCHED=y + CONFIG_DEVPTS_MULTIPLE_INSTANCES=y + CONFIG_INOTIFY_USER=y + CONFIG_FHANDLE=y + CONFIG_E1000=y + CONFIG_CPU_FREQ=y + CONFIG_CONFIG_X86_ACPI_CPUFREQ=y + CONFIG_CPU_FREQ_GOV_ONDEMAND=y + CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y + CONFIG_CFG80211=y + CONFIG_PARAVIRT_SPINLOCKS=y + CONFIG_DUMMY=y + CONFIG_PACKET=y + CONFIG_VETH=y + CONFIG_IP_MULTICAST=y + CONFIG_NET_IPGRE_DEMUX=y + CONFIG_NET_IP_TUNNEL=y + CONFIG_NET_IPGRE=y + CONFIG_NET_IPGRE_BROADCAST=y + EOF + + #debug stuff + # make sure that libelf-dev is installed or module build will fail with something like "No rule to make target 'net/batman-adv/bat_algo.o'" + + cat >> .config << EOF + CONFIG_CC_STACKPROTECTOR_STRONG=y + CONFIG_LOCKUP_DETECTOR=y + CONFIG_DETECT_HUNG_TASK=y + CONFIG_SCHED_STACK_END_CHECK=y + CONFIG_DEBUG_RT_MUTEXES=y + CONFIG_DEBUG_SPINLOCK=y + CONFIG_DEBUG_MUTEXES=y + CONFIG_PROVE_LOCKING=y + CONFIG_LOCK_STAT=y + CONFIG_DEBUG_LOCKDEP=y + CONFIG_DEBUG_ATOMIC_SLEEP=y + CONFIG_DEBUG_LIST=y + CONFIG_DEBUG_PI_LIST=y + CONFIG_DEBUG_SG=y + CONFIG_DEBUG_NOTIFIERS=y + CONFIG_PROVE_RCU_REPEATEDLY=y + CONFIG_SPARSE_RCU_POINTER=y + CONFIG_DEBUG_STRICT_USER_COPY_CHECKS=y + CONFIG_X86_VERBOSE_BOOTUP=y + CONFIG_DEBUG_RODATA=y + CONFIG_DEBUG_RODATA_TEST=n + CONFIG_DEBUG_SET_MODULE_RONX=y + CONFIG_PAGE_EXTENSION=y + CONFIG_DEBUG_PAGEALLOC=y + CONFIG_DEBUG_OBJECTS=y + CONFIG_DEBUG_OBJECTS_FREE=y + CONFIG_DEBUG_OBJECTS_TIMERS=y + CONFIG_DEBUG_OBJECTS_WORK=y + CONFIG_DEBUG_OBJECTS_RCU_HEAD=y + CONFIG_DEBUG_OBJECTS_PERCPU_COUNTER=y + CONFIG_DEBUG_KMEMLEAK=y + CONFIG_DEBUG_STACK_USAGE=y + CONFIG_DEBUG_STACKOVERFLOW=y + CONFIG_DEBUG_INFO=y + CONFIG_DEBUG_INFO_DWARF4=y + CONFIG_GDB_SCRIPTS=y + CONFIG_READABLE_ASM=y + CONFIG_STACK_VALIDATION=y + CONFIG_WQ_WATCHDOG=y + CONFIG_DEBUG_KOBJECT_RELEASE=y + CONFIG_DEBUG_WQ_FORCE_RR_CPU=y + CONFIG_OPTIMIZE_INLINING=y + CONFIG_ENABLE_MUST_CHECK=y + CONFIG_ENABLE_WARN_DEPRECATED=y + EOF + + # for GCC 5+ + cat >> .config << EOF + CONFIG_KASAN=y + CONFIG_KASAN_INLINE=y + CONFIG_UBSAN_SANITIZE_ALL=y + CONFIG_UBSAN=y + EOF + + make olddefconfig + make all -j$(nproc || echo 1) + +Start of the simple environment +------------------------------- + +The two node environment must be started inside a screen session. The +hub (bridge with eth0 + 2 tap devices) has to be started first to have a +simple network. A more complex network setup can be on the page +:doc:`Emulation <Emulation>` + +The ``ETH`` in hub.sh has to be changed to the real interface which +provides internet-connectivity +The ``SHARED_PATH`` in run.sh has to be changed to a valid path which +is used to share the precompiled batman-adv.ko and other tools + +:: + + screen + ./hub.sh + ./run.sh + +Building the batman-adv module +------------------------------ + +The kernel module can be build outside the virtual environment and +shared over the 9p mount. The path to the kernel sources have to be +provided to the make process + +:: + + make KERNELPATH=/home/batman/linux-next + +The kernel module can also be compiled for better readability for the +calltraces: + +:: + + make EXTRA_CFLAGS="-fno-inline -O1 -fno-optimize-sibling-calls" KERNELPATH=/home/sven/tmp/linux-next V=1 + +Resources +--------- + +* :download:`fstab` +* :download:`hub.sh` +* :download:`rc.local` +* :download:`run.sh`