如何编译openwrt/LEDE

如何编译openwrt/LEDE

  • 目的
    • 编译环境(安装linux发行版和软件包)
    • 编译时可能遇到的问题:
    • 参考文献

目的

记录学习openwrt编译流程,可能有错误,请大家指正!

编译环境(安装linux发行版和软件包)

  1. 安装ubuntu14.04或者其他版本及系统, 不同的系统安装的依赖包有点不一样, 这里用的是Ubuntu 14.04。
  2. ubuntu, 执行这个命令以安装编译依赖
sudo apt-get update
sudo apt-get install gcc g++ binutils patch bzip2 flex bison make autoconf gettext texinfo unzip sharutils subversion libncurses5-dev ncurses-term zlib1g-dev gawk  libssl-dev -y
  1. 获取OpenWrt源代码和安装包,更新
git clone https://github.com/openwrt/chaos_calmer.git  #下载源码 chaos_calmer是openwrt 15.05.1 稳定版本
或者
git clone https://github.com/openwrt/openwrt.git 	 #openwrt 最新代码	
git clone https://github.com/lede-project/source.git #LEDE代码,已合并到openwrt 
cd 源码目录
./scripts/feeds update -a   #更新包
./scripts/feeds install -a    #安装包
或者使用 
make package/symlinks #来实现更新和安装
  1. 配置编译选项,运行make menuconfig即可打开menuconfig
make defconfig   #检查编译环境
make menuconfig  #配置编译选项,如芯片型号,软件包
在这里可以加上luci页面方便设置LUCI,中文可以选择
  1. make V=s -j2
V=s 或者V=99 都是输出编译时的log等级, -j是多核编译,都可以不加   

编译时可能遇到的问题:

1. git clone 代码时 gitlab报错 "fatal: index-pack failed error: RPC failed; result=18, HTTP code = 200"

网络上给的方法 git config --globalhttp.postBuffer 24288000 有时候可以解决,如果无法解决试一下
修改gitlab unicorn配置文件unicorn.rb(位置:~/home/git/gitlab/config下)中的timeout,加大timeout值即可
这种情况基本属于网络不好!!!

2. 遇到当前使用root用户无法编译的问题

修改include/pre-build.mk 将里面报错句屏蔽即可

参考文献

[1]: [openwrt wiki]

你可能感兴趣的:(Openwrt)