Openwrt编译环境搭建
操作系统 centos-5.8 64位
安装gnome, 可使用Xmanager
#yum -y groupinstall "X Window System"
#yum -y groupinstall "Desktop"
安装svn
#yum install subversion
下载openwrt源码
#svn co svn://svn.openwrt.org/openwrt/trunk/
地址:https://dev.openwrt.org/wiki/GetSource
# make menuconfig, 报错
不执行 ./scripts/feeds update -a和 ./scripts/feeds install -a 之前,
make menuconfig里是看不到LuCI选项的。
#vim README
"./scripts/feeds update -a" to get all the latest package definitions defined in feeds.conf/ feeds.conf.default respectively.
feeds.conf.default里需要下载的packege的几条git 和svn 的路径地址。
"./scripts/feeds install -a" to install symlinks of all of them into package/feeds/
在package/feeds/luci/中(原本是没有该目录的, package/feeds目录是在执行完./scripts/feeds 的两条命令之后生成的), 可以看到一些链接, ll看一下
例:community-profiles -> ../../../feeds/luci/contrib/package/community-profiles/
此处的feeds是trunk目录下的feeds目录, 原来也是没有的, 在执行完./scripts/feeds两条命令之后生成。
tmp目录本来也是没有的, 在执行完上述两条命令后, 在tmp目录下生成.config和其他文件, 在make menuconfig之后, tmp/.config更新。
trunk下的.config原来没有, 也是此时下载的。 在make menuconfig之后更新。
# make menuconfig, 报错
1. Please install the GNU C++ Compiler (g++).
#yum install gcc-c++;
2. Please install ncurses. (Missing libncurses.so or ncurses.h)
#yum install ncurses;
#yum install ncurses-devel;
3. Please install zlib. ( Missing libz.so or zlib.h)
#yum install zlib-devel
4. Please install git(git-core) v1.6.5 or later.
下载地址:http://git-scm.com/downloads, 点击Old releases.
用wget工具: #wget https://www.kernel.org/pub/software/scm/git/git-1.9.2.tar.gz
#vim INSTALL;
#make prefix=/usr all doc info ;# as yourself
缺少ssl.h #yum install openssl-devel;
缺少curl http.h:54: error: expected specifier-qualifier-list before ‘CURLcode’
#yum install curl
还是缺少curl
#yum install curl-devel
warning: expat.h缺少
#yum install expat-devel;
/bin/sh: msgfmt command not found;
#yum install gettext;
/bin/sh: asciidoc command not found;
安装mercurial
#wget http://mercurial.selenic.com/release/mercurial-3.0.tar.gz
#cd mercurial
#make
#make install
mercurial/base85.c:13:20: error: Python.h: No such file or directory
安装python
#yum install python
#yum install python-devel
此时make install 时, 提示需要安装python-docutils
wget http://cznic.dl.sourceforge.net/project/docutils/docutils/0.11/docutils-0.11.tar.gz
#wget https://www.python.org/ftp/python/3.4.0/Python-3.4.0.tgz
报错:ERROR: certificate common name `*.c.ssl.fastly.net' doesn't match requested host name `www.python.org'.
#wget --no-check-certificate https://www.python.org/ftp/python/3.4.0/Python-3.4.0.tgz
#hg clone -r 8.6.9 https://asciidoc.googlecode.com/hg/ asciidoc-8.6.9
#autoconf: autoconf command not found
#yum install autoconf
git安装好之后,#make menuconfig正常, 选定LuCI, 生成.config(trunk下原来是没有.config文件的)
#make
在./tmp/.config-packge.in中(此.config-package.in也是make menuconfig生成的), 有menu "LuCI"的配置
在.config中, CONFIG_PACKAGE_luci=y
在./tmp/.config中,CONFIG_PACKAGE_luci=y
在./tmp/.packagedeps:package-$(CONFIG_PACKAGE_luci) += feeds/luci/luci 中
太多的Makefile和config.in都是后来生成的, 有必要从开始Makefile看起。
一: make menuconfig V=99过程
topdir的Makfile中, include $(TOPDIR)/include/toplevel.mk
toplevel.mk中,
menuconfig: scripts/config/mconf prepare-tmpinfo FORCE
if [ ! -e .config -a -e $(HOME)/.openwrt/defconfig ]; then
cp $(HOME)/.openwrt/defconfig .config;
fi
$< Config.in
(1) scripts/config/mconf, toplevel.mk中,:
$(_SINGLE)$(SUBMAKE) -s -C scripts/config all CC="$(HOSTCC_WRAPPER)"
//export MAKEFLAGS= ;umask 022; make -w -s -C scripts/config all CC="gcc"
// topdir的Makefile中, _SINGLE=export MAKEFLAGS=$(space)
//toplevel.mk中,SUBMAKE :=umask 022; $(SUBMAKE) umask 022, 表示默认的文件夹权限为755(777-022). 文件权限为644(666-022)?
scrpts/config/Makefile中,
all:conf mconf
conf: $(conf-objs) //conf-objs :conf.o zconf.tab.o
mconf: $(mconf-objs) $(lxidag-objs)
$(CC) -o $@ $^ $(call check_lxdialog, ldflags, $(CC)) ,
生成mconf, 至此, menuconfig的第一个依赖, scripts/config/mconf 完成, 生成/scripts/config/mconf文件
(2)prepare-tmpinfo,