安装OpenWrt(通用)

安装OpenWrt的方法往往是依设备本身而定的。在这个wiki页面start的设备页面,你可以找到针对你的设备的详细方法。如果你在那里一无所获,那么你需要看看本篇文章。当然你先要看看这个Flash Layout

Warning!
This section describes actions that might damage your device or firmware. Proceed with care!

:!: 如果你在安装OpenWrt的时候失败了,那么变砖修复可以帮助你。

:!: 本篇说明是非常泛泛而言的,你不能只是照本宣科地照着做,你必须根据你的硬件来做出相应的调整。

通常来说,你有三种选择:

  • 选择_1: 把OpenWrt装进路由器的非易失内存,也就是ROM上这个页面
  • 选择_2: 把OpenWrt装进RAM中:
  • 选择_3: 通过网络:Netbooting来引导进入OpenWrt,这个方法并不被所有bootloaders支持

四种方法

有四种方法可以把OpenWrt安装在一个设备上:

1. 通过原始固件

通过你的浏览器打开原始固件的管理页面,然后通过使用"固件升级"选项安装OpenWrt固件。搞定。

注意: 一些时候原始固件的升级功能包含一些确定你没有刷入错误固件文件的校验功能,如果存在这个功能,他会阻止你通过这种方式安装OpenWrt。

2. 通过以太网接口和Bootloader

To facilitate exactly this, namely to allow flashing of a firmware, most if not all bootloaders contain a build-in functionality for this purpose. Some contain a TFTP-client, others a TFTP-server, others a FTP-client and some even a FTP-server. You need to know:

  • the preset IP address in the bootloader (this is not necessarily the same IP address the device has after it has booted the original firmware!)
  • which of the above protocols is used
  • whether the bootloader acts as client or as server
  • the preset port number for the service, if not default
  • the interface you need to connect to
  • possibly a user name and a password to login
  • it is useful to know the time window you have after starting the device to obtain a connection to it, e.g. a 1 sec time windows 5 sec after start

Once you know all of the above parameters, you may proceed:

  1. install the corresponding software on your PC (i.e. in case the bootloader contains a FTP-server, you need a FTP-client)
  2. read the manual pages for that software! e.g. man tftp, man tftpd, man ftp, man ncftp, man ftpd, man pure-ftpd or ..
  3. give your PC a static IP address in the same network as pre-configured in the bootloader
  4. connect your PC with the correct port
  5. power cycle the device
  1. obtain a connection to the bootloader
  2. follow specific procedures to overwrite original firmware with OpenWrt firmware file
  3. Do not overwrite or alter the bootloader until explicitly instructed to do so!

NOTE: Sometimes even the bootloader prevents you from flashing a non-OEM firmware, e.g. the Inventel DV4210 (AKA Livebox)
Time window: To be able to use the entire time window, the connection between host and router needs to be established quickly. To make this as quick possible, you could disable auto-negotiation of your NIC and especially disable media sensing of your OS.

Specific Howtos

3. via Bootloader and Serial port

4. via JTAG

port.jtag


5. install a ramdisk-image into main memory

This step shows you howto upload a new ramdisk image to the device. The existing firmware on the flash remains unchanged! You require a working serial cable to do the ramdisk upload.

  1. specifically select the RAMDISK option to make OpenWrt Buildroot create a ramdisk-image for you to upload
  2. connect an ethernet cable between your computer and one of the LAN ports (doesn't matter which, just so long as it's not the WAN port) of the WNDR3700.
  3. connect your serial cable to the header on the WNDR3700 and set your local terminal program (eg. minicom) to
    • 115200 bps 8N1
    • no software flow control
    • no hardware flow control.
  4. set your computer's ethernet port to use the IP address 192.168.0.10/24
  5. set up a TFTP server on your local computer to respond to requests on the 192.168.0.10 interface. Make sure that the ramdisk image (openwrt-ar71xx-uImage-lzma.bin) is in the directory used by the TFTP server.
  6. Fix the header for the ramdisk image so that it's recognized by the u-Boot firmware. Use the wndr3700.c program that was posted by *aorlinsk* on the forums here http://aorlinsk2.free.fr/openwrt/wndr3700/ and run it from the TFTP server's data directory. I've also reproduced the code here just in case:
    • ./wndr3700 openwrt-ar71xx-uImage-lzma.bin openwrt-fixed.out
  7. power up the board. When it gets to the message asking you to press any key to interrupt the normal bootup sequence, press a key on the serial console (or just hold down the enter key from first bootup until you get to a prompt):
  8. enter the following into the serial console:
    setenv ipaddr 192.168.0.1
    setenv serverip 192.168.0.10
    setenv bootargs 'board=WNDR3700'
    tftpboot 80800000 openwrt-fixed.out
    bootm
    (if you forget the bootargs piece below, the board will boot and look normal, but it won't be able to bring up any of the network interfaces!)
  9. The system should boot!

After installation of OpenWrt

Back to original firmware

OpenWrt Sysupgrade

OpenWrt Failsafe

Back to top

zh-cn/doc/howto/generic.flashing.txt · Last modified: 2012/01/06 10:03 by turygo