安装OpenWrt(通用)

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

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安装在一个设备上:

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

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

正是为了便于这方面,即更新固件, 绝大多的(不是所有)bootloader 里面内置了这种更新固件的功能. 有的内置 TFTP-client, 别的有 TFTP-server, 还有FTP-client 和 甚至于有 FTP-server. 你需要了解的有:

  • bootloader的预设IP地址 (启动到系统后的ip和BL的ip不一定相同哦!)
  • 使用的是以上那种协议
  • bootloader是做客户端还是服务端
  • 预设服务的端口号, 若不是 default
  • 接口要连上
  • 可能需要用户名和密码进行登录
  • 了解设备启动后连接的时间点是很有用的, 比如:要在设备上电的1-5秒内连接,否者设备会启动进入系统

一旦你明白了上面的参数,你就可以接着一下操作:

  1. 在你的电脑上安装相应的软件 (即在本案中bootloader内置了FTP-server,你就需要准备FTP连接软件了)
  2. 阅读该软甲你的手册! 比如 man tftp, man tftpd, man ftp, man ncftp, man ftpd, man pure-ftpd 或者 ..
  3. 给你的电脑设置一个与bootloader相同网段的静态ip
  4. 用正确的端口连接你的电脑
  5. 通电
  1. 与bootloader取得连接
  2. 按具体情况用openwrt固件来覆盖原来的固件
  3. 不要改掉或写到bootloader 直到明确指示这样做!(不然就就得到一块高价板砖了)

注意: 有时候bootloader会不让你刷非原厂的固件, 比如 t Inventel DV4210 (AKA Livebox)
时间点: 为了能上准时间点, 连接主机与路由直接要快. 要做到尽可能的快, 你可能需要关掉你网卡的连接速率自动协商功能(也就是开着双工100mbps啥的)尤其要 关掉媒体感知功能 在你的系统上面.

具体的操作

port.jtag

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!

Concrete examples: wnr2000, ...

Don't forget to consult the other Generic Basic Howtos for OpenWrt

This checklist cannot and does not completely cover all the ways you can install OpenWrt.

Pre-Installation

Installation

  • Reboot router.
  • Download OpenWrt image in proper location.
    • In case of upgrading existing OpenWrt system, the proper location is RAM (usually /tmp).
  • Verify MD5 checksum of the OpenWrt image you downloaded.
  • Make sure that there is at least as much free RAM as the size of OpenWrt image you have downloaded.

Post-Installation

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
  • Last modified: 2022/12/26 11:15
  • by heybrowhatsup