LinkSprite CuHead Pro Wifi shield can also be used to for OpenWRT. In this tutorial, we will show how to port OpenWRT to CuHead Pro.
- Install the dependency for building OpenWRT
- Use Trunk of OpenWRT
- Connect the debug port
- Download bin file to CuHead Pro
All the pins of RT5350 core boards are connected to the shield, such as 1 x USB host, 1 x WLAN, 1 x I2S, 1 x I2C, 1 x SPI, and several GPIOs. Customers can use CuHead Pro to design router, portable storage, 3G Hot spot, Lan to WiFi, serial data transceiver, Voip, WiFi Audio, etc.
OpenWRT is an embedded Linux system. The mainstream router firmwares are dd-wrt, tomato and OpenWRT. The package management provides a rewritable file system. Designers can choose and configure the options provided by the vendors. In the following, we will detail the process porting OpenWRT to CuHead Pro.
- Development environment: 64 bits Ubuntu.
- The command starting with ‘$’ means the commands are executed on pcDuino.
- The command starting with ‘#’ means the commands are executed on a x86-64 Linux machine.
- The command starting with ‘>’ means the commands are executed on u-boot status of pcDuino.
#sudo apt-get install subversion #sudo apt-get install git-core #sudo apt-get install gcc g++ binutils patch bzip2 flex bison make autoconf gettext texinfo unzip sharutils subversi-dev ncurses-term zlib1g-dev
Create a directory for OpenWRT, and download using svn:
#mkdir openwrt #cd openwrt # svn co svn://svn.openwrt.org/openwrt/trunk
Update software packages:
#cd trunk # ./scripts/feeds update –a
Install all software packages:
# ./scripts/feeds install –a
After download, we need to configure the build.
The following interface will pop up:
The configuration of CuHead Pro is same as the one of HAME-MPR-A2 of HAME.
1. Select the model of CPU:
Target System —> Ralink RT288x/RT3xxx
2. Select the sub-model of CPU:
Subtarget —> RT3x5x/RT5350 based boards
3. Select the model of router:
Target File —>HAME-MPR-A2
Most routers have a web interface that can be used to configure the router. The web interface used on pcDuino is called LUCI. Here we can select the language of web, App.
1. Default to have Luci:
LuCI —> Collections —> <*> luci
2. Choose the default APP of Luci:
LuCI —> Applications —> <*> luci-app-ddns……………………… Dynamic DNS configuration module <*> luci-app-hd-idle……………………. Hard Disk Idle Spin-Down module <*> luci-app-multiwan………… LuCI Support for the OpenWrt MultiWAN agent
3. Configure to use the default theme of OpenWRT:
LuCI —> 4. Themes —> <*> luci-theme-openwrt……………………………………. OpenWrt.org
4. Default Language:
LuCI —> 5. Translations —> <*> luci-i18n-chinese………………….. Chinese (by Chinese Translators)
As the WiFi is default to be OFF, we need to make a change here.
Modify the file “/trunk/package/mac80211/files/lib/wifi /mac80211.sh”:
# REMOVE THIS LINE TO ENABLE WIFI:
#option disabled 1 –changed it to be this, i.e., comment out this line
Now we can start to build the whole system with the command:
It will take a long time to finish the first build as it will need to download many software packages. The speed really depends on the network connection. It takes 4 hours for me. The switch ‘V=s’ means that it will print out all the build information.
After the build, the generated files are located under ‘bin/ ramips’.
The file openwrt-ramips-rt305x-mpr-a1-squashfs-sysupgrade.bin is the file we need. We need to download it and flash to CuHead Pro. Here we provide a copy of openwrt-ramips-rt305x-mpr-a1-squashfs-sysupgrade.bin.
Remove the jumpers used to connect RX/TX of CuHead Pro to Arduino Uno. Use a USB serial breakout board to interface to the UART of CuHead Pro. It should be connect the RX/TX of the CuHead WiFi Shield.
We also need to connect Ethernet port of CuHead Pro to the same router that is used by your PC.
Launch a serial terminal. In this case, it is SecureCRT. The baud rate is 57600.
The uboot of CuHead Pro supports tftp method to download code. We need a software named Tftpd32.
Run the software, and click the list of server interfaces:
In this case, 192.168.100 is the IP address of my PC’s WiFi card. Also, please select the bin file generated in last step.
Then we use the serial debug terminal to talk to the debug port. Power cycle CuHead Pro, and press ’2′ immediately after power cycle. We will enter into the following:
Enter Y, and begin to set up the parameters:
Here we can see that the device IP is the IP of CuHead Pro. It can be any IP of the LAN. It also needs to be in the same IP section of the server. It will begin to download after we press ‘ENTER’.
CuHead Pro will reboot after it finished downloading. Your PC will see a hotspot named ‘Openwrt’ after it boots up.
Connect to the hot spot named ‘Openwrt’, and type 192.168.1.1 as the IP address:
It will prompt that there is no password. You can login to configure the router. At the same time, PC can access network via CuHead Pro as router.