Navigation


source: freeDiameter/contrib/OpenWRT/HOWTO

Last change on this file was 702:672876bf2699, checked in by Sebastien Decugis <sdecugis@nict.go.jp>, 10 years ago

Changed reference from glibc to eglibc in OpenWRT HOWTO

File size: 11.0 KB
Line 
1#####################
2#  !! IMPORTANT !!  #
3#####################
4
5The uClibc library that is shipped with OpenWRT lacks support for several POSIX thread
6features, such as pthread_cleanup_{push,pop}, that are required by the freeDiameter
7framework.
8
9Until these features are included in the base OpenWRT system, the framework will not
10behave correctly on this platform.
11
12Therefore, the OpenWRT port is NOT usable properly at this moment with uClibc.
13
14A test software is included in test_required for checking if new uClibc distributions
15support the required features. You'll have to adapt the Makefile according to your environment.
16
17An alternative choice if your hardware allows it is to use (e)glibc in your openwrt image.
18
19#####################
20
21
22
23This HOWTO describes how to generate a set of ipkg modules for
24providing support of freeDiameter in an OpenWRT system.
25
26This HOWTO is written for OpenWRT 10.03 (BackFire) and no guarantee is provided
27that it will work for you. Be prepared to eventually brick your routeur...
28
29Table of contents:
300) Quick HOWTO: optimistic step-by-step instructions.
311) Prerequisites: get the OpenWRT development environment ready.
322) Supplied packages: use the existing packages when possible (gnutls, ...)
333) Other dependencies: provide for additional missing dependencies (sctp ...)
344) freediameter package: now create the freeDiameter package
355) Configuration: how to set the configuration on the router.
36
37This HOWTO will NOT cover how to install OpenWRT on your access device, nor
38its basic configuration. Please refer to OpenWRT website for this type of HOWTOs.
39
40
41==============================================
420) Quick HOWTO
43==============================================
44The following instructions should allow you to put freeDiameter on your OpenWRT-compatible router.
45In case something goes wrong, you should follow the detailed instructions in the remaining of
46this file.
47
48Be warned: playing with the software in your router may brick it, i.e. make it unusable forever.
49Do it at your own risk.
50
511) Get the OpenWRT environment:
52$ git clone git://nbd.name/openwrt.git
53$ cd openwrt
54
552) 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
613) 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
724) 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
795) Build the image and packages, this takes a while
80$ make world
81
826) Export the bin/* directory through a webserver.
83   We assume it is available at http://192.168.1.25/owrt
84   
857) Flash the router with your new image -- THIS DESTROYS ALL CONFIG ON THE ROUTER!
86$ ssh root@192.168.1.1
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
978) Update the opkg router's config to get your new packages
98ssh root@192.168.1.1
99# echo "src/gz localrepo http://192.168.1.25/owrt/packages" >> /etc/opkg.conf
100# opkg update
101
1029) 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==============================================
1071) Prerequisites:
108==============================================
109
110We will first need a working OpenWRT toolchain environment. You can retrieve
111pre-compiled binaries of such toolchains ("Image builder") on the OpenWRT website. Anyway,
112in case the architecture you are interested in is not listed, you can build
113the full toolchain from source. This is the path we are following in this HOWTO.
114
115a) Retrieve the latest OpenWRT source, using subversion or git.
116Since I have to go through a proxy, I use the later here, svn being quite annoying with proxies.
117Note, 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
123b) If you are using git, you have to edit the feeds.conf file to use git as well for packages.
124Do the following modifications in this case:
125$ vi feeds.conf
126 Comment out this line:
127src-svn packages https://svn.openwrt.org/openwrt/packages
128 Add this line instead:
129src-git packages git://nbd.name/packages.git
130
131 You can leave uncommented the luci (for GNUTLS) and Xwrt (webif) repositories. Since these repositories
132use svn over http, you can use subversion even if you are behind a proxy.
133
134c) Then issue the following command to update the package list:
135$ scripts/feeds update
136
137d) Now, let's already create the toolchain and basic image.
138$ make menuconfig
139
140This will open a menu for you. You must select the target you are building for.
141See http://wiki.openwrt.org/toh/start for the table of hardware and associated information.
142In 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   
148For many routeurs, the recommended kernel is a 2.4x version. I have NOT tried with such kernel,
149and the SCTP support is likely to be different in this generation of kernels. I strongly recommend
150to go with a 2.6x kernel, whenever possible.
151   
152e) As per freeDiameter ticket #26, you also need to change the library to glibc instead of uClibc.
153Change the option as follow:
154
155- Advanced configuration options (for developers) --->
156  - Toolchain Options ---->
157    C Library implementation (Use eglibc)
158
159f) Once configured, create the toolchain and default image (this takes a while):
160$ make world
161
162After this command completes successfully, your build environment is ready.
163The resulting image and packages are stored in the "bin/" subdirectory.
164It is very convenient if you make this repository available in http to your routeur.
165
166You should probably try at this early stage to flash your device with the image you have generated.
167If the default basic image does not work, it is probably not worth adding new problems on top of it.
168
169For troubleshooting, please consult OpenWRT documentation directly.
170"make prereq" may help you building the initial image also.
171See http://downloads.openwrt.org/docs/buildroot-documentation.html for additional information
172concerning this step.
173
174You should now be able to login on your routeur with telnet (first time) or ssh (after setting a password).
175
176==============================================
1772) Supplied packages:
178==============================================
179
180There are some dependencies of freeDiameter already available in the OpenWRT packages repository.
181You can check for the available packages with the script:
182$ ./scripts/feeds search <package>
183
184We will now describe how to install these dependencies. At the time this HOWTO is written,
185the OpenWRT repositories contains packages for sctp, ipv6, gnutls, pthreads and hostapd.
186Follow these instructions to build them.
187
188Alternatively, you can find these packages pre-compiled in the OpenWRT packages repository.
189
190a) Add the packages
191$ scripts/feeds install libgnutls
192$ scripts/feeds install sctp
193
194b) 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     
212Quit and save the new config, then:
213$ make world
214
215This will add a bunch of modules in your bin directory that will be required for freeDiameter.
216Since we are removing the wpad-mini daemon from the base image, this image (trx or bin file) is also recompiled.
217
218Note 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
222You should now reflash your routeur with the new firmware image. The simplest way to achieve if your routeur has enough
223flash 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
228WARNING: this will erase your existing configuration on the routeur.
229In case you need to save it, you may try the sysupgrade command instead.
230
231This will reboot the device after writing the new image file.
232Afterwards, 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)
234you 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
238Install the newly compiled packages with:
239 root@OpenWrt:~# opkg install kmod-ipv6 hostapd libpthread sctp
240
241==============================================
2423) Missing packages:
243==============================================
244
245UPDATE: Starting from revision r22917, sctp and kmod-sctp are included in the OpenWRT distribution, and have been removed
246from freeDiameter package. One may consider using a freeDiameter package prior to 2010/09/05 in order to get the sctp
247package, or a more recent OpenWRT environment.
248
249PREVIOUS SITUATION: If you are using components prior to 2010/09/05, the following applies:
250P:
251P: There are other dependencies for freeDiameter that are not provided by OpenWRT packages.
252P: For convenience, we include these meta-packages in the freeDiameter distribution -- but they
253P: might not be up-to-date.
254P:
255P: a) Adding the contributed directory to the feeds
256P:   Add the following line in your feeds.conf file:
257P: src-link freediameter /path/to/freediameter/contrib/OpenWRT/packages/
258P:
259P: Then run:
260P: $ scripts/feeds update
261P:
262P: This should allow you to install the missing dependencies as follow:
263P:
264P:
265P: b) SCTP library (note: you might alternatively compile freeDiameter without SCTP support).
266P: $ scripts/feeds install sctp
267P:
268P:
269P: c) Select these components in the menu:
270P: $ make menuconfig
271P: - Libraries --->
272P:    sctp (M)
273P:
274P: Quit and save the new config, then:
275P: $ make world
276P:
277P:
278P: d) Install this on the router as well:
279P:  root@OpenWrt:~# opkg update
280P:  root@OpenWrt:~# opkg install sctp
281
282
283==============================================
2844) freediameter package:
285==============================================
286
287Now, your environment should be ready to compile the freeDiameter ipkg package.
288$ scripts/feeds install freeDiameter
289
290Note 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   
297Quit and save the new config, then:
298$ make world
299
300On your router, run:
301# opkg update
302# opkg install freeDiameter
303
304
305
Note: See TracBrowser for help on using the repository browser.