-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpi3-nexmon-install.yml
125 lines (125 loc) · 3.89 KB
/
pi3-nexmon-install.yml
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
---
- name: Instala la base para los equipos de los laboratorios de Greencore Solutions
hosts: pi
environment:
- ARCH: arm
- OLD_PWD: "{{ ansible_user }}/nexmon"
- SUBARCH: arm
- KERNEL: kernel7
- HOSTUNAME: Linux
- PLATFORMUNAME: armv7l
- CC: /home/pi/nexmon/buildtools/gcc-arm-none-eabi-5_4-2016q2-linux-armv7l/bin/arm-none-eabi-
- CCPLUGIN: /home/pi/nexmon/buildtools/gcc-nexmon-plugin-arm/nexmon.so
- ZLIBFLATE: zlib-flate -compress
- NEXMON_ROOT: /home/pi/nexmon
- NEXMON_SETUP_ENV: 1
tasks:
- name: Instala aptitude (requerido por ansible)
apt:
name: aptitude
state: latest
update_cache: yes
become: yes
## https://github.com/seemoo-lab/nexmon/issues/75
# - name: Actualiza cache, paquetes, y autoremueve
#apt:
#upgrade: dist
#update_cache: yes
# autoremove not available in 16.04's ansible
#autoremove: yes
#become: yes
- name: Instala paquetes requeridos para esta receta
apt:
name: "{{ item }}"
state: installed
with_items:
- raspberrypi-kernel-headers
- git
- libgmp3-dev
- gawk
- qpdf
- bison
- flex
- bc
- libncurses5-dev
- tcpdump
become: yes
- name: Instala rpi-source, utilitario para fuente de kernel en las Pi
get_url:
url: https://raw.githubusercontent.com/notro/rpi-source/master/rpi-source
dest: /usr/bin/rpi-source
mode: 0755
owner: root
group: root
become: yes
- name: Ejecuta rpi-source, para descargar fuente de kernel en las Pi
command: rpi-source -d /usr/src/
become: yes
ignore_errors: true
- name: Descarga software nexmon
git:
#dest: "{{ ansible_user }}/nexmon" ## Pulga, sale como /home/pi/pi/nexmon...
dest: /home/pi/nexmon
repo: https://github.com/seemoo-lab/nexmon.git
ignore_errors: true
- name: Parcha la herramienta nexutil, https://github.com/seemoo-lab/nexmon/issues/62
lineinfile: >
path=/home/pi/nexmon/utilities/nexutil/nexutil.c
regexp='stdint'
insertbefore='#define _XOPEN_SOURCE 700'
line="#include <sys/types.h>
#include <stdint.h>
#include <stdlib.h>"
- name: Compila nexmon
command: make
args:
chdir: /home/pi/nexmon
- name: Compila el software nexmon, bcm43438 chipset
command: make -j4
args:
chdir: /home/pi/nexmon/patches/bcm43438/7_45_41_26/nexmon/
# become: yes
- name: Realiza respaldo de firmware, bcm43438 chipset
command: make backup-firmware
args:
chdir: /home/pi/nexmon/patches/bcm43438/7_45_41_26/nexmon/
# become: yes
- name: Instala nuevo firmware, bcm43438 chipset
command: make install-firmware
args:
chdir: /home/pi/nexmon/patches/bcm43438/7_45_41_26/nexmon/
become: yes
- name: Compila utilizario nextutil para software nexmon
command: make -j4
args:
chdir: /home/pi/nexmon/utilities/nexutil
# become: yes
- name: Instala utilizario nextutil para software nexmon
command: make install
args:
chdir: /home/pi/nexmon/utilities/nexutil
become: yes
- name: Remueve paquetes
apt:
name: "{{ item }}"
state: absent
become: yes
with_items:
- wpasupplicant
- name: Decide si debe copiar el nuevo módulo de kernel
command: test "md5sum /lib/modules/4.4.34-v7+/kernel/drivers/net/wireless/brcm80211/brcmfmac/brcmfmac.ko" == "52623c3a481dca9a233088deab271f79"
register: modulo_viejo
ignore_errors: true
- name: Respalda viejo driver de kernel
file:
src: /home/pi/nexmon/patches/bcm43438/7_45_41_26/nexmon/brcmfmac/brcmfmac.ko
dest: /lib/modules/4.4.34-v7+/kernel/drivers/net/wireless/brcm80211/brcmfmac/brcmfmac.ko
owner: root
group: root
mode: 0644
become: yes
when: modulo_viejo.changed
- name: Ejecuta depmod
command: depmod -a
become: yes
when: modulo_viejo.changed