官方参考: https://dev.openwrt.org/wiki/GetSource
OpenWrt source repository downloads
You can either check out the OpenWrt source code via git or svn.
GIT
The recommended way of checking out the OpenWrt source code is cloning the Git repository using one of the following commands:
trunk (main development tree)
-
Main repository
git clone git://git.openwrt.org/openwrt.git
14.07 branch (Barrier Breaker)
-
Main repository
git clone git://git.openwrt.org/14.07/openwrt.git
12.09 branch (Attitude Adjustment)
-
Main repository
git clone git://git.openwrt.org/12.09/openwrt.git
-
Packages feed
git clone git://git.openwrt.org/12.09/packages.git
SVN
You can checkout the source from the OpenWrt Subversion repository using one of the following commands:
-
Development branch: ChangeLog
svn co svn://svn.openwrt.org/openwrt/trunk/
-
Barrier Breaker 14.07 branch: ChangeLog
svn co svn://svn.openwrt.org/openwrt/branches/barrier_breaker
-
Attitude Adjustment 12.09 branch: ChangeLog
svn co svn://svn.openwrt.org/openwrt/branches/attitude_adjustment
-
Backfire 10.03 branch: ChangeLog
svn co svn://svn.openwrt.org/openwrt/branches/backfire
-
Kamikaze 8.09 branch: ChangeLog
svn co svn://svn.openwrt.org/openwrt/branches/8.09
-
Kamikaze 7.09 branch: ChangeLog
svn co svn://svn.openwrt.org/openwrt/tags/kamikaze_7.09
#稳定分支版本 attitude_adjustment/12.09, 内核3.3.8, org.cn有镜像. 若在windows的共享目录下操作有N种意想不到的错误, 以下操作都在~目录
mkdir openwrt
cd openwrt
git clone git://git.openwrt.org/12.09/openwrt.git
svn co svn://svn.openwrt.org.cn/openwrt/branches/attitude_adjustment
cd attitude_adjustment
./scripts/feeds update -a
./scripts/feeds install -a
make menuconfig: 界面中选择如下
Target System 选(Atheros AR7xxx/AR9xxx)
Target Profile 选(TP-LINK TL-WR703N)
Package features 选 umontu
Base system: 选中 librt, libpthread, block-mount
<*> busybox:
Linux System Utilities:<*> lsusb
Editor:
<*> diff
Kernel modules: 此部分与内核版本紧密相关, 如下
Depends: kernel (=3.2.14-1-eb30a01493673f9c92acd8243277c304), kmod-i2c-core
Filesystem: kmod-fs-vfat, kmod-fs-ntfs, kmod-fs-ext4
Filesystem: kmod-fs-vfat, kmod-fs-ntfs, kmod-fs-ext4
Native Language Support: 选 kmod-nls-utf8
I2C support: 选kmod-i2c-core
other: 选中 kmod-input-core(r42647移到别的位置了)
SPI Support: 选中 kmod-spi-gpio
Sound Support: 选中kmod-sound-core, kmod-usb-audio
SPI Support: 选中 kmod-spi-gpio
Sound Support: 选中kmod-sound-core, kmod-usb-audio
usb support: 选 kmod-usb-ohci、kmod-usb-storage、kmod-usb-storage-extras、kmod- usb-uhci、kmod-usb-video、 kmod-usb2, kmod-usb-hid, kmod-usb-serial(下面的子 项目都选吧, 调试外设备用), (新版本无kmod-usb-video? )
video support: 选 kmod-video-core、kmod-video-uvc, kmod-video-gspca-core, kmod-video-gspca-zc3xx
w1 support: 全选
wireless support: kmod-rtl8187, 后面带USB的全选
wireless support: kmod-rtl8187, 后面带USB的全选
luci: 第1项 collections选luci,第5项Translate里选上luci-i18n-chinese
Multimedia: 选 mjpg-streamer
netwokr:
FileSystem: 选 owftd, owhttp, owserver
Utilities:
Fielsystem: 选 Fuse-utils, owfs, owshell.
attitude adjustment 版本
make defconfig
make clean
rm -rf ./tmp #如果以前编译过一次,删除./tmp目录及该目录下的所有文件
#此时可以把备份的同版本的dl目录拷贝到本目录下的dl目录下, 可以大大加快编译的速度
xxg@xxg-desktop:~/openwrt/r31296/trunk$ make -j 2
make[1] world
make[2] target/compile
make[3] -C target/linux compile
make[2] package/cleanup
make[2] package/compile
make[3] -C package/opkg host-compile
make[3] -C package/busybox compile
make[3] -C package/libnl-tiny compile
make[3] -C package/dnsmasq compile
make[3] -C package/dropbear compile
make[3] -C feeds/luci/freifunk-common compile
make[3] -C feeds/packages/net/olsrd compile
make[3] -C package/iptables compile
make[3] -C package/iproute2 compile
make[3] -C feeds/luci/freifunk-mapupdate compile
make[3] -C package/lua compile
make[3] -C package/lua host-compile
make[3] -C package/px5g compile
make[3] -C package/uci compile
make[3] -C package/uhttpd compile
make[3] -C package/libtool compile
make[3] -C package/fuse compile
make[3] -C package/gpio-button-hotplug compile
make[3] -C package/hostapd compile
make[3] -C package/hotplug2 compile
make[3] -C package/iw compile
make[3] -C package/kernel compile
make[3] -C package/libjson-c compile
make[3] -C package/wireless-tools compile
make[3] -C package/mtd compile
make[3] -C package/opkg compile
make[3] -C package/libpcap compile
make[3] -C package/linux-atm compile
make[3] -C package/swconfig compile
make[3] -C package/zlib compile
make[3] -C package/w1-gpio-custom compile
make[3] -C package/base-files-network compile
make[3] -C package/crda compile
make[3] -C feeds/luci/community-profiles compile
make[3] -C package/firewall compile
make[3] -C package/iwinfo compile
make[3] -C feeds/packages/libs/jpeg compile
make[3] -C package/libubox compile
make[3] -C package/mac80211 compile
make[3] -C package/ppp compile
make[3] -C package/uboot-envtools compile
make[3] -C package/ubus compile
make[3] -C package/base-files compile
make[3] -C feeds/luci/freifunk-gwcheck compile
make[3] -C feeds/packages/multimedia/mjpg-streamer compile
make[3] -C feeds/luci/luci compile
make[2] package/install
make[3] -C package/base-files-network install
make[3] -C package/busybox install
make[3] -C package/crda install
make[3] -C package/dnsmasq install
make[3] -C package/dropbear install
make[3] -C feeds/luci/luci install
make[3] -C package/firewall install
make[3] -C package/gpio-button-hotplug install
make[3] -C package/hostapd install
make[3] -C package/hotplug2 install
make[3] -C package/iptables install
make[3] -C package/iw install
make[3] -C package/kernel install
make[3] -C package/libnl-tiny install
make[3] -C package/mac80211 install
make[3] -C package/mtd install
make[3] -C package/opkg install
make[3] -C package/ppp install
make[3] -C package/swconfig install
make[3] -C package/uboot-envtools install
make[3] -C package/uci install
make[3] -C package/wireless-tools install
make[3] -C package/base-files install
make[2] package/rootfs-prepare
make[3] package/preconfig
make[2] target/install
make[3] -C target/linux compile
make[3] -C target/linux install
make[3] -C target/imagebuilder compile
make[3] -C target/imagebuilder install
make[2] package/index
xxg@xxg-desktop:~/openwrt/r31296/trunk$
#2014-11-18重新编译AA版本, make 不带-j的参数, 以避免发生意想不到的错误.
xxg@EmbeddedLab:~/openwrt/attitude_adjustment$ make clean
make[1] clean
make[2] target/linux/clean
make[3] -C target/linux clean
xxg@EmbeddedLab:~/openwrt/attitude_adjustment$ make
make[1] world
make[2] target/compile
make[3] -C target/linux compile
make[2] package/cleanup
make[2] package/compile
make[3] -C package/toolchain compile
make[3] -C package/libnl-tiny compile
make[3] -C package/libjson-c compile
make[3] -C package/lua compile
make[3] -C package/libubox compile
make[3] -C package/ubus compile
make[3] -C package/uci compile
make[3] -C package/netifd compile
make[3] -C package/opkg host-compile
make[3] -C package/base-files compile
make[3] -C package/ncurses compile
make[3] -C package/util-linux compile
make[3] -C package/block-mount compile
make[3] -C package/busybox compile
make[3] -C package/dnsmasq compile
make[3] -C package/dropbear compile
make[3] -C feeds/luci/freifunk-common compile
make[3] -C feeds/luci/community-profiles compile
make[3] -C feeds/routing/olsrd compile
make[3] -C package/iptables compile
make[3] -C package/firewall compile
make[3] -C package/iproute2 compile
make[3] -C feeds/luci/freifunk-gwcheck compile
make[3] -C feeds/luci/freifunk-mapupdate compile
make[3] -C package/iwinfo compile
make[3] -C package/lua host-compile
make[3] -C package/px5g compile
make[3] -C package/uhttpd compile
make[3] -C feeds/luci/luci compile
make[3] -C package/libtool compile
make[3] -C feeds/packages/libs/jpeg compile
make[3] -C package/uclibc++ compile
make[3] -C feeds/packages/libs/libusb compile
make[3] -C feeds/packages/multimedia/mjpg-streamer compile
make[3] -C package/fuse compile
make[3] -C package/librpc compile
make[3] -C feeds/packages/utils/owfs compile
make[3] -C package/gpio-button-hotplug compile
make[3] -C package/hostapd compile
make[3] -C package/hotplug2 compile
make[3] -C package/iw compile
make[3] -C package/kernel compile
make[3] -C package/mac80211 compile
make[3] -C package/mtd compile
make[3] -C package/opkg compile
make[3] -C package/libpcap compile
make[3] -C package/linux-atm compile
make[3] -C package/resolveip compile
make[3] -C package/ppp compile
make[3] -C package/swconfig compile
make[3] -C package/uboot-ar71xx compile
make[3] -C package/zlib compile
make[3] -C package/uboot-envtools compile
make[3] -C package/w1-gpio-custom compile
make[2] package/install
make[3] -C package/busybox install
make[3] -C package/dnsmasq install
make[3] -C package/dropbear install
make[3] -C package/firewall install
make[3] -C package/gpio-button-hotplug install
make[3] -C package/hostapd install
make[3] -C package/hotplug2 install
make[3] -C package/iptables install
make[3] -C package/iw install
make[3] -C package/kernel install
make[3] -C package/libjson-c install
make[3] -C package/libnl-tiny install
make[3] -C package/libubox install
make[3] -C package/mac80211 install
make[3] -C package/mtd install
make[3] -C package/netifd install
make[3] -C package/opkg install
make[3] -C package/ppp install
make[3] -C package/swconfig install
make[3] -C package/toolchain install
make[3] -C package/uboot-ar71xx install
make[3] -C package/uboot-envtools install
make[3] -C package/ubus install
make[3] -C package/uci install
make[3] -C package/base-files install
make[2] package/rootfs-prepare
make[3] package/preconfig
make[2] target/install
make[3] -C target/linux install
make[3] -C target/imagebuilder install
make[3] -C target/toolchain install
make[2] package/index
xxg@EmbeddedLab:~/openwrt/attitude_adjustment$
--------------------------------------------------------------------------------------------------------------------
Image Builder, 快速固件生成器, 用此创建固件可以省去重新编译的麻烦,大大缩短编译时间。
利用 Imagebuilder 可以生成自己所需要的固件, 告别和别人伸手乞讨固件的磨练
1. mkdir ImageBuilder-ar71xx
2. cd ImageBuilder-ar71xx
OpenWrt-ImageBuilder-ar71xx-for-Linux-i686.tar.bz2, 利用winscp 将本文件传到本目录下
3. 解压
tar jxvf OpenWrt-ImageBuilder-ar71xx-for-Linux-i686.tar.bz2
4. 进入目录
cd OpenWrt-ImageBuilder-ar71xx-for-Linux-i686
5. 查看可编译的路由型号
make info
#比如703N, 可以看到如下信息
TLWR703:
TP-LINK TL-WR703N
Packages: kmod-usb-core kmod-usb2
6. 将自己的配置文件 放在本目录下, 比如我自己的目录就是 wr703n
有 /etc/config, /etc/init.d, ...(此部分可以从好用的路由器上用winscp备份出来即可)
比如配置wireless,只需把备份出来的wireless复制到config就可以了
保留root密码: password和shadow 放在 /etc 目录下
同时packages 目录下可以看到已经带的ipk安装包
7. 生成指定路由型号, 在 bin/ar71xx 目录下可以看到自己所生产的固件. 这里就是你大展伸手的地方
PACKAGES 选项中加上自己所需要的安装包, FILES 选项中加上自己的配置文件
#还是以703N为例,
#最精简的固件, 也就是官网上的, 但配置部分已经是自己的了
make image PROFILE=TLWR703 FILES=wr703n
#只加上luci和
make image PROFILE=TLWR703 PACKAGES="luci" FILES=wr703n
#usb 摄像头, 新版本好像无kmod-usb-video, 摄像头必须有 kmod-video-core, kmod-video-uvc
make image PROFILE=TLWR703 PACKAGES="librt libpthread libjpeg kmod-nls-utf8 kmod-i2c-core kmod-input-core kmod-usb-ohci kmod-usb-storage kmod-usb-storage-extras kmod-usb-uhci kmod-video-core kmod-video-uvc mjpg-streamer" FILES=wr703n
#增加 usb hid: kmod-usb-hid kmod-hid kmod-input-evdev
make image PROFILE=TLWR703 PACKAGES="librt libpthread libjpeg kmod-nls-utf8 kmod-i2c-core kmod-input-core kmod-usb-ohci kmod-usb-storage kmod-usb-storage-extras kmod-usb-uhci kmod-video-core kmod-video-uvc mjpg-streamer kmod-usb-hid kmod-hid kmod-input-evdev" FILES=wr703n
#增加中微星 kmod-video-gspca-core kmod-video-gspca-zc3xx
make image PROFILE=TLWR703 PACKAGES="librt libpthread libjpeg kmod-nls-utf8 kmod-i2c-core kmod-input-core kmod-usb-ohci kmod-usb-storage kmod-usb-storage-extras kmod-usb-uhci kmod-video-core kmod-video-uvc kmod-video-gspca-core kmod-video-gspca-zc3xx mjpg-streamer kmod-usb-hid kmod-hid kmod-input-evdev" FILES=wr703n
#8M专用: luci,中文语言包,DDNS,硬盘休眠,openvpn,打印服务器,QOS,samba,upnp,relay,网络唤醒,USB挂载,硬盘格式支持(ntfs-3g/ext4/ntfs),UTF8编码,USB扩展支持,USB驱动,复位键支持,transmission下载工具.
make image PROFILE=TLWR703 PACKAGES="block-mount librt libpthread luci luci-i18n-chinese luci-app-ddns luci-proto-3g luci-app-hd-idle luci-app-p910nd luci-app-qos luci-app-samba luci-app-upnp luci-app-wol openvpn openvpn-easy-rsa kmod-scsi-core kmod-scsi-generic kmod-fs-ext4 kmod-fs-ntfs kmod-fs-vfat kmod-nls-utf8 kmod-usb-storage-extras kmod-usb-ohci kmod-usb-storage kmod-usb-uhci kmod-usb-acm kmod-usb-serial kmod-usb-serial-ftdi kmod-usb-serial-pl2303 kmod-video-core kmod-video-uvc kmod-video-gspca-core kmod-video-gspca-zc3xx mjpg-streamer ser2net badblocks restorefactory coreutils transmission-daemon transmission-remote transmission-web vsftpd" FILES=wr703n