编译个性化的openwrt固件


基本流程是:下载openwrt源码(推荐attitude adjustment版本)、执行feeds更新、make menuconfig(通过配置feed.conf.default和menuconfig个性化)、make kernel_menuconfig、make V=99

以下是我的个性化配置,主要为了支持ovs和click modular router。

使用feeds的方式加入ovs和click支持 https://github.com/schuza/openvswitch、https://github.com/rriggio/openwrt-packages

cd $TOPDIR

echo 'src-git openvswitch git://github.com/schuza/openvswitch.git' >> feeds.conf.default
echo 'src-git openwrtpackages git://github.com/rriggio/openwrt-packages.git' >> feeds.conf.default
./scripts/feeds update -a

./scripts/feeds install -a

make menuconfig

select Network -> openvswitch-switch, openvswitch-brcompat and openvswitch-controller(选中这三个)
之后,
echo '# CONFIG_KERNEL_BRIDGE is not set' >> .config

 

其中,menuconfig要添加一些必备组件,如:tc、luci、usb挂载、一键复位/无线、QoS/HTB,都在menucofnig中选择,y表示编译到固件中,M是编译但是不编译进固件

3.添加luci  LuCI—>Collections—– <*> luci  4.添加luci的中文语言包  LuCI—>Translations—- <*> luci-i18n-chinese  5.添加DDNS  LuCI—>Applications —> <*>luci-app-ddns.  6.添加USB挂载  Base system —> <*>block-mount  7.添加硬盘格式支持  Kernel modules —> Filesystems —> <*> kmod-fs-ext4  8.添加UTF8编码  Kernel modules —> Native Language Support —> <*> kmod-nls-utf8  9.添加USB扩展支持  Kernel modules —> USB Support —> <*> kmod-usb-storage-extras.  110.添加自动挂载工具  Utilities —> Filesystem —> <*> badblocks  11.添加复位键支持  Utilities —> <*> restorefactory  12.添加一键开关无线  Utilities —> <*> wifitoggle  

network中选择openflow tc Kernel Modules->Network Support中选择knomd-tun 保存退出

接着make kernel_menuconfig

 

Networking Support->Networking options->QoS中选择Hierarchical Token Bucket (HTB) 保存退出

 

make结束之后会在bin/ar71xx目录下找到固件,其中factory即是。

 

--------------------------------------------------------------------------------------------------------------------------------

tips:如果只想编译某个组件,比如某个.ipk,那么可以使用 sudo make package/xx/compile V=99

其中xx是组件的名字,比如我要单独编译click modular router组件,OpenWrt的安装包中也有Click但是版本很旧已经被标注BROKEN,所以在menuconfig里面是不可见的,所以我要单独编译生成click.ipk然后使用opkg安装到路由器中。

https://github.com/rriggio/openwrt-packages/blob/master/click/Makefile

复制这个makefile替换feeds/packages/net/click重的Makefile,然后cd $TOPDIR,执行:

sudo make package/click/compile V=99

即可在bin/ar71xx/packages目录下生成click_20131011-1_ar71xx.ipk

 

如果要生成所有packages组件,执行:make package/compile 即可。

 

 

 

相关内容