You are on page 1of 36

A Mini Project Report on

Porting OpenWrt On D-Link DWL-2100AP


SUBMITTED IN PARTIAL FULFILMENT OF THE REQUIREMENTS FOR THE
AWARD OF THE DEGREE OF
BACHELOR OF TECHNOLOGY
IN
ELECTRONICS AND COMMUNICATION ENGINEERING
BY
E.SHIVANI (10011P0407)
A.PRAMOD KUMAR (10011P0401)

K.HARITHA (10011P0410)
G.TEJA (10011P0408)

Under Esteemed Supervision of:


PROFESSOR DR. L. PRATAP REDDY

DEPARTMENT OF ELECTRONICS AND COMMUNICATION


ENGINEERING
JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY
COLLEGE OF ENGINEERING
HYDERABAD

December 2013

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY


COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS AND COMMUNICATION
ENGINEERING

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.

Dr. D. SRINIVASA RAO


Professor & HOD
Department of ECE
JNTUH College of Engineering
Hyderabad-500085

JAWAHARLAL NEHRU TECHNOLOGICAL UNIVERSITY


COLLEGE OF ENGINEERING
DEPARTMENT OF ELECTRONICS AND COMMUNICATION
ENGINEERING

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.

Dr. L.PRATAP REDDY


R&D Director
Professor
Department of ECE
JNTUH College of Engineering
Hyderabad-500085

DEPARTMENT OF ELECTRONICS AND COMMUNICATION


ENGINEERING
JNTUCOLLEGE OF ENGINEERING
HYDERABAD-500 085

DECLARATION OF THE CANDIDATE


We hereby declare that the mini project entitled Porting OpenWrt On To DLink DWL-2100AP is a bonafide record work done and submitted under the
esteemed guidance of Dr. L. Pratap Reddy, Professor, Department of ECE, JNTU,
Hyderabad, in partial fulfilment of the requirements for the award of the degree of
Bachelor Of Technology (IDP) in Electronics And Communication Engineering
during the academic year 2010-15.
This record is a bonafide work carried out by us and the results kept in the mini
project have not been reproduced or copied. The results in the mini project have not
been submitted in any other university or institution for the award of 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

OpenWrt is a fully featured, extensible RTOS(Real Time Operating System)


for embedded systems. It is an easily modifiable OS for the router with fully writable
file system with package management, allowing for a customizable OS for the router
rather than a single, static firmware. Customization for any application at a low cost
is possible since OpenWrt frees the user from vendor placed restrictions on
application selection and configuration. OpenWrt's open architecture allows packet
inspection, intrusion detection, and various other features that normally require
several thousand dollars worth of hardware to do effectively. More than 2000
software packages are available in the official repository, the number of packages
provide the opportunity to easily port packages and create your own firmware.
The use of OpenWrt provides a full fledged, robust router at a higher
customizable rate and lower cost, making it an ideal choice for developers interested
in development on embedded system.
By simple hardware additions and few software changes, the D-Link DWL
2100AP can be updated with the OpenWrt firmware to free it from restrictions and
make the router useful for embedded systems.
In this project an attempt is made to port OpenWrt to D-Link DWL 2100AP
router.

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

2 Hardware Setup for Porting


2.1 Required hardware components
2.2 Internal hardware of D-Link DWL-2100AP
2.2.1 Internal hardware description of D-Link DWL-2100AP
2.2.1.1 System-On-Chip
2.2.1.2 Hardware Version
2.2.1.3 Flash Chip
2.2.1.4 Bootloader
2.2.2 Serial Console
2.2.3 JTAG

3 Software Setup for Porting


3.1 System Requirements and Network Configuration
3.2 Bootloader
3.2.1 Redboot
3.2.2 Redboot Capabilities
3.2.3 Necessity of Redboot installation
3.3 Trivial File Transfer Protocol(TFTP)

4 Porting
4.1 Ramdisk Network Boot

4.2 Bootloader Replacement


4.3 Install Redboot-JTAG method

5 Conclusion
6 References

LIST OF FIGURES
FIGURE NO

FIGURE NAME

1.1

D-link DWL-2100AP

1.2

Router Connections

2.1

Internal hardware of D-Link DWL-2100AP(A4)

2.2

Internal hardware of D-Link DWL-2100AP(A1,A2,A3)

2.3

Serial console

2.4

Serial port

2.5

Jtag cable

2.6

Jtag connections

3.1

D-link network configuration

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.

Figure1.1 D-link DWL-2100AP

The DWL-2100AP is capable of operating in one of 5 different modes to meet


the wireless networking needs. This can operate as an access point, access point-tomulti-point bridging mode with AP function, access point-to-multi-point bridging
mode without AP function, repeater, or wireless client mode.
The DWL-2100AP is an ideal solution for quickly creating and extending a
Wireless Local Area Network (WLAN) in offices or other workplaces, trade shows

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

Figure1.2 Router Connections

In the above figure:


Power: Solid green light indicates connection.
LAN: Blinking green light indicates activity on the Ethernet Port; solid green
light indicates connection.
WLAN: Blinking green light indicates wireless activity; solid green light
indicates connection.
If all the 3-lights are blinking ,then it indicates that the device is bricked.
1.1.3 Features
5 Different Operation modes are : Access Point, AP-to-multipoint bridge with
AP function, AP-to-Multipoint Bridging without AP function, Repeater, or
Wireless Client.

Compatible with the 802.11b standard to provide a wireless data rate of up to


11Mbps - that means one can migrate a system to the 802.11g standard on our
own schedule without sacrificing connectivity.
Faster wireless networking with the 802.11g standard to provide a wireless
SNMP for Management - The DWL-2100AP is not just fast but it also supports
SNMP v.3 for a better network management. Superior wireless AP manager
software is bundled with the DWL-2100AP for network configuration and
firmware upgrade.
Utilizes OFDM technology (Orthogonal Frequency Division Multiplexing).
OFDM works by splitting the radio signal into multiple smaller sub-signals
that are then transmitted simultaneously at different frequencies to the receiver.
OFDM reduces the amount of crosstalk (interference) in signal transmissions.
The D-Link DWL-2100AP will automatically sense the best possible
connection speed to ensure the greatest speed and range possible.
Operates in the 2.4GHz frequency range.
Web-based interface for managing and configuring data rate of up to 54Mbps
(108Mbps in Super G mode).
Better security with WPA. The DWL-2100AP can securely connect to wireless
clients on the network using WPA (Wi-Fi Protected Access) providing a much
higher level of security for your data and communications than has previously
been available. AES is also supported by the DWL-2100AP to maximize the
network security with data encryption.

1.2 Introduction to OpenWrt


OpenWrt is an operating system based on the Linux kernel, and primarily used
on embedded devices to route network traffic. OpenWrt is thus described as a Linux
distribution for embedded devices. Unlike many other distributions for these routers,
OpenWrt is built from the ground up to be a full-featured, easily modifiable operating
system for the router. In practice this means that one can have all the features needed.
Instead of trying to create a single, static firmware, OpenWrt provides a fully
writable file system with package management. This frees you from the application
selection and configuration provided by the vendor and allows you to customize the
device through the use of packages to suit any application. For developer, OpenWrt is
the framework to build an application without having to build a complete firmware
around it; for users this means the ability for full customization.

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.

1.3 Objective and Methodology


The main objective is to understand the process involved in changing the
firmware of a router by understanding the hardware and software features of the
router and to apply the knowledge to change the default firmware of the D-Link
DWL-2100 AP to OpenWrt.
The methodology involves studying the hardware and software features of the
D-Link router as well as the features of OpenWrt and the study of the porting process.
Then preparation for booting is done by configuring the network, setting up a TFTP
server, and making the necessary hardware connections for actual porting of
OpenWrt. The default firmware is then replaced by OpenWrt by changing the default
boot loader to a boot loader compatible with OpenWrt ie. RedBoot and then dumping
the OpenWrt image compatible with the CPU and flash chip of the router. Finally a
study of any errors and reasons for the errors in done for proper debugging.
1.4 Organization of the Chapters
Chapter 1 gives a brief introduction to D-Link DWL-2100AP and its features
in addition to a brief introduction to OpenWrt and its features. It highlights the
advantage of porting OpenWrt into D-Link and lays the foundation for following
chapters by summarizing the methodology involved in porting OpenWrt.
Chapter 2 gives the description of internal hardware of D-Link, focusing on the
components that play a vital role in determining the porting process, and describes
how to make necessary hardware connections for porting. The understanding
developed in this chapter lays the foundation for understanding the overall porting
process and is useful in analysis of results and debugging.
Chapter 3 discusses the necessary software configurations involved prior to
booting. It outlines the process for network configuration and TFTP server
configuration.
Chapter 4 describes the actual porting. process. First it introduces the software
required during porting and then describes the porting process from interrupting the
boot process in order to change the boot loader to porting the OpenWrt firmware, via
two methods: serial console method and JTAG method.
Chapter 5 gives the results for each porting method and a study of the
challenges faced. It analysis the results and suggests suggestions for future
improvements.

2. HARDWARE SETUP FOR PORTING


2.1 Required Hardware Components
Prior to software configuration and the porting process, necessary hardware
have to be set up. Porting OpenWrt on D-Link DWL-2100AP requires the following
basic hardware components:

A D-Link DWL-2100AP router

A Linux system

A USB cable to connect serial console to system.

A serial console that acts as interface between router's serial port and PC.

Power source for router (Router must be powered during porting)

An Ethernet cable connecting the router's Ethernet port to the computer's port.

2.2 Internal hardware of D-link DWL-2100AP


D-link DWL-2100 AP has different versions .OpenWrt supports few
versions.The versions of D-link that are supported by OpenWrt are A2,A3,A4,A5.

Figure2.1 Internal hardware of DWL-2100AP(A4)

Figure2.2 Internal Hardware of DWL-2100AP(A1,A2,A3)

Table 2.1 Information of D-link DWL-2100AP


Architecture

MIPS 4Kc

Vendor

D-Link

Bootloader

VxWorks

Wireless System-on-chip

Atheros AR2313A

CPU Speed

180/240MHz

Flash Chip

Spansion S29AL032D90TF104 (A4)

Flash Size

4MiB

RAM

16Mib

Wireless

Atheros AR2112A

Ethernet

IC+IP101A (A2/A3/A4/A5)

USB

No

Serial

Yes 9600-8N1

JTAG

Yes

2.2.1 Internal Hardware description


Internal Components:
2.2.1.1 System-On-Chip:
Atheros chip AR2313A is used in the D-link DWL-2100AP. Atheros AR2313A

is manufactured by Atheros for use in single-band and dual-band 108Mb/s routers


and APs. The AR2313 belongs to AR5003 and AR5004 generation (Super-AG
technology).
Super G is Atheros' proprietary frame-bursting, compression and channel
bonding technology to improve IEEE 802.11g (Wi-Fi) wireless LAN performance.
Through bonding two 54Mbit/s 802.11g channels signaling rate of 108Mbit/s is
achieved. When this technology was adapted to Atheros' 802.11a/g chip sets it was
called Super AG.
2.2.1.2 Hardware Version: A4
2.2.1.3 Flash-Chip: Spansion S29AL032D90TF104
Flash memory refers to electronic non-volatile medium that is easily
programmed and erased. It is based on the EEPROM technology. The S29AL032D is
a 32-megabit, 3.0 volt-only flash memory device. The device is designed to be
programmed in-system with the standard 3.0 volt VCC supply, and can also be
programmed in standard EPROM programmers.
The device is available with access times as fast as 70 ns. The devices are
offered in 40-pin TSOP, 48-pin TSOP and 48-ball FBGA packages. Standard control
pins- chip enable (CE#), write enable (WE#), and output enable (OE#)-control
normal read and write operations, and avoid bus contention issues.
The device requires only a single 3.0 volt power supply for both read and write
functions. Internally generated and regulated voltages are provided for the pro-gram
and erase operations.
2.2.1.4 Bootloader: VxWorks
2.2.2 Serial console
Serial port is a serial communication physical interface where data transfer
takes place at 1 bit at a time. It is usually used to see bootprocess and interact with the
boot loader. This is possible only by opening the case and attaching a TTL line
converter cable. The serial communication signals on the 2100AP are TTLcompatible ranging from 0 to 5V. These must not be connected directly to a RS232
cable, which operates at much broader voltage range (-12 to +12V). An appropriate
level coupler must be built for this purpose. There are many such circuits on the net,
and the simplest ones might use a common MAX232 chip.Network equipment such
as routers and switch often use serial console for configuration. Serial ports are still
used in these areas as they are simple, cheap and their console functions are highly
standardized and widespread. A serial port requires a little software support from the
host system.

Figure2.3 Serial Console

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).

Figure2.4 Serial and JTAG Ports

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.

Figure2.5 JTAG Cable

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.

Identifying JTAG connector Headers


There are two major JTAG header arrangements used in SOHO routers based
on MIPS CPUs. One uses 12 pins and the other uses 14 pins.
14 Pin Header
This header is fully MIPS EJTAG 2.6 compatible and described in the EJTAG
2.6 standard. Found in Edimax routers (and other brands that are Edimax clones), the
14-pin header has the following arrangement of JTAG signals and pins:
nTRST
TDI
TDO
TMS
TCK
nSRST
n/a

1
3
5
7
9
11
13

2
4
6
8
10
12
14

GND
GND
GND
GND
GND
n/a
Vcc

Figure2.6 JTAG Connections

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.

3. SOFTWARE SETUP FOR PORTING


In D-link DWL-2100AP inorder to port OpenWrt there are certain issues that
are to be considered.As in the previous chapter ,we have seen the hardware setup for
porting,in this let us see various softwares that are to be installed before porting
inorder to interrupt the bootloader.

3.1 System Requirements and Network Configuration


For porting OpenWrt on to D-link DWL-2100 AP, we need a system with
Windows or Linux Operating System.
It should have access to the internet.
Wired Network Configuration
On the top right hand corner of the monitor click on the wireless icon and
select edit connections.
In the network connections dialog box click on wired connections.

Figure3.1 D-link Network Configuration

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

Figure3.2 D-Link Setup

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.

3.3 Trivial File Transfer Protocol (TFTP):


TFTP is a file transfer protocol. It is generally used for automated transfer of
configuration or boot files between machines in a local environment. Compared to
FTP, TFTP is extremely limited, providing no authentication, and is rarely used
interactively by a user. TFTP is designed to be small and easy to implement, and
therefore it lacks most of the features of a regular FTP. TFTP only reads and writes
files (or mail) from/to a remote server. It cannot list directories, and currently has no
provisions for user authentication.
Due to its simple design, TFTP could be implemented using a very small
amount of memory. TFTP server is extensively used to support remote booting of
diskless devices. The server is normally started by inetd, but can also run standalone.
It is therefore useful for booting computers such as routers which may not have any
data storage devices. It is an element of the Preboot Execution Environment (PXE)
network boot protocol, where it is implemented in the firmware ROM/NVRAM the
host's network card.
Due to the lack of security, it is dangerous to use it over the Internet. Thus,
TFTP is generally only used on private, local networks.
Procedure to Install and Run a TFTP server:
1. Install following packages.
sudo apt-get install xinetd tftpd tftp
2. Create /etc/xinetd.d/tftp and put this entry
service tftp
{
protocol = udp
port

= 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

Original settings we get using command p to print settings:

ar531x rev 0x00005850 firmware startup...


SDRAM TEST...PASSED
WAP-G02A Boot Procedure
V1.0
--------------------------------------------------------Start ..Boot.B12..
atheros AR5001AP default version 3.0.0.43A
1
[Boot]: ?
?
- print this list
@
- boot (load and go)
p
- print boot parameters
c
- change boot parameters
e
- print fatal exception
v
- print version
B
- change board data
S
- show board data
n netif
- print network interface device address
$dev(0,procnum)host:/file h=# e=# b=# g=# u=usr [pw=passwd] f=#
tn=targetname s=script o=other
boot device: tffs=drive,removable file name: /tffs0/vxWorks
Boot flags:
0x02 - load local system symbols
0x04 - don't autoboot
0x08 - quick autoboot (no countdown)
0x20 - disable login security
0x40 - use bootp to get boot parameters
0x80 - use tftp to get boot image
0x100 - use proxy arp
available boot devices:Enhanced Network Devices
ae1 tffs
[Boot]: p
boot device
unit number

: tffs:
:0

processor number : 0
file name
: /fl/APIMG1
inet on ethernet (e) : 192.168.1.20:0xffffff00
flags (f)
: 0x0
other (o)
: ae

Changed settings (use command c to change settings):


[Boot]: p
boot device
: ae
unit number
:1
processor number : 0
host name
: hai
file name
: openwrt-atheros-vmlinux.elf
inet on ethernet (e) : 192.168.1.20:0xffffff00
host inet (h)
: 192.168.1.254
flags (f)
: 0x80
other (o)
: ae

4.2 Bootloader replacement:


By replacing the stock loader with modified Redboot we can install OpenWrt
permanently. Replacing the loader is tricky because one need to get a version tailored
for the device.
Install RedBoot using serial console:
This is a experimental way to flash using only serial interface. RAM version of
custom build RedBoot loader is needed from which one can burn the permanent
ROM version.
A TFTP server with both redboot.img (RAM version) and redboot.bin (ROM version)
is needed for the flash chip in it's root folder.
1.Plug the AP and press ESC until it is prompted to [boot] in terminal window.
2.Send p and write all lines from terminal output (to restore if needed), then with c
change settings:
boot device
: ae1
unit number
:0
processor number : 0
file name
: redboot.img
inet on ethernet (e) : 192.168.1.20:ffffff00 //this is AP IP address
host inet (h)
: 192.168.1.254
//this is tftpd server IP address
gateway inet (g) :
flags (f)
: 0x80
other (o)
: ae
Reboot AP, redboot RAM version have to load,
Install redboot into ROM with next commands:
fis init -f
load -r -b %{FREEMEMLO} redboot.bin -h 192.168.1.254 -m tftp
fis create RedBoot
reset
After AP reboot, redboot ROM version have to load and we are ready to install
OpenWRT.
4.3 Install RedBoot - JTAG method:
The safest way to change the boot loader is by using both j-tag and serial
interface. If something gets broked , one can re-install the original firmware.

Connect JTAG cable and run urjtag. At prompt write jtag.


jtag> cable WIGGLER PPDEV /dev/parport0 #this is for linux
jtag> cable WIGGLER parallel 0x378 #this is for Windows world
jtag> detect
jtag> include atheros/ar2312/ar2312
jtag> poke 0x58400000 0x000e3ce1
jtag> detectflash 0x1fc00000
jtag> flashmem 0x1fc00000 {path to file}/redboot(lzma).bin

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.

Installation and configuration is simple and easy and it supports many


packages to improve router's effectiveness.

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:

OpenWrt is not intended to be a ready-made distribution you can directly load


onto an embedded device. Instead, the framework allows one to create a
firmware tailored to their own particular needs.

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@@@

You might also like