本文将详细记录一个自己编译出来的openwrt固件的编译过程。首先是编译环境的搭建,系统选择Ubuntu 16.04,安装过程就不赘述了。这里需要重点提的是把Ubuntu的软件源更新为国内源:
ubuntu part
sudo apt-get update cd /etc/apt cp sources.list sources.list.back //备份原软件源 sudo vim source.list
变更部分:
deb http://mirrors.163.com/ubuntu/ precise main restricted deb-src http://mirrors.163.com/ubuntu/ precise main restricted deb http://mirrors.163.com/ubuntu/ precise-updates main restricted deb-src http://mirrors.163.com/ubuntu/ precise-updates main restricted deb http://mirrors.163.com/ubuntu/ precise universe deb-src http://mirrors.163.com/ubuntu/ precise universe deb http://mirrors.163.com/ubuntu/ precise-updates universe deb-src http://mirrors.163.com/ubuntu/ precise-updates universe deb http://mirrors.163.com/ubuntu/ precise multiverse deb-src http://mirrors.163.com/ubuntu/ precise multiverse deb http://mirrors.163.com/ubuntu/ precise-updates multiverse deb-src http://mirrors.163.com/ubuntu/ precise-updates multiverse deb http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse deb-src http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse deb http://mirrors.163.com/ubuntu/ precise-security main restricted deb-src http://mirrors.163.com/ubuntu/ precise-security main restricted deb http://mirrors.163.com/ubuntu/ precise-security universe deb-src http://mirrors.163.com/ubuntu/ precise-security universe deb http://mirrors.163.com/ubuntu/ precise-security multiverse deb-src http://mirrors.163.com/ubuntu/ precise-security multiverse deb http://extras.ubuntu.com/ubuntu precise main deb-src http://extras.ubuntu.com/ubuntu precise main
openwrt part
sudo apt-get update sudo apt-get install git g++ ncurses-term zlib1g-dev gawk subversion libncurses5-dev mkdir wr703n sudo chmod 777 wr703n cd wr703n git clone git://git.archive.openwrt.org/14.07/openwrt.git //14.07 BB 版 git clone git://git.archive.openwrt.org/15.05/openwrt.git //15.05 CC 版 (任选一个) cd /home/username/wr703n/openwrt cp feeds.conf.default feeds.conf ./scripts/feeds update -a //更新全部feed ./scripts/feeds update (packagename) //更新某个feed ./scripts/feeds install -a //安装全部feed ./scripts/feeds install (packagename) //安装某个feed make defconfig make clean // (可选,建议每次重新编译之前执行一次清理命令) make menuconfig
3g/4g part
//WR703N插3G上网卡,需要编译或安装如下ipk:
Kernel Modules - USB Support (*)kmod-usb2 //USB2.0支持 (*)kmod-usb-ohci //USB1.1支持 (*)kmod-usb-serial //驱动 (*)kmod-usb-serial-option //附加驱动 Utilities (*)comgt //拨号 (*)usb-modeswitch //模式切换的,这个一定要装,不然303显示为存储设备 Network (*)chat //establish serial communication to prepare PPP link negotiation. (*)ppp //standard point-to-point protocol Luci 1. Collections (*) luci 3. Applications (*) luci-app-multiwan (optional to support multiple 3g dongles) (*) luci-app-qos (optional to provide QOS support) 6. Protocols (*) luci-proto-3g -*- luci-proto-ppp
(顺带把Luci汉化一下,选择5. Translations (*) luci-i18n-chinese)
wifidog part
Network - Captive portal (*) wifidog
如果14.07 BB版在make menuconfig命令下的,Network -> Captive portal 找不到wifidog选项,则退出make menuconfig, 回到工作目录
cd /home/username/wr703n/openwrt vim feeds.conf
增加一行
src-git wifidog https://github.com/wifidog/wifidog-gateway.git
如果是15.05 CC版 无需做任何操作,默认的feeds.conf即可。
变更过 feeds.conf 后,重新执行
./scripts/feeds update -a //更新全部feed ./scripts/feeds install -a //安装全部feed
然后重新
make menuconfig
选中
Network - Captive portal (*) wifidog
根据界面提示操作,如果是要将wifidog编译进内核则(*),如果只是将wifidog编译成模块则
make menuconfig完成后,退出界面,然后执行编译指令:
time make V=s download && time make V=s
或者
make V=99
//显示出详细的编译过程
wifidog version part
wifidog默认git下来的是老版本,为了拥有wifidog的域名白名单功能,再编译固件之前,我们需要手动变更wifidog的版本。
15.05 CC
15.05 CC 版需要确定wifidog源码是git的新版本,而不是1.2.1的版本,新版本为1.3.0,也就是在编译运行以后显示的版本号确定为1.3.0
获取1.30的源码只需要简单的修改下/home/username/wr703n/openwrt/feeds/packages/net/wifidog 里面的这个makefile文件里面的1.2.1改为1.3.0即可,无需任何其他处理。
include $(TOPDIR)/rules.mk PKG_NAME:=wifidog PKG_VERSION:=1.3.0 //这里 PKG_RELEASE=1 PKG_LICENSE:=GPL-2.0 # Note: Packaging is maintained upstream at # https://github.com/wifidog/packages PKG_MAINTAINER:=Michael Haas <haas@computerlinguist.org> PKG_LICENSE_FILES:=COPYING PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=git://github.com/wifidog/wifidog-gateway.git PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) PKG_SOURCE_VERSION:=1.3.0 //这里 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz </haas@computerlinguist.org>
14.07 BB
14.07 BB 版需要确定wifidog源码是git的新版本,而不是20130917的版本,新版本为1.30,也就是在编译运行以后显示的版本号确定为1.30
获取1.30的源码只需要简单的修改下/home/username/wr703n/openwrt/feeds/oldpackages/net/wifidog 里面的这个 makefile 文件里面的 20130917 和 440445db60b0c3aff528ea703a828b0567293387 改为 1.3.0 即可,无需任何其他处理。
PKG_NAME:=wifidog PKG_VERSION:=1.3.0 //这里 PKG_RELEASE=$(PKG_SOURCE_VERSION) PKG_SOURCE_PROTO:=git PKG_SOURCE_URL:=git://github.com/wifidog/wifidog-gateway.git PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) PKG_SOURCE_VERSION:=1.3.0 //这里 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
My choice
原始固件选择14.07 BB 版
wifidog 集成在固件里
3G上网集成在固件里
Luci界面有3G/QoS管理,无wifidog管理
下一篇,我们将讲述这个自制固件的设置方法。