Centos7下编译openwrt,centos7编译openwrt在退出Menucon
Centos7下编译openwrt,centos7编译openwrt在退出Menucon
1.下载openwrt最新源码
git clone https://github.com/openwrt/openwrt.git2.下载feeds
执行
$ ./scripts/feeds update -a
$ ./scripts/feeds install -a
3.配置环境
make defconfig
可检查所需依赖
$sudo yum -y install gcc binutils patch bzip2 flex bison make autoconf gettext texinfo unzip sharutils libncurses5-dev ncurses-term zlib1g-dev wget perl-Thread-Queue openssl-devel zlib-static ncurses-devel gcc-c++
$ make prereq
$ make menuconfig
通过文本对话框进行选项配置,最主要的配置项有:
Target system(目标系统类型)
Package selection(软件包选择)
Build system settings (编译系统设置)
Kernel modules (内核模块)
[*]表示:这个包裹选中编译,并安装在firmware中;
[M]表示:这个软件包选中编译,但并不安装在firmware中。
在退出Menuconfig的时,会提示是否保存配置。
4.编译
一般情况,使用一个简单的命令:
$ make
在多核处理器系统上为提高速度,可使用(例如用3核处理器):
$ make –j 3
在后台进行编译,使用空闲的I/O资源和CPU性能,可使用(例如使用双核处理器)
$ onice -c 3 nice -n 20 make -j 2
编译一个单独的软件包(例如在cups软件包):
$ make package/cups/compile V=99
如果特殊原因需要分析编译报错信息:
$ make V=99 2>&1 |tee build.log |grep -i error
说明:将编译的所有输出信息保存在build.log中,将error信息打印在屏幕上。
一个复杂指令的应用
$ ionice -c 3 nice -n 20 make -j 2 V=99 CONFIG_DEBUG_SECTION_MISMATCH=y 2>&1 |tee build.log |egrep -i '(warn|error)'
说明:将编译的所有输出信息保存在build.log中,将error和warning信息打印在屏幕上。编译过程使用双核CPU,占用后台资源。
5.生成镜像(Image)位置
新生成的镜像会默认放在新建的一个bin目录下。
$ ls bin/*
6.清理工作
$ make clean
除了清除生成的目录,还想清除交叉编译工具(以及工具链目录)
$ make dirclean
清除所有相关的东西,包括下载的软件包,配置文件,feed内容等:
$ make distclean
7.安装openwrt
评论暂时关闭