| 1 | FreeWRT 1.0 Handbook
|
|---|
| 2 | ====================
|
|---|
| 3 |
|
|---|
| 4 | = Introduction =
|
|---|
| 5 |
|
|---|
| 6 | Welcome to FreeWRT! This handbook covers the building, installation and usage
|
|---|
| 7 | aspects of the FreeWRT 1.0 Linux distribution. FreeWRT is a portable, secure
|
|---|
| 8 | and functional Linux distribution for embedded systems. As FreeWRT is a source
|
|---|
| 9 | code distribution, it does not provide any pre-compiled firmware for embedded
|
|---|
| 10 | systems. The latest version of this document is always available at the
|
|---|
| 11 | FreeWRT website. If you have any comments, criticism or found some wrong
|
|---|
| 12 | description, please send us an eMail to freewrt-handbook@freewrt.org, we are
|
|---|
| 13 | always happy about getting feedback to this document, and will try to update
|
|---|
| 14 | or correct the issues mentioned by you.
|
|---|
| 15 |
|
|---|
| 16 | The handbook is split into five distinct sections. Appliance Development Kit
|
|---|
| 17 | covers the building of FreeWRT firmware images. The second section, Installing
|
|---|
| 18 | FreeWRT, covers all aspects regarding the installation and deinstallation of
|
|---|
| 19 | FreeWRT firmware images. The third section is a detailed description of the
|
|---|
| 20 | startup process of FreeWRT. The fourth section, Using FreeWRT, covers
|
|---|
| 21 | administrational tasks, such as network configuration, the FreeWRT
|
|---|
| 22 | configuration filesystem, package management and update mechanism. The last
|
|---|
| 23 | section helps troubleshooting problems and recovering a bad firmware
|
|---|
| 24 | installation. The appendix contains board specific information. For FreeWRT
|
|---|
| 25 | 1.0 these are only Broadcom based embedded systems.
|
|---|
| 26 |
|
|---|
| 27 | The intended audience for this handbook are advanced users with basic
|
|---|
| 28 | knowledge about Linux, networking and software development. The reader should
|
|---|
| 29 | be aware of basic command line tools, the vi editor and a shell. FreeWRT does
|
|---|
| 30 | not contain any high level administration tools (e.g. web based
|
|---|
| 31 | administration) and is fully configured via command line.
|
|---|
| 32 |
|
|---|
| 33 | == Typographic Conventions ==
|
|---|
| 34 |
|
|---|
| 35 | Examples starting with # indicate a command that must be invoked as super
|
|---|
| 36 | user. You can use su to gain super user privilges.
|
|---|
| 37 |
|
|---|
| 38 | {{{
|
|---|
| 39 | # fwcf commit
|
|---|
| 40 | }}}
|
|---|
| 41 |
|
|---|
| 42 | Examples staring with $ indicate a command that can be invoked as a normal
|
|---|
| 43 | user. The default user account on a freshly installed FreeWRT system is
|
|---|
| 44 | "admin".
|
|---|
| 45 |
|
|---|
| 46 | {{{
|
|---|
| 47 | $ cat /etc/banner
|
|---|
| 48 | }}}
|
|---|
| 49 |
|
|---|
| 50 |
|
|---|
| 51 | = Appliance Development Kit (ADK) =
|
|---|
| 52 |
|
|---|
| 53 | Our appliance development kit is called "buildroot". The ADK is the core of
|
|---|
| 54 | FreeWRT and contains all scripts and sources to create firmware images for
|
|---|
| 55 | every supported embedded system. FreeWRT 1.0 supports the following embedded
|
|---|
| 56 | systems:
|
|---|
| 57 |
|
|---|
| 58 | * Asus WL500g
|
|---|
| 59 | * Asus WL500g deluxe
|
|---|
| 60 | * Asus WL500g premium
|
|---|
| 61 | * Linksys WRT54G v1.0
|
|---|
| 62 | * Linksys WRT54G v1.1
|
|---|
| 63 | * Linksys WRT54G v2.0
|
|---|
| 64 | * Linksys WRT54G v2.2
|
|---|
| 65 | * Linksys WRT54G v3.0
|
|---|
| 66 | * Linksys WRT54G v3.1
|
|---|
| 67 | * Linksys WRT54G v4.0
|
|---|
| 68 | * Linksys WRT54GS v1.0
|
|---|
| 69 | * Linksys WRT54GS v1.1
|
|---|
| 70 | * Linksys WRT54GS v4
|
|---|
| 71 | * Linksys WRT54G3G
|
|---|
| 72 | * Netgear WGT634u
|
|---|
| 73 |
|
|---|
| 74 | In this release we only support the Linux 2.4 kernel. The ADK contains over
|
|---|
| 75 | 300 software packages.
|
|---|
| 76 |
|
|---|
| 77 | == Prerequisites ==
|
|---|
| 78 |
|
|---|
| 79 | Here is a list of all supported and tested host systems. The host system is
|
|---|
| 80 | needed to create a firmware for your embedded system.
|
|---|
| 81 |
|
|---|
| 82 | * Debian GNU/Linux 3.1 or newer
|
|---|
| 83 | * Gentoo Linux
|
|---|
| 84 | * Ubuntu Dapper Drake or newer
|
|---|
| 85 | * Fedora Core 4 or newer
|
|---|
| 86 | * OpenBSD 3.9 or newer
|
|---|
| 87 | * MirOS BSD
|
|---|
| 88 |
|
|---|
| 89 | Please install the following software, which is needed to build a basic
|
|---|
| 90 | firmware image. If you choose more packages some more prerequisites might be
|
|---|
| 91 | needed. Buildroot will warn you about any software you need to install to
|
|---|
| 92 | compile a specific package. Here is a list of the required software:
|
|---|
| 93 |
|
|---|
| 94 | * gcc3 or higher
|
|---|
| 95 | * g++
|
|---|
| 96 | * binutils
|
|---|
| 97 | * patch
|
|---|
| 98 | * gzip
|
|---|
| 99 | * bzip2
|
|---|
| 100 | * unzip
|
|---|
| 101 | * flex
|
|---|
| 102 | * bison
|
|---|
| 103 | * GNU make
|
|---|
| 104 | * zlib (+headers)
|
|---|
| 105 | * ncurses (+headers)
|
|---|
| 106 | * (g)libc headers
|
|---|
| 107 | * subversion
|
|---|
| 108 | * perl
|
|---|
| 109 |
|
|---|
| 110 | The buildroot checks for the required versions of these tools in advance.
|
|---|
| 111 |
|
|---|
| 112 | To build FreeWRT with buildroot it is recommended to have an unprivileged
|
|---|
| 113 | user. Please _never_ build FreeWRT as super user. Because all necessary source
|
|---|
| 114 | tarballs are downloaded from the internet automagically, your host system
|
|---|
| 115 | needs a working internet connection.
|
|---|
| 116 |
|
|---|
| 117 | == Getting the source ==
|
|---|
| 118 |
|
|---|
| 119 | Now go to a directory where you want to build the firmware. Depending on the
|
|---|
| 120 | features you select you will need about 2.5-5 GB free disk space. This
|
|---|
| 121 | includes the buildroot itself, any source archives which will be downloaded
|
|---|
| 122 | and their extracted copies (for compiling).
|
|---|
| 123 |
|
|---|
| 124 | To get the initial FreeWRT 1.0 buildroot try one of these commands:
|
|---|
| 125 | {{{
|
|---|
| 126 | $ svn co http://www.freewrt.org/svn/branches/freewrt_1_0 freewrt
|
|---|
| 127 | $ svn co svn://www.freewrt.org/branches/freewrt_1_0 freewrt
|
|---|
| 128 | }}}
|
|---|
| 129 |
|
|---|
| 130 | After successfully downloading, enter the directory:
|
|---|
| 131 | {{{
|
|---|
| 132 | $ cd freewrt
|
|---|
| 133 | }}}
|
|---|
| 134 |
|
|---|
| 135 | This directory will be referred to as the ADK root later on.
|
|---|
| 136 |
|
|---|
| 137 | == Some Theory First ==
|
|---|
| 138 |
|
|---|
| 139 | Building a FreeWRT firmware image is just like building a new Linux kernel,
|
|---|
| 140 | but a little more complex. There is a ncurses-based configuration menu at the
|
|---|
| 141 | beginning, the changes made are saved into a file named ".config" in the ADK
|
|---|
| 142 | root. The build is done by the various Makefiles, compiling and linking the
|
|---|
| 143 | sources together accordingly to the symbols defined in ".config".
|
|---|
| 144 |
|
|---|
| 145 | Unlike kernel compilation, FreeWRT needs to be cross-compiled always. This
|
|---|
| 146 | leads to special premises, as most of the tools need to be specially build.
|
|---|
| 147 | But no panic, FreeWRT will do this all for you. In fact, this is done at the
|
|---|
| 148 | second run of {{{make}}} (the first one opens the configuration), and
|
|---|
| 149 | therefore can be seen as part of the first firmware build. For clarity
|
|---|
| 150 | though, we will discuss these two things separately.
|
|---|
| 151 |
|
|---|
| 152 | == Preparing the Build Process ==
|
|---|
| 153 |
|
|---|
| 154 | After downloading the FreeWRT ADK, it's time to prepare the ADK for the
|
|---|
| 155 | building of firmware Images (for explanations see the chapter above).
|
|---|
| 156 |
|
|---|
| 157 | === Creating A Configuration ===
|
|---|
| 158 | The first step is to run {{{make}}}. After checking some prerequisites (see
|
|---|
| 159 | "Troubleshooting" below for aid in problems), a console based configuration
|
|---|
| 160 | menu should start. Theoretically no choices have to be made, but it's proven
|
|---|
| 161 | usefull to at least:
|
|---|
| 162 | * select a target (menu: "Embedded System")
|
|---|
| 163 | * select the root filesystem type (menu: "Target Firmware type")
|
|---|
| 164 |
|
|---|
| 165 | Then quit saving changes. If you forgot that, just run {{{make}}} again, redo
|
|---|
| 166 | your changes, then save.
|
|---|
| 167 |
|
|---|
| 168 | === Building ADK ===
|
|---|
| 169 | Now that you have a (first) configuration, it is time to build the toolchain
|
|---|
| 170 | (compiler, libraries) for cross-compiling. To do this, just enter {{{make}}}
|
|---|
| 171 | again. The build starts downloading and compiling each needed part of the
|
|---|
| 172 | toolchain, and later continues with building the first firmware image. Later
|
|---|
| 173 | one can be taken as proof of a working ADK.
|
|---|
| 174 |
|
|---|
| 175 | Already experienced in compiling gcc? Then you know... If not, better be told
|
|---|
| 176 | that it takes _really_long_ to finish. In the meantime I suggest reading the
|
|---|
| 177 | next (optional) chapter dealing with internals about cross-compiling.
|
|---|
| 178 |
|
|---|
| 179 | == Details Of Cross-Compiling ==
|
|---|
| 180 |
|
|---|
| 181 | TODO: someone with enough knowledge about this may fill this chapter with
|
|---|
| 182 | _interesting_ information!
|
|---|
| 183 |
|
|---|
| 184 | == Building A FreeWRT Firmware Image ==
|
|---|
| 185 |
|
|---|
| 186 | Ok. Your local copy of the FreeWRT ADK should now be prepared for building
|
|---|
| 187 | images. The next step is to do an extensive configuration for the image you
|
|---|
| 188 | want to create. To start the configuration menu, type {{{make menuconfig}}}.
|
|---|
| 189 |
|
|---|
| 190 | when selecting packages, <*> means it will be inserted into the firmware
|
|---|
| 191 | images and <M> means it will be build as an addon package which can be
|
|---|
| 192 | installed later.
|
|---|
| 193 |
|
|---|
| 194 | The target device and filesystem should already been chosen by you to the
|
|---|
| 195 | right value, if not you will have to issue a {{{make clean}}} before actually
|
|---|
| 196 | building the firmware image, because otherwise things get messed up. (smooth
|
|---|
| 197 | rebuild is a (yet) missing feature in our buildroot.) For the packages, if
|
|---|
| 198 | unsure, you can just select one of the package collections. After that, you
|
|---|
| 199 | can still manually check the choices made by the collection and correct them
|
|---|
| 200 | if appropriate. Do not forget to save your configuration when leaving!
|
|---|
| 201 |
|
|---|
| 202 | Guess ... right, type {{{make}}} again to build the new FreeWRT firmware
|
|---|
| 203 | image. Depending on your package selections and underlying hardware, this will
|
|---|
| 204 | take different amounts of time. For your spare time there is the following
|
|---|
| 205 | chapter giving some explanation about what is done at this point.
|
|---|
| 206 |
|
|---|
| 207 | == Firmware Build Process In Detail ==
|
|---|
| 208 |
|
|---|
| 209 | Just like when building the ADK's toolchain, the sources for the selected
|
|---|
| 210 | packages are downloaded from the internet first, then build using the
|
|---|
| 211 | cross-compiler and libraries of the ADK.
|
|---|
| 212 |
|
|---|
| 213 | TODO: more to follow by some more skilled people!!
|
|---|
| 214 |
|
|---|
| 215 | == Troubleshooting ==
|
|---|
| 216 | This section deals with various tips for problems with ADK installation.
|
|---|
| 217 |
|
|---|
| 218 | === Errors During Prerequisites Check ===
|
|---|
| 219 | To re-issue the checks, use "make prereq".
|
|---|
| 220 |
|
|---|
| 221 | * GNU make 3.80 too old
|
|---|
| 222 | On my FC4 buildsystem the first I get is
|
|---|
| 223 | {{{
|
|---|
| 224 | $ make
|
|---|
| 225 | GNU make 3.80 too old.
|
|---|
| 226 | Please install GNU make 3.81 or higher to continue.
|
|---|
| 227 | You can override this check, see http://www.freewrt.org/faq for details.
|
|---|
| 228 | It is suggested to upgrade your copy of bison to
|
|---|
| 229 | GNU Bison 2.3 because of its bug fixes.
|
|---|
| 230 | make: *** [.prereq_done] Error 1
|
|---|
| 231 | }}}
|
|---|
| 232 |
|
|---|
| 233 | it is quite a nice error that tells me to use more up to date software, but we can
|
|---|
| 234 | anyhow give this hostsystem a try and tell make to ignore those errors/warnings:
|
|---|
| 235 | {{{
|
|---|
| 236 | make prereq-noerror
|
|---|
| 237 | }}}
|
|---|
| 238 |
|
|---|
| 239 |
|
|---|
| 240 | = Installing FreeWRT =
|
|---|
| 241 |
|
|---|
| 242 | This document describes how to
|
|---|
| 243 | * build FreeWRT firmware images using the buildroot environment,
|
|---|
| 244 | * install the compiled firmware image to your router,
|
|---|
| 245 | * restore the original firmware.
|
|---|
| 246 |
|
|---|
| 247 | == Configuring ==
|
|---|
| 248 |
|
|---|
| 249 | To start a fresh new build, type {{{make}}}. Some early preparation and
|
|---|
| 250 | checking is done, then a console based configuration menu should start.
|
|---|
| 251 | See section "Troubleshooting" below if there are errors.
|
|---|
| 252 |
|
|---|
| 253 | [[PICS]]
|
|---|
| 254 |
|
|---|
| 255 | The ncurses based menu will aid you in configuring the firmware to be build.
|
|---|
| 256 | At least:
|
|---|
| 257 | * select a target (menu: "Embedded System")
|
|---|
| 258 | * select the root filesystem type (menu: "Target Firmware type")
|
|---|
| 259 |
|
|---|
| 260 | when selecting packages, <*> means it will be inserted into the firmware
|
|---|
| 261 | images and <M> means it will be build as an addon package which can be
|
|---|
| 262 | installed later. If you change the target or root filesystem later you always
|
|---|
| 263 | need to clean up before rebuilding using {{{make clean}}}. (smooth rebuild is
|
|---|
| 264 | a (yet) missing feature in our buildroot)
|
|---|
| 265 |
|
|---|
| 266 | After finishing your selections hit "exit" and save your configuration. As
|
|---|
| 267 | already mentioned above, the file containing your configuration is ".config"
|
|---|
| 268 | in buildroot's top directory. '''BEWARE:''' never mess with manually editing
|
|---|
| 269 | this autogenerated file, it may lead to unexpected results. (such as exploding
|
|---|
| 270 | embedded systems, etc.)
|
|---|
| 271 |
|
|---|
| 272 | == Build it ==
|
|---|
| 273 | You have a config now and the system starts to build whatever you configured
|
|---|
| 274 | starting with the mandatory toolchain for crosscompiling. That looks like this:
|
|---|
| 275 |
|
|---|
| 276 | * download the sources for the toolchain
|
|---|
| 277 | * build the toolchain
|
|---|
| 278 | * download the next piece of source
|
|---|
| 279 | * and so on.
|
|---|
| 280 |
|
|---|
| 281 | And after the toolchain is built it goes on with the kernel and the packages.
|
|---|
| 282 | Finally the built binaries are tied together to a firmware image for your selected
|
|---|
| 283 | target platform.
|
|---|
| 284 |
|
|---|
| 285 | BTW: not only get a cup of coffee now but have a walk to the next coffee bar ...
|
|---|
| 286 |
|
|---|
| 287 | == have fun ==
|
|---|
| 288 | Coffe finished? Then it might be time to use your freshly built firmware now. If
|
|---|
| 289 | you don't know how, you are absolutely right here, as this is the handbook,
|
|---|
| 290 | currently pointing to the next chapter.
|
|---|
| 291 |
|
|---|
| 292 | == Build your firmware image ==
|
|---|
| 293 |
|
|---|
| 294 | Here is a step by step guide:
|
|---|
| 295 | * If you might want to remove FreeWRT and restore the original firmware of your
|
|---|
| 296 | * embedded system, you should get a working firmware image from the manufacturer
|
|---|
| 297 | * of your embedded system first.
|
|---|
| 298 | * Test the manufacturers firmware image, update the firmware on your embedded
|
|---|
| 299 | * system just to see that everything works fine!
|
|---|
| 300 | * For a minimum build of FreeWRT you need 1,2 GB free space on your hard disk of
|
|---|
| 301 | * your host system. If you compile a full build of all available packages you
|
|---|
| 302 | * might need up to 8 GB free space on your hard disk.
|
|---|
| 303 | * Either install subversion on your host system to get the latest source of the
|
|---|
| 304 | * buildroot or use the latest daily sourcecode snapshots from
|
|---|
| 305 | * http://www.freewrt.org/downloads/source/ .
|
|---|
| 306 | * Don't do the next steps as a priviliged user (f.e. root on a Linux system).
|
|---|
| 307 | * Change to an unpriviliged user first.
|
|---|
| 308 | * Create a directory in which the buildroot system will reside. Everything will
|
|---|
| 309 | * be done inside this directory. The command rm -Rf <directory name> will remove
|
|---|
| 310 | * all FreeWRT stuff, if you want to get rid of it, so don't worry!
|
|---|
| 311 | * Change to the newly created directory.
|
|---|
| 312 | * Get the FreeWRT buildroot environment:
|
|---|
| 313 | * svn co svn://www.freewrt.org/
|
|---|
| 314 | * wget http://www.freewrt.org/downloads/source/<name of the latest stable or
|
|---|
| 315 | * trunk archive>[[BR]]
|
|---|
| 316 | Then extract the files via tar xzvf freewrt-src-<version><date>.tar.gz
|
|---|
| 317 | * After downloading approx. 200MB do:[[BR]]
|
|---|
| 318 | cd www.freewrt.org/trunk/freewrt
|
|---|
| 319 | * Now type: make menuconfig.[[BR]]
|
|---|
| 320 | After a while a configuration menu will appear. If not you might need to
|
|---|
| 321 | install the ncurses development package of your host system.
|
|---|
| 322 | * Select your embedded system model and select one of the target filesystems.
|
|---|
| 323 | * For every software or kernel module package you have three options
|
|---|
| 324 | 1. not selected < >
|
|---|
| 325 | 2. Build a s standalone package <M>
|
|---|
| 326 | 3. Include the package into the firmware image <*>
|
|---|
| 327 | * Do not include too many packages into the firmware image file, it is limited in
|
|---|
| 328 | * size! (depends on your hardware). You can install additional packages later.
|
|---|
| 329 | * If you like, step through the configuration options to see whats available.
|
|---|
| 330 | * Quit the configuration menu and save your configuration.
|
|---|
| 331 | * To build the firmware image type "make" or "make v" for verbose mode.
|
|---|
| 332 | * Your compile has been started now. This will take some time (30 minutes (P4
|
|---|
| 333 | * 3GHZ) to 10 Hours (100 MHz P1) ) depending on your hardware. The toolchain for
|
|---|
| 334 | * crosscompiling will be build first, then the kernel for the system and at last
|
|---|
| 335 | * all selected packages.
|
|---|
| 336 | * For some packages to compile, some extra tools need to be installed on your
|
|---|
| 337 | * host system, please read the error messages carefully.
|
|---|
| 338 | * After the build has been completed you will find all packages and one firmware
|
|---|
| 339 | * image in the bin directory (do: cd bin ; ls -l)
|
|---|
| 340 |
|
|---|
| 341 | == Flashing the compiled firmware to your embedded system ==
|
|---|
| 342 | * For Linksys Routers like WRT54GL, you can use the webinterface. Just select the
|
|---|
| 343 | * firmware upgrade page, and select the FreeWRT image as firmware file. Do
|
|---|
| 344 | * NEVER remove power from your router while it flashes !!
|
|---|
| 345 | * Now type: ssh admin@192.168.1.1 (Use default password FreeWRT, if you didn't
|
|---|
| 346 | * changed it in the configuration process)
|
|---|
| 347 | * You should be logged into your router now. Congratulation. Use "su" to get root
|
|---|
| 348 | * access.
|
|---|
| 349 |
|
|---|
| 350 | == How to install and remove software via the ipkg utility ==
|
|---|
| 351 |
|
|---|
| 352 | Use the ipkg utility to install and remove software.
|
|---|
| 353 |
|
|---|
| 354 | ipkg install <filename> # this is used for installing software
|
|---|
| 355 | ipkg remove <package-name> # this is used for removing a package
|
|---|
| 356 | ipkg list_installed # lists all installed packages by the name of the package
|
|---|
| 357 |
|
|---|
| 358 | To install a new package you need to transfer the package to your router this can
|
|---|
| 359 | be done by using scp or ftp.
|
|---|
| 360 | When you want to use ftp you need to start vsftpd on your router first.
|
|---|
| 361 | When the package has been transferred to your router, you can install it by
|
|---|
| 362 | typing: ipkg install <package filname>
|
|---|
| 363 |
|
|---|
| 364 |
|
|---|
| 365 | == First steps ==
|
|---|
| 366 |
|
|---|
| 367 | == Startup process ==
|
|---|
| 368 |
|
|---|
| 369 | === Flash layout ===
|
|---|
| 370 |
|
|---|
| 371 | The flash layout of the supported embedded systems is designed in the same way.
|
|---|
| 372 | There are some model specific differences between the exact sizes and partition
|
|---|
| 373 | offsets.
|
|---|
| 374 |
|
|---|
| 375 | We always have a separate partition for the bootloader. After that we have a
|
|---|
| 376 | partition for the kernel including a embedded root filesystem.
|
|---|
| 377 |
|
|---|
| 378 | === Bootloader ===
|
|---|
| 379 |
|
|---|
| 380 | The bootloader initializes the hardware, f.e. CPU, cache and ethernet devices.
|
|---|
| 381 | The different supported embedded systems have different bootloaders, with
|
|---|
| 382 | different features and sizes. To access the bootloader and a command line
|
|---|
| 383 | prompt you always need a serial connection to the embedded system.
|
|---|
| 384 | Not all embedded systems have a serial device onboard or only some crippled
|
|---|
| 385 | ones. Most of the time you can solder the board to get some working serial
|
|---|
| 386 | device, but this is not part of this short technical introduction.
|
|---|
| 387 |
|
|---|
| 388 | === Kernel ===
|
|---|
| 389 |
|
|---|
| 390 | The kernel is configured via append line to startup the ash compatible
|
|---|
| 391 | /etc/preinit script.
|
|---|
| 392 |
|
|---|
| 393 | === Preinit ===
|
|---|
| 394 |
|
|---|
| 395 | This is needed to first make some checks, which root filesystem is used and
|
|---|
| 396 | then to switch the root filesystem to that. This is either a complete writable
|
|---|
| 397 | root filesystem, which fills up the complete available flash.
|
|---|
| 398 |
|
|---|
| 399 | The preinit script exports the environment variable PATH and then mounts the
|
|---|
| 400 | virtual proc filesystem to /proc.
|
|---|
| 401 |
|
|---|
| 402 | There is another board specific preinit script, which is used to setup
|
|---|
| 403 | some board specific drivers or startup variables. (preinit.arch)
|
|---|
| 404 | After that the script mount\_root will mount the root filesystem and
|
|---|
| 405 | all other filesystems and startup init to start the system.
|
|---|
| 406 |
|
|---|
| 407 | is_dirty:
|
|---|
| 408 | reserved a byte for this flag at the end of the lzma loader
|
|---|
| 409 | 15:21 < nbd> (where it would not disturb the boot loader or the firmware)
|
|---|
| 410 | 15:22 < nbd> so the offset to this byte is the offset to the second partition - 1
|
|---|
| 411 | 15:23 < nbd> directly after flashing this byte is set to 0
|
|---|
| 412 | 15:23 < nbd> and in shell 0 == true :)
|
|---|
| 413 | 15:24 < nbd> jffs2root changes it
|
|---|
| 414 | 15:24 < nbd> --clean
|
|---|
| 415 | 15:24 < nbd> initially it's 0, jffs2root sets it to 1
|
|---|
| 416 |
|
|---|
| 417 | === Root filesystem ===
|
|---|
| 418 |
|
|---|
| 419 | - mini-fo
|
|---|
| 420 | - jffs2
|
|---|
| 421 | - symlinks
|
|---|
| 422 |
|
|---|
| 423 | === Init scripts ===
|
|---|
| 424 |
|
|---|
| 425 | In /etc/inittab we use /etc/init.d/rcS to startup all services, which
|
|---|
| 426 | are activated in /etc/rc.conf
|
|---|
| 427 |
|
|---|
| 428 | == Configuration filesystem ==
|
|---|
| 429 |
|
|---|
| 430 |
|
|---|
| 431 | == Network configuration ==
|
|---|
| 432 |
|
|---|
| 433 | = Network Configuration =
|
|---|
| 434 |
|
|---|
| 435 | The device names for real network interfaces in Linux are named ethx (x is 0-9).
|
|---|
| 436 | If the device has a switch the different ports are separated via VLAN technology.
|
|---|
| 437 | The vlan interfaces are named ethx.y.
|
|---|
| 438 | The network configuration in FreeWRT is managed via Busybox's ifupdown
|
|---|
| 439 | implementation. Busybox's ip builtin
|
|---|
| 440 | command configures the network interfaces. There is no "ifconfig" or "route".
|
|---|
| 441 | To show all configured network interfaces use:
|
|---|
| 442 | {{{
|
|---|
| 443 | $ ip addr show
|
|---|
| 444 | }}}
|
|---|
| 445 | To show the kernel routing table use:
|
|---|
| 446 | {{{
|
|---|
| 447 | $ ip route show
|
|---|
| 448 | }}}
|
|---|
| 449 |
|
|---|
| 450 | All available network settings can be found in {{{/etc/network/interfaces}}} which
|
|---|
| 451 | has the common form:
|
|---|
| 452 | {{{
|
|---|
| 453 | auto <iface-name>
|
|---|
| 454 | iface <iface-name> inet <method>
|
|---|
| 455 | <option-x> <value>
|
|---|
| 456 | <option-y> <value>
|
|---|
| 457 | <option-z> <value>
|
|---|
| 458 | }}}
|
|---|
| 459 |
|
|---|
| 460 | {{{auto <iface-name>}}} is optional and, if set, tells the "ifup" script to start
|
|---|
| 461 | this interface automatically on bootup.
|
|---|
| 462 |
|
|---|
| 463 | Each interface needs a unique name which, depending on the method, represent a
|
|---|
| 464 | physical interface or a logical interface name like "eth0.1" for a physical VLAN
|
|---|
| 465 | or "umts" as a logical name for a ppp interface.
|
|---|
| 466 |
|
|---|
| 467 | Possible methods are:
|
|---|
| 468 | {{{
|
|---|
| 469 | static :use the given options to configure the interface statically
|
|---|
| 470 | dhcp :just start a dhcp client using the interface "iface-name"
|
|---|
| 471 | manual :don't configure the interface but start pre-up.d hook scripts
|
|---|
| 472 | ppp :run "pon <provider>" where "<provider>" is given as an interface option
|
|---|
| 473 | }}}
|
|---|
| 474 |
|
|---|
| 475 | == Switch/VLAN ==
|
|---|
| 476 | The switch built-in in the most routers is capable of separating each port using
|
|---|
| 477 | VLAN tagging. You can configure the switch simply by adding the interface to the
|
|---|
| 478 | config file and give the desired switch-ports:
|
|---|
| 479 | {{{
|
|---|
| 480 | auto eth0.0
|
|---|
| 481 | iface eth0.0 inet static
|
|---|
| 482 | switch-ports 1 2 5*
|
|---|
| 483 | address 192.168.1.1
|
|---|
| 484 | netmask 255.255.255.0
|
|---|
| 485 |
|
|---|
| 486 | auto eth0.1
|
|---|
| 487 | iface eth0.1 inet static
|
|---|
| 488 | switch-ports 3 4 5
|
|---|
| 489 | address 192.168.2.1
|
|---|
| 490 | netmask 255.255.255.0
|
|---|
| 491 |
|
|---|
| 492 | auto eth0.2
|
|---|
| 493 | iface eth0.2 inet static
|
|---|
| 494 | switch-ports 0 5
|
|---|
| 495 | address 172.16.1.42
|
|---|
| 496 | netmask 255.255.255.0
|
|---|
| 497 | gateway 172.16.1.1
|
|---|
| 498 | }}}
|
|---|
| 499 |
|
|---|
| 500 | This configures three VLAN interfaces "eth0.0" on "1" and "2", "eth0.1" on port
|
|---|
| 501 | "3" and "4" and "eth0.2" on port "0".
|
|---|
| 502 | Explanation:
|
|---|
| 503 | {{{
|
|---|
| 504 | port 0 :this is typically the port labeled as WAN
|
|---|
| 505 | port 1-4 :these are typically the ports labeled as LAN
|
|---|
| 506 | port 5 :this special port represents the port where the
|
|---|
| 507 | router-board is connected to the switch
|
|---|
| 508 | * :one interface always need an asterisk behind port 5
|
|---|
| 509 | which means it is the default interface and gets all
|
|---|
| 510 | the packages with unknown tags.
|
|---|
| 511 | }}}
|
|---|
| 512 |
|
|---|
| 513 | == Static IP configuration ==
|
|---|
| 514 | As you can see in the VLAN example I configured three interfaces with static IP
|
|---|
| 515 | settings, so these are the commonly used options:
|
|---|
| 516 | {{{
|
|---|
| 517 | address :the IP address - required
|
|---|
| 518 | netmask :the netmask - required
|
|---|
| 519 | gateway :an IP address added as default gateway if present
|
|---|
| 520 | }}}
|
|---|
| 521 |
|
|---|
| 522 | == DHCP ==
|
|---|
| 523 | That's just as simple as:
|
|---|
| 524 | {{{
|
|---|
| 525 | auto eth0.1
|
|---|
| 526 | iface eth0.1 inet dhcp
|
|---|
| 527 | switch-ports 0 5
|
|---|
| 528 | }}}
|
|---|
| 529 | Typically this configures the WAN-Port to start a DHCP request on bootup.
|
|---|
| 530 |
|
|---|
| 531 | == Bridging ==
|
|---|
| 532 | This is mostly needed to combine LAN and WLAN to a homogeneous network like:
|
|---|
| 533 | {{{
|
|---|
| 534 | auto eth0.0
|
|---|
| 535 | iface eth0.0 inet manual
|
|---|
| 536 | switch-ports 1 2 3 4 5*
|
|---|
| 537 |
|
|---|
| 538 | auto eth1
|
|---|
| 539 | iface eth1 inet manual
|
|---|
| 540 | [... wifi-settings, see below ...]
|
|---|
| 541 |
|
|---|
| 542 | auto br0
|
|---|
| 543 | iface br0 inet static
|
|---|
| 544 | bridge-ifaces eth0.0 eth1
|
|---|
| 545 | address 192.168.1.1
|
|---|
| 546 | netmask 255.255.255.0
|
|---|
| 547 | }}}
|
|---|
| 548 | This creates a new bridging interface "br0" which combines the VLAN interface
|
|---|
| 549 | eth0.0 (representing the LAN-ports 1-4) and the WLAN interface "eth1" (on some
|
|---|
| 550 | devices like Asus WL500g or Linksys WRT54G v1.1 this might be eth2).
|
|---|
| 551 |
|
|---|
| 552 | == WLAN ==
|
|---|
| 553 | A router containing a WLAN interface has an additional ethernet device, which
|
|---|
| 554 | represents it. On Broadcom based hardware it is typically eth1 (Linksys) or eth2
|
|---|
| 555 | (Asus) (in the current driver version), on Madwifi devices it is ath0, ath1, etc.
|
|---|
| 556 | You can use these interfaces standalone or bridged with other devices, e.g. the
|
|---|
| 557 | internal LAN.
|
|---|
| 558 |
|
|---|
| 559 | === Basic Settings ===
|
|---|
| 560 |
|
|---|
| 561 | ^*^ with Option means mandatory, ^*^ with Parameter means default.
|
|---|
| 562 |
|
|---|
| 563 | || '''Option''' || '''Parameter''' || '''Description''' ||
|
|---|
| 564 | || type^*^ || broadcom || Broadcom based card ||
|
|---|
| 565 | || || atheros || Madwifi driver ||
|
|---|
| 566 | || mode^*^ || ap || Access point mode ||
|
|---|
| 567 | || || sta || Client mode ||
|
|---|
| 568 | || || adhoc || Ad-Hoc mode ||
|
|---|
| 569 | || || wds || WDS point-to-point link ||
|
|---|
| 570 | || || monitor || The node acts as a passive monitor and only
|
|---|
| 571 | receives packets ||
|
|---|
| 572 | || ssid^*^ || <String> || Set the SSID (Network Name) ||
|
|---|
| 573 | || country || {ALL|DE|JP|US|...} || The country code used to determine the
|
|---|
| 574 | regulatory settings. ||
|
|---|
| 575 |
|
|---|
| 576 | === Security Settings ===
|
|---|
| 577 |
|
|---|
| 578 | || '''Option''' || '''Parameter''' || '''Description''' ||
|
|---|
| 579 | || security^*^ || open || No authorization ||
|
|---|
| 580 | || || wep || WEP key ||
|
|---|
| 581 | || || wpa-psk || WPA with preshared key ||
|
|---|
| 582 | || || 8021x || IEEE 802.1X authentication ||
|
|---|
| 583 | || authorization^*^ || || '''wep''' ||
|
|---|
| 584 | || || open || Only Open System Authentication ||
|
|---|
| 585 | || || shared || Only Shared Key Authentication ||
|
|---|
| 586 | || || open+shared^*^ || Both Open System and Shared Key
|
|---|
| 587 | Authentication ||
|
|---|
| 588 | || || || '''wpa-psk''' ||
|
|---|
| 589 | || || psk || WPA PSK ||
|
|---|
| 590 | || || psk2 || WPA2 PSK ||
|
|---|
| 591 | || || psk psk2 || WPA PSK and WPA2 PSK ||
|
|---|
| 592 | || || || '''8021x''' ||
|
|---|
| 593 | || || open || Only Open System Authentication ||
|
|---|
| 594 | || || shared || Only Shared Key Authentication ||
|
|---|
| 595 | || || wpa || WPA with RADIUS ||
|
|---|
| 596 | || || wpa2 || WPA2 with RADIUS ||
|
|---|
| 597 | || || wpa wpa2 || WPA and WPA2 ||
|
|---|
| 598 | || encryption^*^ || || '''wep''' ||
|
|---|
| 599 | || || - || not needed, automatically by key size ||
|
|---|
| 600 | || || || '''wpa-psk''' ||
|
|---|
| 601 | || || tkip || RC4 encryption ||
|
|---|
| 602 | || || aes || AES encryption ||
|
|---|
| 603 | || || aes+tkip || support both ||
|
|---|
| 604 | || || || '''8021x''' ||
|
|---|
| 605 | || || wep || RC4 encryption (static) ||
|
|---|
| 606 | || || tkip || RC4 encryption ||
|
|---|
| 607 | || || aes || AES encryption ||
|
|---|
| 608 | || || aes+tkip || support both ||
|
|---|
| 609 | || eap-type || || '''8021x''' ||
|
|---|
| 610 | || || tls^*^ || Transport Layer Security ||
|
|---|
| 611 | || || ttls || Tunnelled TLS ||
|
|---|
| 612 | || || peap || Protected EAP ||
|
|---|
| 613 | || || leap || Cisco Wireless ||
|
|---|
| 614 | || key || || '''wep''' ||
|
|---|
| 615 | || || {1^*^|2|3|4} || Select WEP key to use. ||
|
|---|
| 616 | || key[1..4] || || '''wep''' ||
|
|---|
| 617 | || || <String> || WEP key. The key must be 5, 13 or 16 bytes
|
|---|
| 618 | long, or 10, 26, 32, or 64 hex digits long. The encryption algorithm is
|
|---|
| 619 | automatically selected based on the key size. key1 is the key for WEP client mode.
|
|---|
| 620 | ||
|
|---|
| 621 | || wpa-key || || '''wpa-psk''' ||
|
|---|
| 622 | || || <String> || Password to use with WPA/WPA2 PSK (at least
|
|---|
| 623 | 8, up to 63 chars) ||
|
|---|
| 624 | || wpa-gtk-rekey || || '''wpa-psk''', '''8021x''' ||
|
|---|
| 625 | || || <Int> (3600^*^) || Rekeying interval in seconds. ||
|
|---|
| 626 | || radius-ipaddr^*^ || || '''8021x''' ||
|
|---|
| 627 | || || <a.b.c.d> || IP to connect. ||
|
|---|
| 628 | || radius-port || || '''8021x''' ||
|
|---|
| 629 | || || <Int> (1812^*^) || RADIUS-Port# to connect ||
|
|---|
| 630 | || radius-key^*^ || || '''8021x''' ||
|
|---|
| 631 | || || <String> || Shared Secret for connection to the Radius
|
|---|
| 632 | server ||
|
|---|
| 633 |
|
|---|
| 634 | === MAC filter ===
|
|---|
| 635 |
|
|---|
| 636 | || '''Option''' || '''Parameter''' || '''Description''' ||
|
|---|
| 637 | || macmode || {0|1|2} || 0 - Disable MAC address matching. ||
|
|---|
| 638 | || || || 1 - Deny association to stations on the MAC
|
|---|
| 639 | list. ||
|
|---|
| 640 | || || || 2 - Allow association to stations on the MAC
|
|---|
| 641 | list. ||
|
|---|
| 642 | || maclist || <MAC1> ... <MACn> || List of space separated mac addresses to
|
|---|
| 643 | allow/deny according to ''macmode''. Addresses should be entered with colons,
|
|---|
| 644 | e.g.: "00:02:2D:08:E2:1D 00:03:3E:05:E1:1B". note that if you have more than one
|
|---|
| 645 | mac use quotes or only the first will be recognized. ||
|
|---|
| 646 |
|
|---|
| 647 | === Wireless Distribution System (WDS) / Repeater / Bridge ===
|
|---|
| 648 | || '''Option''' || '''Parameter''' || '''Description''' ||
|
|---|
| 649 | || lazywds || {0|1} || Accept WDS connections from anyone ||
|
|---|
| 650 | || wds || <MAC1> ... <MACn> || List of WDS peer mac addresses
|
|---|
| 651 | (xx:xx:xx:xx:xx:xx, space separated) ||
|
|---|
| 652 |
|
|---|
| 653 | === Miscellaneous ===
|
|---|
| 654 | || '''Option''' || '''Parameter''' || '''Description''' ||
|
|---|
| 655 | || channel || {1-14} || The wifi channel ||
|
|---|
| 656 | || maxassoc || {1-255} || Maximum number of associated clients ||
|
|---|
| 657 | || gmode || {LegacyB| Auto^*^| GOnly| BDeferred| Performance| LRS} || Set
|
|---|
| 658 | the 54g Mode ||
|
|---|
| 659 | || frameburst || {0^*^|1} || Disable/Enable frameburst mode. ||
|
|---|
| 660 | || txpower || {0-255|-1^*^} || Set the transmit power in dBm ||
|
|---|
| 661 | || rate || <Int> (-1^*^) || force a fixed rate ||
|
|---|
| 662 | || || || valid values for 802.11a are (6, 9, 12, 18,
|
|---|
| 663 | 24, 36, 48, 54) ||
|
|---|
| 664 | || || || valid values for 802.11b are (1, 2, 5.5, 11)
|
|---|
| 665 | ||
|
|---|
| 666 | || || || valid values for 802.11g are (1, 2, 5.5, 6,
|
|---|
| 667 | 9, 11, 12, 18, 24, 36, 48, 54) ||
|
|---|
| 668 | || || ||-1 means automatically determine the best
|
|---|
| 669 | rate ||
|
|---|
| 670 | || rts || {0-2347} || Set the RTS threshhold. ||
|
|---|
| 671 | || frag || {256-2346} || Set the fragmentation threshhold. ||
|
|---|
| 672 | || afterburner || {0^*^|1} || Enable Afterburner capability ||
|
|---|
| 673 | || isolate || {0^*^|1} || Hide Clients from each other ||
|
|---|
| 674 |
|
|---|
| 675 | === Examples ===
|
|---|
| 676 | WLAN with WEP128
|
|---|
| 677 | {{{
|
|---|
| 678 | iface eth1 inet static
|
|---|
| 679 | address 192.168.10.1
|
|---|
| 680 | netmask 255.255.255.0
|
|---|
| 681 | wireless-type broadcom
|
|---|
| 682 | wireless-country DE
|
|---|
| 683 | wireless-mode ap
|
|---|
| 684 | wireless-ssid FreeWRT
|
|---|
| 685 | wireless-security wep
|
|---|
| 686 | wireless-key1 11223344556677889900112233
|
|---|
| 687 | wireless-channel 11
|
|---|
| 688 | }}}
|
|---|
| 689 |
|
|---|
| 690 | WLAN without encryption
|
|---|
| 691 | {{{
|
|---|
| 692 | iface eth1 inet static
|
|---|
| 693 | address 192.168.10.1
|
|---|
| 694 | netmask 255.255.255.0
|
|---|
| 695 | wireless-type broadcom
|
|---|
| 696 | wireless-country DE
|
|---|
| 697 | wireless-mode ap
|
|---|
| 698 | wireless-ssid FreeWRT
|
|---|
| 699 | wireless-security open
|
|---|
| 700 | wireless-channel 11
|
|---|
| 701 | }}}
|
|---|
| 702 |
|
|---|
| 703 | WLAN with WPA2 (AES)
|
|---|
| 704 | {{{
|
|---|
| 705 | iface eth1 inet static
|
|---|
| 706 | address 192.168.10.1
|
|---|
| 707 | netmask 255.255.255.0
|
|---|
| 708 | wireless-type broadcom
|
|---|
| 709 | wireless-country DE
|
|---|
| 710 | wireless-mode ap
|
|---|
| 711 | wireless-ssid FreeWRT
|
|---|
| 712 | wireless-security wpa-psk
|
|---|
| 713 | wireless-authorization psk2
|
|---|
| 714 | wireless-encryption aes
|
|---|
| 715 | wireless-wpa-key 12345678
|
|---|
| 716 | wireless-channel 11
|
|---|
| 717 | }}}
|
|---|
| 718 |
|
|---|
| 719 | If you want to do MAC filtering, add the following to the sample above:
|
|---|
| 720 | {{{
|
|---|
| 721 | wireless-macmode 2
|
|---|
| 722 | wireless-mac 00:01:02:03:04:05 06:07:08:09:0a:0b
|
|---|
| 723 | }}}
|
|---|
| 724 | this enables the filter and defines the list to contain addresses that should be
|
|---|
| 725 | allowed.
|
|---|
| 726 |
|
|---|
| 727 | To enhanced wireless performance, you can enable some flags like Broadcom's
|
|---|
| 728 | SpeedBooster. Normally, these flags are not dangerous:
|
|---|
| 729 | {{{
|
|---|
| 730 | wireless-gmode performance
|
|---|
| 731 | wireless-frameburst 1
|
|---|
| 732 | wireless-afterburner 1
|
|---|
| 733 | }}}
|
|---|
| 734 |
|
|---|
| 735 | WLAN client with WPA2 (AES) (''untested'')
|
|---|
| 736 | {{{
|
|---|
| 737 | iface eth1 inet static
|
|---|
| 738 | address 192.168.10.1
|
|---|
| 739 | netmask 255.255.255.0
|
|---|
| 740 | wireless-type broadcom
|
|---|
| 741 | wireless-country DE
|
|---|
| 742 | wireless-mode sta
|
|---|
| 743 | wireless-ssid FreeWRT
|
|---|
| 744 | wireless-security wpa-psk
|
|---|
| 745 | wireless-authorization psk2
|
|---|
| 746 | wireless-encryption aes
|
|---|
| 747 | wireless-wpa-key 12345678
|
|---|
| 748 | }}}
|
|---|
| 749 |
|
|---|
| 750 | WLAN client with WEP128
|
|---|
| 751 | {{{
|
|---|
| 752 | iface eth1 inet dhcp
|
|---|
| 753 | wireless-type broadcom
|
|---|
| 754 | wireless-country DE
|
|---|
| 755 | wireless-mode sta
|
|---|
| 756 | wireless-ssid FreeWRT
|
|---|
| 757 | wireless-security wep
|
|---|
| 758 | wireless-key1 11223344556677889900112233
|
|---|
| 759 | }}}
|
|---|
| 760 |
|
|---|
| 761 | == PPP ==
|
|---|
| 762 | PPP comes in various flavours for different situations, the most commonly needed
|
|---|
| 763 | will be DSL I think and for WRT54G3G users UMTS. So we made a hook-script that
|
|---|
| 764 | evaluates a "use-template" option and generates a ppp-peer. This way everything
|
|---|
| 765 | needed so far can be configured within the "interfaces" file.
|
|---|
| 766 |
|
|---|
| 767 | === DSL ===
|
|---|
| 768 | {{{
|
|---|
| 769 | auto ppp0
|
|---|
| 770 | iface ppp0 inet ppp
|
|---|
| 771 | use-template dsl
|
|---|
| 772 | provider t-online
|
|---|
| 773 | ppp-username 0001201234563200123456#0001@t-online.de
|
|---|
| 774 | ppp-password fooBARfoo
|
|---|
| 775 | ppp-device eth0.1
|
|---|
| 776 | }}}
|
|---|
| 777 |
|
|---|
| 778 | Now your t-online dsl connection will be started on boot ("auto ppp0") and you can
|
|---|
| 779 | manually shut it down with "ifdown ppp0" or start it up with "ifup ppp0".
|
|---|
| 780 | The template "dsl" will configure a typical PPPoE peer for you.
|
|---|
| 781 |
|
|---|
| 782 | === UMTS ===
|
|---|
| 783 | Same footprint different template and some specific options. That all needed for
|
|---|
| 784 | an UMTS connection to Vodafone as it can be seen in this example.
|
|---|
| 785 | {{{
|
|---|
| 786 | iface ppp0 inet ppp
|
|---|
| 787 | use-template umts
|
|---|
| 788 | provider umts
|
|---|
| 789 | #ppp-username ""
|
|---|
| 790 | #ppp-password ""
|
|---|
| 791 | ppp-device /dev/noz0
|
|---|
| 792 | umts-apn web.vodafone.de
|
|---|
| 793 | umts-pincode 1234
|
|---|
| 794 | umts-mode umts_first
|
|---|
| 795 | }}}
|
|---|
| 796 | As you can see: unneeded options like "ppp-username" or "ppp-password" can just be
|
|---|
| 797 | removed or commented out. Don't leave them without a value as that causes a
|
|---|
| 798 | failure in "ipup". It does work if you give empty double quotes as value like "".
|
|---|
| 799 |
|
|---|
| 800 | Note that you have to set the correct APN, username and password for your
|
|---|
| 801 | provider!
|
|---|
| 802 |
|
|---|
| 803 | You may also remove the pin from your SIM-card and the configuration if you like.
|
|---|
| 804 |
|
|---|
| 805 | For Linksys WRT54G3G a package called "broadcom-watchbutton" will be installed,
|
|---|
| 806 | this is a small daemon that monitors the UMTS-button of the router and executes
|
|---|
| 807 | "ifup umts" or "ifdown umts" on a button press.
|
|---|
| 808 | You have to set "watchdog=YES" in /etc/rc.conf to have it start automagically.
|
|---|
| 809 |
|
|---|
| 810 | This is totally independent from the "auto umts" setting. Even if you start the
|
|---|
| 811 | connection on bootup you can shut it down again with a button press.
|
|---|
| 812 |
|
|---|
| 813 | == custom interface hooks ==
|
|---|
| 814 | === per interface ===
|
|---|
| 815 | You can execute various commands on interface startup or shutdown with special
|
|---|
| 816 | option:
|
|---|
| 817 | {{{
|
|---|
| 818 | iface foobar inet static
|
|---|
| 819 | [...]
|
|---|
| 820 | pre-up <command>
|
|---|
| 821 | up <command>
|
|---|
| 822 | up <command>
|
|---|
| 823 | down <command>
|
|---|
| 824 | post-down <command>
|
|---|
| 825 | }}}
|
|---|
| 826 |
|
|---|
| 827 | You can give each option multiple times and their commands will be executed in
|
|---|
| 828 | given order.
|
|---|
| 829 | {{{
|
|---|
| 830 | pre-up :before the interface will be started
|
|---|
| 831 | up :after the interface was started successfully
|
|---|
| 832 | down :before the interface goes down
|
|---|
| 833 | post-down :after the interface shut down
|
|---|
| 834 | }}}
|
|---|
| 835 |
|
|---|
| 836 | === general hooks ===
|
|---|
| 837 | Additionally you can write script executed for each interface if you put them in
|
|---|
| 838 | * /etc/network/if-pre-up.d
|
|---|
| 839 | * /etc/network/if-up.d
|
|---|
| 840 | * /etc/network/if-down.d
|
|---|
| 841 | * /etc/network/if-post-down.d
|
|---|
| 842 | Same semantics as above.
|
|---|
| 843 |
|
|---|
| 844 |
|
|---|
| 845 | == Package management ==
|
|---|
| 846 |
|
|---|
| 847 | == Troubleshooting ==
|
|---|
| 848 |
|
|---|
| 849 | === Failsafe mode ===
|
|---|
| 850 |
|
|---|
| 851 | Failsafe mode is very useful if you misconfigured your embedded system,
|
|---|
| 852 | so that you can not access it anymore. For example you disabled accidently
|
|---|
| 853 | secure shell or misconfigured the firewall, so that you can not login via
|
|---|
| 854 | secure shell.
|
|---|
| 855 |
|
|---|
| 856 | == How it works ==
|
|---|
| 857 |
|
|---|
| 858 | To get FreeWRT into failsafe mode you need physical access to the device and
|
|---|
| 859 | the failsafe utility. The failsafe utility is build inside our ADK and
|
|---|
| 860 | is available in the directory bin/ after a successful build.
|
|---|
| 861 |
|
|---|
| 862 | If you just want to compile the tool and not a complete firmware image,
|
|---|
| 863 | use following command:
|
|---|
| 864 | {{{
|
|---|
| 865 | $ make subdir=tools/failsafe install
|
|---|
| 866 | }}}
|
|---|
| 867 |
|
|---|
| 868 | For some operating systems we provide ready to go binaries of failsafe.
|
|---|
| 869 | Take a look at http://www.freewrt.org/downloads/tools/failsafe
|
|---|
| 870 |
|
|---|
| 871 | The tool just opens a network socket and waits for a special UDP packet
|
|---|
| 872 | from the embedded device. FreeWRT sends the UDP packet via the first
|
|---|
| 873 | recognized network interface (eth0).
|
|---|
| 874 |
|
|---|
| 875 | == Enable failsafe mode ==
|
|---|
| 876 |
|
|---|
| 877 | Connect your computer to the embedded system via direct or crossed network
|
|---|
| 878 | cable. Use the failsafe port, in most cases one of the LAN ports,
|
|---|
| 879 | see the device specific page for the exact network port.
|
|---|
| 880 |
|
|---|
| 881 | Configure your network interface to the IP address 192.168.1.2 with network
|
|---|
| 882 | mask 255.255.255.0. Now start the failsafe utility on your computer.
|
|---|
| 883 |
|
|---|
| 884 | {{{
|
|---|
| 885 | ./failsafe
|
|---|
| 886 | }}}
|
|---|
| 887 |
|
|---|
| 888 | After that startup your embedded system and wait for the following message in your
|
|---|
| 889 | failsafe application running on your computer:
|
|---|
| 890 | {{{
|
|---|
| 891 | Press reset now to enter Failsafe!
|
|---|
| 892 | }}}
|
|---|
| 893 |
|
|---|
| 894 | As soon as this message is displayed you should push the reset button of
|
|---|
| 895 | your embedded system. You have 2 seconds time to push the button. If you
|
|---|
| 896 | successfully enabled the failsafe mode, following message is displayed:
|
|---|
| 897 | {{{
|
|---|
| 898 | Entering Failsafe!
|
|---|
| 899 | }}}
|
|---|
| 900 |
|
|---|
| 901 | Now you should be able to login to your embedded system via a telnet
|
|---|
| 902 | application. Just use:
|
|---|
| 903 | {{{
|
|---|
| 904 | telnet 192.168.1.1
|
|---|
| 905 | }}}
|
|---|
| 906 |
|
|---|
| 907 | == Repair your FreeWRT configuration ==
|
|---|
| 908 |
|
|---|
| 909 | If you want to repair your configuration, you first need to
|
|---|
| 910 | mount the root filesystem via:
|
|---|
| 911 | {{{
|
|---|
| 912 | mount_root
|
|---|
| 913 | }}}
|
|---|
| 914 |
|
|---|
| 915 | After that you need to enable the FreeWRT configuration filesystem:
|
|---|
| 916 | {{{
|
|---|
| 917 | fwcf setup
|
|---|
| 918 | }}}
|
|---|
| 919 |
|
|---|
| 920 | Now you can change files in /etc and repair your broken configuration.
|
|---|
| 921 | Do not forget to commit your changes afterwards.
|
|---|
| 922 | {{{
|
|---|
| 923 | fwcf commit
|
|---|
| 924 | }}}
|
|---|
| 925 |
|
|---|
| 926 | If you want to start with the default /etc directory, just remove the fwcf
|
|---|
| 927 | partition content with following command:
|
|---|
| 928 | {{{
|
|---|
| 929 | mtd erase fwcf
|
|---|
| 930 | }}}
|
|---|
| 931 |
|
|---|
| 932 | Software reset/reboot does not work in failsafe, please disconnect the power cable
|
|---|
| 933 | to restart.
|
|---|
| 934 |
|
|---|
| 935 | == Serial console ==
|
|---|
| 936 |
|
|---|
| 937 | == JTAG ==
|
|---|
| 938 |
|
|---|
| 939 | == Restoring the original firmware ==
|
|---|
| 940 |
|
|---|
| 941 | Removing FreeWRT and restoring the original Firmware is very simple. Just transfer
|
|---|
| 942 | the original firmware image, which was downloaded before you installed FreeWRT to
|
|---|
| 943 | your embedded system, to your embedded system via secure copy (scp/pscp). See the
|
|---|
| 944 | following steps:
|
|---|
| 945 |
|
|---|
| 946 | * Transfer the manufacturers firmware image to the router. This can be done via
|
|---|
| 947 | * scp/pscp
|
|---|
| 948 | * For using scp do: scp <firmware-image-filename> admin@192.168.1.1:
|
|---|
| 949 | * Now login to your router via ssh and get root access.
|
|---|
| 950 | * Now write the firmware to the flash ROM by typing: mtd write -r
|
|---|
| 951 | * <firmware-image-filename> linux
|
|---|
| 952 | * Your router will reboot when the flash process is completed and the original
|
|---|
| 953 | * firmware has been restored.
|
|---|
| 954 |
|
|---|
| 955 | = Broadcom specific notes =
|
|---|
| 956 |
|
|---|
| 957 | === Drivers ===
|
|---|
| 958 |
|
|---|
| 959 | === NVRAM ===
|
|---|
| 960 |
|
|---|
| 961 | == Default settings ==
|
|---|
| 962 | On many router models, you can completly erase the NVRAM, some values will then
|
|---|
| 963 | reappear as default. This is often useful when you want to drop the relicts from
|
|---|
| 964 | the original firmware. Please look into the model docs to make sure its safe.
|
|---|
| 965 | {{{
|
|---|
| 966 | mtd -r erase nvram
|
|---|
| 967 | }}}
|
|---|
| 968 |
|
|---|
| 969 | == boot_wait ==
|
|---|
| 970 | On many router models (like Linksys), you can flash the router via tftp even in a
|
|---|
| 971 | special failsafe mode. To make sure the router will wait long enough for the tftp
|
|---|
| 972 | put command, set the special NVRAM parameter boot_wait
|
|---|
| 973 | {{{
|
|---|
| 974 | nvram set boot_wait=on
|
|---|
| 975 | nvram commit
|
|---|
| 976 | }}}
|
|---|
| 977 |
|
|---|
| 978 | = Firmware =
|
|---|
| 979 |
|
|---|
| 980 | == Flashing via TFTP ==
|
|---|
| 981 | You have to set the router in failsafe mode (often done by holding the reset
|
|---|
| 982 | button when switching the router on), then you can upload the image. On most
|
|---|
| 983 | routers, the default ip address is 192.168.1.1, unfortunately, Asus routers uses
|
|---|
| 984 | the ip address saved in nvram.
|
|---|
| 985 | {{{
|
|---|
| 986 | tftp 192.168.1.1
|
|---|
| 987 | tftp> binary
|
|---|
| 988 | tftp> trace
|
|---|
| 989 | tftp> rexmt 1
|
|---|
| 990 | tftp> put <image.bin>
|
|---|
| 991 | }}}
|
|---|
| 992 |
|
|---|
| 993 | or from Windows:
|
|---|
| 994 | {{{
|
|---|
| 995 | tftp -i 192.168.1.1 put <image.bin>
|
|---|
| 996 | }}}
|
|---|
| 997 |
|
|---|
| 998 | == Flashing via mtd ==
|
|---|
| 999 |
|
|---|
| 1000 | If you have direct access to the router, you can use mtd to flash the firmware
|
|---|
| 1001 | locally. Copy the bin file via scp to the router (to /tmp memory filesystem) and
|
|---|
| 1002 | execute:
|
|---|
| 1003 | {{{
|
|---|
| 1004 | mtd -r write <image.bin> linux
|
|---|
| 1005 | }}}
|
|---|
| 1006 |
|
|---|
| 1007 | If you update from older FreeWRT installations and you want to remove your changes
|
|---|
| 1008 | to /etc, use:
|
|---|
| 1009 | {{{
|
|---|
| 1010 | mtd -e fwcf -r write <image.bin> linux
|
|---|
| 1011 | }}}
|
|---|
| 1012 |
|
|---|
| 1013 | The mtd application automatically convert bin to trx, so that a manual convert via
|
|---|
| 1014 | dd is not necessary.
|
|---|
| 1015 |
|
|---|