English Language flag
// Log In
// CVSweb
Project: FreeWRT
// Summary // Activity // Search // Tracker // Lists // News // SCM // Wiki

SCM Repository

ViewVC logotype

Contents of /branches/freewrt_1_0/docs/handbook/user/handbook.tex

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2548 - (show annotations) (download) (as text)
Sat May 19 11:09:45 2007 UTC (6 years, 9 months ago) by wbx
File MIME type: application/x-tex
File size: 58659 byte(s)
resolve conflicts, n0-1 told me not to break this
1 \documentclass[12pt,a4paper,openany,smallheadings,headinclude,headsepline,final]{scrreprt}
2 %\usepackage{ucs} % Unicode support
3 \usepackage[utf8]{inputenc} % UTF-8 characters as input are allowed
4 %\usepackage{amsmath}
5 %\usepackage{amsfonts}
6 %\usepackage{amssymb}
7 %\usepackage{caption2}
8 \usepackage[english]{babel} % Sets the layout to English style
9 \usepackage{varioref} % Intelligent page references
10 %\usepackage{txfonts}
11 \usepackage[pdftex]{color} % Colour control for LaTeX documents
12 \usepackage[pdftex]{graphicx} % Enhanced support for graphics
13 %\usepackage{listings}
14 \usepackage{makeidx} % Standard LaTeX package for creating indexes
15 \usepackage{longtable} % Allow tables to flow over page boundaries
16 \usepackage[T1]{fontenc} % T1-fonts
17 \usepackage{fancyvrb} % Sophisticated verbatim text
18 \usepackage[a4paper,rmargin=2cm,lmargin=2cm,tmargin=2.5cm,bmargin=3.5cm]{geometry} % Flexible and complete interface to document dimensions
19 \usepackage{fixltx2e, mparhack} % Patches for LaTeX; A workaround for a LaTeX bug in marginpars
20 \usepackage[nofancy]{svninfo} % Typeset Subversion Keywords
21 \usepackage{float} % Improved interface for floating objects
22 \usepackage{hyperref} % Extensive support for hypertext in LaTeX
23
24
25 % marvosym macht Pfeil kaputt, also sichern
26 % line 28, /usr/share/texmf/tex/latex/marvosym/marvosym.sty
27 %\let\RescueRightarrow=\Rightarrow
28 %\usepackage{marvosym}
29 %\renewcommand{\Rightarrow}{\RescueRightarrow}
30
31 \definecolor{skyblue}{rgb}{0,0.3323,0.5720}
32 \restylefloat{figure}
33 \hypersetup{
34 colorlinks=true,anchorcolor=red,
35 breaklinks=true,linkcolor=blue,urlcolor=red,
36 citecolor=skyblue,
37 pdfauthor={The FreeWRT Team},
38 pdftitle={FreeWRT User Handbook},
39 pdfcreator={tetex and VIM},
40 pdfsubject={Open Source},
41 pdfview=FitV,
42 pdfstartview=FitV,
43 pdfstartpage={1},
44 pdfpagelayout=SinglePage,
45 pdfpagemode=None,
46 pdfkeywords={FreeWRT}
47 }
48 \fvset{fontsize=\small, frame=single} % fancyvrb: set small font size and enable frames
49 %\usepackage{cancel}
50 %\usepackage[final, activate, verbose=true]{microtype}
51 %\usepackage{ngerman}
52 %\usepackage{bookman}
53 %\usepackage[a4paper,twoside,rmargin=2cm,lmargin=2cm,tmargin=2.5cm]{geometry}
54 %\usepackage[a4paper,rmargin=2cm,lmargin=2cm,tmargin=2.5cm,bmargin=3.5cm]{geometry}
55 %\usepackage{ncntrsbk}
56 %\usepackage{float}
57 %\restylefloat{figure}
58 %\bibliographystyle{alphadin}
59 %\bibliographystyle{alpha}
60
61 % Generate index in preamble
62 \makeindex
63
64 \begin{document}
65 \svnInfo $Id$
66 \setlength{\marginparwidth}{10mm}
67
68 \include{cover}
69
70 \renewcommand{\thepage}{\roman{page}}
71 \tableofcontents
72 %Set Arabic Numbering 1,2,3,...
73 % Clear needed to renumber from the right position
74 \cleardoublepage
75 \renewcommand{\thepage}{\arabic{page}}
76 %Reset Counter
77 %\setcounter{page}{1}
78
79 % Set marks where it should Change
80 \renewcommand{\chaptermark}[1]{%
81 \markboth{\large \thechapter.\ \normalsize \scshape #1}{}}
82 \renewcommand{\sectionmark}[1]{\markright{\thesection.\ \scshape #1}}
83
84
85 % Create some new commands for designing the text
86 % applications
87 \newcommand{\app}[1]{%
88 \textsf{\textit{#1}}}
89 % terminology, vendor or product names
90 \newcommand{\term}[1]{%
91 \textsc{#1}}
92 % filenames and directories
93 \newcommand{\file}[1]{%
94 \textsf{#1}}
95 % user input
96 \newcommand{\command}[1]{%
97 \texttt{\textbf{#1}}}
98 % example code, output of applications
99 \newcommand{\code}[1]{%
100 \texttt{#1}}
101 % emphasized text (nicer than \emph{})
102 \newcommand{\strong}[1]{%
103 \textbf{#1}}
104
105
106 \chapter{Introduction}
107
108 Welcome to FreeWRT! This handbook covers the building, installation and usage
109 aspects of the FreeWRT 1.0 Linux distribution. FreeWRT is a portable, secure
110 and functional Linux distribution for embedded systems. As FreeWRT is a source
111 code distribution, it does not provide any pre-compiled firmware for embedded
112 systems. The latest version of this document is always available at the FreeWRT
113 website. If you have any comments, criticism or found some wrong description,
114 please send us an e-mail to
115 \href{mailto:freewrt-handbook@freewrt.org}{freewrt-handbook@freewrt.org}, we
116 are always happy about getting feedback to this document, and will try to
117 update or correct the issues mentioned by you.
118
119 The FreeWRT User handbook is split into several distinct chapters.
120 \nameref{ch:ADK} covers the building of FreeWRT firmware images. In
121 \autoref{ch:installing}, \nameref{ch:installing}, all aspects regarding the
122 installation and deinstallation of FreeWRT firmware images are covered. The
123 next chapter, \nameref{ch:administration}, covers administrational tasks, such
124 as network configuration, the FreeWRT configuration filesystem, package
125 management and update mechanism. The last chapter,
126 \nameref{ch:troubleshooting}, helps troubleshooting problems and recovering a
127 bad firmware installation. The appendix contains board specific information.
128 For FreeWRT 1.0 these are only Broadcom based embedded systems.
129
130 The intended audience for this handbook are advanced users with basic knowledge
131 about Linux, networking and software development. The reader should be aware of
132 basic command line tools, the vi editor and a shell. FreeWRT does not contain
133 any high level administration tools (e.g. web based administration) and is
134 fully configured via command line.
135
136 \section{Typographic Conventions}
137
138 Examples starting with \code{\#} indicate a command that must be invoked as
139 super user. You can use \command{su} to gain super user privileges.
140
141 \begin{Verbatim}[label=example for a command line with super user privileges]
142 # fwcf commit
143 \end{Verbatim}
144
145 Examples starting with \code{\$} indicate a command that can be invoked as a
146 normal user. The default user account on a freshly installed FreeWRT system is
147 "\code{admin}", the password "\code{FreeWRT}".
148
149 \begin{Verbatim}[label=example for a command line as non-privileged user]
150 $ cat /etc/banner
151 \end{Verbatim}
152
153 %\chapter{Web Interface Builder (WIB)}\label{ch:WIB}
154 %
155 %FIXME It is named later in the text, but not explained what it is. Probably
156 %this chapter can be joined with the chapter about ADK
157
158 \chapter{Appliance Development Kit (ADK)}\label{ch:ADK}
159
160 The ADK is the core of FreeWRT and contains all scripts and sources to create
161 firmware images for every supported embedded system. FreeWRT 1.0 supports the
162 following embedded systems:
163
164 \begin{itemize}
165 \item Asus WL500g
166 \item Asus WL500g deluxe
167 \item Asus WL500g premium
168 \item Linksys WRT54G v2.0
169 \item Linksys WRT54G v2.2
170 \item Linksys WRT54G v3.0
171 \item Linksys WRT54G v3.1
172 \item Linksys WRT54G v4.0
173 \item Linksys WRT54GS v1.0
174 \item Linksys WRT54GS v1.1
175 \item Linksys WRT54GS v4
176 \item Linksys WRT54G3G
177 \item Linksys WRT54GL
178 \item Netgear WGT634u
179 \end{itemize}
180
181 In this release we only support the Linux 2.4 kernel. The ADK contains over 600
182 software packages.
183
184 \section{Prerequisites}
185
186 Here is a list of all supported and tested host systems. The host system is
187 needed to create a firmware for your embedded system.
188
189 The list of supported GNU/Linux build systems is not an exclusive one, these
190 are just the ones tested and verified. The other millions of linux
191 distributions are very likely to work, too.
192
193 \begin{itemize}
194 \item Debian GNU/Linux
195 \item Gentoo Linux
196 \item OpenSuSE
197 \item Ubuntu GNU/Linux
198 \item Fedora Core
199 \item OpenBSD (partial support)
200 \footnote{some addon packages does not compile}
201 \item MirOS BSD (partial support)
202 \footnote{some addon packages does not compile}
203 \end{itemize}
204
205 Please install the following software, which is needed to build a basic
206 firmware image. If you choose more packages some more prerequisites might be
207 needed. The ADK host checks will warn you about any software you need to
208 install to compile a specific package. Here is a list of the required
209 software:
210
211 \begin{itemize}
212 \item gcc3 or higher
213 \item g++
214 \item binutils
215 \item patch
216 \item gzip
217 \item bzip2
218 \item unzip
219 \item flex
220 \item bison
221 \item GNU make
222 \item zlib (+headers)
223 \item ncurses (+headers)
224 \item (g)libc headers
225 \item perl
226 \end{itemize}
227
228 The ADK scripts will check for the required versions of these tools in advance.
229
230 To build FreeWRT with the ADK it is recommended to have an unprivileged user.
231 Please \underline{never} build FreeWRT as super user. Because all necessary
232 source tarballs are downloaded from the internet automatically, your host
233 system needs a working internet connection.
234
235 \section{Getting the source}
236
237 Now go to a directory where you want to build the firmware. Depending on the
238 features you select you will need about 2.5--5 GB free disk space. This
239 includes the ADK itself, any source archives which will be downloaded and their
240 extracted copies (for compiling).
241
242 To get the latest stable FreeWRT ADK try one of these commands:
243 \begin{Verbatim}[label=Check out the 1.0-branch of FreeWRT ADK via HTTP protocol]
244 $ svn co http://www.freewrt.org/svn/tags/freewrt_1_0_x freewrt
245 \end{Verbatim}
246 \begin{Verbatim}[label=Check out the 1.0-branch of FreeWRT ADK via subversion protocol]
247 $ svn co svn://www.freewrt.org/itags/freewrt_1_0_x freewrt
248 \end{Verbatim}
249
250 The value $x$ is a place holder for the latest minor release number. Take a
251 look at our project page to find out which minor release number is the latest
252 one.
253
254 After successfully downloading, enter the directory:
255
256 \begin{Verbatim}
257 $ cd freewrt
258 \end{Verbatim}
259
260 This directory will be referred to as the ADK root later on.
261
262 \section{Some Theory First}
263
264 Building a FreeWRT firmware image is just like building a new Linux kernel, but
265 a little more complex. There is a \app{ncurses}-based configuration menu at the
266 beginning, the changes made are saved into a file named \file{.config} in the
267 ADK root. The build is done by the various Makefiles, compiling and linking the
268 sources together accordingly to the symbols defined in \file{.config}.
269
270 Unlike kernel compilation, FreeWRT needs to be cross-compiled. This leads to
271 special premises, as most of the tools need to be specially build. But no
272 panic, FreeWRT will do this all for you. In fact, this is done at the second
273 run of \command{make} (the first one opens the configuration), and therefore
274 can be seen as part of the first firmware build. For clarity though, we will
275 discuss these two things separately.
276
277 \section{Preparing the Build Process}
278
279 After downloading the FreeWRT ADK, it's time to prepare the ADK for the
280 building of firmware images (for explanations see the chapter above).
281
282 \subsection{Creating A Configuration}
283
284 The first step is to run \command{make}. After checking some prerequisites (see
285 \nameref{ch:troubleshooting} below for aid in problems), a console based
286 configuration menu should start. Theoretically no choices have to be made, but
287 it's proven useful to at least:
288 \begin{itemize}
289 \item select a target (menu: \code{Embedded System})
290 \item select the root filesystem type (menu: \code{Target Firmware type})
291 \end{itemize}
292
293 Then quit saving changes. If you forgot that, just run \command{make} again,
294 redo your changes, then save.
295
296 \subsection{Building ADK}
297
298 Now that you have a first minimal configuration, it is time to build the
299 toolchain for cross-compiling. To do this, just enter \command{make} again. The
300 build starts downloading and compiling each needed part of the toolchain, and
301 later continues with building the first firmware image. Later one can be taken
302 as proof of a working ADK.
303
304 Already experienced in compiling \app{gcc}? Then you know\dots If not, better
305 be told that it takes \underline{really long} to finish. In the meantime I
306 suggest reading the next chapter dealing with internals about cross-compiling.
307
308 \section{Details Of Cross-Compiling}
309
310 A cross-compile toolchain exists of a set of tools: a compiler, linker,
311 assembler, debugger and a C~library. A cross-compile toolchain runs on your
312 host system and creates native binaries for your target system. A cross-compile
313 toolchain is basically created in six steps:
314
315 \begin{enumerate}
316 \item Get and prepare the Kernel and C~library headers of your target system
317 \item Compile the binutils package for your target
318 \item Compile a static C~compiler for your target
319 \item Compile and install a C~library for your target
320 \item Compile and install a full C/C++~compiler
321 \item Compile and install the GNU debugger
322 \end{enumerate}
323
324 The cross-compile toolchain is created in
325 \file{staging\_dir\_\$(cpu\_arch)}\footnote{e.g. mipsel, which stands for MIPS
326 Little Endian}. All the tools running on the host, but used to create, analyze
327 or debug for the target are kept in this directory. All addon headers and
328 libraries are installed to this directory.
329
330 If you want to compile a simple application without using the ADK, just use the
331 compiler directly (e.g. compiling a MIPS Little Endian application):
332 \begin{Verbatim}[label=compile a simple application with the cross-compiler]
333 ./staging_dir_mipsel/bin/mipsel-linux-uclibc-gcc -o myapp myapp.c
334 \end{Verbatim}
335
336 Check with the tool \app{file} if you got a MIPS binary:
337 \begin{Verbatim}[label=check the binary with \app{file}]
338 $ file myapp
339 myapp: ELF 32-bit LSB MIPS-I executable, MIPS, version 1 (SYSV), dynamically
340 linked (uses shared libs), not stripped
341 \end{Verbatim}
342
343 \section{Building A FreeWRT Firmware Image}
344
345 Your local copy of the FreeWRT ADK should now be prepared for building firmware
346 images. The next step is to do an extensive configuration for the image you
347 want to create. To start the configuration menu, type \command{make
348 menuconfig}.
349
350 When selecting packages, \code{<*>} means it will be inserted into the firmware
351 images and \code{<M>} means it will be build as an addon package which can be
352 installed later at runtime.
353
354 The target device and filesystem should already been chosen by you to the right
355 value, if not you will have to issue a \command{make clean} before actually
356 building the firmware image. Otherwise things get messed up. A smooth rebuild
357 is a missing feature in the current ADK. For the packages, if unsure, you can
358 just select one of the package collections. After that, you can still manually
359 check the choices made by the collection and correct them if appropriate. Do
360 not forget to save your configuration when leaving!
361
362 After leaving the menubased configuration, type \command{make} again to build
363 the new FreeWRT firmware image. Depending on your package selections and
364 underlying hardware, this will take different amounts of time. For your spare
365 time there is the following chapter giving some explanation about what is done
366 at this point.
367
368 \section{Firmware Build Process In Detail}
369
370 Just like when building the ADK's toolchain, the sources for the selected
371 packages are downloaded from the internet first, then built using the
372 cross-compiler and libraries of the ADK.
373
374 The detailed order of firmware image building is:
375
376 \begin{itemize}
377 \item compile the Linux kernel and all supported kernel modules
378 \item compile all selected packages
379 \item clean the target root directory
380 \item install all packages to the target root directory
381 \item create the root filesystem image
382 \item create the firmware image (bootloader, kernel and root
383 filesystem)
384 \end{itemize}
385
386 The result of the build process is created in the directory \file{bin/}. You
387 will find a firmware image in the top level directory. Check the size of the
388 binary image file to see if it is small enough to fit into flash memory of your
389 embedded system. Furthermore there is a directory \file{package/}, which
390 contains all base and add--on packages.
391
392 \section{Troubleshooting}
393
394 This section deals with various tips for problems with the ADK installation.
395
396 \subsection{Errors During Prerequisites Check}
397
398 To re-issue the checks, use \command{make prereq}.
399
400 \begin{itemize}
401 \item GNU make 3.80 too old \\
402 On a Fedora Core 4 hostsystem the first you'll get is
403 \begin{Verbatim}[label=error message with too old GNU make]
404 $ make
405 GNU make 3.80 too old.
406 Please install GNU make 3.81 or higher to continue.
407 You can override this check, see http://www.freewrt.org/faq for details.
408 It is suggested to upgrade your copy of bison to
409 GNU Bison 2.3 because of its bug fixes.
410 make: *** [.prereq_done] Error 1
411 \end{Verbatim}
412 it is quite a nice error that tells you to use more up to date software, but
413 we can anyhow give this hostsystem a try and tell make to ignore those
414 errors/warnings running \command{make prereq-noerror}.
415 \end{itemize}
416
417 \subsection{Compilation errors}
418
419 If you encounter any compilation errors, then first try to reproduce the error.
420 First update your ADK tree via \command{svn update}, to be sure that the error
421 is not already fixed in the subversion repository. After that do a
422 \command{make clean \&\& make}, to reproduce your problem.
423
424 If you can reproduce the problem, please file a bug report. Please always
425 report following information:
426 \begin{itemize}
427 \item Operating system type and version
428 \item GCC and Binutils versions of your host system
429 \item complete error message, not only the last 4 lines
430 \end{itemize}
431
432 \chapter{Installing FreeWRT Firmware Images}\label{ch:installing}
433
434 The FreeWRT ADK produces a single image holding both kernel and root
435 filesystem. This image can be written into your hardware's builtin flash memory
436 on serveral ways (ordered by needed skills, increasing downwards):
437 \begin{itemize}
438 \item via the original firmware's web interface
439 (\autoref{sec:webinterface})
440 \item via \texttt{mtd} when reflashing or migrating from another third
441 party distribution (\autoref{sec:mtd})
442 \item via network using a TFTP client (\autoref{sec:tftp})
443 \end{itemize}
444
445 \section{Flashing The Firmware}
446
447 \subsection{Web Interface Method}\label{sec:webinterface}
448
449 The following text describes how to use the original firmware's web interface
450 to flash FreeWRT. The object of demonstration is an \term{Asus WL500gP}, but
451 this guide should fit more or less fine for other systems, too.
452
453 If you flash a router from \term{Linksys}, we strongly suggest to use the
454 popular \term{ping exploit} to allow recovery, if your image is broken or the
455 flash process was interrupted by a power shortage.
456
457 There are some things that you should have done previously:
458 \begin{itemize}
459 \item read the special documentation page about your hardware in our wiki, some
460 systems need special precaution before flashing
461 \item a firmware image has to be built (matching the used hardware, of course)
462 \item the router has to be powered on
463 \item your computer needs to be connected to one of the LAN ports
464 (using IP address \file{192.168.1.2})
465 \end{itemize}
466
467 \parbox{17em}{
468 After preparation is complete, open your favourite browser and type
469 \command{192.168.1.1} into the address bar. You should reach the web
470 interface's startup page:
471 }\hfill\parbox{20em}{
472 \includegraphics[width=20em]{pics/asus-startup.png}
473 } \\ [1em]
474 \parbox{17em}{
475 Then click on \code{System Setup}:
476 }\hfill\parbox{20em}{
477 \includegraphics[width=20em]{pics/asus-system_setup.png}
478 } \\ [1em]
479 \parbox{17em}{
480 In the new menu click on \code{Firmware Upgrade}, and enter the name of your
481 firmware image into the appropriate field:
482 }\hfill\parbox{20em}{
483 \includegraphics[width=20em]{pics/asus-fw_upgrade.png}
484 } \\ [1em]
485 Finally click on \code{Upload}. As the whole process of writing the image to
486 flash and rebooting (don't forget that it creates \app{ssh} hostkeys on first
487 boot) takes quite long (yes, a couple of minutes). Better go and get a coffee
488 or tea.
489
490 When everything went well, you can login using \app{ssh}. The default username
491 is "\code{admin}". The default password for images created via WIB or ADK is
492 "\code{FreeWRT}". It is possible to change this password in the ADK, before
493 image creation.
494
495 \subsection{\texttt{mtd} -- The Flash Utility}\label{sec:mtd}
496
497 For this method to work, you need to copy the file containing the firmware
498 image to the router, preferably into \file{/tmp/}, the memory filesystem should
499 be big enough to hold the full image. If not, use \app{wget} to get the image
500 via http or ftp and pipe the result into \app{mtd}.
501
502 Then the image is written to flash using \app{mtd}, optionally giving
503 additional options (see below).
504
505 The \app{mtd} utility was written with simplicity and code size in mind. It's
506 features were derived from the
507 \href{http://sources.redhat.com/jffs2/}{\app{mtd-utils}}, combining the needed
508 parts into a single small tool providing all the functionality necessary for
509 FreeWRT, and leaving everything out that's not.
510
511 \app{mtd} provides the following features:
512 \begin{description}
513 \item[unlock] some chips need unlocking before they can be written to
514 \item[erase] this is a filesystem independent method to delete all
515 contents on the flash. Basically this is like \app{format} in
516 MS--DOS.
517 \item[write] this is generally the same functionality as using \app{dd}
518 or \app{rawrite}, but \app{mtd} takes care of the quirks that
519 have to be paid attention to for correctly handling the type of
520 flash in use
521 \end{description}
522
523 Further it can request your system to reboot. Some of the features mentioned
524 here can also be combined, so it is e.g. possible to immediately reboot the
525 system after the flash has been written.
526
527 Mostly, similar to the sample usage shown in the help output should be all that
528 has to be done to write the firmware to flash:
529 \begin{Verbatim}[label=write a previously downloaded new firmware-file into flash]
530 # mtd -e linux -r write freewrt.bin linux &
531 \end{Verbatim}
532 Or via wget pipe:
533 \begin{Verbatim}[label=download and write a new firmware-file into flash]
534 # wget -O - http://www.yourserver.com/freewrt.bin | mtd -e linux -r write - linux &
535 \end{Verbatim}
536 The parameters explained in detail:
537 \begin{description}
538 \item[\command{-e linux}] erase existing data in flash
539 \item[\command{-r}] trigger rebooting right after finishing work
540 \item[\command{write}] write the firmware image contained in the file
541 given as next parameter to flash
542 \item[\command{freewrt.bin}] the actual image to write -- ignore the
543 suffix, it is detected at runtime
544 \item[\command{linux}] this is an abstract identifier for a certain
545 partition in flash, so don't change this
546 \item[\command{\&}] put the process into background, to prevent
547 accidentally stopping
548 \end{description}
549
550 \subsection{Installation using TFTP}\label{sec:tftp}
551
552 All supported target devices are shipped with a builtin bootloader, comparable
553 to the BIOS of \term{x86} machines. This bootloader is used to bootstrap the
554 system until it can boot a regular operating system. Besides the ability to
555 load the executable code from flash, it can be received from another node in
556 the local area network via the famous TFTP protocol.
557
558 For doing this, there are two ways:
559 \begin{itemize}
560 \item the device acts as a client, asks the local \app{dhcpd} for a
561 lease, the address of the next \app{tftpd} and the filename to
562 download
563 \item the device acts as a server, having a known IP address and
564 waiting for any TFTP client to connect and send the file
565 \end{itemize}
566
567 Most of the hardware supported by FreeWRT 1.0 uses the second method. Only the
568 device \term{Netgear WGT634u} is using the first method, the bootloader
569 provides a DHCP/TFTP client. Though this may be a little confusing to people
570 being familiar with netboot technologies, it is definitely the easier way of
571 doing it. Otherwise one had to setup both DHCP and TFTP servers and configure
572 them right.
573
574 The even quite simple task of sending the flash image to the target device is
575 made even more easy by providing a little shell script for the job. Invocation
576 is as follows:
577 \begin{Verbatim}[label=sending the new firmware via TFTP]
578 $ ./scripts/flash.sh firmware.bin [address]
579 \end{Verbatim}
580 The second Parameter \code{address} is used to specify a different IP address
581 of the target device than the default \file{192.168.1.1}.
582
583 \strong{Beware:} do not rename the firmware image before flashing it using the
584 script as the original name is parsed to guess what hardware is to be flashed.
585
586 To actually being able to flash the device, it has to wait for a tftp
587 connection when booting. To complicate installation of third vendor's firmware
588 images and to improve bootup time, of course, this feature is disabled by
589 default. The following list shows what has to be done for a certain device to
590 get it to wait at boot: \\
591 \begin{center}
592 \begin{tabular}{l|l|p{7cm}} % TODO: fill this table
593 \strong{Target Device} & \strong{Action to be taken} & \strong{Comments} \\
594 \hline
595 All supported Linksys models & Ping Exploit & nvram variable \code{boot\_wait}
596 needs to be on \\
597 All supported Asus models & Recovery mode & power off $\rightarrow$ push and
598 hold the reset button $\rightarrow$
599 power on $\rightarrow$ power led is
600 flashing \\
601 \end{tabular}
602 \end{center}
603
604 \chapter{FreeWRT Administration}\label{ch:administration}
605
606 After the FreeWRT firmware image has been built by the ADK and later flashed
607 onto the hardware, the resulting operating system has to be configured. This
608 section provides the necessary information to do that, including tips and
609 guides for using FreeWRT in general, of course.
610
611 \section{Network Configuration}
612
613 The device names for real network interfaces in Linux are named \code{ethx} (\code{x} is
614 \code{0--9}). If the device has a switch, the different ports are separated via VLAN
615 technology. The vlan interfaces are named \code{ethx.y}. The network configuration in
616 FreeWRT is managed via \app{Busybox}'s \app{ifupdown} implementation. \app{Busybox}'s builtin \app{ip}
617 command configures the network interfaces. There is no \app{ifconfig} or \app{route}, you can activate
618 it in the ADK menue, if you like.
619
620 To show all configured network interfaces use:
621 \begin{Verbatim}[label=show IP address]
622 $ ip addr show
623 \end{Verbatim}
624 To show the kernel routing table use:
625 \begin{Verbatim}[label=show routing table]
626 $ ip route show
627 \end{Verbatim}
628
629 All available network settings can be found in \file{/etc/network/interfaces}
630 which has the common form:
631 \begin{Verbatim}[label=common form of \file{/etc/network/interfaces}]
632 auto <iface-name>
633 iface <iface-name> inet <method>
634 <option-x> <value>
635 <option-y> <value>
636 <option-z> <value>
637 \end{Verbatim}
638
639 <b>ATTENTION: Be sure you have no whitespaces at the and of any value!</b>
640
641 \code{auto <iface-name>} is optional and, if set, tells the \app{ifup} script to
642 start this interface automatically on bootup.
643
644 Each interface needs a unique name which, depending on the method, represents
645 either a physical interface or a logical interface name like \code{eth0.1} for
646 a physical VLAN or \code{umts} as a logical name for a PPP interface.
647
648 Possible methods are:
649 \begin{description}
650 \item[static] use the given options to configure the interface
651 statically
652 \item[dhcp] just start a dhcp client using the interface
653 \code{iface-name}
654 \item[manual] don't configure the interface but start \code{pre-up.d}
655 hook scripts
656 \item[ppp] run \code{pon <provider>} where \code{<provider>} is given
657 as an interface option
658 \end{description}
659
660 \subsection{Switch/VLAN}
661 The switch built-in into the most routers is capable of separating each port
662 using VLAN tagging. You can configure the switch by simply adding the interface
663 to the config file and giving the desired switch-ports:
664 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
665 auto eth0.0
666 iface eth0.0 inet static
667 switch-ports 1 2 5*
668 address 192.168.1.1
669 netmask 255.255.255.0
670
671 auto eth0.1
672 iface eth0.1 inet static
673 switch-ports 3 4 5
674 address 192.168.2.1
675 netmask 255.255.255.0
676
677 auto eth0.2
678 iface eth0.2 inet static
679 switch-ports 0 5
680 address 172.16.1.42
681 netmask 255.255.255.0
682 gateway 172.16.1.1
683 \end{Verbatim}
684
685 This configures three VLAN interfaces \code{eth0.0} on ports 1 and 2,
686 \code{eth0.1} on port 3 and 4 and \code{eth0.2} on port 0.
687
688
689 If you need to do some advanced settings, because you have for example a
690 powerful switch with a VLAN trunking port connected to one of your switch
691 ports, the configuration would look like this:
692
693 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
694 auto eth0.1
695 iface eth0.1 inet static
696 switch-ports 2 3 4 5*
697 address 192.168.1.1
698 netmask 255.255.255.0
699
700 auto eth0.2
701 iface eth0.2 inet static
702 switch-ports 1t 5
703 address 10.2.0.1
704 netmask 255.255.255.0
705 broadcast +
706
707 auto eth0.3
708 iface eth0.3 inet static
709 switch-ports 1t 5
710 address 10.3.0.1
711 netmask 255.255.255.0
712 broadcast +
713
714 auto eth0.4
715 iface eth0.4 inet static
716 switch-ports 1t 5
717 address 10.4.0.1
718 netmask 255.255.255.0
719 broadcast +
720
721 \end{Verbatim}
722
723 This configures four VLAN interfaces, \code{eth0.1} on physical ports 2, 3 and
724 4. The interfaces \code{eth0.2}, \code{eth0.3} and \code{eth0.4} are three
725 different networks with VLAN ID 2--4. The physical port 1 needs to be connected
726 to a VLAN trunking port on a switch with knows the same VLAN IDs.
727
728
729 Explanation:
730 \begin{description}
731 \item[port 0] this is typically the port labeled as WAN
732 \item[port 1--4] these are typically the ports labeled as LAN
733 \item[port 5] this special port represents the port where the
734 router--board is connected to the switch
735 \item[*] one interface always need an asterisk behind port 5 which
736 means it is the default interface and gets all the packages
737 with unknown tags.
738 \end{description}
739
740 \subsection{Static IP configuration}
741 As you can see in the VLAN example three interfaces were configured with static
742 IP settings, so these are the commonly used options:
743 \begin{description}
744 \item[address] the IP address --- required
745 \item[netmask] the netmask --- required
746 \item[broadcast] broadcast address --- only required for legacy
747 applications (if using \code{+}, it will be calculated
748 automatically by the kernel)
749 \item[gateway] an IP address added as default gateway if present
750 \item[mac-address] if you need to change your MAC address (required for
751 some DSL providers)
752 \end{description}
753
754 \subsection{DHCP}
755 That's just as simple as:
756 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
757 auto eth0.1
758 iface eth0.1 inet dhcp
759 switch-ports 0 5
760 \end{Verbatim}
761 Typically this configures the WAN-Port to start a DHCP request on bootup.
762
763 \subsection{WLAN}
764 A router containing a WLAN interface has an additional ethernet device
765 representing it. On Broad\-com-based hardware it is typically \code{eth1}
766 (\term{Linksys}),\code{eth2} (\term{Asus WL500gP}) or on \term{Netgear WGT634u}
767 which has a Madwifi WLAN chip, it is \code{ath0}, \code{ath1}, etc. You can use
768 these interfaces standalone or bridged with other devices, e.g. the internal
769 LAN.
770
771 \subsubsection{Basic Settings}
772
773 Mandatory options and default parameters are in bold font.
774
775 \begin{tabular}{l|l|p{10cm}}
776 \strong{Option} & \strong{Parameter} & \strong{Description} \\
777 \hline\hline
778 \code{\strong{type}} & \code{broadcom} & Broadcom based card \\
779 & \code{atheros} & Madwifi driver \\
780 \hline
781 \code{\strong{mode}} & \code{ap} & Access point mode \\
782 & \code{sta} & Client mode \\
783 & \code{adhoc} & Ad-Hoc mode \\
784 & \code{wds} & WDS point-to-point link over wireless\\
785 & \code{monitor} & The node acts as a passive monitor and
786 only receives packets \\
787 \hline
788 \code{\strong{ssid}} & \code{<String>} & Set the SSID (Network Name) \\
789 \hline
790 \code{country} & \code{\{ALL|DE|JP|US|\ldots\}} & The country code used
791 to determine the
792 regulatory settings. \\
793 \hline
794 \end{tabular}
795
796 \subsubsection{Security Settings}
797 \begin{longtable}{l|l|p{10cm}}
798 \strong{Option} & \strong{Parameter} & \strong{Description} \\
799 \hline\hline
800 \code{\strong{security}} & \code{none} & No authorization \\
801 & \code{wep} & WEP key \\
802 & \code{wpa-psk} & WPA with preshared key \\
803 & \code{8021x} & IEEE 802.1X authentication \\
804 \hline
805 \code{\strong{authorization}} & & \strong{wpa-psk} \\
806 & \code{psk} & WPA PSK \\
807 & \code{psk2} & WPA2 PSK \\
808 & \code{psk psk2} & WPA PSK and WPA2 PSK \\
809 & & \strong{8021x} \\
810 & \code{wpa} & WPA with RADIUS \\
811 & \code{wpa2} & WPA2 with RADIUS \\
812 & \code{wpa wpa2} & WPA and WPA2 \\
813 \hline
814 \code{\strong{encryption}} & & \strong{wep} \\
815 & --- & not needed, automatically by key size \\
816 & & \strong{wpa-psk} \\
817 & \code{tkip} & RC4 encryption \\
818 & \code{aes} & AES encryption \\
819 & \code{aes+tkip} & support both \\
820 & & \strong{8021x} \\
821 & \code{wep} & RC4 encryption (static) \\
822 & \code{tkip} & RC4 encryption \\
823 & \code{aes} & AES encryption \\
824 & \code{aes+tkip} & support both \\
825 \hline
826 \code{eap-type} & & \strong{8021x} \\
827 & \code{\strong{tls}} & Transport Layer Security \\
828 & \code{ttls} & Tunnelled TLS \\
829 & \code{peap} & Protected EAP \\
830 & \code{leap} & Cisco Wireless \\
831 \hline
832 \code{key} & & \strong{wep} \\
833 &\code{\{\strong{1}|2|3|4\}} & Select WEP key to use. \\
834 \hline
835 \code{key[1..4]} & & \strong{wep} \\
836 & \code{<String>} & WEP key. The key must be 5, 13 or 16
837 bytes long, or 10, 26, 32, or 64 hex
838 digits long. The encryption algorithm is
839 automatically selected based on the key
840 size. key1 is the key for WEP client mode.
841 \\
842 \hline
843 \code{wpa-key} & & \strong{wpa-psk} \\
844 & <String> & Password to use with WPA/WPA2 PSK (at least 8, up
845 to 63 chars) \\
846 \hline
847 \code{wpa-gtk-rekey} & & \strong{wpa-psk},
848 \strong{8021x} \\
849 & \code{<Int>} (\strong{3600}) & Rekeying interval in
850 seconds. \\
851 \hline
852 \code{\strong{radius-ipaddr}} & & \strong{8021x} \\
853 & \code{<a.b.c.d>} & IP to connect. \\
854 \hline
855 \code{radius-port} & & \strong{8021x} \\
856 & \code{<Int>} (\strong{1812}) & RADIUS-Port no. to connect
857 \\
858 \hline
859 \strong{radius-key} & & \strong{8021x} \\
860 & \code{<String>} & Shared Secret for connection to the
861 Radius server \\
862 \hline
863 \end{longtable}
864
865 \subsubsection{MAC filter}
866 \begin{tabular}{l|l|p{10cm}}
867 \strong{Option} & \strong{Parameter} & \strong{Description} \\
868 \hline\hline
869 \code{macmode} & \code{\{0|1|2\}} & 0: Disable MAC address matching. \\
870 & & 1: Deny association to stations on the MAC
871 list. \\
872 & & 2: Allow association to stations on the MAC
873 list. \\
874 \hline
875 \code{maclist} & \code{<MAC1> \ldots <MACn>} & List of space separated mac
876 addresses to allow/deny
877 according to \code{macmode}.
878 Addresses should be entered with
879 colons, e.g.:
880 "\code{00:02:2D:08:E2:1D
881 00:03:3E:05:E1:1B}"\\
882 \end{tabular}
883
884 \subsubsection{Wireless Distribution System (WDS)}
885 \begin{tabular}{l|l|p{10cm}}
886 \strong{Option} & \strong{Parameter} & \strong{Description} \\
887 \hline\hline
888 \code{lazywds} & \code{\{0|1\}} & Accept WDS connections
889 from anyone \\
890 \hline
891 \code{wds-bridge} & \code{br\{X\}} & Add WDS peers to bridge
892 brX \\
893 \hline
894 \code{wds-security} & \code{\{wpa-psk\}} & secure the wds bridge
895 with WPA (optional)\\
896 \hline
897 \code{wds-encryption} & \code{\{aes|tkip\}} & Use AES or TKIP as
898 cipher\\
899 \hline
900 \code{wds-wpa-key} & \code{<String>} & Password to use with WPA
901 PSK (at least 8, up to 63
902 chars) \\
903 \hline
904 \code{wds} & \code{<MAC1> \ldots <MACn>} & List of WDS peer mac
905 addresses
906 (\code{xx:xx:xx:xx:xx:xx},
907 space separated) \\
908 \hline
909 \end{tabular}
910
911 \subsubsection{Miscellaneous}
912 \begin{longtable}{l|l|p{10cm}}
913 \strong{Option} & \strong{Parameter} & \strong{Description} \\
914 \hline\hline
915 \code{channel} & \code{\{1--14\}} & The wifi channel \\
916 \hline
917 \code{maxassoc} & \code{\{1--255\}} & Maximum number of associated clients \\
918 \hline
919 % TODO: add descriptions to the different gmode settings
920 \code{gmode} & & Set the 54g Mode \\
921 & \code{\strong{Auto}} & default \\
922 & \code{LegacyB} & \\
923 & \code{GOnly} & \\
924 & \code{BDeferred} & \\
925 & \code{Performance} & \\
926 & \code{LRS} & \\
927 \hline
928 \code{frameburst} & \code{\{\strong{0}|1\}} & Disable/Enable frameburst mode. \\
929 \hline
930 \code{txpower} & \code{\{0--255|\strong{$-1$}\}} & Set the transmit power in dBm \\
931 \hline
932 \code{rate} & \code{<Int> (\strong{$-1$})} & force a fixed rate \\
933 & & valid values for 802.11a are (6,
934 9, 12, 18, 24, 36, 48, 54) \\
935 & & valid values for 802.11b are (1,
936 2, 5.5, 11) \\
937 & & valid values for 802.11g are (1,
938 2, 5.5, 6, 9, 11, 12, 18, 24, 36,
939 48, 54) \\
940 & & $-1$ means automatically determine
941 the best rate \\
942 \hline
943 \code{rts} & \code{\{0-2347\}} & Set the RTS threshhold. \\
944 \hline
945 \code{frag} & \code{\{256-2346\}} & Set the fragmentation
946 threshhold. \\
947 \hline
948 \code{afterburner} & \code{\{\strong{0}|1\}} & Enable Afterburner capability
949 \\
950 \hline
951 \code{isolate} & \code{\{\strong{0}|1\}} & Hide Clients from each other \\
952 \hline
953 \code{bridge-if} & \code{\{br0..brX\}} & The bridge interface (optional)
954 \\
955 \hline
956 \end{longtable}
957
958 \subsubsection{Examples for wireless configuration}
959
960 \paragraph{WLAN with WPA1/WPA2 AES+TKIP}
961
962 This combination works with any kind of WPA client implementation.
963
964 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
965 auto eth1
966 iface eth1 inet static
967 address 192.168.10.1
968 netmask 255.255.255.0
969 broadcast +
970 wireless-type broadcom
971 wireless-country DE
972 wireless-mode ap
973 wireless-ssid FreeWRT
974 wireless-security wpa-psk
975 wireless-authorization psk psk2
976 wireless-encryption aes+tkip
977 wireless-wpa-key 12345678
978 wireless-channel 11
979 \end{Verbatim}
980
981 If you want to do MAC filtering, add the following to the sample above:
982 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
983 wireless-macmode 2
984 wireless-mac 00:01:02:03:04:05 06:07:08:09:0a:0b
985 \end{Verbatim}
986 this enables the filter and defines the list to contain addresses that should be allowed.
987
988 \paragraph{WLAN without encryption}
989
990 If you already use VPN to secure your connection, you can just use an unencrypted setup
991 and setup the firewall on your embedded device.
992
993 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
994 auto eth1
995 iface eth1 inet static
996 address 192.168.10.1
997 netmask 255.255.255.0
998 broadcast +
999 wireless-type broadcom
1000 wireless-country DE
1001 wireless-mode ap
1002 wireless-ssid FreeWRT
1003 wireless-security none
1004 wireless-channel 11
1005 \end{Verbatim}
1006
1007 \paragraph{WLAN client with WPA2 (AES)}
1008
1009 This can only be used in routing mode, you can not bridge it with LAN or WAN interfaces.
1010
1011 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
1012 auto eth1
1013 iface eth1 inet static
1014 address 192.168.10.1
1015 netmask 255.255.255.0
1016 broadcast +
1017 wireless-type broadcom
1018 wireless-country DE
1019 wireless-mode sta
1020 wireless-ssid FreeWRT
1021 wireless-security wpa-psk
1022 wireless-authorization psk2
1023 wireless-encryption aes
1024 wireless-wpa-key 12345678
1025 \end{Verbatim}
1026
1027 WLAN with WDS nodes, the WDS nodes need to have the same
1028 SSID, channel and encryption parameters. The WDS connection is separetely
1029 secured via WPA1 and AES. WPA2 for WDS connection security is \_not\_ working.
1030
1031 WDS node 1 (MAC of Wireless \code{06:05:04:03:02:01})
1032 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
1033 auto br0
1034 iface br0 inet static
1035 bridge-ifaces eth1
1036 address 192.168.10.1
1037 netmask 255.255.255.0
1038 broadcast +
1039 wireless-type broadcom
1040 wireless-country DE
1041 wireless-mode wds
1042 wireless-ssid FreeWRT-WDS
1043 wireless-security wpa-psk
1044 wireless-authorization psk psk2
1045 wireless-encryption aes+tkip
1046 wireless-wpa-key apkey
1047 wireless-lazywds 1
1048 wireless-wds-security wpa-psk
1049 wireless-wds-encryption aes
1050 wireless-wds-wpa-key wdskey
1051 wireless-wds 01:02:03:04:05:06
1052 wireless-wds-bridge br0
1053 \end{Verbatim}
1054 WDS node 2 (MAC of Wireless \code{01:02:03:04:05:06})
1055 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
1056 auto br0
1057 iface br0 inet static
1058 bridge-ifaces eth1
1059 address 192.168.10.2
1060 netmask 255.255.255.0
1061 broadcast +
1062 wireless-type broadcom
1063 wireless-country DE
1064 wireless-mode wds
1065 wireless-ssid FreeWRT-WDS
1066 wireless-security wpa-psk
1067 wireless-authorization psk psk2
1068 wireless-encryption aes+tkip
1069 wireless-wpa-key apkey
1070 wireless-lazywds 1
1071 wireless-wds-security wpa-psk
1072 wireless-wds-encryption aes
1073 wireless-wds-wpa-key wdskey
1074 wireless-wds 06:05:04:03:02:01
1075 wireless-wds-bridge br0
1076 \end{Verbatim}
1077
1078 \paragraph{Peer-to-Peer/AdHoc mode (no encryption, IP must be static)}
1079 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
1080 auto eth1
1081 iface eth1 inet static
1082 address 192.168.10.1
1083 netmask 255.255.255.0
1084 broadcast +
1085 wireless-type broadcom
1086 wireless-country DE
1087 wireless-mode adhoc
1088 wireless-ssid FreeWRT
1089 wireless-security none
1090 wireless-channel 11
1091 \end{Verbatim}
1092
1093 \subsection{Bridging}
1094
1095 This is mostly needed to combine LAN and WLAN to a homogeneous network.
1096 Be sure you have installed the package \app{bridge-utils}.
1097 See the example for a bridging setup, WLAN is secured via WPA/WPA2.
1098
1099 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
1100 auto eth0.0
1101 iface eth0.0 inet manual
1102 switch-ports 1 2 3 4 5*
1103
1104 auto eth1
1105 iface eth1 inet manual
1106 wireless-type broadcom
1107 wireless-country DE
1108 wireless-mode ap
1109 wireless-ssid FreeWRT
1110 wireless-channel 11
1111 wireless-security wpa-psk
1112 wireless-authorization psk psk2
1113 wireless-encryption aes+tkip
1114 wireless-wpa-key MyWlanSecret
1115 wireless-bridge-if br0
1116
1117 auto br0
1118 iface br0 inet static
1119 bridge-ifaces eth0.0 eth1
1120 address 192.168.1.1
1121 netmask 255.255.255.0
1122 broadcast +
1123 \end{Verbatim}
1124
1125 This creates a new bridging interface \code{br0} which combines the VLAN
1126 interface \code{eth0.0} (representing the LAN-ports 1--4) and the WLAN interface
1127 \code{eth1} (on some devices like \term{Asus WL500gP} this might be \code{eth2}).
1128 The bridge interface needs always be the last one, otherwise it can not find
1129 the interfaces in \code{bridge-ifaces}.
1130
1131 \subsection{PPP}
1132
1133 PPP comes in various flavours for different situations, the most commonly
1134 needed will likely be DSL and for \term{WRT54G3G} users UMTS. So there exists a
1135 hook-script that evaluates a \code{use-template} option and generates a
1136 ppp-peer. This way everything needed so far can be configured within the
1137 \code{interfaces} file. Be sure you have installed the packages \app{kmod-ppp},
1138 \app{ppp} and \app{ppp-mod-pppoe}. For providers using PPTP for authentication,
1139 instead of PPPoE, you need to install \app{pptp}.
1140
1141 \subsubsection{DSL with PPPoE}
1142 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
1143 auto ppp0
1144 iface ppp0 inet ppp
1145 use-template dsl
1146 provider foobar
1147 ppp-username 0001201234563200123456#0001@bar.de
1148 ppp-password bar
1149 ppp-device eth0.1
1150 \end{Verbatim}
1151
1152 Now your DSL connection will be started on boot (\code{auto ppp0}) and you can
1153 manually shut it down with \command{ifdown ppp0} or start it up with
1154 \command{ifup ppp0}. The template \code{dsl} will configure a typical PPPoE
1155 peer for you.
1156
1157 \subsubsection{DSL with PPTP}
1158 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
1159 auto ppp0
1160 iface ppp0 inet ppp
1161 use-template pptp
1162 provider foobar
1163 ppp-username foo
1164 ppp-password bar
1165 ppp-modemip 10.0.0.1
1166 ppp-mtu 1480
1167 ppp-device eth0.1
1168 \end{Verbatim}
1169
1170 Now your DSL connection will be started on boot (\code{auto ppp0}) and you can
1171 manually shut it down with \command{ifdown ppp0} or start it up with
1172 \command{ifup ppp0}. The template \code{pptp} will configure a typical PPTP
1173 peer for you.
1174
1175 \subsubsection{UMTS}
1176 Same footprint different template and some specific options. That is all that
1177 is needed for an UMTS connection to Vodafone as it can be seen in this example.
1178 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
1179 iface ppp0 inet ppp
1180 use-template umts
1181 provider umts
1182 #ppp-username ""
1183 #ppp-password ""
1184 ppp-device /dev/noz0
1185 umts-apn web.vodafone.de
1186 umts-pincode 1234
1187 umts-mode umts_first
1188 \end{Verbatim}
1189 As you can see: unneeded options like \code{ppp-username} or
1190 \code{ppp-password} can just be removed or commented out. Don't leave them
1191 without a value as that causes a failure in \app{ipup}. It does work if you
1192 give empty double quotes as value like \code{""}.
1193
1194 Note that you have to set the correct APN, username and password for your
1195 provider!
1196
1197 You may also remove the pin from your SIM-card and the configuration if you
1198 like.
1199
1200 For \term{Linksys WRT54G3G} a package called \app{broadcom-watchbutton} will be
1201 installed, this is a small daemon that monitors the UMTS-button of the router
1202 and executes \command{ifup umts} or \command{ifdown umts} on a button press.
1203 You have to set \code{watchbutton=YES} in /etc/rc.conf to have it start
1204 automatically.
1205
1206 This is totally independent from the \code{auto umts} setting. Even if you
1207 start the connection on bootup you can shut it down again with a button press.
1208
1209 \subsection{custom interface hooks}
1210 \subsubsection{per interface}
1211 You can execute various commands on interface startup or shutdown with special
1212 option:
1213 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
1214 iface foobar inet static
1215 [...]
1216 pre-up <command>
1217 up <command>
1218 up <command>
1219 down <command>
1220 post-down <command>
1221 \end{Verbatim}
1222
1223 You can give each option multiple times and their commands will be executed in
1224 given order.
1225 \begin{description}
1226 \item[pre-up] before the interface will be started
1227 \item[up] after the interface was started successfully
1228 \item[down] before the interface goes down
1229 \item[post-down] after the interface shut down
1230 \end{description}
1231
1232 \subsubsection{general hooks}
1233 Additionally you can write scripts executed for each interface if you put them
1234 in
1235 \begin{itemize}
1236 \item \texttt{/etc/network/if-pre-up.d}
1237 \item \texttt{/etc/network/if-up.d}
1238 \item \texttt{/etc/network/if-down.d}
1239 \item \texttt{/etc/network/if-post-down.d}
1240 \end{itemize}
1241 Same semantics as above.
1242
1243 \section{FWCF - FreeWRT Configuration Filesystem}
1244
1245 FWCF is a separate flash partition for all changes made to the \file{/etc/}
1246 directory. There is a small tool named \app{fwcf}, which is used to setup the
1247 system or to commit changes to the fwcf partition.
1248
1249 On bootup the script \file{/sbin/mount\_root} is executed, which calls
1250 \command{fwcf setup} to setup \file{/etc/} as memory filesystem and overlay the
1251 changes committed to the fwcf partition.
1252
1253 If you change anything in \file{/etc/} and like to keep the change, it is
1254 required to execute \command{fwcf commit}. This will compress all changed or
1255 new files in \file{/etc/} and write the result into the fwcf partition. The
1256 fwcf partition is 128 Kb in size. This size is not changeable at the moment.
1257
1258 If you need more detailed information, please read the specification of FWCF,
1259 which can be found at
1260 \url{http://www.freewrt.org/trac/wiki/Documentation/Specs/FwCf}
1261
1262 If you want to remove all your changes and start your configuration from
1263 scratch, use \command{fwcf erase}. This is also required if you switch between
1264 compression plugins. Right now LZO plugin is default.
1265
1266 \section{IPKG - Packagemanagement}
1267
1268 All software for FreeWRT is available as a IPKG package. IPKG is a package
1269 manager very similar to Debian's \app{dpkg/apt-get} utilities. It is specially
1270 designed for embedded systems and is widely used. The FreeWRT project use a
1271 special version, which is embedded to the busybox binary. Normally the command
1272 line tool \app{ipkg} is pre-installed.
1273
1274 IPKG uses a configuration file similar to \file{/etc/apt/sources.list}, which
1275 contains a list of software repositories available via HTTP or FTP. The
1276 configuration file \file{/etc/ipkg.conf} contains the official FreeWRT 1.0
1277 repository for your board and kernel version.
1278
1279 To update the list of available packages execute following command as root:
1280 \begin{Verbatim}[label=update list of available packages]
1281 # ipkg update
1282 \end{Verbatim}
1283
1284 This command requires a working internet connection, because it will fetch a
1285 package list from every repository declared in \file{/etc/ipkg.conf}.
1286
1287 To install a new package use following command:
1288 \begin{Verbatim}[label=example installation of \app{tcpdump}]
1289 # ipkg install tcpdump
1290 \end{Verbatim}
1291
1292 This will install the package \app{tcpdump} and all dependencies onto the
1293 flash. Where the data is saved depends on the root filesystem you decided to
1294 use while installing FreeWRT. If you use jffs2 as root filesystem, then the
1295 package is installed on the big linux partition. If you use squashfs-overlay,
1296 then the package is installed on the mini-fo overlay filesystem which writes
1297 its data to the jffs2 data partition. If you use a squashfs-symlinks
1298 filesystem, then the package data is directly install into the jffs2 data
1299 partition, containing symlinks to the read-only squashfs partition.
1300
1301 You can also remove packages, but this is only useful if you are using jffs2 as
1302 root filesystem:
1303 \begin{Verbatim}[label=example removal of \app{tcpdump}]
1304 # ipkg remove tcpdump
1305 \end{Verbatim}
1306
1307 This will not remove any dependencies, installed earlier. For example,
1308 \app{libpcap} is still installed after executing this command. On jffs2 root
1309 filesystem you should never remove any essential packages like \app{busybox},
1310 \app{fwcf} or \app{uclibc}, otherwise you make the embedded system unusable.
1311
1312 Nearly the same as for removing packages, counts for \command{ipkg upgrade}.
1313 Please \strong{never ever} use \command{ipkg upgrade} to update your embedded
1314 system. This command is only useful to upgrade single packages on a jffs2
1315 rootfilesystem or data partition.
1316
1317 \section{Startup scripts}
1318
1319 Some of the available packages containing software which start services at boot
1320 time. For that we provide simple startup scripts, which are installed into the
1321 directory \file{/etc/init.d}. See following example for the package
1322 \app{dnsmasq}, a combined dns and dhcp server daemon:
1323
1324 \begin{Verbatim}[label=\file{/etc/init.d/S50dnsmasq}]
1325 #!/bin/sh
1326
1327 . /etc/rc.conf
1328
1329 case $1 in
1330 autostart)
1331 test x"${dns_dhcp:-NO}" = x"NO" && exit 0
1332 exec $0 start
1333 ;;
1334 start)
1335 [ -f /etc/dnsmasq.conf ] || exit
1336 /usr/sbin/dnsmasq
1337 ;;
1338 stop)
1339 killall dnsmasq
1340 ;;
1341 restart)
1342 $0 stop
1343 $0 start
1344 ;;
1345 *)
1346 echo "Usage: $0 {start | stop | restart}"
1347 ;;
1348 esac
1349 exit 0
1350 \end{Verbatim}
1351
1352 After installation the package postinst script will add all needed changes to
1353 the \file{/etc/} directory. For example packages can add new user and groups,
1354 add new variables to \file{/etc/rc.conf} or just add new values to existing
1355 files as \file{/etc/services}. It is FreeWRT policy not to start any services
1356 after installation or in case of a new boot. To start services on bootup you
1357 need to set \code{\$servicename=YES} in \file{/etc/rc.conf} and commit your
1358 changes via \command{fwcf commit}. For every policy exists an exception, we
1359 start all essential services by default, like ssh daemon, syslog and network
1360 initialisation.
1361
1362 For some services you can control the startup behaviour by modifying the
1363 \code{\$servicename\_flags} variable in \file{/etc/rc.conf}.
1364
1365 For example the variable \code{\$ssh\_opts} is provided as an argument to the
1366 dropbear ssh daemon to control its behaviour.
1367
1368 Having this policy helps you to configure your FreeWRT embedded system without
1369 shooting yourself in the foot. For example if you try to realize a firewall
1370 system and trying to set the rules in \file{/etc/firewall.user}, which is read
1371 by \file{/etc/init.d/S45firewall}, if the iptables package is installed. You
1372 can just reload the changed ruleset via \code{/etc/init.d/S45firewall restart}.
1373 If you managed to kick you out of the system, you can just reboot the system
1374 and you gain access again. As soon as your are ready with the firewall
1375 configuration and you decide to activate the firewall rules on bootup, you set
1376 \code{firewall=YES} in \file{/etc/rc.conf}, commit your changes via
1377 \command{fwcf commit} and reboot. Now the firewall rules will be activated on
1378 bootup.
1379
1380
1381 \chapter{Troubleshooting}\label{ch:troubleshooting}
1382
1383 \section{Failsafe Mode}
1384
1385 Failsafe mode is very useful if you misconfigured your embedded system, so that
1386 you can not access it anymore. E.g. if you accidentially disabled secure shell
1387 or misconfigured the firewall, so that you can not login any more.
1388
1389 When in failsafe mode, the device won't interpret any networking setup files.
1390 It stops even before the root filesystem gets mounted read--write, and fwcf is
1391 set up. It will just set the LAN interface up and give it the IP address
1392 \file{192.168.1.1} and netmask \file{255.255.255.0}. Then it will start a
1393 \app{telnet} daemon, so you get straight access (without depending on the
1394 installed SSH daemon).
1395
1396 \subsection{How It Works}
1397
1398 To get FreeWRT into failsafe mode you need physical access to the device and
1399 the failsafe utility. The failsafe utility is built inside our ADK and is
1400 available in the directory \file{bin/} after a successful build.
1401
1402 If you just want to compile the tool and not a complete firmware image, use
1403 following command:
1404
1405 \begin{Verbatim}[label=building the failsafe utility for the host system]
1406 $ make subdir=tools/failsafe install
1407 \end{Verbatim}
1408
1409 For some operating systems we provide ready to go binaries of failsafe.
1410 Take a look at \url{http://www.freewrt.org/downloads/tools/failsafe}
1411
1412 The tool just opens a network socket and waits for a special UDP packet
1413 from the embedded device. FreeWRT sends the UDP packet via the first
1414 recognized network interface (eth0).
1415
1416 \subsection{Enabling Failsafe Mode}
1417
1418 Connect your computer to the embedded system via direct or crossed network
1419 cable. Use the failsafe port (in most cases one of the LAN ports), see the
1420 device specific page for the exact network port.
1421
1422 Configure your network interface to the IP address \file{192.168.1.2} with
1423 network mask \file{255.255.255.0}. Now start the failsafe utility on your
1424 computer.
1425
1426 \begin{Verbatim}
1427 $ ./failsafe
1428 \end{Verbatim}
1429
1430 After that power on your embedded system and wait for the following message in
1431 your failsafe application running on your computer:
1432
1433 \begin{Verbatim}
1434 Press reset now to enter Failsafe!
1435 \end{Verbatim}
1436
1437 As soon as this message is displayed you should push the reset button of
1438 your embedded system. You have 2 seconds time to push the button. If you
1439 successfully enabled the failsafe mode, following message will be displayed:
1440
1441 \begin{Verbatim}
1442 Entering Failsafe!
1443 \end{Verbatim}
1444
1445 Now you should be able to login to your embedded system via a telnet
1446 application. Just use:
1447
1448 \begin{Verbatim}
1449 $ telnet 192.168.1.1
1450 \end{Verbatim}
1451
1452 \subsection{Repairing Your FreeWRT Configuration}
1453
1454 If you want to repair your configuration, you first need to mount the root
1455 filesystem read--writeable. This is best done via:
1456
1457 \begin{Verbatim}
1458 # mount_root
1459 \end{Verbatim}
1460
1461 After that you need to enable the FreeWRT configuration filesystem:
1462
1463 \begin{Verbatim}
1464 # fwcf setup
1465 \end{Verbatim}
1466
1467 Now you can change files in \file{/etc/} and repair your broken configuration.
1468 Do not forget to commit your changes afterwards.
1469
1470 \begin{Verbatim}
1471 # fwcf commit
1472 \end{Verbatim}
1473
1474 If you want to start over with the default \file{/etc/} directory, just remove
1475 the fwcf partition content with following command:
1476
1477 \begin{Verbatim}
1478 mtd erase fwcf
1479 \end{Verbatim}
1480
1481 You can either use \command{reboot -f} or the option \command{-r} for \app{mtd}
1482 to reboot the system.
1483
1484 %\section{Serial Console}
1485
1486 %\section{JTAG}
1487
1488 % Erstmal auskommentieren. Sind ja paar Seiten die erstmal keiner braucht
1489 %\begin{appendix}
1490 %\include{A-blaetter}
1491 %\end{appendix}
1492
1493 %\cleardoublepage
1494 %\addcontentsline{toc}{chapter}{\glossaryname}
1495 \end{document}

Properties

Name Value
svn:keywords Id

root@freewrt.org:443
ViewVC Help
Powered by ViewVC 1.1.20