首页 > 代码库 > ubuntu 编译openwrt

ubuntu 编译openwrt

参考文献:http://blog.csdn.net/mirkerson/article/details/7287931

https://dev.openwrt.org/ticket/12860

http://www.2cto.com/os/201204/126215.html

 

一。搭建编译环境
应用程序--附件--终端
sudo apt-get update      (更新)
安装编译需要的组件:
sudo apt-get install gcc 
sudo apt-get install g++ 
sudo apt-get install binutils 
sudo apt-get install patch 
sudo apt-get install bzip2 
sudo apt-get install flex 
sudo apt-get install bison 
sudo apt-get install make 
sudo apt-get install autoconf 
sudo apt-get install gettext 
sudo apt-get install texinfo 
sudo apt-get install unzip 
sudo apt-get install sharutils 
sudo apt-get install subversion 
sudo apt-get install libncurses5-dev 
sudo apt-get install ncurses-term 
sudo apt-get install zlib1g-dev 
sudo apt-get install gawk
sudo apt-get install asciidoc
sudo apt-get install libz-dev

二。下载源码:

mkdir openwrt 创建一个openwrt文件夹
cd openwrt    进入openwrt文件夹
svn co svn://svn.openwrt.org/openwrt/branches/backfire  下载官网的源码
./scripts/feeds update -a     更新软件包
./scripts/feeds install -a    安装软件包

注解:其中有google相关的源代码需要FQ

三。配置:

make menuconfig

注解:如果有如下错误

--: /info/sys/openwrt/stable/include/shell.sh;: No such file or directoryERROR: please fix target/linux/brcm63xx/MakefileERROR: please fix target/linux/brcm47xx/MakefileERROR: please fix target/linux/ppc40x/MakefileERROR: please fix target/linux/ppc44x/MakefileERROR: please fix target/linux/brcm-2.4/MakefileERROR: please fix target/linux/x86/MakefileERROR: please fix target/linux/orion/MakefileERROR: please fix target/linux/xburst/MakefileERROR: please fix target/linux/lantiq/MakefileERROR: please fix target/linux/ar7/MakefileERROR: please fix target/linux/kirkwood/MakefileERROR: please fix target/linux/ar71xx/MakefileERROR: please fix target/linux/uml/MakefileERROR: please fix target/linux/rb532/MakefileERROR: please fix target/linux/avr32/MakefileERROR: please fix target/linux/ixp4xx/MakefileERROR: please fix target/linux/atheros/MakefileERROR: please fix target/linux/au1000/MakefileERROR: please fix target/linux/rdc/MakefileERROR: please fix target/linux/adm5120/MakefileCollecting target info: donePrerequisite check failed. Use FORCE=1 to override.make: *** [tmp/.prereq-build] Ошибка 1

参考:https://dev.openwrt.org/ticket/12860 原因是make版本问题,源码依赖 3.8.2 我本身最新版make是4.0的

修复参考:

Resolution worksforme deletedStatus changed from closed to reopenedThis is caused by Gentoo applying the patch from ?https://savannah.gnu.org/bugs/?23922 (file #23363) in make-3.82-r4 , which adds filtering of special characters in $SHELL .The openwrt trunk has a fix for this in ?https://dev.openwrt.org/changeset?reponame=&new=22720%40trunk%2Frules.mk&old=22443%40trunk%2Frules.mk. While this seems to be done for a different purpose, it appears to fix this build problem

  网址:https://dev.openwrt.org/changeset?reponame=&new=22720%40trunk%2Frules.mk&old=22443%40trunk%2Frules.mk 中的解决办法

trunk/rules.mk r22443	r22720	 16	16	 17	17	TMP_DIR:=$(TOPDIR)/tmp 18	 	    #删除行19	 	#export SHELL=/usr/bin/env bash -c ‘. $(TOPDIR)/include/shell.sh; eval "$$2"‘ -- 20	18	 21	19	GREP_OPTIONS= …	…	 149	147	export STAGING_DIR 150	148	export GCC_HONOUR_COPTS:=0 #增加行 	149	export SH_FUNC:=. $(INCLUDE_DIR)/shell.sh; 151	150	 152	151	PKG_CONFIG:=$(STAGING_DIR_HOST)/bin/pkg-config 

另一个问题 编译不成功 执行 make lclean  提示 未安装 ncurses

参考:http://www.2cto.com/os/201204/126215.html

 

 

四。make V=99   (开始编译)
剩下的就是等待了

 

ubuntu 编译openwrt