使用Image Generator (Image Builder)生成OpenWrt固件

标签: , , , , ,

之前写过一篇《为HG255D编译OpenWrt Barrier Breaker固件》,但是编译既麻烦又浪费时间,更简单的方法是用Image Generator(以前叫做Image Builder)直接生成OpenWrt固件。

编译环境为Ubuntu 14.04 LTS 64-bit真机,当然也可以用虚拟机,仍然以HG255D为例。

1、下载OpenWrt Barrier Breaker 14.07 Image Generator(链接根据路由器的架构自行修改):

http://downloads.openwrt.org/barrier_breaker/14.07/ramips/rt305x/OpenWrt-ImageBuilder-ramips_rt305x-for-linux-x86_64.tar.bz2
tar -xvjf OpenWrt-ImageBuilder-ramips_rt305x-for-linux-x86_64.tar.bz2
cd OpenWrt-ImageBuilder-ramips_rt305x-for-linux-x86_64/

2、配置软件包仓库(Package Repositories):

vim repositories.conf

修改如下(链接根据路由器的架构自行修改):

src/gz barrier_breaker_base http://downloads.openwrt.org/barrier_breaker/14.07/ramips/rt305x/packages/base
src/gz barrier_breaker_luci http://downloads.openwrt.org/barrier_breaker/14.07/ramips/rt305x/packages/luci
src/gz barrier_breaker_management http://downloads.openwrt.org/barrier_breaker/14.07/ramips/rt305x/packages/management
src/gz barrier_breaker_oldpackages http://downloads.openwrt.org/barrier_breaker/14.07/ramips/rt305x/packages/oldpackages
src/gz barrier_breaker_packages http://downloads.openwrt.org/barrier_breaker/14.07/ramips/rt305x/packages/packages
src/gz barrier_breaker_routing http://downloads.openwrt.org/barrier_breaker/14.07/ramips/rt305x/packages/routing
src/gz barrier_breaker_telephony http://downloads.openwrt.org/barrier_breaker/14.07/ramips/rt305x/packages/telephony
## This is the local package repository, do not remove!
src imagebuilder file:packages

3、打开对HG255D的支持:

vim target/linux/ramips/image/Makefile

搜索HG255D,去掉前面的注释符#

4、生成固件:

make image PROFILE=HG255D

可以自定义需要集成的软件包( -dnsmasq表示不包含dnsmasq这个软件包):

make image PROFILE=HG255D PACKAGES="-dnsmasq dnsmasq-full python"

还可以自定义配置文件:


例如,OpenWrt默认WIFI是关闭的,可以用自己的文件覆盖默认配置文件使WIFI默认开启

mkdir -p files/etc/config
vim files/etc/config/wireless

配置如下(仅为HG255D的配置,其他路由器不一样)

config wifi-device 'radio0'
	option type 'mac80211'
	option channel '11'
	option hwmode '11g'
	option path '10180000.wmac'
	option htmode 'HT20'
	option txpower '20'
	option country '00'

config wifi-iface
	option device 'radio0'
	option network 'lan'
	option mode 'ap'
	option ssid 'demon'
	option encryption 'none'

将配置文件写入固件:

make image PROFILE=HG255D PACKAGES="-dnsmasq dnsmasq-full python" FILES=files/

参考链接:http://wiki.openwrt.org/doc/howto/obtain.firmware.generate

赞赏

微信赞赏支付宝赞赏

随机文章:

  1. 批处理技术内幕:重定向与句柄
  2. OpenWrt利用DNSPod实现动态域名解析DDNS
  3. PHP中的gzcompress gzdeflate gzencode函数
  4. JavaScript调用VBS中的InputBox和MsgBox函数
  5. ActivePython PyPM error: (OperationalError) unable to open database file None None

留下回复