0%

编译OpenWRT(非官方版)

编译环境

  • Ubuntu 12.04 32bit
  • Windows Subsystem for Linux

项目源码

项目源码托管在GitHub上,地址如下:**openwrt-hc5x61**。

本项目不是官方支持的OpenWRT,因此OpenWRT版本比较旧,有较大的差别。

本项目使用的是极路由的极路由2路由器。

前提工作

  1. 必装工具(仅限Debian和Ubuntu)
    1
    sudo apt-get install build-essential git subversion wget flex gettext libncurses5-dev unzip gawk liblzma-dev zlib1g-dev ccache u-boot-tools
  2. Checkout项目代码
    1
    git clone https://github.com/rssnsj/openwrt-hc5x61.git

    编译

    注意:建议国内用户在编译过程中全程翻墙,因为会从国外下载一些额外的软件包。推荐使用proxychains,具体使用方法,请自行Google
    1
    2
    3
    4
    5
    6
    7
    cd openwrt-hc5x61
    # 将hc5761(极2)设置为编译目标对象
    ln -s ./config-hiwifi-hc5761 ./config-hiwifi
    # 可自定义自己需要的额外功能
    make menuconfig
    # 编译
    make
    编译成功后,目标文件在openwrt-ramips/bin/ramips/openwrt-ramips-mt7620a-hc5761-squashfs-sysupgrade.bin

注意1:
编译过程中,会有一些组件下载失败,手动下载同名的文件放到openwrt-ramips/dl下面,再执行make继续编译。
注意2:
pdnsd组件原项目地址已经失效,请单独下载,注意切换分支。
文件名为:pdnsd-1.2.9a-par-a8e46ccba7b0fa2230d6c42ab6dcd92926f6c21d.tar.gz
commit Hash:a8e46ccba7b0fa2230d6c42ab6dcd92926f6c21d

刷机

FTP

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# 登录路由器(IP地址是路由器地址)
ssh root@192.168.199.1
cd /tmp

# 替换U-boot以防止万一刷砖无法直接tftp刷root固件
# 已经替换的可以忽略,以极2为例,其他请参考项目文档
wget http://rssn.cn/roms/uboot/HC5761-uboot.bin
mtd write HC5761-uboot.bin u-boot

# 下载固件
# 可以通过FTP等方式,将刚刚生成的文件放到/tmp文件夹下

# 刷机
sysupgrade -F -n openwrt-ramips-mt7620a-hc5761-squashfs-sysupgrade.bin