User Tools

Site Tools


zh-cn:doc:howto:imagebuilder

镜像生成器

映像生成器 是一个创建自定义固件的预编译环境,可以在现有固件的基础编辑创建镜像。

使用映像生成器的原因:

  • 创建最小化镜像如去除WEB界面
  • 软件包直接嵌入squashfs,减少目标平台的空间需求
  • 配置文件直接嵌入squashfs作为预配置

下载

ImageBuilder随着OpenWrt Kamikaze神风8.09.2版本中,并就在服务器上提供下载。

  • 浏览OpenWrt下载目录

http://kamikaze.openwrt.org/8.09.2/

  • 点击你路由器的架构, 例如brcm-2.4 架构的WRT54GL映像
  • 下载ImageBuilder存档。使用 i686在32位系统或x86_64 基于64位的系统
  • 提取档案和目录更改到ImageBuilder
$ wget http://kamikaze.openwrt.org/...-for-Linux-i686.tar.bz2 $ tar -xjf OpenWrt-ImageBuilder-brcm-2.4-for-Linux-i686.tar.bz2 $ cd OpenWrt-ImageBuilder-brcm-2.4-for-Linux-i686/

用法

The make image command will create a minimal image with just essential packages included, the behaviour can be controlled with three variables passed as arguments:

  • PROFILE - specifies the target image to build
  • PACKAGES - a list of packages to embed into the image
  • FILES - directory with custom files to include

见下一章节的阐释。

After the make command is finished, the generated images are stored in the bin directory.

$ ls bin/ md5sums openwrt-wrt350n_v1-squashfs.bin openwrt-brcm-2.4-squashfs.trx openwrt-wrt54g-squashfs.bin openwrt-usr5461-squashfs.bin openwrt-wrt54g3g-em-squashfs.bin openwrt-wa840g-squashfs.bin openwrt-wrt54g3g-squashfs.bin openwrt-we800g-squashfs.bin openwrt-wrt54gs-squashfs.bin openwrt-wr850g-squashfs.bin openwrt-wrt54gs_v4-squashfs.bin openwrt-wrt150n-squashfs.bin openwrt-wrtsl54gs-squashfs.bin openwrt-wrt300n_v1-squashfs.bin

概况

Run make info to obtain a list of defined profiles:

$ make info Current Target: "brcm-2.4" Default Packages: base-files libgcc … kmod-switch kmod-diag nvram Available Profiles: Broadcom: Generic, Broadcom WiFi (default) Packages: kmod-brcm-wl wlc nas kmod-wlcompat BroadcomMimo: Generic, Broadcom WiFi (MIMO) Packages: kmod-brcm-wl-mimo wlc nas kmod-wlcompat None: Generic, No WiFi Packages: USBGeneric: Generic USB Packages: kmod-brcm-wl kmod-usb-core kmod-usb-ohci kmod-usb2 … WL500G: ASUS WL-500g Packages: kmod-brcm-wl kmod-usb-core kmod-usb-ohci kmod-lp … WL500GD: ASUS WL-500g Deluxe Packages: kmod-brcm-wl kmod-usb-core kmod-usb-uhci kmod-usb2 … WL500GP: ASUS WL-500g Premium Packages: kmod-brcm-wl kmod-usb-core kmod-usb-uhci-iv … WL700GE: WL-700gE Packages: -ppp -ppp-mod-pppoe -kmod-ipt-nathelper -iptables … WLHDD: WL-HDD Packages: kmod-brcm-wl kmod-usb-core kmod-usb-ohci … WRT54G3G: Linksys WRT54G3G Packages: kmod-brcm-wl kmod-usb-core kmod-usb-ohci kmod-usb2 …

… and pass the appropriate profile to the make command:

$ make image PROFILE=WL500GP

软件包

The PACKAGES variable specifies a list of packages to include when building an image. If a name is prefixed with - then the corresponding package will be excluded from the image.

$ make image PROFILE=WL500GP PACKAGES="nano openvpn -ppp -ppp-mod-pppoe"

Tip贴士: 查看当前已安装的软件包列表可以使用如下命令:

root@OpenWrt:~# echo `opkg list_installed | awk '{ print $1 }'`

文件

A directory with custom files to add can be specified using the FILES variable. Custom files will replace default ones if necessary.

$ mkdir -p files/etc/config $ scp root@192.168.1.1:/etc/config/network files/etc/config/ $ scp root@192.168.1.1:/etc/config/wireless files/etc/config/ $ scp root@192.168.1.1:/etc/config/firewall files/etc/config/ $ make image PROFILE=WL500GP PACKAGES="nano openvpn -ppp -ppp-mod-pppoe" FILES=files/

清理临时文件

清理临时文件 要清理建立和生成映像时的临时文件,请使用make clean 命令。

zh-cn/doc/howto/imagebuilder.txt · Last modified: 2010/12/18 08:20 (external edit)