05
2023
09
21:24:13

openwrt环境搭建、编译以及版本说明



推荐点击下面图片,通过本站淘宝优惠价购买:

image.png

openwrt环境搭建比较简单,没有太多复杂的东西,只要安装好相应的依赖库然后编译就可以,遇到相应的问题就直接解决。这里需要提到的一点MTK官方维护的固件是比较多编译问题的。

一、ubuntu版本问题

ubuntu版本要求,如果编译的是MTK官方固件,建议不要太高版本的,因为版本太高,编译不通过,笔者曾经尝试不同版本的,基本上ubuntu16编译没什么太大的问题,如果是18版本或者是更高版本,同样的固件是编译不通过的。如果你使用的是网上开源的代码,那最新版本是没什么问题的,低版本可能会缺少相应的库,安装即可,尤其是要求python是3.0版本以上的。

二、编译出错细节处理

1、错误

freadahead.c: In function 'freadahead':freadahead.c:64:3: error: #error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread on your system, then report this to bug-gnulib."#error "Please port gnulib freadahead.c to your platform! Look at the definition of fflush, fread on your system, then report this to bug-gnulib."


解决:

cd build_dir/host/m4-1.4.17/sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.cecho "#define _IO_IN_BAXKUP 0x100">>lib/stdio-impl.h

2、提示没有help2man,可以按照提示的网站去搜索官网下载相应的库(我的是从官网上下载最新的安装包)

(help2man-1.49.2.tar这是我只能装的版本)

也可以用以下命令:

wget https://mirrors.sjtug.sjtu.edu.cn/gnu/help2man/help2man-1.47.9.tar.xzxz -d help2man-1.47.9.tar.xztar -xvf help2man-1.47.9.tar./configure --prefix=/usr/localmakesudo make install

3、遇到xxx文件deny,需要开启权限,可以给最高权限编译就不报错

4、错误

fatal: unable to access 'https://git.openwrt.org/openwrt/openwrt.git/': server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none


解决:

git config --global http.sslVerify "false"

5、错误

perl: warning: Setting locale failed.perl: warning: Please check that your locale settings:LANGUAGE = "zh_CN:zh",LC_ALL = (unset),LANG = "zh_CN.UTF-8"are supported and installed on your system.

解决:在~/.bashrc中添加一句话

export LC_ALL=C,然后source ~/.bashrc 就行了

6、编译其他问题可以参考该链接去解决:blog.csdn.net/kuangzuxi

三、关于编译

依赖库安装:

sudo apt-get updatesudo apt-get install git g++ make libncurses5-dev subversion libssl-dev gawk libxml-parser-perl unzip wget python xz-utils vim zlibc zlib1g zlib1g-dev openjdk-8-jdk build-essential ccache gettext xsltproc

资源更新:

./scripts/feeds update -a./scripts/feeds install -a

关于这两个命令,是在相应的文件夹下的脚本文件,执行这两条命令就可以更新和下载该版本代码的最新资源。

编译命令:

make V=99

或make V=s -jx (x代表数字,数字是几就代表用几核编译),第一次变异要的时间比较长,可以多核编译,出现问题的时候采用单核编译,就可以知道具体是什么问题了。



图中就是编译成功的界面,我采用的是四核编译。


本文链接:https://www.hqyman.cn/post/4381.html 非本站原创文章欢迎转载,原创文章需保留本站地址!

分享到:





休息一下,本站随机推荐观看栏目:


« 上一篇 下一篇 »

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

您的IP地址是: