零基础openwrt固件编译

零基础OpenWRT固件编译

戴维营教育《物联网/智能家居开发》课程系列

1.OpenWRT项目简介

OpenWRT是一个专用于无线路由器设备的Linux发行版。支持众多的芯片方案的路由器设备,由x86到ARM,MIPS等等。

目前稳定版本是: BARRIER BREAKER (14.07)

目前开发版本是: Chaos Calmer (trunk)

详细信息参看官方网址:https://openwrt.org

2.采用OpenWRT的智能路由器3. 采用OpenWRT的开发板WRTNodeVoCore4. 获取OpenWRT的源代码

我们可以去项目的官方网站获取其源代码,通过SVN或者GIT的方式,官方开发者网站:https://dev.openwrt.org/wiki/GetSource

trunk (main development tree)

Main repository

git clone git://git.openwrt.org/openwrt.git

14.07 branch (Barrier Breaker) – Main repository

git clone git://git.openwrt.org/14.07/openwrt.git

当然,在我们正式开始编译前我们需要把前提依赖环境和源码准备好,

打开虚拟终端,执行如下命令:

openwrt@cheetah-desktop:~$ sudo apt-get install git build-essential libncurses5-dev gawk libssl-dev subversion;openwrt@cheetah-desktop:~$ mkdir -p $HOME/opensource;openwrt@cheetah-desktop:~/opensource;openwrt@cheetah-desktop:~/opensource$ git clone git://git.openwrt.org/openwrt.git##上面命令会克隆远程仓库到本地,根据网络环境情况需要较长时间。

待源代码克隆下来之后,我们的源码和编译环境基本就OK了。

5. OpenWRT官方固件编译

进入源码目录下面进行软件包的更新与“安装”。

openwrt@cheetah-desktop:~/opensource$ cd openwrt;openwrt@cheetah-desktop:~/opensource/openwrt$ ./scripts/feeds update -a;openwrt@cheetah-desktop:~/opensource/openwrt$ ./scripts/feeds install -a;

执行上面的脚本之后就可以对我们中意的设备类型进行编译设置。如下命令进入终端下面的buildroot编译配置界面:

make menuconfig;

我们教程所采用的设备的CPU芯片是MT7620系列(MT7620A/N),下面就开始为MT7620系列的设备进行最基本的配置,步骤如下: 1.Target System (Atheros AR7xxx/AR9xxx) —>回车进入下翻后空格选择Ralink RT288x/RT3xxx然后再回车后退,这时编译目标就是:Target System (Ralink RT288x/RT3xxx) —>了。 2.Subtarget (RT3x5x/RT5350 based boards) —>回车进入下翻按空格选择(X) MT7620 based boards然后回车后退,这时编译的子目标就是:Subtarget (MT7620 based boards) —>了。 3.LuCI —>回车进去1. Collections —>再回车进去再空格选择第一个<*> luci(new),然后在Exit一路后退到主菜单。 4. 在主菜单Exit退出配置并保存。

That’s All. 基本配置就是这么简单。下面开始我们人生的“第一次”路由器固件编译了,是不是很紧张阿? What Ever. 第一次总是要经历的,那就积极面对吧。

我们用下面这个命令来进行编译固件:

make V=s

就这么一个命令就会开启整个编译构建系统,全自动的去为我们编译我们需要的固件。所以的所以,这个过程将会是一个漫长的等待。如果互联网网络比较通畅,那么咱们这第一次编译的时间大约要花2~3小时。因为构建系统需要去互联网上下载各种程序库源代码,然后再逐个编译,最后集成并组建出我们需要的固件。

这段时间里,我们大可以出去湘江边溜达一圈,隔江望望毛主席,,再回来咱们戴维营里看结果。

溜达回来后,编译也许结束,等结束的这个时候,我们的固件会乖乖的躺在当前目录下的bin/ramips/这个路径下.

openwrt@cheetah-desktop:~/opensource/openwrt$ ls bin/ramips/md5sumsopenwrt-ramips-mt7620-rp_n53-squashfs-sysupgrade.binopenwrt-ramips-mt7620-ai-br100-squashfs-sysupgrade.binopenwrt-ramips-mt7620-rt-n14u-squashfs-sysupgrade.binopenwrt-ramips-mt7620-ArcherC20i-squashfs-sysupgrade.binopenwrt-ramips-mt7620-uImage.binopenwrt-ramips-mt7620-dir-810l-squashfs-sysupgrade.binopenwrt-ramips-mt7620-vmlinux.binopenwrt-ramips-mt7620-e1700-squashfs-factory.binopenwrt-ramips-mt7620-vmlinux.elfopenwrt-ramips-mt7620-e1700-squashfs-sysupgrade.binopenwrt-ramips-mt7620-whr-1166d-squashfs-sysupgrade.binopenwrt-ramips-mt7620-Lenovo-y1-squashfs-sysupgrade.binopenwrt-ramips-mt7620-whr-300hp2-squashfs-sysupgrade.binopenwrt-ramips-mt7620-Lenovo-y1s-squashfs-sysupgrade.binopenwrt-ramips-mt7620-whr-600d-squashfs-sysupgrade.binopenwrt-ramips-mt7620-mlw221-squashfs-sysupgrade.binopenwrt-ramips-mt7620-wmr-300-squashfs-sysupgrade.binopenwrt-ramips-mt7620-mlwg2-squashfs-sysupgrade.binopenwrt-ramips-mt7620-wr8305rt-squashfs-sysupgrade.binopenwrt-ramips-mt7620-mt7620a_mt7530-squashfs-sysupgrade.bin openwrt-ramips-mt7620-wrtnode-squashfs-sysupgrade.binopenwrt-ramips-mt7620-mt7620a_mt7610e-squashfs-sysupgrade.bin openwrt-ramips-mt7620-wt3020-8M-squashfs-factory.binopenwrt-ramips-mt7620-mt7620a-squashfs-sysupgrade.binopenwrt-ramips-mt7620-wt3020-8M-squashfs-sysupgrade.binopenwrt-ramips-mt7620-mt7620a_v22sg-squashfs-sysupgrade.bin openwrt-ramips-mt7620-xiaomi-miwifi-mini-squashfs-sysupgrade.binopenwrt-ramips-mt7620-mzk-750dhp-squashfs-sysupgrade.binopenwrt-ramips-mt7620-zbt-wa05-squashfs-sysupgrade.binopenwrt-ramips-mt7620-na930-squashfs-sysupgrade.binpackagesopenwrt-ramips-mt7620-root.squashfs

那段岁月,无论从何种角度读你,你都完美无缺,

零基础openwrt固件编译

相关文章:

你感兴趣的文章:

标签云: