MT7688路由器 openwrt编译笔记

Openwrt:19.07.4

路由器平台:MT7688

代码下载:

git clone git://git.openwrt.org/openwrt.git

或者更快的下载如下:

git clone https://gitee.com/mirrors/openwrt.git

查看README.md,查看编译说明


执行 ./scripts/feeds update -a

错误1:
Build dependency: Please install GNU 'awk'

Prerequisite check failed. Use FORCE=1 to override.
make: *** [/home/lgcdb/openwrt/openwrt/include/toplevel.mk:185: staging_dir/host/.prereq-build] Error 1
awk: include/scan.awk: line 21: function asort never defined
awk: include/scan.awk: line 21: function asort never defined
Collecting package info: done
awk: include/scan.awk: line 21: function asort never defined
awk: include/scan.awk: line 21: function asort never defined
Collecting target info: done

解决:

sudo apt-get install gawk

重新执行 ./scripts/feeds update -a


执行./scripts/feeds install -a

执行make menuconfig

Target System (xxxxxxx)  --->

选择MediaTek Ralink MIPS

Subtarget (xxxxxxxxxxx)  --->

选择MT76x8 based boards


执行sudo make -j1 V=s

编译并查看详细信息

错误2:

make[3]: Entering directory '/home/lgcdb/openwrt/openwrt/toolchain/kernel-headers'
mkdir -p /home/lgcdb/openwrt/openwrt/dl
SHELL= flock /home/lgcdb/openwrt/openwrt/tmp/.linux-5.4.63.tar.xz.flock -c '  	/home/lgcdb/openwrt/openwrt/scripts/download.pl "/home/lgcdb/openwrt/openwrt/dl" "linux-5.4.63.tar.xz" "e0260dae0da01163b1a3289ad9c5cc6ee4226720e199e8a1d982e24efda7ffc0" "" "@KERNEL/linux/kernel/v5.x"    '
Can't exec "curl": No such file or directory at /home/lgcdb/openwrt/openwrt/scripts/download.pl line 77.
+ wget --tries=5 --timeout=20 --no-check-certificate --output-document=- https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.4.63.tar.xz
--2020-09-10 14:49:36--  https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.4.63.tar.xz
Resolving cdn.kernel.org (cdn.kernel.org)... 151.101.9.176, 2a04:4e42:2::432
Connecting to cdn.kernel.org (cdn.kernel.org)|151.101.9.176|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 109583360 (105M) [application/x-xz]
Saving to: 'STDOUT'

-                               0%[                                                  ]  34.81K  8.60KB/s    in 4.0s    

2020-09-10 14:50:14 (8.60 KB/s) - Read error at byte 35646/109583360 (Resource temporarily unavailable, try again.). Retrying.

--2020-09-10 14:50:15--  (try: 2)  https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.4.63.tar.xz
Connecting to cdn.kernel.org (cdn.kernel.org)|151.101.9.176|:443... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 109583360 (105M), 109547714 (104M) remaining [application/x-xz]
Saving to: 'STDOUT'

-                               0%[                                                  ]  54.89K  2.13KB/s    in 15s     

2020-09-10 14:50:51 (1.30 KB/s) - Read error at byte 56211/109583360 (Resource temporarily unavailable, try again.). Retrying.

--2020-09-10 14:50:53--  (try: 3)  https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.4.63.tar.xz
Connecting to cdn.kernel.org (cdn.kernel.org)|151.101.9.176|:443... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 109583360 (105M), 109527149 (104M) remaining [application/x-xz]
Saving to: 'STDOUT'

-                               0%[                                                  ] 116.48K  1.91KB/s    in 32s     

2020-09-10 14:51:48 (1.91 KB/s) - Read error at byte 119277/109583360 (Resource temporarily unavailable, try again.). Retrying.

--2020-09-10 14:51:51--  (try: 4)  https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.4.63.tar.xz
Connecting to cdn.kernel.org (cdn.kernel.org)|151.101.9.176|:443... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 109583360 (105M), 109464083 (104M) remaining [application/x-xz]
Saving to: 'STDOUT'

-                               3%[>                                                 ]   3.51M  11.2KB/s    eta 1h 58m ^Cmake[3]: *** [Makefile:105: /home/lgcdb/openwrt/openwrt/dl/linux-5.4.63.tar.xz] Interrupt
time: toolchain/kernel-headers/compile#0.01#0.02#378.13
make[1]: *** [toolchain/Makefile:96: /home/lgcdb/openwrt/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/stamp/.toolchain_compile] Interrupt
make: *** [/home/lgcdb/openwrt/openwrt/include/toplevel.mk:235: world] Interrupt

解决:

linux内核代码一直下载失败,手动通过迅雷下载linux-5.4.63.tar.xz内核,放到openwrt/dl目录下。并删除linux-5.4.63.tar.xz.****后缀的其他文件。

这里的错误提示需要安装curl, 执行sudo apt-get install curl

但能自己下载内核,速度会快点。


错误3:

  INSTALL /home/lgcdb/openwrt/openwrt/build_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/linux-dev//include
/bin/sh: 1: rsync: not found
make[4]: *** [Makefile:1212: headers_install] Error 127
make[4]: Leaving directory '/home/lgcdb/openwrt/openwrt/build_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/linux-5.4.63'
make[3]: *** [Makefile:108: /home/lgcdb/openwrt/openwrt/build_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/linux-5.4.63/.configured] Error 2
make[3]: Leaving directory '/home/lgcdb/openwrt/openwrt/toolchain/kernel-headers'
time: toolchain/kernel-headers/compile#24.82#11.44#32.46
make[2]: *** [toolchain/Makefile:100: toolchain/kernel-headers/compile] Error 2
make[2]: Leaving directory '/home/lgcdb/openwrt/openwrt'
make[1]: *** [toolchain/Makefile:96: /home/lgcdb/openwrt/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/stamp/.toolchain_compile] Error 2
make[1]: Leaving directory '/home/lgcdb/openwrt/openwrt'
make: *** [/home/lgcdb/openwrt/openwrt/include/toplevel.mk:235: world] Error 2
解决:

执行sudo apt-get install rsync


错误4:

[mktplinkfw2] *** error: kernel image is too big
make[5]: *** [Makefile:231: /home/lgcdb/openwrt/openwrt/build_dir/target-mipsel_24kc_musl/linux-ramips_mt76x8/tmp/openwrt-ramips-mt76x8-tplink_tl-wr840n-v5-initramfs-kernel.bin] Error 255
make[5]: Leaving directory '/home/lgcdb/openwrt/openwrt/target/linux/ramips/image'
make[4]: *** [Makefile:25: install] Error 2
make[4]: Leaving directory '/home/lgcdb/openwrt/openwrt/target/linux/ramips'
make[3]: *** [Makefile:13: install] Error 2
make[3]: Leaving directory '/home/lgcdb/openwrt/openwrt/target/linux'
time: target/linux/install#840.53#74.53#890.03
make[2]: *** [target/Makefile:25: target/linux/install] Error 2
make[2]: Leaving directory '/home/lgcdb/openwrt/openwrt'
make[1]: *** [target/Makefile:19: /home/lgcdb/openwrt/openwrt/staging_dir/target-mipsel_24kc_musl/stamp/.target_install] Error 2
make[1]: Leaving directory '/home/lgcdb/openwrt/openwrt'
make: *** [/home/lgcdb/openwrt/openwrt/include/toplevel.mk:235: world] Error 2


解决:

执行make menuconfig

Target Profile (xxxxxxxxxxxxxx)  --->

选择:MediaTek MT7628 EVB

继续编译。


编译完成之后,在openwrt/bin/targets/ramips/mt76x8中可以发现有很多的.bin文件,这些都是编译好的固件。尝试选择

openwrt-ramips-mt76x8-mediatek_mt7628an-eval-board-squashfs-sysupgrade.bin

烧录到板子上,打开如下画面:

BusyBox v1.31.1 () built-in shell (ash)

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt SNAPSHOT, r14431-f58d323534
 -----------------------------------------------------
=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------

说明已经成功把openwrt在MT7688运行起来了。

  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值