Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
zh-cn:doc:howto:generic.flashing [2015/05/06 10:55] – fix link theoradicuszh-cn:doc:howto:generic.flashing [2018/03/03 20:24] – ↷ Links adapted because of a move operation
Line 1: Line 1:
 +====== 安装OpenWrt(通用) ======
 +安装OpenWrt的方法往往是依设备本身而定的。在这个wiki页面[[toh:start]]的设备页面,你可以找到针对你的设备的详细方法。如果你在那里一无所获,那么你需要看看本篇文章。当然你先要看看这个[[docs:techref:flash.layout]]。
 +
 +{{page>meta:infobox:dangerous&noheader&nofooter&noeditbtn}}
 +
 +:!: 如果你在安装OpenWrt的时候失败了,那么[[docs:user-guide:troubleshooting:generic.debrick|变砖修复]]可以帮助你。
 +
 +:!: 本篇说明是非常泛泛而言的,你不能只是照本宣科地照着做,你必须根据你的硬件来做出相应的调整。
 +
 +通常来说,你有三种选择:
 +  * **''选择_1:''** 把OpenWrt装进路由器的非易失内存,也就是ROM上//这个页面//
 +  * **''选择_2:''** 把OpenWrt装进RAM中:
 +  * **''选择_3:''** 通过网络:[[inbox:howto:netboot|Netbooting]]来引导进入OpenWrt,这个方法并不被所有[[docs:techref:bootloader|bootloaders]]支持
 +
 +===== 四种方法 =====
 +有四种方法可以把OpenWrt安装在一个设备上:
 +
 +==== 1. 通过原始固件 ====
 +通过你的浏览器打开//原始固件//的管理页面,然后通过使用//"固件升级"//选项安装OpenWrt固件。搞定。
 +
 +**''注意:''** 一些时候原始固件的升级功能包含一些确定你没有刷入错误固件文件的校验功能,如果存在这个功能,他会阻止你通过这种方式安装OpenWrt。
 +
 +
 +==== 2. 通过Bootloader和网口 ====
 +正是为了便于这方面,即更新固件, 绝大多的(不是所有)[[docs:techref:bootloader]] 里面内置了这种更新固件的功能. 有的内置 [[wp>Trivial File Transfer Protocol|TFTP]]-client, 别的有 TFTP-server, 还有[[wp>File Transfer Protocol|FTP]]-client 和 甚至于有 FTP-server. 你需要了解的有:
 +
 +  * bootloader的预设IP地址 (启动到系统后的ip和BL的ip不一定相同哦!)
 +  * 使用的是以上那种协议
 +  * bootloader是做客户端还是服务端
 +  * 预设服务的端口号, 若不是 [[wp>List of TCP and UDP port numbers|default]]
 +  * 接口要连上
 +  * 可能需要用户名和密码进行登录
 +  * 了解设备启动后连接的**时间点**是很有用的, 比如:要在设备上电的1-5秒内连接,否者设备会启动进入系统
 +
 +一旦你明白了上面的参数,你就可以接着一下操作:
 +  - 在你的电脑上安装相应的软件 (即在本案中bootloader内置了FTP-server,你就需要准备FTP连接软件了)
 +  - 阅读该软甲你的手册! 比如 ''[[http://linux.die.net/man/1/tftp|man tftp]]'', ''[[http://linux.die.net/man/8/tftpd|man tftpd]]'', ''[[http://linux.die.net/man/1/ftp|man ftp]]'', ''[[http://linux.die.net/man/1/ncftp|man ncftp]]'', ''[[http://linux.die.net/man/8/ftpd|man ftpd]]'', ''[[http://linux.die.net/man/8/pure-ftpd|man pure-ftpd]]'' 或者 ..
 +  - 给你的电脑设置一个与bootloader相同网段的静态ip
 +  - 用正确的端口连接你的电脑
 +  - 通电
 +
 +  - 与bootloader取得连接
 +  - 按具体情况用openwrt固件来覆盖原来的固件
 +  - **<color red>不要改掉或写到bootloader</color>** 直到明确指示这样做!(不然就就得到一块高价板砖了)
 +
 +**''注意:''** 有时候bootloader会不让你刷非原厂的固件, 比如 t [[toh/inventel/dv4210|Inventel DV4210 (AKA Livebox)]]\\
 +**''时间点:''** 为了能上准时间点, 连接主机与路由直接要快. 要做到尽可能的快, 你可能需要关掉你网卡的连接速率自动协商功能(也就是开着双工100mbps啥的)尤其要 [[http://support.microsoft.com/kb/239924|关掉媒体感知功能]] 在你的系统上面.
 +
 +
 +=== 具体的操作 ===
 +  * -> [[docs:guide-user:installation:generic.flashing.tftp]]
 +  * -> [[docs:guide-user:installation:generic.flashing.ftp]]
 +  * -> [[docs:guide-user:installation:generic.flashing.xmodem]]
 +
 +==== 3. via Bootloader and Serial port ====
 +  * -> [[docs:guide-user:installation:generic.flashing.serial]]
 +
 +==== 4. via JTAG ====
 +-> [[docs:hardware: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.
 +
 +  - specifically select the RAMDISK option to make OpenWrt Buildroot create a ramdisk-image for you to upload
 +  - 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.
 +  - 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.
 +  - set your computer's ethernet port to use the IP address ''192.168.0.10/24''
 +  - 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.
 +  - 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:
 +    * <code bash>
 +./wndr3700 openwrt-ar71xx-uImage-lzma.bin openwrt-fixed.out
 +</code>
 +  - 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):
 +  - enter the following into the serial console:<code bash>
 +setenv ipaddr 192.168.0.1
 +setenv serverip 192.168.0.10
 +setenv bootargs 'board=WNDR3700'
 +tftpboot 80800000 openwrt-fixed.out
 +bootm
 +</code>(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!)
 +  - The system should boot!
 +
 +----
 +
 +
 +===== After installation of OpenWrt =====
 +==== Back to original firmware ====
 +-> [[docs:guide-user:installation:generic.uninstall]]
 +
 +==== OpenWrt Sysupgrade ====
 +-> [[docs:guide-user:installation:generic.sysupgrade]]
 +
 +==== OpenWrt Failsafe ====
 +-> [[docs:user-guide:troubleshooting:failsafe_and_factory_reset]]
  
  • Last modified: 2022/12/26 11:15
  • by heybrowhatsup