forked from cyoung/stratux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBUILDING-buffalowifi
241 lines (203 loc) · 6.38 KB
/
BUILDING-buffalowifi
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
steps to build these images from the official stratux images, using qemu and virtualbox on ubuntu...
**************
prepare ubuntu working environment
**************
> sudo apt-get install binfmt-support qemu qemu-user-static unzip
> git clone https://github.com/alexchamberlain/piimg
> cd piimg
> make
> sudo make install
> sudo piimg mount /home/(user)/Downloads/stratux1234567*.img /mnt
> sudo cp /usr/bin/qemu-arm-static /mnt/usr/bin/
> sudo cp /etc/resolv.conf /mnt/etc
> sudo nano /mnt/etc/ld.so.preload and comment all contents, save
> sudo chroot /mnt
raspi-config … change locale info, save/exit
apt-get update
apt-get install unionfs-fuse
nano /usr/local/bin/mount_unionfs
****************
add contents
****************
#!/bin/sh
[ -z "$1" ] && exit 1 || DIR=$1
ROOT_MOUNT=$(grep -v "^#" /etc/fstab | awk '$2=="/" {print substr($4,1,2)}')
if [ "$ROOT_MOUNT" != "ro" ]; then
/bin/mount --bind ${DIR}_org ${DIR}
else
/bin/mount -t tmpfs ramdisk ${DIR}_rw
/usr/bin/unionfs-fuse -o cow,allow_other,suid,dev,nonempty ${DIR}_rw=RW:${DIR}_org=RO ${DIR}
fi
****************
end of file
****************
chmod +x /usr/local/bin/mount_unionfs
apt-get install busybox-syslogd; dpkg —-purge rsyslog
nano /etc/bash.bashrc … add the following to the end of the file
****************
add contents
****************
# set variable identifying the filesystem you work in (used in the prompt below)
fs_mode=$(mount | sed -n -e "s/^\/dev\/root on \/ .*(\(r[w|o]\).*/\1/p")
alias ro='mount -o remount,ro / ; fs_mode=$(mount | sed -n -e "s/^\/dev\/root on \/ .*(\(r[w|o]\).*/\1/p")'
alias rw='mount -o remount,rw / ; fs_mode=$(mount | sed -n -e "s/^\/dev\/root on \/ .*(\(r[w|o]\).*/\1/p")'
# setup fancy prompt
export PS1='\[\033[01;32m\]\u@\h${fs_mode:+($fs_mode)}\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
****************
end of file
****************
nano /root/.bashrc … uncomment middle section lines beginning with “export” and add the following to the end of the file
****************
add contents
****************
rw
history -a
fake-hwclock save
ro
****************
end of file
****************
apt-get install watchdog libssl-dev libnl-dev
update-rc.d watchdog enable
nano /etc/watchdog.conf … erase all contents and replace with the following
****************
add contents
****************
min-memory = 5000
watchdog-device = /dev/watchdog
interval = 5
logtick = 60
# This greatly decreases the chance that watchdog won't be scheduled before
# your machine is really loaded
realtime = yes
priority = 1
# Check if processes are still running by enabling the following line or similar
pidfile = /var/run/hostapd.pid
pidfile = /var/run/dhcpd.pid
****************
end of file
****************
nano /etc/default/watchdog …
change watchdog_module from “none” to “bcm2708_wdog” and save/exit
nano /etc/modprobe.d/watchdog.conf
****************
add contents
****************
options bcm2708_wdog heartbeat=10 nowayout=1
****************
end of file
****************
cd /home/pi
git clone git://w1.fi/srv/git/hostap.git
cd hostap/hostapd
cp defconfig .config
make install
mv /usr/sbin/hostapd /home/pi/hostapd_old
mv /usr/sbin/hostapd_cli /home/pi/hostapd_cli_old
mv /usr/local/bin/hostapd /usr/sbin/hostapd
mv /usr/local/bin/hostapd_cli /usr/sbin/hostapd_cli
nano /etc/hostapd/hostapd.conf … erase all contents and replace with the below
***************
add contents
***************
interface=wlan0
driver=nl80211
ssid=stratux
hw_mode=g
channel=1
auth_algs=1
wpa=3
wpa_passphrase=asdf1234
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
wmm_enabled=1
ignore_broadcast_ssid=0
***************
end of file
***************
nano /etc/default/ifplugd … replace INTERFACES and HOTPLUG_INTERFACES values with “eth0”
nano /etc/init.d/checkroot-bootclean.sh … find the following lines, comment the lines beginning with “rm -f” and “clean_all”
***************
file contents
***************
case "$1" in
start|"")
# Clean /tmp, /lib/init/rw, /run and /run/lock. Remove the
# .clean files to force initial cleaning. This is intended
# to
# allow cleaning of directories masked by mounts while the
# system was previously running, which would otherwise
# prevent
# them being cleaned.
#rm -f /tmp/.clean /lib/init/rw/.clean /run/.clean /run/lock/.clean
#clean_all
exit $?
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
# No-op
;;
*)
echo "Usage: checkroot-bootclean.sh [start|stop]" >&2
exit 3
;;
esac
***************
end file contents
***************
nano /etc/fstab … remove ‘defaults’ add ‘ro’ to boot and root mounts…
proc /proc proc defaults 0 0
/dev/mmcblk456 /boot vfat ro 0 2
/dev/mmcblk123 / ext4 ro,noatime 0 1
add the following three lines under the root mount
****************
add contents
****************
mount_unionfs /etc fuse defaults 0 0
mount_unionfs /var fuse defaults 0 0
none /tmp tmpfs defaults 0 0
****************
end of file
****************
nano /boot/cmdline.txt and add the following to the end of the line
****************
add contents
****************
fastboot noswap ro
****************
end of file
****************
nano /etc/hosts.deny … add contents to the end of the file
****************
add contents
****************
sshd : 192.168.10.0/255.255.255.0
****************
end of file
****************
dphys-swapfile swapoff
dphys-swapfile uninstall
update-rc.d bootlogs disable
rm -f /etc/mtab
ln -s /proc/self/mounts /etc/mtab
update-rc.d apply_noobs_os_config disable
update-rc.d regenerate_ssh_host_keys disable
/etc/init.d/apply_noobs_os_config start
/etc/init.d/regenerate_ssh_host_keys start
apt-get remove —-purge triggerhappy logrotate dphys-swapfile raspi-config
apt-get clean
cp -al /etc /etc_org
mv /var /var_org
mkdir /etc_rw
mkdir /var /var_rw
ctrl - D
sudo nano /mnt/etc/ld.so.preload … and uncomment all contents, save
sudo rm -f /mnt/usr/bin/qemu-arm-static
sudo rm -f /mnt/etc_org/resolv.conf
sudo touch /mnt/etc_org/resolv.conf
sudo piimg umount /mnt
now the image is ready to boot, flash it to your SD card as described by the original author.