Debian Codegraph @

lib/freeDiameter-1.2.1/contrib/OpenWRT/HOWTO

raw
1 #####################
2 # !! IMPORTANT !! #
3 #####################
4
5 The uClibc library that is shipped with OpenWRT lacks support for several POSIX thread
6 features, such as pthread_cleanup_{push,pop}, that are required by the freeDiameter
7 framework.
8
9 Until these features are included in the base OpenWRT system, the framework will not
10 behave correctly on this platform.
11
12 Therefore, the OpenWRT port is NOT usable properly at this moment with uClibc.
13
14 A test software is included in test_required for checking if new uClibc distributions
15 support the required features. You'll have to adapt the Makefile according to your environment.
16
17 An alternative choice if your hardware allows it is to use (e)glibc in your openwrt image.
18
19 #####################
20
21
22
23 This HOWTO describes how to generate a set of ipkg modules for
24 providing support of freeDiameter in an OpenWRT system.
25
26 This HOWTO is written for OpenWRT 10.03 (BackFire) and no guarantee is provided
27 that it will work for you. Be prepared to eventually brick your routeur...
28
29 Table of contents:
30 0) Quick HOWTO: optimistic step-by-step instructions.
31 1) Prerequisites: get the OpenWRT development environment ready.
32 2) Supplied packages: use the existing packages when possible (gnutls, ...)
33 3) Other dependencies: provide for additional missing dependencies (sctp ...)
34 4) freediameter package: now create the freeDiameter package
35 5) Configuration: how to set the configuration on the router.
36
37 This HOWTO will NOT cover how to install OpenWRT on your access device, nor
38 its basic configuration. Please refer to OpenWRT website for this type of HOWTOs.
39
40
41 ==============================================
42 0) Quick HOWTO
43 ==============================================
44 The following instructions should allow you to put freeDiameter on your OpenWRT-compatible router.
45 In case something goes wrong, you should follow the detailed instructions in the remaining of
46 this file.
47
48 Be warned: playing with the software in your router may brick it, i.e. make it unusable forever.
49 Do it at your own risk.
50
51 1) Get the OpenWRT environment:
52 $ git clone git://nbd.name/openwrt.git
53 $ cd openwrt
54
55 2) Get the feeds
56 $ cp feeds.conf.default feeds.conf
57 $ echo "src-hg freediameter http://www.freediameter.net/hg/fD-OWRT-packages" >> feeds.conf
58 $ scripts/feeds update
59 $ scripts/feeds install freeDiameter
60
61 3) Configure your image
62 $ make menuconfig
63 (set Target System and Target Profile as needed for your equipment)
64
65 - Network --->
66 freeDiameter (M)
67 freeDiameter-test (M)
68 wpad (*)
69 wpad-mini ( )
70
71
72 4) Set the C library to glibc instead of uClibc (broken support, see #26)
73
74 - Advanced configuration options (for developers) --->
75 - Toolchain Options ---->
76 C Library implementation (Use eglibc)
77
78
79 5) Build the image and packages, this takes a while
80 $ make world
81
82 6) Export the bin/* directory through a webserver.
83 We assume it is available at http://192.168.1.25/owrt
84
85 7) Flash the router with your new image -- THIS DESTROYS ALL CONFIG ON THE ROUTER!
86 $ ssh [email protected]
87 # cd /tmp
88 # wget http://192.168.1.25/owrt/openwrt-brcm47xx-squashfs.trx
89 ;; change the file name with yours
90 # mtd -r write openwrt-brcm47xx-squashfs.trx linux
91 ;; wait for reboot
92 $ telnet 192.168.1.1
93 # passwd
94 # sync
95 # exit
96
97 8) Update the opkg router's config to get your new packages
98 ssh [email protected]
99 # echo "src/gz localrepo http://192.168.1.25/owrt/packages" >> /etc/opkg.conf
100 # opkg update
101
102 9) Install freeDiameter, you're done. Optionnaly, install also certtool on the router before, to
103 generate the TLS certificate automatically.
104 # opkg install freeDiameter
105
106 ==============================================
107 1) Prerequisites:
108 ==============================================
109
110 We will first need a working OpenWRT toolchain environment. You can retrieve
111 pre-compiled binaries of such toolchains ("Image builder") on the OpenWRT website. Anyway,
112 in case the architecture you are interested in is not listed, you can build
113 the full toolchain from source. This is the path we are following in this HOWTO.
114
115 a) Retrieve the latest OpenWRT source, using subversion or git.
116 Since I have to go through a proxy, I use the later here, svn being quite annoying with proxies.
117 Note, the following commands must not be run as root.
118 $ git clone git://nbd.name/openwrt.git
119 (Note: you might instead use "backfire.git" if you want to stick with an OpenWRT release.)
120 $ cd openwrt
121 $ cp feeds.conf.default feeds.conf
122
123 b) If you are using git, you have to edit the feeds.conf file to use git as well for packages.
124 Do the following modifications in this case:
125 $ vi feeds.conf
126 Comment out this line:
127 src-svn packages https://svn.openwrt.org/openwrt/packages
128 Add this line instead:
129 src-git packages git://nbd.name/packages.git
130
131 You can leave uncommented the luci (for GNUTLS) and Xwrt (webif) repositories. Since these repositories
132 use svn over http, you can use subversion even if you are behind a proxy.
133
134 c) Then issue the following command to update the package list:
135 $ scripts/feeds update
136
137 d) Now, let's already create the toolchain and basic image.
138 $ make menuconfig
139
140 This will open a menu for you. You must select the target you are building for.
141 See http://wiki.openwrt.org/toh/start for the table of hardware and associated information.
142 In my case, I am using a Buffalo WZR-HP-G300NH router. I therefore select these options:
143 - Target System --->
144 Atheros AR71xx/AR7240/AR913x
145 - Target Profile --->
146 Buffalo WZR-HP-G300NH
147
148 For many routeurs, the recommended kernel is a 2.4x version. I have NOT tried with such kernel,
149 and the SCTP support is likely to be different in this generation of kernels. I strongly recommend
150 to go with a 2.6x kernel, whenever possible.
151
152 e) As per freeDiameter ticket #26, you also need to change the library to glibc instead of uClibc.
153 Change the option as follow:
154
155 - Advanced configuration options (for developers) --->
156 - Toolchain Options ---->
157 C Library implementation (Use eglibc)
158
159 f) Once configured, create the toolchain and default image (this takes a while):
160 $ make world
161
162 After this command completes successfully, your build environment is ready.
163 The resulting image and packages are stored in the "bin/" subdirectory.
164 It is very convenient if you make this repository available in http to your routeur.
165
166 You should probably try at this early stage to flash your device with the image you have generated.
167 If the default basic image does not work, it is probably not worth adding new problems on top of it.
168
169 For troubleshooting, please consult OpenWRT documentation directly.
170 "make prereq" may help you building the initial image also.
171 See http://downloads.openwrt.org/docs/buildroot-documentation.html for additional information
172 concerning this step.
173
174 You should now be able to login on your routeur with telnet (first time) or ssh (after setting a password).
175
176 ==============================================
177 2) Supplied packages:
178 ==============================================
179
180 There are some dependencies of freeDiameter already available in the OpenWRT packages repository.
181 You can check for the available packages with the script:
182 $ ./scripts/feeds search <package>
183
184 We will now describe how to install these dependencies. At the time this HOWTO is written,
185 the OpenWRT repositories contains packages for sctp, ipv6, gnutls, pthreads and hostapd.
186 Follow these instructions to build them.
187
188 Alternatively, you can find these packages pre-compiled in the OpenWRT packages repository.
189
190 a) Add the packages
191 $ scripts/feeds install libgnutls
192 $ scripts/feeds install sctp
193
194 b) Select the following components in the menu:
195 $ make menuconfig
196 - Base system --->
197 libpthread (M)
198
199 - Network --->
200 sctp (M)
201 hostapd (M)
202 wpad-mini ( )
203
204 - Libraries --->
205 SSL --->
206 libgnutls (M)
207
208 - Kernel modules --->
209 Network Support --->
210 kmod-ipv6 (M)
211
212 Quit and save the new config, then:
213 $ make world
214
215 This will add a bunch of modules in your bin directory that will be required for freeDiameter.
216 Since we are removing the wpad-mini daemon from the base image, this image (trx or bin file) is also recompiled.
217
218 Note that if you are setting your device as WPA supplicant also (wireless client), you must select wpad instead of hostapd.
219 (in any case, the -mini version is not suitable since we will use the RADIUS authentication).
220
221
222 You should now reflash your routeur with the new firmware image. The simplest way to achieve if your routeur has enough
223 flash memory is to:
224 - copy the new trx image to your routeur's /tmp (using wget or scp)
225 - run this command (on the device) -- replace <newfile.trx> with your actual filename:
226 root@OpenWrt:~# mtd -r write <newfile.trx> linux
227
228 WARNING: this will erase your existing configuration on the routeur.
229 In case you need to save it, you may try the sysupgrade command instead.
230
231 This will reboot the device after writing the new image file.
232 Afterwards, if you have set up the http server on your development machine properly
233 (let's assume it has IP address 192.168.1.25)
234 you can run the following command on your router:
235 root@OpenWrt:~# echo "src/gz mydev http://192.168.1.25/packages" >> /etc/opkg.conf
236 root@OpenWrt:~# opkg update
237
238 Install the newly compiled packages with:
239 root@OpenWrt:~# opkg install kmod-ipv6 hostapd libpthread sctp
240
241 ==============================================
242 3) Missing packages:
243 ==============================================
244
245 UPDATE: Starting from revision r22917, sctp and kmod-sctp are included in the OpenWRT distribution, and have been removed
246 from freeDiameter package. One may consider using a freeDiameter package prior to 2010/09/05 in order to get the sctp
247 package, or a more recent OpenWRT environment.
248
249 PREVIOUS SITUATION: If you are using components prior to 2010/09/05, the following applies:
250 P:
251 P: There are other dependencies for freeDiameter that are not provided by OpenWRT packages.
252 P: For convenience, we include these meta-packages in the freeDiameter distribution -- but they
253 P: might not be up-to-date.
254 P:
255 P: a) Adding the contributed directory to the feeds
256 P: Add the following line in your feeds.conf file:
257 P: src-link freediameter /path/to/freediameter/contrib/OpenWRT/packages/
258 P:
259 P: Then run:
260 P: $ scripts/feeds update
261 P:
262 P: This should allow you to install the missing dependencies as follow:
263 P:
264 P:
265 P: b) SCTP library (note: you might alternatively compile freeDiameter without SCTP support).
266 P: $ scripts/feeds install sctp
267 P:
268 P:
269 P: c) Select these components in the menu:
270 P: $ make menuconfig
271 P: - Libraries --->
272 P: sctp (M)
273 P:
274 P: Quit and save the new config, then:
275 P: $ make world
276 P:
277 P:
278 P: d) Install this on the router as well:
279 P: root@OpenWrt:~# opkg update
280 P: root@OpenWrt:~# opkg install sctp
281
282
283 ==============================================
284 4) freediameter package:
285 ==============================================
286
287 Now, your environment should be ready to compile the freeDiameter ipkg package.
288 $ scripts/feeds install freeDiameter
289
290 Note that in order to build this package, you need to have cmake & flex on your compilation machine.
291
292 $ make menuconfig
293 - Network --->
294 freeDiameter (M)
295 freeDiameter-test (M)
296
297 Quit and save the new config, then:
298 $ make world
299
300 On your router, run:
301 # opkg update
302 # opkg install freeDiameter
303
304
305