参考文献: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 directory ERROR: please fix target/linux/brcm63xx/Makefile ERROR: please fix target/linux/brcm47xx/Makefile ERROR: please fix target/linux/ppc40x/Makefile ERROR: please fix target/linux/ppc44x/Makefile ERROR: please fix target/linux/brcm-2.4/Makefile ERROR: please fix target/linux/x86/Makefile ERROR: please fix target/linux/orion/Makefile ERROR: please fix target/linux/xburst/Makefile ERROR: please fix target/linux/lantiq/Makefile ERROR: please fix target/linux/ar7/Makefile ERROR: please fix target/linux/kirkwood/Makefile ERROR: please fix target/linux/ar71xx/Makefile ERROR: please fix target/linux/uml/Makefile ERROR: please fix target/linux/rb532/Makefile ERROR: please fix target/linux/avr32/Makefile ERROR: please fix target/linux/ixp4xx/Makefile ERROR: please fix target/linux/atheros/Makefile ERROR: please fix target/linux/au1000/Makefile ERROR: please fix target/linux/rdc/Makefile ERROR: please fix target/linux/adm5120/Makefile Collecting target info: done Prerequisite 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 deleted Status changed from closed to reopened This 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 (开始编译)
剩下的就是等待了