[vc_row][vc_column width=”1/1″][vc_column_text]Since the IOS source code of the Linux-based wireless router was released to public by Cisco/ Linksys on March 2003, enthusiasts have been working on the modification of the source code. There are many different versions with enhanced features appearing on the Internet.
Among these versions, 99% uses original LinkSys source codes, and only 1% of the source files are newly developed code. Every different version addresses different markets. By doing this, there are two drawbacks: The first is that it’s difficult to merge the advantages of different versions. The second is that it departs more and more away from the official Linux release.
OpenWrt chooses another path. It starts from scratch, adds functions into it one by one, and makes it closer and closer to the original firmware of LinkSys. One prominent feature of Openwrt is that its file system is rewritable. Developer doesn’t need to recompile the whole system after every modification. This feature makes it more like a small linux system, and speed up the development.
Advantage:
When you buy a Openwrt compatible router, you get an embedded system with CPU, FLASH and RAM. After the completion of the development, this router can be used in real life. Because it is based on Linux, linux provides many open source applications, user can install and port these open source applications.[/vc_column_text][vc_tour][vc_tab title=”Install Linux Cross Compile Environment” tab_id=”1389142972-1-89″][vc_column_text]
Install Linux system
In this tutorial, we are going to use Ubuntu 10.X as an example. The linux system can be installed on the virtual machine and can also be installed on the real PC. We recommend to install on the virtual machine.
Install virtual machine (use VMWare 7.1 as example)
nstall Ubuntu on virtual machine
We can download Ubuntu from Ubuntu download.
Configure virtual machine environment:
- Launch VMware, click menu “file”, and select “New”->”Virtual Machine”.
- Pop up the create new virtual machine wizard, and click “Next step”.
- In the “Virtual machine configuration”, click option 2 “self define”, and clock “next step”.
- In “Virtual machine format”, select “Workstation 8”, and click “Next step”.
- Select “Linux” in the operation system, and select “Ubuntu” in the version, then click “Next Step”.
- Select the virtual machine storage directory and provide virtual machine name, and click “Next step”.
- For virtual machine processors number, select “1” and “Dual core” and click “Next Step”.
- For virtual memory, it is suggested to set between 512MB and 1024MB, and click “Next Step”.
- For the network connection type, it is recommended to use “NAT”. This option will allow the virtual machine to use host’s IP to access network. Click “Next Step”.
- I/O adapter. Please select “SCSI Logic” and click “Next Step”.
- Hard Drive. Please select “Create a new virtual hard drive” and click “Next Step”.
- Virtual hard drive type. Please select “SCSI” and click “Next Step”.
- Hard drive capacity. Please set according to your need.
- Path for the disk image. Please set according to your real situation, and click “Next Step”.
Install Operation System:
- Switch to the newly configured virtual machine, and click “Setting” of the virtual machine menu. Select “CD-ROM1” device, and right click “use ISO image”, and select the Ubuntu image file, and then click “OKAY” to turn off the windows.
- Click “Turn on Virtual Machine” to turn on the virtual machine.
- Ubuntu will boot from virtual machine, and we select “Language”,”Dislay” and “Resolution”.
- Select GUI installation.
- After the loading, we enter into the installation interface.
- Select the keyboard layout. We will select “American English”.
- Scan for hardware and CD. It will take a while.
- Automatically configure network.
- Configure network, and first it needs computer name.
- It will scan for hard drvie.
- Partition setup. It can be manual or automatic. We will select automatic partition.
- Time setup.
- Ask for username and password.
- Finishing the installation.
Compile Openwrt firmware
Prepare the compilation environment package
We will use root to install the package.
- sudo apt-get install gcc
- sudo apt-get install g++
- sudo apt-get install binutils
- sudo apt-get install patch
- sudo apt-get install bzip2
- sudo apt-get install flex
- sudo apt-get install bison
- sudo apt-get install make
- sudo apt-get install autoconf
- sudo apt-get install gettext
- sudo apt-get install unzip
- sudo apt-get install subversion
- sudo apt-get install libncurses5-dev
- sudo apt-get install ncurses-term
- sudo apt-get install zlib1g-dev
- sudo apt-get install gawk
- sudo apt-get install git-core
- sudo apt-get install libz-dev
After the installation is done, we can use ‘apt-get clean’ to clean cache.
Prepare openwrt source files
Logout root and login use normal user. The source files has two favors: trunk (latest and not stable) and backfile (stable).
Switch to home directory:
cd /home
Download trunck source files:
svn co svn://svn.openwrt.org/openwrt/trunk
Download back file source files:
svn co svn://svn.openwrt.org/openwrt/branches/backfile
Select the version you want.
Switch to the download directory by using:
cd /home/trunk
or
cd /home/backfile
Update the source files using:
svn up
Update software package:
./scripts/feeds update –a
./scripts/feeds install –a
Prepare to compile
- ‘make defconfig’ to generate the .config file including all default options.
- ‘make menuconfig’ to configure the firmware.
Select TP-LINK TL-WR703N in the Target Profile, where it is the target router. Other options can be chosen according to real need, [*] means complied into the kernel, [M] means selecting to install after boot, [] means removing the package.
After selection, select “EXIT” and save.
- ‘make V=99’ to begin compilation. First time compilation takes about 4 hours.
Finish the compilation
The target files are generated under /home/trunk/bin/ar71xx.
Under the directory “packages”, there are generated package file, ipk format.
Factory firmware: openwrt-ar71xx-generic-tl-wr703n-squashfs-factory.bin
Upgrade firmware: openwrt-ar71xx-generic-tl-wr703n-squashfs-sysupgrade.bin
Clean Compilation files
- ‘make clean’ It is used to clean intermediate files. buxxx_dir will be deleted. Rebuild needs 2 hours.
- ‘make dirclean’ It is more clean compared to ‘make clean’.
- ‘make distclean’ It is used to initialize the compilation environment.
Upload firmware
There are many ways to upload firmware.
- Use virtual machine, and create a shared directory between virtual machine and Windows.
- On windows, set up ftp server, and in Ubuntu, use ftp 192.168.1.1 (host ip) and ftp firmware to windows using command “put local-file remote-file”.
- Install utility package on virtual machine. It will enable USB flash drive. Copy firmware through the USB flash drive.
[/vc_column_text][/vc_tab][vc_tab title=”Install OpenWRT” tab_id=”1389142972-2-4″][vc_column_text]
Upgrade through Web portal
- Connect PC to the router’s LAN RJ45, or use WiFi. We recommend to use RJ45.
- Open browser, and login into 192.168.1.1 to enter into router’s management interface.
- Select “Software upgrade”, and flash openwrt-ar71
Log into OpenWrt
- By default, Openwrt enables telnet service. Now we can use telnet to log into router (we can use putty, SecureCRT, DOC etc telnet tools). Use the command: telnet 192.168.1.1
- Add root user. Use command passwd to modify password of root. After password of root is changed, the system will automatically turn off telnet, and turn on ssh service. Now reboot the router.
- Use ssh client to log into router. User command: ssh -l root 192.168.1.1
- Configure network
Edit network, and add dns and gateway.
Edit wireless, and enable wireless. Note: Both #option disbale 1 and option disable 0 represent to turn on wireless network.
- Reboot network
Install software package
- Update software package
- Install software package
- web control console:
- opkg install luci
- /etc/init.d/uhttpd enable Configure luci to be the mode that it will automatically turn on after reboot
- /etc/init.d/uhttpd start
- Driver of camera
- opkg install kmod-i2c-core
- opkg install kmod-video-core
- opkg install kmod-usb-video
- opkg install video-gspca-core
- opkg install video-gspca-zc3xx #minivision camera like zc301 zc303 zc305 need to install this
- opkg install kmod-video-uvc #driver free uvc camera needs to install this
- opkg install mjpg-streamer
- web control console:
Note: The above software package may be included in your firmware, and not needed to be installed.
After the installation, we can configure the camera paramters:
- Configure the software to be automatically on after reboot (mjpg_streamer, ser2net)
Create a script named wificar under /etc/init.d/:
Add the execution right to wificar: ‘chmod +x /etc/init.d/wificar’.
Create a link file under /etc/rc.d: ln –s /etc/init.d/wificar /etc/rc.d/S80wificar
Other methods to install the software packages
WinSCP
Copy the downloaded ipk package to Openwrt’s /tmp through WinSCP tool.
Switch to /tmp by using: cd /tmp Install the package: opkg install xxx.ipk
Http (we used HFS)
Then we use the following remote download command in openwrt:
At last, we install the package by using: opkg install xxx.ipk
FTP (We used Qucik Easy FTP Server 4.0)
we are going to use the following command:
wget ftp//username:passwd@127.0.0.1/** –C /tmp/**
Then we are going to install the package by:
opkg install xxx.ipk
[/vc_column_text][/vc_tab][vc_tab title=”Flash router using TTL UART (if step 3 doesn’t work)” tab_id=”1389143307118-2-3″][vc_column_text]
Connect to Router using TTL UART
- USB to TTL cable
RXD: Data receiver end TXD: Data send end GND: Ground (When connect USB TTL cable to the router, only TXD, RXD and GND are needed).
- wr703n
Note:
The solder point left to red GND is the ground. TP_IN to the right to RXD is the send end. TP_OUT to the left of TXD is the receiver end.
Flash router
- Turn on tftp service. The tool that we used is tftpd32.
- Use the serial terminal tool to access the router. We can use putty or SecureCRT. Here we are going to use SecureCRT.
- Display the boot information on the serial terminal, and press TPL (three characters on the keypad) to abort the boot processing.
- The detailed list of commands:
- setenv ipaddr 192.168.1.2
- setenv serverip 192.168.1.12 (IP of the host PC)
- tftpboot 0x80000000 xxx.bin
- erase 0x9f020000 +0x3c0000
- cp.b 0x80000000 0x9f020000 0x3c0000
It is as shown in the following:
Hardware parameters of WR703N
- Atheros AR7240 CPU (400Mhz)
- Atheros AR9331 Chipset (integrated wireless)
- 802.11 b/g/n 150Mbps (130Mbps real)
- wireless power output 20dBm – 100mW
- 4 MB flash memory
- 32 MB RAM
- USB 2.0 port
- Powered via micro-USB socket
- Tiny form factor: 5.7cm x 5.7cm
Leave a Reply
You must be logged in to post a comment.