Professional Documents
Culture Documents
K.HARITHA (10011P0410)
G.TEJA (10011P0408)
December 2013
CERTIFICATE
This is to certify that the Project Report entitled "Porting OpenWrt On D-Link
DWL-2100AP" being submitted by E.Shivani, A.Pramod Kumar, K.Haritha, G.Teja
in partial fulfillment for the award of the Degree of Bachelor of Technology in
Electronics and Communication Engineering at Jawaharlal Nehru Technological
University during the academic year 2010-15.
The results embodied in this project report have not been submitted to any other
University or institute for the award of any Degree or Diploma.
CERTIFICATE
This is to certify that the Project Report entitled "Porting OpenWrt On D-Link
DWL-2100AP" being submitted by E.Shivani, A.Pramod Kumar, K.Haritha, G.Teja
in partial fulfillment for the award of the Degree of Bachelor of Technology in
Electronics and Communication Engineering at Jawaharlal Nehru Technological
University during the academic year 2010-15.
The results embodied in this project report have not been submitted to any other
University or institute for the award of any Degree or Diploma.
E.SHIVANI (10011P0407)
A.PRAMOD KUMAR (10011P0401)
K.HARITHA (10011P0410)
G.TEJA(10011P0408)
ACKNOWLEDGEMENT
I sincerely express my deep sense of gratitude to my project guide Dr. L.
PRATAP REDDY, Professor, ECE Department, JNTU College of Engineering,
Hyderabad, for his invaluable help, efficient guidance and encouragement to me
throughout this project.
I am thankful to Dr.D.VINAY BABU, Principal, JNTU College Of
Engineering for his implicit moral support during this project work.
I take this opportunity to specially thank Dr.D.SRINIVASA RAO, Professor &
Head of ECE Dept.for his timely advice and guidance while pursuing this project as
well as throughout the B.Tech course.
I also owe a deep respect of gratitude to my parents and friends for their
cheerful encouragement and valuable suggestions, without whom this work could not
have been completed in the stipulated time.
I would like to articulate my heartfelt gratitude to the authorities of JNTU for
their help throughout my project work. A few lines of acknowledgement do not fully
express my gratitude and appreciation for those who guided and supported me
through this report. Last but not in the least, I acknowledge the help received from
many journals and websites.
Finally, I thank one and all who helped me directly or indirectly right through
my project work.
Regards
E.SHIVANI(10011P0407)
A.PRAMOD KUMAR(10011P0401)
K.HARITHA(10011P0410)
G.TEJA(10011P0408)
ABSTRACT
TABLE OF CONTENTS
Abstract
List of Figures
1 Introduction
1.1 Introduction to D-Link DWL-2100AP
1.1.1 Brief Summary
1.1.2 Router Connections
1.1.3 Features
1.2 Introduction to OpenWrt
1.2.1 Features
1.2.2 Advantages
1.3 Objective and Methodology
1.4 Organization of Chapters
4 Porting
4.1 Ramdisk Network Boot
5 Conclusion
6 References
LIST OF FIGURES
FIGURE NO
FIGURE NAME
1.1
D-link DWL-2100AP
1.2
Router Connections
2.1
2.2
2.3
Serial console
2.4
Serial port
2.5
Jtag cable
2.6
Jtag connections
3.1
3.2
D-link Setup
PAGE
1. INTRODUCTION
1.1 Introduction to D-Link DWL-2100AP
1.1.1 Brief Summary
D-link DWL-2100AP is a wireless access point. It provides up to fifteen times
the maximum wireless signal rate of previous wireless devices (up to 108Mbps* in
Super G mode) .Thus, one can work faster and more efficiently, increasing
productivity. With the DWL-2100AP, bandwidth-intensive applications like graphics
or multimedia will benefit significantly because large files are able to move across
the network quickly.
and special events. Through this it is possible to send and receive large packets of
data simultaneously.
A Wireless Local Area Network (WLAN) is a computer network that transmits
and receives data with radio signals instead of wires. WLANs are used increasingly in
both home and office environments, and public areas such as airports, coffee shops
and universities. Innovative ways to utilize WLAN technology are helping people to
work and communicate more efficiently. Increased mobility and the absence of
cabling and other fixed infrastructure have proven to be beneficial for many users.
1.1.2 Router Connections
1.2.1 Features
Free and open-source: The project is entirely free and open-source, licensed
under the GPL. The project is intend to always be hosted at an easily accessible
site, with full source code readily available and easy to build.
Easy and free access: The project will always be open to new contributors and
have a low barrier for participation. Anyone shall be able to contribute. The
current developers, actively grant write access to anyone interested in having
it.
Community driven.
OpenWrt has long been established as the best firmware solution in its class. It
far exceeds other embedded solutions in performance, stability, extensibility,
robustness, and design. Open architecture enables one to use stateful packet
inspection, intrusion detection, and any number of other things that normally require
several thousand dollars worth of hardware to do effectively.
At the moment there are more than 2000 software packages in the official
repository, and many more provided by the community. The number of packages is
evidence of the effectiveness of the OpenWrt build system, which provides the
opportunity to easily port packages and create your own firmware.
1.2.2 Advantages(if supported by the router hardware):
OpenWrt enable sophisticated features on a very low-cost router. This has
almost every feature one could ask for or will ever need- features often only found on
enterprise routers like Cisco and MicroTek - but with a GUI. OpenWrt is arguably the
best operating system for a SOHO(Small Office/Home Office).
Use all the hardware's capabilities: Full control of your router hardware- not
just what the manufacturer allows.
Create multiple wireless networks, multiple SSIDs. For example: Create a
guest access WLAN.
Create a multiple physical networks, using VLAN techniques: One can create a
separate network for a neighbour, kids computers or those game consoles that
need that need all ports forwarded and just cannot trust.
Use standard IP tables for firewall and packet shaping and policing techniques.
Install additional software on the broadband router to make it a web server, bit
-torrent client or audio streamer for example, or all of that and more.
Because it is open source, it is probably more secure and better in respect to
one's privacy than the stock firmware from the factory.
A Linux system
A serial console that acts as interface between router's serial port and PC.
An Ethernet cable connecting the router's Ethernet port to the computer's port.
MIPS 4Kc
Vendor
D-Link
Bootloader
VxWorks
Wireless System-on-chip
Atheros AR2313A
CPU Speed
180/240MHz
Flash Chip
Flash Size
4MiB
RAM
16Mib
Wireless
Atheros AR2112A
Ethernet
IC+IP101A (A2/A3/A4/A5)
USB
No
Serial
Yes 9600-8N1
JTAG
Yes
Most routers come with an UART integrated into the system-on-chip and its
pins are routed on the Printed Circuit Board(PCB) to allow debugging, firmware
replacement or serial device connection (like modems). Finding an UART on a router
is fairly easy since it only needs 3 signals (without modem signalling) to work: GND,
TX and RX (often accompanied by VCC).
To find out the serial console pins on the PCB, we will be looking for a
populated or unpopulated 4-pin header, which can be far from the SoC (signals are
relatively slow) and usually with tracks on the top or bottom layer of the PCB, and
connected to the TX and RX. In order to interact with our device over its serial port,
we need a minimum of three wires connected: a ground (GND); transmit (TX); and
receive (RX). It is possible to get useful information about what is happening with
only GND and RX, but in order to fix a problem we usually also need TX. Our
computer TX should be connected to the device RX, and our computer's RX should
be connected to the device TX. The computer's GND should connect the device's
GND. That way, what we say will get heard by the device and what the device says
will get heard by our computer. This is often called a "null-modem" configuration.
We also need a terminal emulation program on our computer, such as minicom,
hyperterminal, etc. The terminal emulation program needs to be configured to be
compatible with our device, in particular, with regard to baud rate and flow control. If
we are using only three wires (GND, TX, and RX) then hardware flow control should
be turned off; we aren't using the pins (RTS and CTS) necessary for it to work.
Rarely, the baud rate that the device expects might be different in the
bootloader and the running firmware; if so, you'll need to modify the baud rate
settings in your terminal emulator after the firmware boots up.If we get something
like this during the bootcycle (output is garbled)So in contrast to the JTAG-PORT, the
Serial Port needs some software running on the CPU so we can use it. If the
bootloader is damaged, or doesn't offer such a feature, the port is useless.
Most devices supported by OpenWrt include a serial port. These serial ports
typically provide a console to the boot-loader and when the firmware has booted a
console to the running system. Typically, a console to the boot-loader will allow us to
configure a network, fetch and flash a new firmware, which can be a life-saver when
the firmware is broken. A console to the running system will let us correct a
misconfigured network.
In router Serial console provides an interface for interrupting the boot process
in the router while boot process is in progress. It represents hardware interface
between router on-board serial port and PC. It is usually used to see boot process and
interact boot loader. This is possible only if opening the case and attaching a TTL line
converter cable. Then we can stop the boot process by pressing ESC on boot-up until
we get a boot prompt and change the boot-loader environment settings.
2.2.3 JTAG
JTAG (joint test action group) was originally known for testing printed circuit
boards. This was later standardized as IEEE 1149.1 Standard Test Access Port. Today
JTAG is commonly known for a JTAG Debug Port in many embedded systems.
JTAG is a communication/debug interface to access flash chips directly even
when the OS is corrupted or not installed. If the device is bricked by flashing it with
incorrect firmware, interrupting the flashing process, etc., we can use JTAG to bring
the device back to life. We can also use JTAG to make backups of our existing flash
content. This is very useful for porting.
There is always a JTAG automate (JTAG logic) integrated into our SOC or
CPU and usually this is connected to a JTAG header on the PCB. We can test and
program the IC by issuing JTAG commands to it through the JTAG.To do that, we
need to connect the parallel port of our PC with the JTAG header on the PCB via a
bought or a homemade "JTAG cable". We then run a special JTAG software on our
PC, which allows us to comfortably control the JTAG automate and make it perform
commands like reads and writes at arbitrary locations.
As already stated the primal intention of the JTAG automate is to test the IC
itself. But of course it can additionally be utilized to recover a device if you erased
the bootloader resident on the flash. Because, through the JTAG automate in the SoC,
we can also write to the Flash Chip.
A JTAG port can be used without any software running on the IC itself, but the
IC still has to be powered by a separate power supply. This means, we can solder a
lonely SoC to a PCB, no Flash-Chip, no RAM; then connect to it via JTAG and
interact with the SoC. On the PC itself, we should have some sort of software, to
make this interaction with the hardware on the lowest level possible a bit more
comfortable. If there is a flash chip soldered onto the PCB, we could access this chip
by programming the SoC via JTAG. It is one of those amazingly useful things that
allows us to recover from pretty much anything that doesn't involve a hardware
failure.
There is no one JTAG automate. Different SoCs/CPUs/ISAs have different
JTAG automates behaviour and reset sequence, most likely we will find ARM and
MIPS CPUs, both having their standard to allow controlling the CPU behavior using
JTAG.
Finding JTAG connector on a PCB can be a little easier than finding the UART
since most vendors leave those headers unpopulated after production. JTAG
connectors are usually 12, 14, or 20-pins headers with one side of the connector
having some signals at 3.3V and the other side being connected to GND.
1
3
5
7
9
11
13
2
4
6
8
10
12
14
GND
GND
GND
GND
GND
n/a
Vcc
A buffered cable such as the Wiggler requires an external Vcc voltage supply. The 14pin header conveniently supplies this voltage on pin 14. The typical unbuffered cable,
however, does not require an external voltage in order to function. Formally, the pin
14 is called VREF and used to indicate a JTAG signal levels: 5V, 3.3V or 2.5V. On
the most devices this pin is tied to the device's Vcc and may be used to power a buffer
IC chip (and to generate an appropriate levels as result) .
Redboot loader is installed using JTAG method. The safest way to change the
boot loader is by using both j-tag and serial interface. If something gets broked, we
can re-install the original firmware.
If wired connection is available click on it and press edit, else add a new
connection.
In Editing Wired Connection dialog box go to IPv4 section and choose method
as manual.
Change the IP address to an address in the vicinity of the router's default
address of 192.168.0.50
Change net mask to 255.255.0.0 and keep Gateway as 0.0.0.0
3.2 Bootloader
The default bootloader present in the D-link DWL-2100 AP is Vxworks.But
inorder to change the existing firmware of the router we need to install a new
bootloader too.So here for porting OpenWrt , we are loading Redboot on D-link
DWL-2100AP.
3.2.1 Redboot
RedBoot (Red Hat Embedded Debug and Bootstrap) is an open source
application, employing eCos real-time operating system , used to provide bootstrap
firmware for embedded systems through Hardware Abstraction Layer. It allows the
download and execution of embedded applications, including embedded Linux and
eCos applications via serial or Ethernet. Provision of an interactive command line
interface allows management of Flash images, image download and RedBoot
configuration, etc,. Via serial or ethernet.
Boot script can be stored in Flash allowing for loading of images from Flash,
hard disk or TFTP server .,etc. Tools for debug support, flash and network booting are
provided with RedBoot.
eCOS
eCOS (embedded configurable operating system) is a real-time free and open
source operating system for embedded systems and applications that need only one
process with multiple threads. It is primarily designed for precise application
requirements of run-time performance and hardware needs. While implementation is
in C/C++ it is compatible with POSIX and ITRON through compatibility layers and
APIs.
3.2.2 RedBoot Capabilities
Boot scripting support
Simple command line interface for RedBoot configuration and management
via serial (terminal) or Ethernet (telnet)
Integrated GDB stubs for connection to host-based debugger via serial or
ethernet (Ethernet connectivity limited to local network only)
Users control configuration of attributes
Adapted to target environment and can be extensible
Network bootstrap support include setup and download via BOOTP, DHCP
and TFTP
3.2.3 Necessity of RedBoot Installation
D-link DWL-2100AP comes installed with VxWorks Bootloader. A bootloader,
software that initializes low level hardware, is necessary to boot the aforementioned
router. But VxWorks does not support OpenWrt and RedBoot does, hence VxWorks
has to be replaced by RedBoot. Normally the bootloader is considered a part of the
firmware but OpenWrt does not come with a boot loader hence a compatible boot
loader aka RedBoot installation is necessary. RedBoot can be installed via serial
console.
= 69
socket_type = dgram
wait = yes
user = nobody
server = /usr/sbin/in.tftpd
server_args = /tftpboot
disable = no
}
3. Create a folder /tftpboot this should match whatever you gave in server_args.
mostly it will be tftpboot
sudo mkdir /tftpboot
sudo chmod -R 777 /tftpboot
sudo chown -R nobody /tftpboot
4. Restart the xinetd service.
sudo /etc/nit.d/xinetd restart
Now our tftp server is up and running.
Testing our tftp server
1. Create a file named test with some content in /tftpboot path of the tftp server
Obtain the IP address of the tftp server using ifconfig command
2. Now in some other system follow the following steps.
tftp 192.168.1.2
tftp> get test
sent 159 bytes in 0.0 seconds
tftp> quit
cat test
4. PORTING
Booting Process:
Installing
The DWL-2100AP's firmware is VxWorks rtos with its own boot loader.
Factory bootloader can load via TFTP and execute a MIPS elf executable. MIPS elf
executable can be a OpenWrt ramdisk or modified bootloader.
(MIPS: Microprocessor without Interlocked Pipeline Stages is a reduced instruction
set computer instruction set architecture.
elf: executable and linkable format is a common standard file format for executables,
object code, shared libraries and core dumps)
There are different methods by which OpenWrt can be ported on to D-link
DWL-2100AP. They are:
4.1 Ramdisk Network Boot
Testing of OpenWrt can be done without making any changes to flash. This
way one can safely play with OpenWrt and preserve the original firmware in flash. If
a backup is done for settings and configure OpenWrt , one can easily restore the
saved backup when needed.
A tftp server with OpenWrt-atheros-vmlinux.elf boot image in its root folder is
required.
Connect the D-link DWL-2100AP to the computer using a serial console.
Switch on the power supply to D-link DWL-2100AP.
Wait for the boot process to start and press ESC to interrupt the bootloader
until a boot prompt is obtained.
Enter the command :
$ae(1,0)hai:openwrt-atheros-vmlinux.elf h=192.168.1.25
e=192.168.1.20:0xffffff00 f=0x80
where:
hai is the hostname of the computer running tftp (not needed to be correct)
h= sets the host computer IP address
e= sets the network address and mask of the ap
f= sets the flags to tftp boot and run
: tffs:
:0
processor number : 0
file name
: /fl/APIMG1
inet on ethernet (e) : 192.168.1.20:0xffffff00
flags (f)
: 0x0
other (o)
: ae
Install OpenWrt:
DWL-2100AP is supported from Backfire 10.03.1-rc1 on
A redboot loader is required for the flash chip installed and a TFTP server with
openwrt-atheros-vmlinux.lzma (kernel) and openwrt-atheros-root.squashfs (root file
system) in it's root folder.
Next step is set loader environment up:
fconfig boot_script true
fconfig boot_script_timeout 2
fconfig
Run script at boot: true
Boot script:
..
Enter script, terminate with empty line
>> fis load -l linux
>> go
>>
Boot script timeout (1000ms resolution): 2
Use BOOTP for network configuration: false
Gateway IP address: 192.168.1.254
Local IP address: 192.168.1.1
Local IP address mask: 255.255.255.0
Default server IP address: 192.168.1.254
Console baud rate: 9600
DNS server IP address: 192.168.1.254
GDB connection port: 9000
Force console for special debug messages: false
Network debug at boot time: false
Update RedBoot non-volatile configuration - continue (y/n)? y
reset
After AP reboot and we are ready for OpenWrt install. In this example AP is
@192.168.1.1 & tftp server is @192.168.1.254
fis init -f
load -r -b 0x80041000 openwrt-atheros-vmlinux.lzma
fis create -r 0x80041000 linux
load -r -b 0x80041000 openwrt-atheros-root.squashfs
fis create -r 0x80041000 -e 0x0 rootfs
reset
Recovery Board Config:
Connect JTAG cable, run urjtag
jtag> cable WIGGLER PPDEV /dev/parport0
jtag> detect
jtag> include atheros/ar2312/ar2312
jtag> poke 0x58400000 0x000e3ce1
jtag> detectflash 0x1FFF0000
jtag> flashmem 0x1FFF0000 {path to file}/eeprom_dwl2100hw4_3FFF00003FFF0800.bin
5.CONCLUSION
Observations:
OpenWrt is a great way to extend the usability of a router and to improve the
computing power of the network.
It does not support all the devices and also installation is device specific.
Specific procedure is to be carried out for device SoC and its flash chip.
Though D-link dwl 2100ap with atheros SoC supports OpenWrt, its flash chip
Spansion S29al032D90TF104 does not support this firmware.
Limitations:
Although there are several UI projects available to cover common use cases,
OpenWrt is not end user firmware. More advanced tasks require command line
operations and basic knowledge about operating a linux-based system.
6.REFERENCES
https://openwrt.org/
http://wiki.openwrt.org/doc/howto/generic.flashing
http://wiki.openwrt.org/toh/d-link/dwl-2100ap
http://www.dlink.com/-/media/Business_Products/DWL/DWL
%202100AP/Manual/dwl2100ap_manual_EN_USA.pdf
http://downloads.openwrt.org/snapshots/trunk/atheros/
http://en.wikipedia.org/wiki/OpenWrt
http://irc.lc/oftc/openwrt/irctc@@@