编译一个能够安装的OpenWrt
固件镜像文件(大约8MB
大小的),有以下需求:html
OpenWrt
编译系统大约须要200MB
的空间。feeds
的OpenWrt
编译系统大约须要300MB
的空间。feeds
中的软件包大约须要2.1GB
的空间用于存放下载来的源代码。OpenWrt
并生成固件文件须要大约3-4 GB
的空间。OpenWrt
须要大约1-4 GB
的内存。安装须要的工具:linux
$ sudo apt-get update $ sudo apt-get install git-core build-essential libssl-dev libncurses5-dev unzip subversion mercurial
从官方源下载15.05
分支(Chaos Calmer
):git
$ git clone git://git.openwrt.org/15.05/openwrt.git
下载并安装全部可用的feeds
:框架
$ cd openwrt $ ./scripts/feeds update -a $ ./scripts/feeds install -a
在编译OpenWrt
系统以前,首先要对它进行配置,让它可以支持咱们的开发板。OpenWrt
系统也是一个Linux
系统,经过make menuconfig
来进行配置,最后运行make -j8 V=99
便可。工具
编译完成后,在bin/ramips/
目录下会生成以下文件:post
$ ls bin/ramips/ md5sums openwrt-ramips-mt7628-uImage.bin OpenWrt-ImageBuilder-ramips-mt7628.Linux-x86_64.tar.bz2 openwrt-ramips-mt7628-uImage-initramfs.bin openwrt-ramips-mt7628-LinkIt7688-initramfs-uImage.bin openwrt-ramips-mt7628-vmlinux.bin openwrt-ramips-mt7628-LinkIt7688-squashfs-sysupgrade.bin openwrt-ramips-mt7628-vmlinux.elf openwrt-ramips-mt7628-mt7628-initramfs-uImage.bin openwrt-ramips-mt7628-vmlinux-initramfs.bin openwrt-ramips-mt7628-mt7628-squashfs-sysupgrade.bin openwrt-ramips-mt7628-vmlinux-initramfs.elf openwrt-ramips-mt7628-root.jffs2-128k OpenWrt-SDK-ramips-mt7628_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64.tar.bz2 openwrt-ramips-mt7628-root.jffs2-64k packages openwrt-ramips-mt7628-root.squashfs sha256sums
作路由器应用开发并不须要整个源码环境,只要制做一个能够编译生成ipk
的特定的SDK
环境就好,恰巧openwrt
配置提供了这样的选项功能。若要给应用开发人员提供SDK
开发环境,只要在make menuconfig
的时候选上:ui
[*] Build the OpenWrt SDK
make V=99
编译以后,在bin/ramips/
目录下生成OpenWrt-SDK-ramips-mt7628_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64.tar.bz2
,解压后目录和源码目录同样。es5
uboot.bin
为了防止uboot.bin
被破坏而没法恢复的问题,能够把uboot.bin
从Flash
中导出来。能够采用以下的方法:.net
root@OpenWrt:/tmp# cat /proc/mtd dev: size erasesize name mtd0: 00030000 00010000 "u-boot" mtd1: 00010000 00010000 "u-boot-env" mtd2: 00010000 00010000 "factory" mtd3: 007b0000 00010000 "firmware" mtd4: 006bfd4b 00010000 "rootfs" mtd5: 00300000 00010000 "rootfs_data" root@OpenWrt:/tmp# dd if=/dev/mtdblock0 of=/tmp/uboot.bin 384+0 records in 384+0 records out root@OpenWrt:/tmp# ln -s /tmp /www/tmp root@OpenWrt:/tmp# ls -l -rw-r--r-- 1 root root 196608 Jul 10 11:57 uboot.bin root@OpenWrt:/tmp# md5sum uboot.bin db70ae5ae66f6efbb7f334e71b95f1d0 uboot.bin
接着就能够利用scp
命令上传出uboot.bin
了。code
Opkg
Opkg
是一个轻量快速的套件管理系统,目前已成为Opensource
界嵌入式系统标准。经常使用于路由、交换机等嵌入式设备中,用来管理软件包的安装升级与下载。
经常使用命令:
opkg update 更新能够获取的软件包列表 opkg upgrade 对已经安装的软件包升级 opkg list 获取软件列表 opkg install 安装指定的软件包 opkg remove 卸载已经安装的指定的软件包
OpenWrt编译系统 – 安装
编译openwrt下载到MT7688开发板
csdn openwrt资料集合
建立软件包
用OpenWRT编译软件安装包
openwrt: Makefile 框架分析
Openwrt 交叉编译(Crosscompile)及使用SDK生成ipk安装包