WRTnode是基于Wi-Fi AP-Soc的开源硬件开发板。使用联发科(Mediatek)mt7620方案。体积小,成本低,功耗尚可接受,计算能力还不错,天生高速的wifi交换能力。
官方网址 http://wiki.wrtnode.com/index.php?title=Main_Page/zh-cn
虽然 WRTnode 上提供 gcc,但是编译速度以及存储等限制,所以并不足以用来
开发软件。 需要用到交叉开发模式:在PC 上编辑、编译软件 ,然后在 WRTnode
板上运行、验证程序。以下为在Ubuntu下安装WRTnode的交叉编译环境OpenWrt的步骤:
1.打开Ubuntu操作系统,单击 Search your computer and online sources,输入 Terminal,单击运行 Terminal。
2.配置Linux编译环境。根据系统选择输入以下命令,按回车执行。
Debian 5 Lenny:
apt-get install gawk ncurses-dev unzip zlib1g-dev
Debian 6 Squeeze:
apt-get install libncurses5-dev zlib1g-dev gawk flex libssl-dev sdcc-nf
Debian 7 Wheezy:
apt-get install libncurses5-dev zlib1g-dev gawk
Ubuntu 13.10:
sudo apt-get install build-essential subversion git-core libncurses5-dev zlib1g-dev gawk flex quilt xsltproc
Ubuntu 12.04LTS:
sudo apt-get install build-essential subversion git-core libncurses5-dev zlib1g-dev gawk flex quilt libssl-dev xsltproc libxml-parser-perl mercurial bzr ecj cvs unzip
Ubuntu 64bit:
sudo apt-get install build-essential subversion libncurses5-dev zlib1g-dev gawk gcc-multilib flex git-core gettext
Fedora 17:
yum install -y subversion binutils bzip2 gcc gcc-c++ gawk gettext flex libz-dev flex ncurses-devel zlib-devel make patch unzip perl-ExtUtils-MakeMaker
Fedora 18 – 64Bit (Maybe also for lower versions, some packages seem to be missing above):
yum install -y subversion binutils bzip2 gcc gcc-c++ gawk gettext flex ncurses-devel zlib-devel make patch unzip perl-ExtUtils-MakeMaker \ glibc glibc-devel glibc-static quilt ncurses-lib sed sdcc intltool sharutils bison#Maybe you need glibc.i686 glibc-static.i686 glibc-devel.i686 libgcc.i686 too
Fedora 19 – 64Bit (Maybe also for lower versions, some packages seem to be missing above):
yum install -y subversion binutils bzip2 gcc gcc-c++ gawk gettext flex ncurses-devel zlib-devel make patch unzip perl-ExtUtils-MakeMaker \ glibc glibc-devel glibc-static quilt ncurses-lib sed sdcc intltool sharutils bison wget
openSuSE 11.1
zypper install binutils bzip2 gawk gcc gcc-c++ gettext make ncurses-devel patch unzip wget zlib-devel flex git-core
In openSuSE some packages require additional repositories. Search on http://packages.opensuse-community.org and add repositories like that:
zypper ar"http://download.opensuse.org/repositories/devel:/languages:/perl/openSUSE_11.1/devel:languages:perl.repo"
Arch Linux
pacman -S --needed subversion asciidoc bash bc binutils bzip2 fastjar flex git gcc util-linux gawk intltool zlib make cdrkit ncurses openssl patch perl-extutils-makemaker rsync sdcc unzip wget gettext libxslt zlib boost libusb bin86 sharutils b43-fwcutter findutils
3.建工作目录:
$ mkdir OpenWrt $ cd OpenWrt
4.下载 OpenWrt,并将其放到OpenWrt目录下:
$ wget http://downloads.openwrt.org/chaos_calmer/15.05/ramips/mt7620/OpenWrt-SDK-15.05-ramips-mt7620_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64.tar.bz2
经过漫长的等待,下载完成。你也可以通过U盘安装,那样就不用网上下载了。
5.解压 OpenWrt,并重命名:
$ tar -jxvf OpenWrt-SDK-15.05-ramips-mt7620_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64.tar.bz2
$ mv OpenWrt-SDK-15.05-ramips-mt7620_gcc-4.8-linaro_uClibc-0.9.33.2.Linux-x86_64 WRTnode-SDK
$ cd WRTnode-SDK
6.开发hello wrold的软件包
(1)进入package目录:
$ls
$cd package
(2)在package目录下创建helloworld目录,并进入helloworld目录:
$mkdir helloworld $cd helloworld
(3)创建 helloworld.c 并编辑
$vi helloworld.c
按下 'i' 进行编辑,输入以下代码:
#include
int main(void)
{
printf("Hello World!\n");
return 0;
}
按下 Esc 按键,输入":wq"(输入" "中的),按回车保存并退出。
(4)使用 mipsel-openwrt-linux-gcc 编译 helloworld.c
$export STAGING_DIR=~/OpenWrt/OpenWrt-SDK/staging_dir/
$export PATH=$STAGING_DIR/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin
$mipsel-openwrt-linux-gcc helloworld.c -o helloworld
7.上电WRTnode,将电脑连接到热点 ITRON+xxxx 上,密码与WIFI名一样
8.重新打开 Terminal,将编译出的文件 helloworld 上传到WRTnode上:
$ cd ~/OpenWrt/WRTnode-SDK/package/helloworld
$ scp helloworld [email protected]:/tmp/
9.远程登录WRTnode:
$ ssh [email protected]
输入登录密码,密码不显示,按回车登录。
10.执行 helloworld:
# cd /tmp
# ls
# ./helloworld