首先参考官方文档:http://wiki.openwrt.org/doc/howto/build
1.下载源码
wr703n要下载attitude adjustment分支(对应12.09),下载到12.09目录
$ git clone git://git.openwrt.org/12.09/openwrt.git 12.09
2.更新feeds
$ cd 12.09
$ ./scripts/feeds update -a
$ ./scripts/feeds install -a
3.配置
$ make menuconfig
配置文件也可以从openwrt下一个
$ wget http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/config.ar71xx_generic
$ ln -sv config.ar71xx_generic .config
4.编译
$ make V=s
另外,可以用make defconfig先生成一个默认配置,然后make download下载各个包的源代码(保存在dl目录),以后每次make distclean的时候先重命名一下dl目录,不要删除了,可以节省时间
select a target before “make defconfig” or default broadcom is selected:
echo CONFIG_TARGET_ar71xx=y > .config
make defconfig
Then is advisable to run make without any further modification to menuconfig for test and debug purposes. If fail at this point must fill a bug and wait another revision…
BUT, before any make is advisable to download sources at once:
echo CONFIG_TARGET_ar71xx=y > .config
make defconfig
make download
This fill up “dl” directory, so the real time saver is keep “dl” away from distclean reach:
echo CONFIG_TARGET_ar71xx=y > .config
make defconfig
ln -sf ../../dl
make download
make
Finally if all goes well you are free to issue “make menuconfig” and go on.
Cleaning Up
You might need to clean your build environment every now and then. The following
make
-targets are useful for that job:
Clean
make clean
deletes contents of the directories
/bin
and /build_dir
.
Dirclean
make dirclean
deletes contents of the directories
/bin
and /build_dir
and additionally /staging_dir
and /toolchain
(=the cross-compile tools) and/logs
. ‘Dirclean’ is your basic “Full clean” operation.
Distclean
make distclean
nukes everything you have compiled or configured and also deletes all downloaded feeds contents and package sources.
CAUTION: In addition to all else, this will erase your build configuration (<buildroot_dir>/.config
), your toolchain and all other sources. Use with care!
There are numerous other functionalities in the OpenWrt build system, but the above should have covered some of the fundamentals.
Clean small part
In more time, you may not want to clean so many objects, then you can use some of the commands below to do it.
Clean linux objects.
make target/linux/clean
Clean package base-files objects.
make package/base-files/clean
Clean luci.
make package/feeds/luci/luci/clean