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 2538 - (show annotations) (download) (as text)
Thu May 17 21:12:17 2007 UTC (6 years, 9 months ago) by n0-1
File MIME type: application/x-tex
File size: 58057 byte(s)
full long line cleanup. note that this should not have changed anything at the produced pdf
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}
614 (\code{x} is \code{0--9}). If the device has a switch, the different ports are
615 separated via VLAN technology. The vlan interfaces are named \code{ethx.y}.
616 The network configuration in FreeWRT is managed via \app{Busybox}'s
617 \app{ifupdown} implementation. \app{Busybox}'s builtin \app{ip} command
618 configures the network interfaces. There is no \app{ifconfig} or \app{route}.
619 To show all configured network interfaces use:
620 \begin{Verbatim}[label=show IP address]
621 $ ip addr show
622 \end{Verbatim}
623 To show the kernel routing table use:
624 \begin{Verbatim}[label=show routing table]
625 $ ip route show
626 \end{Verbatim}
627
628 All available network settings can be found in \file{/etc/network/interfaces}
629 which has the common form:
630 \begin{Verbatim}[label=common form of \file{/etc/network/interfaces}]
631 auto <iface-name>
632 iface <iface-name> inet <method>
633 <option-x> <value>
634 <option-y> <value>
635 <option-z> <value>
636 \end{Verbatim}
637
638 \code{auto <iface-name>} is optional and, if set, tells the \app{ifup} script
639 to start this interface automatically on bootup.
640
641 Each interface needs a unique name which, depending on the method, represents
642 either a physical interface or a logical interface name like \code{eth0.1} for
643 a physical VLAN or \code{umts} as a logical name for a PPP interface.
644
645 Possible methods are:
646 \begin{description}
647 \item[static] use the given options to configure the interface
648 statically
649 \item[dhcp] just start a dhcp client using the interface
650 \code{iface-name}
651 \item[manual] don't configure the interface but start \code{pre-up.d}
652 hook scripts
653 \item[ppp] run \code{pon <provider>} where \code{<provider>} is given
654 as an interface option
655 \end{description}
656
657 \subsection{Switch/VLAN}
658 The switch built-in into the most routers is capable of separating each port
659 using VLAN tagging. You can configure the switch by simply adding the interface
660 to the config file and giving the desired switch-ports:
661 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
662 auto eth0.0
663 iface eth0.0 inet static
664 switch-ports 1 2 5*
665 address 192.168.1.1
666 netmask 255.255.255.0
667
668 auto eth0.1
669 iface eth0.1 inet static
670 switch-ports 3 4 5
671 address 192.168.2.1
672 netmask 255.255.255.0
673
674 auto eth0.2
675 iface eth0.2 inet static
676 switch-ports 0 5
677 address 172.16.1.42
678 netmask 255.255.255.0
679 gateway 172.16.1.1
680 \end{Verbatim}
681
682 This configures three VLAN interfaces \code{eth0.0} on ports 1 and 2,
683 \code{eth0.1} on port 3 and 4 and \code{eth0.2} on port 0.
684
685
686 If you need to do some advanced settings, because you have for example a
687 powerful switch with a VLAN trunking port connected to one of your switch
688 ports, the configuration would look like this:
689
690 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
691 auto eth0.1
692 iface eth0.1 inet static
693 switch-ports 2 3 4 5*
694 address 192.168.1.1
695 netmask 255.255.255.0
696
697 auto eth0.2
698 iface eth0.2 inet static
699 switch-ports 1t 5
700 address 10.2.0.1
701 netmask 255.255.255.0
702 broadcast +
703
704 auto eth0.3
705 iface eth0.3 inet static
706 switch-ports 1t 5
707 address 10.3.0.1
708 netmask 255.255.255.0
709 broadcast +
710
711 auto eth0.4
712 iface eth0.4 inet static
713 switch-ports 1t 5
714 address 10.4.0.1
715 netmask 255.255.255.0
716 broadcast +
717
718 \end{Verbatim}
719
720 This configures four VLAN interfaces, \code{eth0.1} on physical ports 2, 3 and
721 4. The interfaces \code{eth0.2}, \code{eth0.3} and \code{eth0.4} are three
722 different networks with VLAN ID 2--4. The physical port 1 needs to be connected
723 to a VLAN trunking port on a switch with knows the same VLAN IDs.
724
725
726 Explanation:
727 \begin{description}
728 \item[port 0] this is typically the port labeled as WAN
729 \item[port 1--4] these are typically the ports labeled as LAN
730 \item[port 5] this special port represents the port where the
731 router--board is connected to the switch
732 \item[*] one interface always need an asterisk behind port 5 which
733 means it is the default interface and gets all the packages
734 with unknown tags.
735 \end{description}
736
737 \subsection{Static IP configuration}
738 As you can see in the VLAN example three interfaces were configured with static
739 IP settings, so these are the commonly used options:
740 \begin{description}
741 \item[address] the IP address --- required
742 \item[netmask] the netmask --- required
743 \item[broadcast] broadcast address --- only required for legacy
744 applications (if using \code{+}, it will be calculated
745 automatically by the kernel)
746 \item[gateway] an IP address added as default gateway if present
747 \item[mac-address] if you need to change your MAC address (required for
748 some DSL providers)
749 \end{description}
750
751 \subsection{DHCP}
752 That's just as simple as:
753 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
754 auto eth0.1
755 iface eth0.1 inet dhcp
756 switch-ports 0 5
757 \end{Verbatim}
758 Typically this configures the WAN-Port to start a DHCP request on bootup.
759
760 \subsection{Bridging}
761
762 This is mostly needed to combine LAN and WLAN to a homogeneous network. Be
763 sure you have installed the package \app{bridge-utils}.
764
765 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
766 auto eth0.0
767 iface eth0.0 inet manual
768 switch-ports 1 2 3 4 5*
769
770 auto eth1
771 iface eth1 inet manual
772 wireless-bridge-if br0
773 [... other wifi-settings, see below ...]
774
775 auto br0
776 iface br0 inet static
777 bridge-ifaces eth0.0 eth1
778 address 192.168.1.1
779 netmask 255.255.255.0
780 broadcast +
781 \end{Verbatim}
782
783 This creates a new bridging interface \code{br0} which combines the VLAN
784 interface \code{eth0.0} (representing the LAN-ports 1--4) and the WLAN
785 interface \code{eth1} (on some devices like \term{Asus WL500gP} this might be
786 \code{eth2}). The bridge interface needs always be the last one, otherwise it
787 can not find the interfaces in \code{bridge-ifaces}.
788
789 \subsection{WLAN}
790 A router containing a WLAN interface has an additional ethernet device
791 representing it. On Broad\-com-based hardware it is typically \code{eth1}
792 (\term{Linksys}),\code{eth2} (\term{Asus WL500gP}) or on \term{Netgear WGT634u}
793 which has a Madwifi WLAN chip, it is \code{ath0}, \code{ath1}, etc. You can use
794 these interfaces standalone or bridged with other devices, e.g. the internal
795 LAN.
796
797 \subsubsection{Basic Settings}
798
799 Mandatory options and default parameters are in bold font.
800
801 \begin{tabular}{l|l|p{10cm}}
802 \strong{Option} & \strong{Parameter} & \strong{Description} \\
803 \hline\hline
804 \code{\strong{type}} & \code{broadcom} & Broadcom based card \\
805 & \code{atheros} & Madwifi driver \\
806 \hline
807 \code{\strong{mode}} & \code{ap} & Access point mode \\
808 & \code{sta} & Client mode \\
809 & \code{adhoc} & Ad-Hoc mode \\
810 & \code{wds} & WDS point-to-point link over wireless\\
811 & \code{monitor} & The node acts as a passive monitor and
812 only receives packets \\
813 \hline
814 \code{\strong{ssid}} & \code{<String>} & Set the SSID (Network Name) \\
815 \hline
816 \code{country} & \code{\{ALL|DE|JP|US|\ldots\}} & The country code used
817 to determine the
818 regulatory settings. \\
819 \hline
820 \end{tabular}
821
822 \subsubsection{Security Settings}
823 \begin{longtable}{l|l|p{10cm}}
824 \strong{Option} & \strong{Parameter} & \strong{Description} \\
825 \hline\hline
826 \code{\strong{security}} & \code{none} & No authorization \\
827 & \code{wep} & WEP key \\
828 & \code{wpa-psk} & WPA with preshared key \\
829 & \code{8021x} & IEEE 802.1X authentication \\
830 \hline
831 \code{\strong{authorization}} & & \strong{wpa-psk} \\
832 & \code{psk} & WPA PSK \\
833 & \code{psk2} & WPA2 PSK \\
834 & \code{psk psk2} & WPA PSK and WPA2 PSK \\
835 & & \strong{8021x} \\
836 & \code{wpa} & WPA with RADIUS \\
837 & \code{wpa2} & WPA2 with RADIUS \\
838 & \code{wpa wpa2} & WPA and WPA2 \\
839 \hline
840 \code{\strong{encryption}} & & \strong{wep} \\
841 & --- & not needed, automatically by key size \\
842 & & \strong{wpa-psk} \\
843 & \code{tkip} & RC4 encryption \\
844 & \code{aes} & AES encryption \\
845 & \code{aes+tkip} & support both \\
846 & & \strong{8021x} \\
847 & \code{wep} & RC4 encryption (static) \\
848 & \code{tkip} & RC4 encryption \\
849 & \code{aes} & AES encryption \\
850 & \code{aes+tkip} & support both \\
851 \hline
852 \code{eap-type} & & \strong{8021x} \\
853 & \code{\strong{tls}} & Transport Layer Security \\
854 & \code{ttls} & Tunnelled TLS \\
855 & \code{peap} & Protected EAP \\
856 & \code{leap} & Cisco Wireless \\
857 \hline
858 \code{key} & & \strong{wep} \\
859 &\code{\{\strong{1}|2|3|4\}} & Select WEP key to use. \\
860 \hline
861 \code{key[1..4]} & & \strong{wep} \\
862 & \code{<String>} & WEP key. The key must be 5, 13 or 16
863 bytes long, or 10, 26, 32, or 64 hex
864 digits long. The encryption algorithm is
865 automatically selected based on the key
866 size. key1 is the key for WEP client mode.
867 \\
868 \hline
869 \code{wpa-key} & & \strong{wpa-psk} \\
870 & <String> & Password to use with WPA/WPA2 PSK (at least 8, up
871 to 63 chars) \\
872 \hline
873 \code{wpa-gtk-rekey} & & \strong{wpa-psk},
874 \strong{8021x} \\
875 & \code{<Int>} (\strong{3600}) & Rekeying interval in
876 seconds. \\
877 \hline
878 \code{\strong{radius-ipaddr}} & & \strong{8021x} \\
879 & \code{<a.b.c.d>} & IP to connect. \\
880 \hline
881 \code{radius-port} & & \strong{8021x} \\
882 & \code{<Int>} (\strong{1812}) & RADIUS-Port no. to connect
883 \\
884 \hline
885 \strong{radius-key} & & \strong{8021x} \\
886 & \code{<String>} & Shared Secret for connection to the
887 Radius server \\
888 \hline
889 \end{longtable}
890
891 \subsubsection{MAC filter}
892 \begin{tabular}{l|l|p{10cm}}
893 \strong{Option} & \strong{Parameter} & \strong{Description} \\
894 \hline\hline
895 \code{macmode} & \code{\{0|1|2\}} & 0: Disable MAC address matching. \\
896 & & 1: Deny association to stations on the MAC
897 list. \\
898 & & 2: Allow association to stations on the MAC
899 list. \\
900 \hline
901 \code{maclist} & \code{<MAC1> \ldots <MACn>} & List of space separated mac
902 addresses to allow/deny
903 according to \code{macmode}.
904 Addresses should be entered with
905 colons, e.g.:
906 "\code{00:02:2D:08:E2:1D
907 00:03:3E:05:E1:1B}"\\
908 \end{tabular}
909
910 \subsubsection{Wireless Distribution System (WDS)}
911 \begin{tabular}{l|l|p{10cm}}
912 \strong{Option} & \strong{Parameter} & \strong{Description} \\
913 \hline\hline
914 \code{lazywds} & \code{\{0|1\}} & Accept WDS connections
915 from anyone \\
916 \hline
917 \code{wds-bridge} & \code{br\{X\}} & Add WDS peers to bridge
918 brX \\
919 \hline
920 \code{wds-security} & \code{\{wpa-psk\}} & secure the wds bridge
921 with WPA (optional)\\
922 \hline
923 \code{wds-encryption} & \code{\{aes|tkip\}} & Use AES or TKIP as
924 cipher\\
925 \hline
926 \code{wds-wpa-key} & \code{<String>} & Password to use with WPA
927 PSK (at least 8, up to 63
928 chars) \\
929 \hline
930 \code{wds} & \code{<MAC1> \ldots <MACn>} & List of WDS peer mac
931 addresses
932 (\code{xx:xx:xx:xx:xx:xx},
933 space separated) \\
934 \hline
935 \end{tabular}
936
937 \subsubsection{Miscellaneous}
938 \begin{longtable}{l|l|p{10cm}}
939 \strong{Option} & \strong{Parameter} & \strong{Description} \\
940 \hline\hline
941 \code{channel} & \code{\{1--14\}} & The wifi channel \\
942 \hline
943 \code{maxassoc} & \code{\{1--255\}} & Maximum number of associated clients \\
944 \hline
945 % TODO: add descriptions to the different gmode settings
946 \code{gmode} & & Set the 54g Mode \\
947 & \code{\strong{Auto}} & default \\
948 & \code{LegacyB} & \\
949 & \code{GOnly} & \\
950 & \code{BDeferred} & \\
951 & \code{Performance} & \\
952 & \code{LRS} & \\
953 \hline
954 \code{frameburst} & \code{\{\strong{0}|1\}} & Disable/Enable frameburst mode. \\
955 \hline
956 \code{txpower} & \code{\{0--255|\strong{$-1$}\}} & Set the transmit power in dBm \\
957 \hline
958 \code{rate} & \code{<Int> (\strong{$-1$})} & force a fixed rate \\
959 & & valid values for 802.11a are (6,
960 9, 12, 18, 24, 36, 48, 54) \\
961 & & valid values for 802.11b are (1,
962 2, 5.5, 11) \\
963 & & valid values for 802.11g are (1,
964 2, 5.5, 6, 9, 11, 12, 18, 24, 36,
965 48, 54) \\
966 & & $-1$ means automatically determine
967 the best rate \\
968 \hline
969 \code{rts} & \code{\{0-2347\}} & Set the RTS threshhold. \\
970 \hline
971 \code{frag} & \code{\{256-2346\}} & Set the fragmentation
972 threshhold. \\
973 \hline
974 \code{afterburner} & \code{\{\strong{0}|1\}} & Enable Afterburner capability
975 \\
976 \hline
977 \code{isolate} & \code{\{\strong{0}|1\}} & Hide Clients from each other \\
978 \hline
979 \code{bridge-if} & \code{\{br0..brX\}} & The bridge interface (optional)
980 \\
981 \hline
982 \end{longtable}
983
984 \subsubsection{Examples}
985 \paragraph{WLAN with WEP128}
986 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
987 iface eth1 inet static
988 address 192.168.10.1
989 netmask 255.255.255.0
990 broadcast +
991 wireless-type broadcom
992 wireless-country DE
993 wireless-mode ap
994 wireless-ssid FreeWRT
995 wireless-security wep
996 wireless-key1 11223344556677889900112233
997 wireless-channel 11
998 \end{Verbatim}
999
1000 \paragraph{WLAN without encryption}
1001 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
1002 iface eth1 inet static
1003 address 192.168.10.1
1004 netmask 255.255.255.0
1005 broadcast +
1006 wireless-type broadcom
1007 wireless-country DE
1008 wireless-mode ap
1009 wireless-ssid FreeWRT
1010 wireless-security none
1011 wireless-channel 11
1012 \end{Verbatim}
1013
1014 \paragraph{WLAN with WPA2 (AES)}
1015 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
1016 iface eth1 inet static
1017 address 192.168.10.1
1018 netmask 255.255.255.0
1019 broadcast +
1020 wireless-type broadcom
1021 wireless-country DE
1022 wireless-mode ap
1023 wireless-ssid FreeWRT
1024 wireless-security wpa-psk
1025 wireless-authorization psk2
1026 wireless-encryption aes
1027 wireless-wpa-key 12345678
1028 wireless-channel 11
1029 \end{Verbatim}
1030
1031 If you want to do MAC filtering, add the following to the sample above:
1032 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
1033 wireless-macmode 2
1034 wireless-mac 00:01:02:03:04:05 06:07:08:09:0a:0b
1035 \end{Verbatim}
1036 this enables the filter and defines the list to contain addresses that should
1037 be allowed.
1038
1039 To enhance wireless performance, you can enable some flags like Broadcom's
1040 SpeedBooster. Normally, these flags are not dangerous:
1041 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
1042 wireless-gmode performance
1043 wireless-frameburst 1
1044 wireless-afterburner 1
1045 \end{Verbatim}
1046
1047 \paragraph{WLAN client with WPA2 (AES) (\strong{untested})}
1048 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
1049 iface eth1 inet static
1050 address 192.168.10.1
1051 netmask 255.255.255.0
1052 broadcast +
1053 wireless-type broadcom
1054 wireless-country DE
1055 wireless-mode sta
1056 wireless-ssid FreeWRT
1057 wireless-security wpa-psk
1058 wireless-authorization psk2
1059 wireless-encryption aes
1060 wireless-wpa-key 12345678
1061 \end{Verbatim}
1062
1063 \paragraph{WLAN client with WEP128}
1064 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
1065 iface eth1 inet dhcp
1066 wireless-type broadcom
1067 wireless-country DE
1068 wireless-mode sta
1069 wireless-ssid FreeWRT
1070 wireless-security wep
1071 wireless-key1 11223344556677889900112233
1072 \end{Verbatim}
1073
1074 WLAN with WDS nodes, the WDS nodes need to have the same
1075 SSID, channel and encryption parameters.
1076
1077 WDS node 1 (MAC of Wireless \code{06:05:04:03:02:01})
1078 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
1079 iface br0 inet static
1080 bridge-ifaces eth1
1081 address 192.168.10.1
1082 netmask 255.255.255.0
1083 broadcast +
1084 wireless-type broadcom
1085 wireless-country DE
1086 wireless-mode wds
1087 wireless-ssid FreeWRT-WDS
1088 wireless-security none
1089 wireless-lazywds 0
1090 wireless-wds 01:02:03:04:05:06
1091 wireless-wds-bridge br0
1092 \end{Verbatim}
1093 WDS node 2 (MAC of Wireless \code{01:02:03:04:05:06})
1094 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
1095 iface br0 inet static
1096 bridge-ifaces eth1
1097 address 192.168.10.2
1098 netmask 255.255.255.0
1099 broadcast +
1100 wireless-type broadcom
1101 wireless-country DE
1102 wireless-mode wds
1103 wireless-ssid FreeWRT-WDS
1104 wireless-security none
1105 wireless-lazywds 0
1106 wireless-wds 06:05:04:03:02:01
1107 wireless-wds-bridge br0
1108 \end{Verbatim}
1109
1110 \paragraph{Peer-to-Peer mode (no encryption, IP must be static)}
1111 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
1112 iface eth1 inet static
1113 address 192.168.10.1
1114 netmask 255.255.255.0
1115 broadcast +
1116 wireless-type broadcom
1117 wireless-country DE
1118 wireless-mode adhoc
1119 wireless-ssid FreeWRT
1120 wireless-security none
1121 wireless-channel 11
1122 \end{Verbatim}
1123
1124 \subsection{PPP}
1125
1126 PPP comes in various flavours for different situations, the most commonly
1127 needed will likely be DSL and for \term{WRT54G3G} users UMTS. So there exists a
1128 hook-script that evaluates a \code{use-template} option and generates a
1129 ppp-peer. This way everything needed so far can be configured within the
1130 \code{interfaces} file. Be sure you have installed the packages \app{kmod-ppp},
1131 \app{ppp} and \app{ppp-mod-pppoe}. For providers using PPTP for authentication,
1132 instead of PPPoE, you need to install \app{pptp}.
1133
1134 \subsubsection{DSL with PPPoE}
1135 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
1136 auto ppp0
1137 iface ppp0 inet ppp
1138 use-template dsl
1139 provider foobar
1140 ppp-username 0001201234563200123456#0001@bar.de
1141 ppp-password bar
1142 ppp-device eth0.1
1143 \end{Verbatim}
1144
1145 Now your DSL connection will be started on boot (\code{auto ppp0}) and you can
1146 manually shut it down with \command{ifdown ppp0} or start it up with
1147 \command{ifup ppp0}. The template \code{dsl} will configure a typical PPPoE
1148 peer for you.
1149
1150 \subsubsection{DSL with PPTP}
1151 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
1152 auto ppp0
1153 iface ppp0 inet ppp
1154 use-template pptp
1155 provider foobar
1156 ppp-username foo
1157 ppp-password bar
1158 ppp-modemip 10.0.0.1
1159 ppp-mtu 1480
1160 ppp-device eth0.1
1161 \end{Verbatim}
1162
1163 Now your DSL connection will be started on boot (\code{auto ppp0}) and you can
1164 manually shut it down with \command{ifdown ppp0} or start it up with
1165 \command{ifup ppp0}. The template \code{pptp} will configure a typical PPTP
1166 peer for you.
1167
1168 \subsubsection{UMTS}
1169 Same footprint different template and some specific options. That is all that
1170 is needed for an UMTS connection to Vodafone as it can be seen in this example.
1171 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
1172 iface ppp0 inet ppp
1173 use-template umts
1174 provider umts
1175 #ppp-username ""
1176 #ppp-password ""
1177 ppp-device /dev/noz0
1178 umts-apn web.vodafone.de
1179 umts-pincode 1234
1180 umts-mode umts_first
1181 \end{Verbatim}
1182 As you can see: unneeded options like \code{ppp-username} or
1183 \code{ppp-password} can just be removed or commented out. Don't leave them
1184 without a value as that causes a failure in \app{ipup}. It does work if you
1185 give empty double quotes as value like \code{""}.
1186
1187 Note that you have to set the correct APN, username and password for your
1188 provider!
1189
1190 You may also remove the pin from your SIM-card and the configuration if you
1191 like.
1192
1193 For \term{Linksys WRT54G3G} a package called \app{broadcom-watchbutton} will be
1194 installed, this is a small daemon that monitors the UMTS-button of the router
1195 and executes \command{ifup umts} or \command{ifdown umts} on a button press.
1196 You have to set \code{watchbutton=YES} in /etc/rc.conf to have it start
1197 automatically.
1198
1199 This is totally independent from the \code{auto umts} setting. Even if you
1200 start the connection on bootup you can shut it down again with a button press.
1201
1202 \subsection{custom interface hooks}
1203 \subsubsection{per interface}
1204 You can execute various commands on interface startup or shutdown with special
1205 option:
1206 \begin{Verbatim}[label=\file{/etc/network/interfaces}]
1207 iface foobar inet static
1208 [...]
1209 pre-up <command>
1210 up <command>
1211 up <command>
1212 down <command>
1213 post-down <command>
1214 \end{Verbatim}
1215
1216 You can give each option multiple times and their commands will be executed in
1217 given order.
1218 \begin{description}
1219 \item[pre-up] before the interface will be started
1220 \item[up] after the interface was started successfully
1221 \item[down] before the interface goes down
1222 \item[post-down] after the interface shut down
1223 \end{description}
1224
1225 \subsubsection{general hooks}
1226 Additionally you can write scripts executed for each interface if you put them
1227 in
1228 \begin{itemize}
1229 \item \texttt{/etc/network/if-pre-up.d}
1230 \item \texttt{/etc/network/if-up.d}
1231 \item \texttt{/etc/network/if-down.d}
1232 \item \texttt{/etc/network/if-post-down.d}
1233 \end{itemize}
1234 Same semantics as above.
1235
1236 \section{FWCF - FreeWRT Configuration Filesystem}
1237
1238 FWCF is a separate flash partition for all changes made to the \file{/etc/}
1239 directory. There is a small tool named \app{fwcf}, which is used to setup the
1240 system or to commit changes to the fwcf partition.
1241
1242 On bootup the script \file{/sbin/mount\_root} is executed, which calls
1243 \command{fwcf setup} to setup \file{/etc/} as memory filesystem and overlay the
1244 changes committed to the fwcf partition.
1245
1246 If you change anything in \file{/etc/} and like to keep the change, it is
1247 required to execute \command{fwcf commit}. This will compress all changed or
1248 new files in \file{/etc/} and write the result into the fwcf partition. The
1249 fwcf partition is 128 Kb in size. This size is not changeable at the moment.
1250
1251 If you need more detailed information, please read the specification of FWCF,
1252 which can be found at
1253 \url{http://www.freewrt.org/trac/wiki/Documentation/Specs/FwCf}
1254
1255 If you want to remove all your changes and start your configuration from
1256 scratch, use \command{fwcf erase}. This is also required if you switch between
1257 compression plugins. Right now LZO plugin is default.
1258
1259 \section{IPKG - Packagemanagement}
1260
1261 All software for FreeWRT is available as a IPKG package. IPKG is a package
1262 manager very similar to Debian's \app{dpkg/apt-get} utilities. It is specially
1263 designed for embedded systems and is widely used. The FreeWRT project use a
1264 special version, which is embedded to the busybox binary. Normally the command
1265 line tool \app{ipkg} is pre-installed.
1266
1267 IPKG uses a configuration file similar to \file{/etc/apt/sources.list}, which
1268 contains a list of software repositories available via HTTP or FTP. The
1269 configuration file \file{/etc/ipkg.conf} contains the official FreeWRT 1.0
1270 repository for your board and kernel version.
1271
1272 To update the list of available packages execute following command as root:
1273 \begin{Verbatim}[label=update list of available packages]
1274 # ipkg update
1275 \end{Verbatim}
1276
1277 This command requires a working internet connection, because it will fetch a
1278 package list from every repository declared in \file{/etc/ipkg.conf}.
1279
1280 To install a new package use following command:
1281 \begin{Verbatim}[label=example installation of \app{tcpdump}]
1282 # ipkg install tcpdump
1283 \end{Verbatim}
1284
1285 This will install the package \app{tcpdump} and all dependencies onto the
1286 flash. Where the data is saved depends on the root filesystem you decided to
1287 use while installing FreeWRT. If you use jffs2 as root filesystem, then the
1288 package is installed on the big linux partition. If you use squashfs-overlay,
1289 then the package is installed on the mini-fo overlay filesystem which writes
1290 its data to the jffs2 data partition. If you use a squashfs-symlinks
1291 filesystem, then the package data is directly install into the jffs2 data
1292 partition, containing symlinks to the read-only squashfs partition.
1293
1294 You can also remove packages, but this is only useful if you are using jffs2 as
1295 root filesystem:
1296 \begin{Verbatim}[label=example removal of \app{tcpdump}]
1297 # ipkg remove tcpdump
1298 \end{Verbatim}
1299
1300 This will not remove any dependencies, installed earlier. For example,
1301 \app{libpcap} is still installed after executing this command. On jffs2 root
1302 filesystem you should never remove any essential packages like \app{busybox},
1303 \app{fwcf} or \app{uclibc}, otherwise you make the embedded system unusable.
1304
1305 Nearly the same as for removing packages, counts for \command{ipkg upgrade}.
1306 Please \strong{never ever} use \command{ipkg upgrade} to update your embedded
1307 system. This command is only useful to upgrade single packages on a jffs2
1308 rootfilesystem or data partition.
1309
1310 \section{Startup scripts}
1311
1312 Some of the available packages containing software which start services at boot
1313 time. For that we provide simple startup scripts, which are installed into the
1314 directory \file{/etc/init.d}. See following example for the package
1315 \app{dnsmasq}, a combined dns and dhcp server daemon:
1316
1317 \begin{Verbatim}[label=\file{/etc/init.d/S50dnsmasq}]
1318 #!/bin/sh
1319
1320 . /etc/rc.conf
1321
1322 case $1 in
1323 autostart)
1324 test x"${dns_dhcp:-NO}" = x"NO" && exit 0
1325 exec $0 start
1326 ;;
1327 start)
1328 [ -f /etc/dnsmasq.conf ] || exit
1329 /usr/sbin/dnsmasq
1330 ;;
1331 stop)
1332 killall dnsmasq
1333 ;;
1334 restart)
1335 $0 stop
1336 $0 start
1337 ;;
1338 *)
1339 echo "Usage: $0 {start | stop | restart}"
1340 ;;
1341 esac
1342 exit 0
1343 \end{Verbatim}
1344
1345 After installation the package postinst script will add all needed changes to
1346 the \file{/etc/} directory. For example packages can add new user and groups,
1347 add new variables to \file{/etc/rc.conf} or just add new values to existing
1348 files as \file{/etc/services}. It is FreeWRT policy not to start any services
1349 after installation or in case of a new boot. To start services on bootup you
1350 need to set \code{\$servicename=YES} in \file{/etc/rc.conf} and commit your
1351 changes via \command{fwcf commit}. For every policy exists an exception, we
1352 start all essential services by default, like ssh daemon, syslog and network
1353 initialisation.
1354
1355 For some services you can control the startup behaviour by modifying the
1356 \code{\$servicename\_flags} variable in \file{/etc/rc.conf}.
1357
1358 For example the variable \code{\$ssh\_opts} is provided as an argument to the
1359 dropbear ssh daemon to control its behaviour.
1360
1361 Having this policy helps you to configure your FreeWRT embedded system without
1362 shooting yourself in the foot. For example if you try to realize a firewall
1363 system and trying to set the rules in \file{/etc/firewall.user}, which is read
1364 by \file{/etc/init.d/S45firewall}, if the iptables package is installed. You
1365 can just reload the changed ruleset via \code{/etc/init.d/S45firewall restart}.
1366 If you managed to kick you out of the system, you can just reboot the system
1367 and you gain access again. As soon as your are ready with the firewall
1368 configuration and you decide to activate the firewall rules on bootup, you set
1369 \code{firewall=YES} in \file{/etc/rc.conf}, commit your changes via
1370 \command{fwcf commit} and reboot. Now the firewall rules will be activated on
1371 bootup.
1372
1373
1374 \chapter{Troubleshooting}\label{ch:troubleshooting}
1375
1376 \section{Failsafe Mode}
1377
1378 Failsafe mode is very useful if you misconfigured your embedded system, so that
1379 you can not access it anymore. E.g. if you accidentially disabled secure shell
1380 or misconfigured the firewall, so that you can not login any more.
1381
1382 When in failsafe mode, the device won't interpret any networking setup files.
1383 It stops even before the root filesystem gets mounted read--write, and fwcf is
1384 set up. It will just set the LAN interface up and give it the IP address
1385 \file{192.168.1.1} and netmask \file{255.255.255.0}. Then it will start a
1386 \app{telnet} daemon, so you get straight access (without depending on the
1387 installed SSH daemon).
1388
1389 \subsection{How It Works}
1390
1391 To get FreeWRT into failsafe mode you need physical access to the device and
1392 the failsafe utility. The failsafe utility is built inside our ADK and is
1393 available in the directory \file{bin/} after a successful build.
1394
1395 If you just want to compile the tool and not a complete firmware image, use
1396 following command:
1397
1398 \begin{Verbatim}[label=building the failsafe utility for the host system]
1399 $ make subdir=tools/failsafe install
1400 \end{Verbatim}
1401
1402 For some operating systems we provide ready to go binaries of failsafe.
1403 Take a look at \url{http://www.freewrt.org/downloads/tools/failsafe}
1404
1405 The tool just opens a network socket and waits for a special UDP packet
1406 from the embedded device. FreeWRT sends the UDP packet via the first
1407 recognized network interface (eth0).
1408
1409 \subsection{Enabling Failsafe Mode}
1410
1411 Connect your computer to the embedded system via direct or crossed network
1412 cable. Use the failsafe port (in most cases one of the LAN ports), see the
1413 device specific page for the exact network port.
1414
1415 Configure your network interface to the IP address \file{192.168.1.2} with
1416 network mask \file{255.255.255.0}. Now start the failsafe utility on your
1417 computer.
1418
1419 \begin{Verbatim}
1420 $ ./failsafe
1421 \end{Verbatim}
1422
1423 After that power on your embedded system and wait for the following message in
1424 your failsafe application running on your computer:
1425
1426 \begin{Verbatim}
1427 Press reset now to enter Failsafe!
1428 \end{Verbatim}
1429
1430 As soon as this message is displayed you should push the reset button of
1431 your embedded system. You have 2 seconds time to push the button. If you
1432 successfully enabled the failsafe mode, following message will be displayed:
1433
1434 \begin{Verbatim}
1435 Entering Failsafe!
1436 \end{Verbatim}
1437
1438 Now you should be able to login to your embedded system via a telnet
1439 application. Just use:
1440
1441 \begin{Verbatim}
1442 $ telnet 192.168.1.1
1443 \end{Verbatim}
1444
1445 \subsection{Repairing Your FreeWRT Configuration}
1446
1447 If you want to repair your configuration, you first need to mount the root
1448 filesystem read--writeable. This is best done via:
1449
1450 \begin{Verbatim}
1451 # mount_root
1452 \end{Verbatim}
1453
1454 After that you need to enable the FreeWRT configuration filesystem:
1455
1456 \begin{Verbatim}
1457 # fwcf setup
1458 \end{Verbatim}
1459
1460 Now you can change files in \file{/etc/} and repair your broken configuration.
1461 Do not forget to commit your changes afterwards.
1462
1463 \begin{Verbatim}
1464 # fwcf commit
1465 \end{Verbatim}
1466
1467 If you want to start over with the default \file{/etc/} directory, just remove
1468 the fwcf partition content with following command:
1469
1470 \begin{Verbatim}
1471 mtd erase fwcf
1472 \end{Verbatim}
1473
1474 You can either use \command{reboot -f} or the option \command{-r} for \app{mtd}
1475 to reboot the system.
1476
1477 %\section{Serial Console}
1478
1479 %\section{JTAG}
1480
1481 % Erstmal auskommentieren. Sind ja paar Seiten die erstmal keiner braucht
1482 %\begin{appendix}
1483 %\include{A-blaetter}
1484 %\end{appendix}
1485
1486 %\cleardoublepage
1487 %\addcontentsline{toc}{chapter}{\glossaryname}
1488 \end{document}

Properties

Name Value
svn:keywords Id

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