当前位置: 首页 - 编程技术 - 文章正文

编译 openwrt 及初始配置-及部分排错

xiaoqihv

主机为 ubuntu 14 x64 硬件: 优酷土豆宝 cpuMT7620A,内存128M,flash 32M 有2个源,用哪个也可以 git clone https://github.com/openwrt/openwrt.git git clone https://git.openwrt.org/openwrt/openwrt.git

安装的插件 gcc, binutils, bzip2, flex, python, perl, make, find, grep, diff, unzip, gawk, getopt, subversion, libz-dev

gcc 要求 4.8 以上

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

配置 make menuconfig

选择 mtk7620

Target System (MediaTek Ralink MIPS) Subtarget (MT7620 based boards) Target Profile (YOUKU YK1)

make -j 4 编译看不到编译信息

make V=99 -j 4 加上 V=99 参数看到具体信息,是下载不了,还是什么的错误 一共下载了2天时间。有的包还是手动下的。

编译以后全部文件有10个G 。

在路由器后台直接升级  squashfs-sysupgrade.bin 就可以了

需要装上界面

opkg update opkg install luci /etc/init.d/uhttpd enable /etc/init.d/uhttpd start

更新 openwrt 19 2019-12-24

build_dir/hostpkg/libubox-2019-11-24-07413cce/json_script.c:124:3: error: missing initializer for field 'name' of 'struct blobmsg_policy' [-Werror=missing-field-initializers]

修改

/build_dir/hostpkg/libubox-2019-11-24-07413cce/CMakeLists.txt

-Werror 去掉即可,原因:存在 warning 当错误,导致编译不过。

更新 openwrt 19 2021-01-16

build_dir/hostpkg/expat-2.2.10/lib/xmlparse.c:109:4: error: #error You do not have support for any sources of high quality entropy enabled. For end user security, that is probably not what you want. Your options include: * Linux >=3.17 + glibc >=2.25 (getrandom): HAVE_GETRANDOM, * Linux >=3.17 + glibc (including <2.25) (syscall SYS_getrandom): HAVE_SYSCALL_GETRANDOM, * BSD / macOS >=10.7 (arc4random_buf): HAVE_ARC4RANDOM_BUF, * BSD / macOS (including <10.7) (arc4random): HAVE_ARC4RANDOM, * libbsd (arc4random_buf): HAVE_ARC4RANDOM_BUF + HAVE_LIBBSD, * libbsd (arc4random): HAVE_ARC4RANDOM + HAVE_LIBBSD, * Linux (including <3.17) / BSD / macOS (including <10.7) (/dev/urandom): XML_DEV_URANDOM, * Windows >=Vista (rand_s): _WIN32. If insist on not using any of these, bypass this error by defining XML_POOR_ENTROPY; you have been warned. If you have reasons to patch this detection code away or need changes to the build system, please open a bug. Thank you! # error You do not have support for any sources of high quality entropy \

去掉这个宏检查。 

更新 openwrt 21 2021-10-24 

错误1:

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

新的 ca curl  不认识。

解决方法:

export GIT_SSL_NO_VERIFY=1

或者 

sudo apt-get update sudo apt-get install ca-certificates

错误2

Build dependency: Please install the GNU C Compiler (gcc) 6 or later Build dependency: Please install the GNU C++ Compiler (g++) 6 or later Build dependency: Please install Python >= 3.6 Build dependency: Please install Python >= 3.6 Build dependency: Please install the Python3 distutils module

不能在使用 ubuntu 16.0.4 编译了,改用 ubuntu 20.0.4  可以正常编译

================

其他的错误。

编译的lean的,网件4300v1,4.14内核,10.1正常编译,后来更新的就一直报错,恢复以前备份虚拟机文件还是一样错误,麻烦给看看 checking whether mknod can create fifo without root privileges... configure: error: in `/root/lede/build_dir/host/tar-1.30': configure: error: you should not run configure as root (set FORCE_UNSAFE_CONFIGURE=1 in environment to bypass this check) See `config.log' for more details Makefile:31: recipe for target '/root/lede/build_dir/host/tar-1.30/.configured' failed make[3]: *** [/root/lede/build_dir/host/tar-1.30/.configured] Error 1 make[3]: Leaving directory '/root/lede/tools/tar' time: tools/tar/compile#12.69#7.85#24.55 tools/Makefile:155: recipe for target 'tools/tar/compile' failed make[2]: *** [tools/tar/compile] Error 2 make[2]: Leaving directory '/root/lede' tools/Makefile:153: recipe for target '/root/lede/staging_dir/target-mips_24kc_musl/stamp/.tools_compile_yynyyyyynyyyyynyynnnyyyyyyyyyyyyyyyyyyyynnyynynyyyynnyy' failed make[1]: *** [/root/lede/staging_dir/target-mips_24kc_musl/stamp/.tools_compile_yynyyyyynyyyyynyynnnyyyyyyyyyyyyyyyyyyyynnyynynyyyynnyy] Error 2 make[1]: Leaving directory '/root/lede' /root/lede/include/toplevel.mk:216: recipe for target 'world' failed make: *** [world] Error 2

解决方式:

you should not run configure as root 不要以root用户运行

文章地址:https://wenmayi.cn/post/310.html