01204428 Wireless Embedded Systems - CPE.KU
-
Upload
khangminh22 -
Category
Documents
-
view
0 -
download
0
Transcript of 01204428 Wireless Embedded Systems - CPE.KU
OpenWRT #2
Aphirak Jansang, D.Eng.
http://www.cpe.ku.ac.th/~aphirak
IWING Lab,
Department of Computer Engineering,
Faculty of Engineering,
Kasetsart University
1 01204428 Wireless Embedded Systems
February 14, 2013
ASUS 500gp
01204428 Wireless Embedded Systems 3
http://usa.asus.com/Networks/Wireless_Routers/WL500g_Premium/
* Pictures from http://en.wikipedia.org/wiki/Asus_routers
ASUS 500gp – Physical Look
01204428 Wireless Embedded Systems 4
* Pictures from https://www.epointsystem.org/trac/vending_machine/wiki/WL500gP
Supported target for ASUS 500gp
01204428 Wireless Embedded Systems 6
For Backfire 10.03, brcm-2.4 target
uses an older 2.4 kernel
uses the binary only broadcom driver, which supports the wireless in the v2.
Recommended for v2
brcm47xx target
uses a current 2.6 kernel, it is faster and has more features
uses the open source b43 wireless driver, which currently does not work with the wireless in the v2
Recommended for v1
For "Attitude adjustment“ 12.09, uses BCM947xx/953xx target for both v1 and v2
Switch Ports for VLANs
01204428 Wireless Embedded Systems 8
For v1,
- vlan0 = eth0.0
- vlan1 = eth0.1, eth0.2, eth0.3 eth0.4
For v2,
- vlan0 = eth0.4
- vlan1 = eth0.0, eth0.1, eth0.2 eth0.3
Install a new firmware on ASUS 500gp
01204428 Wireless Embedded Systems 9
First, put router in “diag mode”
Second, install a new firmware by
TFTP method
or
ASUS Firmware Restoration Utility method
First: put router in “diag mode”
01204428 Wireless Embedded Systems 10
assume: router’s IP address is 192.168.1.1
put the router in diag mode
To put router in diag mode:
Unplug the router's power cord
Confirm your PC is configured to use a fixed IP in the 192.168.1.0/24 range (do not use .1)
Connect the router's LAN port directly to your PC
Push the black RESTORE button using a pen or such, and keep the button pushed down
Plug the power on while keeping the RESTORE button pushed for few seconds
When you see a slowly blinking power light, you are in diag mode
Now the router should accept an image via TFTP or via the ASUS firmware restoration tool
Second: install a new firmware
01204428 Wireless Embedded Systems 11
By TFTP method
Linux (or Mac OS X)
By ASUS firmware restoration tool (windows)
Based on ASUS WL-500gP V2 utilities
tftp 192.168.1.1 (replace it with its real ip address)
tftp> binary
tftp> trace
tftp> put openwrt-brcm-2.4-squashfs.trx
OpenWRT buildroot
01204428 Wireless Embedded Systems 13
a set of Makefiles and patches that makes it easy to
generate a complete embedded Linux system
Buildroot can generate any or all of
cross-compilation toolchain
root filesystem
kernel image
bootloader image
Preparing Ubuntu for OpenWRT buildroot
01204428 Wireless Embedded Systems 14
To Build the Buildroot, the following packages must be
installed
build-essential - this installs a complete build environment
libssl-dev
libncurses-dev
bison
flex
texinfo
zlib1g-dev
gettext
autoconf
patch
subversion
sudo apt-get install build-essential \
libncurses-dev bison flex texinfo \
zlib1g-dev gettext libssl-dev \
autoconf subversion
OpenWRT Buildroot procedure
01204428 Wireless Embedded Systems 15
Download OpenWrt sources from SVN
Download and install feeds using feeds script
Configure the build
Start the build
compile toolchain
cross-compile sources and packages
generate an image ready to be flashed
Proceed to Installing OpenWRT
- Do everything as non-root user!
- Issue all OpenWrt Buildroot commands in the <buildsystem root> directory,
e.g. ~/openwrt/trunk/
-Do not build in a directory that has spaces in its full path
OpenWRT branch
01204428 Wireless Embedded Systems 16
https://dev.openwrt.org/wiki/GetSource
select the OpenWRT branch
Download OpenWrt sources from SVN
01204428 Wireless Embedded Systems 17
e.g. select OpenWRT development branch (trunk)
all buildroot sources for development branch will be installed in ~/openwrt/trunk
Updating to the latest sources
mkdir ~/openwrt
cd ~/openwrt
svn co svn://svn.openwrt.org/openwrt/trunk/
cd trunk
svn up
OpenWRT feeds
01204428 Wireless Embedded Systems 18
feed: a collection of packages which share a common
location
Default feed defined in <builroot dir>/feeds.conf.default
feed method feed name feed source
src-svn packages svn://svn.openwrt.org/openwrt/packages
src-svn xwrt http://x-wrt.googlecode.com/svn/trunk/package
src-svn luci http://svn.luci.subsignal.org/luci/trunk/contrib/package
*http://wiki.openwrt.org/doc/devel/feeds
feed methods
01204428 Wireless Embedded Systems 19
current supported feed methods
feed method function
src-bzr downloaded from the source path/URL using bzr
src-cpy copied from the source path
src-darcs downloaded from the source path/URL using darcs
src-git downloaded from the source path/URL using git
src-hg downloaded from the source path/URL using hg
src-link A symlink to the source path is created
src-svn downloaded from the source path/URL using svn
*http://wiki.openwrt.org/doc/devel/feeds
Download and install feeds
01204428 Wireless Embedded Systems 20
using feeds script to install package sources
to install individual feed
e.g. install only LuCI feed
./scripts/feeds update –a
./scripts/feeds install -a
./scripts/feeds install luci
./scripts/feeds script means "making package available in make menuconfig"
rather than really installing or compiling package.
Configure the build
01204428 Wireless Embedded Systems 21
Use the following command to check the missing
packages on build system
make defconfig
make prereq
make menuconfig
Build configuration
01204428 Wireless Embedded Systems 23
Standard configuration process
Target system
Package selection
Build system settings
Kernel modules
Type of selective option
< > - the source code will not be processed
<M> - the source code of the package will be cross-compiled into
binaries and a opkg package will be built
<*> - the package will built into the firmware
Kernel configuration
01204428 Wireless Embedded Systems 24
To modify the Kernel configuration templates
Issuing “make kernel_menuconfig”
To revert back saved configuration
svn revert -R target/linux/
Start the build
01204428 Wireless Embedded Systems 25
To build OpenWRT image from Buildroot
To enable verbose mode while build OpenWRT image
Building OpenWRT on multi-core CPU, e.g 3 cores
make world
make world V=99
make world –j 3
make world –j 3 V=99
Building process
01204428 Wireless Embedded Systems 26
After issuing “make world”, it will do the following steps
compile the toolchain
Cross-compile the sources with this toolchain
create opkg-packages
create a firmware image file ready to be flashed
Checking build errors
01204428 Wireless Embedded Systems 27
Assumption build.log location: ~/openwrt/trunk/build.log
To spot the error
make V=s 2>&1 | tee build.log | grep -i error
Compiled OpenWRT image
01204428 Wireless Embedded Systems 28
the compiled OpenWRT fimrware and packages are located in ~/openwrt/trunk/bin/<selected
platform>
e.g for ar71xx platform, the compiled firmware will
locate in ~/openwrt/trunk/bin/ar71xx
Cleaning up build directory
01204428 Wireless Embedded Systems 29
Clean
deletes contents of bin and build_dir directories
Dirclean
deletes contents of /bin and /build_dir directories and
additionally /staging_dir and /toolchain
Distclean
deletes everything
make clean
make dirclean
make distclean
Building single package
01204428 Wireless Embedded Systems 30
To build only a package
e.g. cups
To build a package in feeds
e.g. mc (midnight commander package)
make package/cups/compile V=s
make package/feeds/packages/mc/compile V=s
Custom files
01204428 Wireless Embedded Systems 31
to have a custom image that has been pre-configured
before issuing “make world”
place your custom files in
<buildroot dir>/files/
e.g. modified /etc/config/firewall in build image
place the modified firewall configuration file in
<buildroot dir>/files/etc/config/
References/Materials
01204428 Wireless Embedded Systems 32
http://vivekian2.wordpress.com/2007/03/28/building-your-
own-package-for-openwrt/
https://wiki.projectmeshnet.org/Build_for_OpenWRT
https://gnunet.org/mhd-on-openwrt
http://wiki.openwrt.org/doc/howto/build
http://wiki.openwrt.org/doc/howto/start
http://wiki.openwrt.org/doc/devel/feeds