OpenWrt Forum Archive

Topic: Experiences with D-Link DSL-2640B (ADSL2+ Router) (new to OpenWRT)

The content of this topic has been archived on 5 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,
Here are my experiences with a new D-Link DSL-2640B that I purchased for OpenWRT hacking.
I am new to OpenWRT.
Stephen
_______________________________________________________________________________

I started with the D-Link DSL-2640B "hardware page" as my guide, referring to the generic guide for background.

    http://wiki.openwrt.org/toh/d-link/dsl-2640u
    http://wiki.openwrt.org/doc/howto/generic.flashing

1. POWER ADAPTER

I received my D-Link DSL-2640B and opened it up.
The first thing I noticed was that I had accidentally ordered the model with the power adapter that fits European outlets (2 thin cylindrical pegs).
I read somewhere that this model is popular in Brazil. Perhaps the power adapter fits Brazilian power outlets.
Luckily I had an adapter around and I was able to proceed. (You can get these from your local AAA store or anywhere that sells travel adapters.)
I'm not sure how to avoid this if I order it again. Nothing on the web-based ordering warned me about this.
I guess I will order from some place which has a telephone so I can call and make sure I am getting the US model.

2. SOFTWARE

I am using a Windows 7 laptop to do the configuration.
There are two pieces of software I needed to download before I flash the image.

    Putty - a free Window ssh client (Free Software) (it is also a terminal emulator useful for accessing a serial port console via RS-232, i.e. COM1:)
    http://www.chiark.greenend.org.uk/~sgtatham/putty/

    tftpd32 - tftp client and server software for Windows (Free Software)
    http://tftpd32.jounin.net/
    http://tftpd32.jounin.net/tftpd32_download.html
    http://tftpd32.jounin.net/download/Tftp … -setup.exe  (this is the 64-bit version, which I am choosing)

3. OPENWRT IMAGE SELECTION

I needed to download an OpenWRT image to flash to the device.
I followed the following URL's.

    http://downloads.openwrt.org/
    http://downloads.openwrt.org/backfire/
    http://downloads.openwrt.org/backfire/10.03/
    http://downloads.openwrt.org/backfire/10.03/brcm63xx/

"backfire" seems to be the name of the latest stable release of OpenWRT.
The latest stable release number is 10.03.
The hardware page said the CPU on this device is a Broadcom 6348 CPU (a MIPS instruction set CPU) so I chose the "brcm63xx" branch.
(Perhaps this is a missprint. Elsewhere on the page it says Broadcom 6338.)

The hardware page said I should use an image named "openwrt-DSL2640B-squashfs-cfe.bin".
This is verified in the following source code page.

    https://dev.openwrt.org/browser/trunk/t … es-bcm63xx

(An older version of the README.images-bcm63xx indicates that the "openwrt-D-4P-W-<fs>-bc310-cfe.bin" images are the right ones to use for DSL-2640B.)
I downloaded the following available images, thinking that one of them might work.

    openwrt-DSL2640B-squashfs-cfe.bin      (I'll start with this one because that is the one the hardware page identifies.)
    openwrt-DSL2640B-jffs2-128k-cfe.bin    (I think I'll want to use this one eventually.)
    openwrt-DSL2640B-jffs2-64k-cfe.bin

Along the way I learned that CFE stands for Common Firmware Environment.
Common Firmware Environment (CFE) is a firmware interface and bootloader developed by Broadcom for 32-bit and 64-bit system-on-a-chip (SOC) systems. It is roughly analogous to the BIOS on the IBM PC platform.

    http://en.wikipedia.org/wiki/Common_Fir … nvironment

4. ROUTER ADMINISTRATION

Next I plugged the network cable that came with the router into my laptop port and one of the ports on the back of the router.
Usually these routers have a tiny web server built in and you use a web browser to administer them.
Since I actually had the manual, I consulted it and verified this.
It said to type the following address into my browser (which I did).

    http://10.1.1.1

Then I got a login screen from the router. I supplied the standard username of "admin" with password of "admin".
I was in and talking to the administration screen of the router.
I explored all of the screens to understand the features available with the initial firmware.
The screens of note were:

    Management > Access Control > Services   (Enable tftp under LAN. Click "Save/Apply".)
    Management > Update Software   (This is the official way to reflash the firmware. More on this later.)
    Management > Save/Reboot    (Click the "Save/Reboot")

5. FLASHING USING "Management > Update Software" FAILS

The "hardware page" describes that there are two ways to flash the OpenWRT firmware onto this D-Link device.
The first is to use the built-in administration page called "Management > Update Software".
It says that this will fail because there is some ID in the firmware file and that you have to modify the original firmware to get this to work.
I wanted to try it anyway and see what happens.
I went to the "Management > Update Software" screen.
I selected one of my firmware images ("openwrt-DSL2640B-squashfs-cfe.bin") I had downloaded to my PC with the "Choose File" button, then hit "Update Software".
I got the following error.

    DSL Router Update
    Fatal error during image uploading.

The hardware page describes how you can recompile the original source code and flash that.
Then it will not check to see whether any new firmware is "official."
I decided not to go this route (yet).

6. FLASHING USING CONSOLE (NOT!!!)

The hardware page says that the other way you can flash new firmware onto the OpenWRT is by using the serial port console which talks directly to the CFE.
Unfortunately, the serial port on this version of the device is not exposed at the back of the device.
I opened up the case to see if it was obvious inside somewhere.
(Turn box over. Remove rubber feet. Unscrew screws hidden under rubber feet. Pry open.)
I found a 4-pin connector in the middle of the circuit board and wondered if that was the serial port.

(Later I found a document that claimed that this was in fact the serial port. It also details the pinout.)

    https://forum.openwrt.org/viewtopic.php?id=26632
    J3 is the console.
    DSL-2640B H/W T1 ( Mostly found in Brazil )
    The pinout is : 2-GND 3-TX 4-RX ( pin 1 is marked with a dot )
    Baudrate 115200 8N1
    The serial port is ttl level. You need an converter or use an old celular data cable. ( I use an old cable from a Siemens C63 )

However, I have no cable-making equipment and no soldering iron, so I was not going to do the serial port console thing (unless I had to).
Details on appropriate cabling seems to be described here.
(Note that TTL voltage levels on the board go from 0V to 3.3V or 5V while the voltage levels for a standard RS-232 comms link go from -12V to +12V.)
(So a converter is required, not just a cable of wires.)

    http://wiki.openwrt.org/doc/hardware/port.serial

I searched around for an appropriate cable in the internet and bought this one.

    http://www.superdroidrobots.com/shop/it … itemid=335

Meanwhile, the fact that the serial port was removed from the back of the case prompted me to wonder if there were network access to the console.

7. EXPLORING THE INTERNAL COMMAND SHELL

"Putty" is my ssh client on Windows. I tried:

    putty 10.1.1.1

and sure enough I got a login prompt.
(The hardware page has a cryptic reference to "log in using telnet" and I think this is what they were referring to. Both telnet and ssh seem to work similarly using Putty.)

I logged in with admin/admin and received a command prompt.
I am hoping this is comparable to the serial port access to the CFE command prompt.
(Although the CFE prompt is a lower level interface than a command shell of an already booted Linux operating system.)
If it does work, I won't have to open up the box or mess with cables and soldering.

Typing "help" reveals the commands I can use.
The following seemed interesting in my poking around.

help
echo /*
cat <file>
df
ifconfig
swversion show
ps
sysinfo
ping 10.1.1.2
tftp help

It is a very odd little shell.
There is no "ls" command in this shell to list files and there is no "cd" to change directory.
However, "echo /*" does much the same thing.

> echo /*
> echo /etc/*

I discovered that there are a number of executables (like "ls") which do not seem to be directly runnable from the shell.

> echo /bin/*
> echo /usr/bin/*
> echo /sbin/*

However, they can be run using the following.

> sh -c "ls -l"         # long listing of files in current directory ("/")
> sh -c "ls /bin"     # lists the files in /bin
> sh -c date          # shows the current date/time
> sh -c dmesg       # shows boot and other kernel-level log messages (lots of hardware info in here)
> echo $PATH

Other commands in /bin, /usr/bin, and /sbin that look interesting are "cp", "rm", "mount", "top", "ftpget".
For instance, consider the following. (I want to explore where we have write access and where we don't.)

> df -k
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/mtdblock0            3072      3072         0 100% /
none                      7088         0      7088   0% /mnt
tmpfs                      960       124       836  13% /var

This would seem to indicate that we have 7088 1K blocks on /mnt and 960 1K blocks on /var (close to 8MB).

> sh -c mount
/dev/mtdblock0 on / type squashfs (ro)
/proc on /proc type proc (rw,nodiratime)
none on /mnt type tmpfs (rw)
tmpfs on /var type tmpfs (rw)

> cat /etc/fstab
proc            /proc   proc    defaults    0   0
none            /mnt    tmpfs   defaults   0    0
tmpfs           /var    tmpfs   size=960k    0   0

Not sure what "none" means, but both /mnt and /var are "tmpfs" file systems and behave similarly as read-write areas.
1MB is for /var.
7MB is for /mnt and is empty.

The following tests show the read-only (ro) and read-write (rw) characteristics of the various file systems.

# /etc is read-only
> sh -c "cp /etc/services /etc/new_file"
cp: unable to open `/etc/new_file': Read-only file system

# /var is read-write
> sh -c "cp /etc/services /var/new_file"
> sh -c "ls -l /var/new_file"
-rwxr-xr-x    1 admin    root         5647 Jan  1 01:28 /var/new_file
> sh -c "rm /var/new_file"
> sh -c "ls -l /var/new_file"
ls: /var/new_file: No such file or directory

# /mnt is read-write
> sh -c "cp /etc/services /mnt/new_file"
> sh -c "ls -l /mnt/new_file"
-rwxr-xr-x    1 admin    root         5647 Jan  1 01:29 /mnt/new_file
> sh -c "rm /mnt/new_file"
> sh -c "ls -l /mnt/new_file"
ls: /mnt/new_file: No such file or directory

So if we look at the /etc directory, normally a place for config files, we see that all of the editable files are actually symbolic links to files in /var.

> sh -c "ls -l /etc"

Those and other modifyable files are in /var.

> sh -c "ls -l /var"

8. OPENING UP THE NETWORK BETWEEN THE ROUTER AND MY PC (WINDOWS FIREWALL)

I found that trying to use tftp was just hanging, getting me nowhere.
So I just tried "ping" to test the networking connection.

I found that the "ping 10.1.1.2" command was timing out.
It turns out that Windows Firewall was blocking this.
I turned off Windows Firewall ("Control Panel > System and Security > Windows Firewall"), and the ping command started working.
This "ping" command is the basic test of whether we can communicate with another system.
Since 10.1.1.1 is the router, 10.1.1.2 is my PC.
ping should return something like this.

> ping 10.1.1.2
PING 10.1.1.2 (10.1.1.2): 56 data bytes
56 bytes from 10.1.1.2: icmp_seq=0 ttl=128 time=5.0 ms
56 bytes from 10.1.1.2: icmp_seq=1 ttl=128 time=0.0 ms
56 bytes from 10.1.1.2: icmp_seq=2 ttl=128 time=0.0 ms
56 bytes from 10.1.1.2: icmp_seq=3 ttl=128 time=0.0 ms

--- 10.1.1.2 ping statistics ---
4 packets transmitted, 4 packets received, 0% packet loss
round-trip min/avg/max = 0.0/1.2/5.0 ms

9. FLASHING USING TFTP

From the on-board command prompt.

"tftp help" got me the following.

    BusyBox v1.00 (2009.08.10-02:17+0000) multi-call binary

    Usage: tftp [OPTION]... tftp_server_ip

    Update firmware image and configuration data from OR backup configuration
    data to a tftp server.

    Options:
    -g      Get file. (Update image/configuration data)
    -p      Put file. (backup configuration data)
    -f      remote file name.
    -t      i for image and c for configuration data.

So I moved the downloaded OpenWRT firmware images to a directory called C:\install.
I started up the Windows tftp server and configured C:\install as the "Current Directory".
I then typed the following and got the following output.

> tftp -g -f openwrt-DSL2640B-squashfs-cfe.bin -t i 10.1.1.2
> tftp -g -f openwrt-DSL2640B-squashfs-cfe.bin -t i 10.1.1.2
bcmUploadPrepare ... curPid[513] ifPid[0] ifName[br0]

Number of processes: 27
12:04am  up 4 min,
load average: 1 min:0.06, 5 min:0.12, 15 min:0.06
              total         used         free       shared      buffers
  Mem:        14180        13756          424            0         1132
Swap:            0            0            0
Total:        14180        13756          424
  PID  Uid     VmSize Stat Command
    1 admin       280 S   init
    2 admin           SWN [ksoftirqd/0]
    3 admin           SW< [events/0]
    4 admin           SW< [khelper]
    5 admin           SW< [kblockd/0]
   15 admin           SW  [pdflush]
   16 admin           SW  [pdflush]
   17 admin           SW  [kswapd0]
   18 admin           SW< [aio/0]
   23 admin           SW  [mtdblockd]
   34 admin       324 S   -sh
   74 admin      1600 S   cfm
  272 admin       216 S   pvc2684d
  361 admin       176 S   wps_btn
  387 admin       304 S   dhcpd
  391 admin       280 S   dhcpd
  427 admin       816 S   snmp
  438 admin      1704 S   tr64
  459 admin      1728 S   httpd
  460 admin      1600 S   cfm
  466 admin       364 S   pppd -c 0.0.35.1 -i nas_0_0_35 -u -f 0 -M 1492
  501 admin      1612 S   telnetd
  502 admin      1648 S   telnetd
  512 admin       288 S   sh -c tftp -g -f openwrt-DSL2640B-squashfs-cfe.bin -t
  513 admin       284 S   tftp -g -f openwrt-DSL2640B-squashfs-cfe.bin -t i 10.
  516 admin       288 S   sh -c ps > /var/psList
  517 admin       284 R   ps
kill process [pid: 361] [wps_btn]...
kill process [pid: 387] [dhcpd]...
kill process [pid: 391] [dhcpd]...
kill process [pid: 427] [snmp]...
kill process [pid: 438] [tr64]...
kill process [pid: 466] [pppd]...
kill process [pid: 512] [sh]...
> kill process [pid: 460]...

Remaining modules:
ip_conntrack_httpfilter 17424 0 - Live 0xc00e3000
ipt_state 544 0 - Live 0xc00e2000
iptable_raw 544 0 - Live 0xc00e0000
ipt_NOTRACK 672 0 - Live 0xc00df000
ipt_dscp 448 0 - Live 0xc00de000
ip_nat_sip 10704 0 - Live 0xc00d7000
ip_queue 10592 0 - Live 0xc00ca000
ip_conntrack_sip 10336 1 ip_nat_sip, Live 0xc00cf000
iptable_nat 15632 2 ip_nat_sip,ip_queue, Live 0xc0053000
ip_conntrack 30464 6 ipt_state,ipt_NOTRACK,ip_nat_sip,ip_queue,ip_conntrack_sip,iptable_nat, Live 0xc0018000
ip_tables 14848 6 ipt_state,iptable_raw,ipt_NOTRACK,ipt_dscp,ip_queue,iptable_nat, Live 0xc0006000
wl 515824 0 - Live 0xc013b000
bcm_enet 29744 0 - Live 0xc0043000
bcmprocfs 14624 0 - Live 0xc000c000
br2684 69440 0 - Live 0xc0032000
blaa_dd 7104 0 - Live 0xc000a000
adsldd 141408 0 - Live 0xc0062000
atmapi 64896 4 bcm_enet,br2684,blaa_dd,adsldd, Live 0xc0022000

Memory info:
Number of processes: 20
12:04am  up 4 min,
load average: 1 min:0.22, 5 min:0.15, 15 min:0.07
              total         used         free       shared      buffers
  Mem:        14180        12496         1684            0         1132
Swap:            0            0            0
Total:        14180        12496         1684
... done bcmUploadPrepare

The power light on the D-Link turns red and the LAN link light flashes for about 40 seconds.
Then I get disconnected.
When I reconnect, nothing is changed.
I wonder if the same check inherent in the web-based firmware upgrade is stopping my tftp from going through.
...
So I have tried tftp of an image to the device ("put") and tftp of image from the device ("get") and neither seem to work.
Nor can I find any traces of these files that were transferred down and failed the check.
Nor can I find any log messages about this action.

I looked again at the hardware page.

    http://wiki.openwrt.org/toh/d-link/dsl- … oadcom.tag

This would indicate that the unmodified tftp service will not be useful in reflashing an OpenWRT image onto the device the first time even from the ssh command line.
(I was hoping that the "ssh" command prompt would be equivalent to the serial-port console in functionality.)
I tried one more desperate attempt to use the serial port without a serial cable and terminal emulator software.

> sh -c "echo 'flashimage 10.1.1.2:openwrt-DSL2640B-squashfs-cfe.bin' >> /dev/console"

Nothing happened.
Since I want other people to be able to do this without hardware hacking (and cable-making), the next easiest thing to try is the modified official image.
I'll try that next.

10. DOWNLOADING STANDARD IMAGES FROM D-LINK

After searching, I found the following useful links from D-Link.

    http://www.dlink.com/support/products/default.aspx    (the DSL-2640B is under the Broadband section. This page assures me that the 2640B is not at "end-of-life".)
    http://www.dlink.com/products/?pid=DSL-2640B          (This is the general product page for the device. Click on "Support Resources".)
    ftp://ftp.dlink.com/Broadband/dsl2640B/ … 306041.zip   (Under "Firmware", this link is from the "Download Now" button.)
            This page warns that this firmware is only for North American versions of the product and gives a link for non-US D-Link sites. (I'm in the US.)
            The page says this firmware is Version 306041 from 5/22/2008 but the file itself indicates it hasn't been modified since 11/14/2006.
            So, while this device is not at "end-of-life", it is clearly no longer being developed by D-Link.
    http://forums.dlink.com/    (seems to pertain to recent products more than older products like the DSL-2640B.)

I downloaded the firmware and tried flashing it using the standard method.
This should establish a baseline for me for what a "normal flashing session" should look like.

I went to the "Management > Update Software" screen of the on-device web-based administration console.
I selected the standard North America (3.10) firmware image ("GE_DSL-2640B_306041G00_cfe_fs_kernel") I had downloaded to my PC with the "Choose File" button, then hit "Update Software".
I got the same error I did before.

    DSL Router Update
    Fatal error during image uploading.

This makes me wonder whether there is something more general that I am doing wrong.

I ought to actually call D-Link customer support for this because this should be a supported activity.

11. DOWNLOADING THE GPL SOURCES FROM D-LINK

I return to the matter of trying to get the source code to rebuild a modified vendor firmware image. per the hardware page...
We follow the Live Journal entry cited.

    http://pudeev.livejournal.com/33449.html

However, this is all for the RU and EU versions of source code.

    D-Link DSL-2640U Hardware version: B2
    GPL Source Code for firmware version RU_V3.06
    http://ftp.dlink.ru/pub/ADSL/GPL_source … GPL.tar.gz

    D-Link DSL-2640U Hardware version: D1
    GPL Source Code for firmware version RU_1.10
    http://tsd.dlink.com.tw/temp/download/3 … GPL.tar.gz

    D-Link DSL-2640B Hardware version: B2
    GPL Source Code for firmware V4.00
    ftp://ftp.dlink.fr/DSL/DSL-2640B/GPL/EU … GPL.tar.gz
    GPL Source Code for firmware V3.07
    http://tsd.dlink.com.tw/temp/download/3 … GPL.tar.gz
    GPL Source Code for firmware V3.06
    http://tsd.dlink.com.tw/temp/download/2 … GPL.tar.gz

    D-Link DSL-2640B Hardware version: B3
    GPL Source Code for firmware V5.00
    ftp://ftp.dlink.pl/dsl/dsl-2640b/driver … 420.tar.gz

We search on for more links that might reveal the US version of code.

    ftp://tsd.dlink.com.tw/GPL/index.html          (lots of D-Link GPL source code, but only an EU version of the 2640B.)
    ftp://ftp.dlink.ru/pub/ADSL/GPL_source_code/   (a bit higher up on the URL given above shows lots of source code for Russian D-Link models.)

    ftp://ftp.dlink.com/
    ftp://ftp.dlink.com/Broadband/
    ftp://ftp.dlink.com/Broadband/dsl2640B/     (no source code here. just the supported binary firmware file for US devices.)

The following is a fantastic link that has all kinds of source code for all kinds of D-Link devices.

    http://tsd.dlink.com.tw/downloads2008list.asp?OS=GPL     (This link looks interesting. It even has an email contact link to request GPL sources not found on the site.)

Search for DSL-2640B, follow the link and you get 6 files. One of them appears to be the sources for the North America 3.10 version (latest).

    GPL: DSL-2640B T1 F/W BCM-3.10L.NA.20100623

I downloaded it (as "out.tar.gz") and renamed it to "GPL_DSL-2640B_T1_FW_BCM-3.10L.NA.20100623.tar.gz".

I happened to have a RedHat Linux server accessible to me (to which I had root access).
I followed the instructions in the enclosed README file to rebuild the image.
The whole process went smoothly and produced an image file.
However, burning this image fared no better than the official binary image I had downloaded.

12. MODIFYING THE GPL SOURCES FROM D-LINK

The hardware page says that you should rebuild the standard image while disabling the check that inhibits OpenWRT from replacing it.
The instructions for modifying the source code are here:

    https://dev.openwrt.org/ticket/5472

I'll get to that after I can burn a standard image.

So that's how far I've gotten.
I still have not succeeded in putting OpenWRT software onto my D-Link device.
I keep trying however, and I update this page as I discover things.

-- Stephen Adkins

What is below is a bunch of output from the ssh-accessible command line that may be interesting for people.

-----------------------------------------------------------------------------------------------------------------------------------------
LOW-LEVEL DEVICE INFORMATION
-----------------------------------------------------------------------------------------------------------------------------------------
This information was all derived from the command prompt accessible by ssh or telnet.

> swversion show
3.10L.02.A2pB022g.d20h

> df -k
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/mtdblock0            3072      3072         0 100% /
none                      7088         0      7088   0% /mnt
tmpfs                      960       120       840  13% /var

> sysinfo
Number of processes: 25
12:07am  up 7 min,
load average: 1 min:0.00, 5 min:0.06, 15 min:0.05
              total         used         free       shared      buffers
  Mem:        14180        13864          316            0         1136
Swap:            0            0            0
Total:        14180        13864          316

> cat /proc/cpuinfo
system type             : 96333W
processor               : 0
cpu model               : BCM6338 V1.0
BogoMIPS                : 239.20
wait instruction        : no
microsecond timers      : yes
tlb_entries             : 32
extra interrupt vector  : yes
hardware watchpoint     : no
unaligned access                : 49288
VCED exceptions         : not available
VCEI exceptions         : not available

> ifconfig -a
atm0            Link encap:UNSPEC  HWaddr 71-40-00-00-00-40-00-42-00-00-00-00-00-00-00-00
                [NO FLAGS]  MTU:0  Metric:1
                RX packets:0 errors:0 dropped:0 overruns:0 frame:0
                TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
                collisions:0 txqueuelen:0
                RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

br0             Link encap:Ethernet  HWaddr 14:D6:4D:F9:F8:42
                inet addr:10.1.1.1  Bcast:10.255.255.255  Mask:255.0.0.0
                UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
                RX packets:2088 errors:0 dropped:0 overruns:0 frame:0
                TX packets:1065 errors:0 dropped:0 overruns:0 carrier:0
                collisions:0 txqueuelen:0
                RX bytes:194080 (189.5 KiB)  TX bytes:175472 (171.3 KiB)

cpcs0           Link encap:UNSPEC  HWaddr 05-60-FF-00-00-00-00-00-00-00-00-00-00-00-00-00
                [NO FLAGS]  MTU:65535  Metric:1
                RX packets:0 errors:0 dropped:0 overruns:0 frame:0
                TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
                collisions:0 txqueuelen:0
                RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

dsl0            Link encap:UNSPEC  HWaddr 05-60-00-00-00-00-00-00-00-00-00-00-00-00-00-00
                [NO FLAGS]  MTU:0  Metric:1
                RX packets:0 errors:0 dropped:0 overruns:0 frame:0
                TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
                collisions:0 txqueuelen:0
                RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

eth0            Link encap:Ethernet  HWaddr 14:D6:4D:F9:F8:42
                UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
                RX packets:2088 errors:0 dropped:0 overruns:0 frame:0
                TX packets:1065 errors:0 dropped:0 overruns:0 carrier:0
                collisions:0 txqueuelen:1000
                RX bytes:231664 (226.2 KiB)  TX bytes:180616 (176.3 KiB)
                Interrupt:23 Base address:0x2800

lo              Link encap:Local Loopback
                inet addr:127.0.0.1  Mask:255.0.0.0
                UP LOOPBACK RUNNING  MTU:16436  Metric:1
                RX packets:60 errors:0 dropped:0 overruns:0 frame:0
                TX packets:60 errors:0 dropped:0 overruns:0 carrier:0
                collisions:0 txqueuelen:0
                RX bytes:2944 (2.8 KiB)  TX bytes:2944 (2.8 KiB)

nas_0_0_35      Link encap:Ethernet  HWaddr 14:D6:4D:F9:F8:44
                UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
                RX packets:0 errors:0 dropped:0 overruns:0 frame:0
                TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
                collisions:0 txqueuelen:1000
                RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wl0             Link encap:Ethernet  HWaddr 14:D6:4D:F9:F8:43
                BROADCAST MULTICAST  MTU:1500  Metric:1
                RX packets:0 errors:0 dropped:0 overruns:0 frame:0
                TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
                collisions:0 txqueuelen:0
                RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
                Interrupt:25

> sh -c dmesg
Linux version 2.6.8.1 (root@localhost.localdomain) (gcc version 3.4.2) #1 Mon Aug 10 10:12:04 CST 2009
Serial flash device: name EN25P32, id 0x1c15, size 4096KB
96333W prom init
CPU revision is: 00029010
Determined physical RAM map:
memory: 00fa0000 @ 00000000 (usable)
On node 0 totalpages: 4000
  DMA zone: 4000 pages, LIFO batch:1
  Normal zone: 0 pages, LIFO batch:1
  HighMem zone: 0 pages, LIFO batch:1
Built 1 zonelists
Kernel command line: root=31:0 ro noinitrd console=ttyS0,115200
brcm mips: enabling icache and dcache...
Primary instruction cache 16kB, physically tagged, 2-way, linesize 16 bytes.
Primary data cache 8kB 2-way, linesize 16 bytes.
PID hash table entries: 64 (order 6: 512 bytes)
Using 120.000 MHz high precision timer.
Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
Memory: 14096k/16000k available (1319k kernel code, 1884k reserved, 196k data, 64k init, 0k highmem)
Calibrating delay loop... 239.20 BogoMIPS
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
Checking for 'wait' instruction...  unavailable.
NET: Registered protocol family 16
Total Flash size: 4096K with 64 sectors
File system address: 0xbfc10100
Can't analyze prologue code at 80158764
PPP generic driver version 2.4.2
NET: Registered protocol family 24
Using noop io scheduler
bcm963xx_mtd driver v1.0
brcmboard: brcm_board_init entry
SES: Button Interrupt 0x0 is enabled
XXXXXXX: wifiBtn_mapIntr Enter
XXXXXX: WIFI: Button Interrupt 0xffff is not enabled
Serial: BCM63XX driver $Revision: 3.00 $
ttyS0 at MMIO 0xfffe0300 (irq = 10) is a BCM63XX
NET: Registered protocol family 2
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 512 bind 1024)
NET: Registered protocol family 1
NET: Registered protocol family 17
Ebtables v2.0 registered
NET: Registered protocol family 8
NET: Registered protocol family 20
802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
All bugs added by David S. Miller <davem@redhat.com>
VFS: Mounted root (squashfs filesystem) readonly.
Freeing unused kernel memory: 64k freed
Algorithmics/MIPS FPU Emulator v1.5
atmapi: module license 'Proprietary' taints kernel.
adsl: adsl_init entry
blaadd: blaa_detect entry
BCMPROCFS v1.0 initialized
BCM6338A2 Ethernet Network Device v0.3 Aug 10 2009 10:10:23
Config Internal PHY Plus Switch Through GPIO2MDIO
Link up, time=0(ms)
BCM63xx_ENET: 100 MB Full-Duplex (auto-neg)
switch type = BCM5325E.
dgasp: kerSysRegisterDyingGaspHandler: eth0 registered
eth0: MAC Address: 14:D6:4D:F9:F8:42
eth0 Link UP.
SDIOH mode switch from 1 to 2
available commands: sdio sdioh

---SDIO init SUCCEEDED--- blockmode capable

chipid 0x4014312
chip is bcm4312, use 512 bytes blksize
bcmsdh_attach, sdioh_attach successful, bcmsdh->sdioh 0x80f80c00
wl: srom not detected, using main memory mapped srom info (wombo board)
wl0: wlc_attach: use mac addr from the system pool by id: 0x776c0000
wl0: MAC Address: 14:D6:4D:F9:F8:43
wl0: Broadcom BCM4318 802.11 Wireless Controller 4.174.64.19.cpe1.0sd-s1
dgasp: kerSysRegisterDyingGaspHandler: wl0 registered
Trying to free free IRQ25
BcmAdsl_Initialize=0xC00633D8, g_pFnNotifyCallback=0xC007C294
AnnexCParam=0x7FFF7EA8 AnnexAParam=0x00000980 adsl2=0x00000000
pSdramPHY=0xA0FFFFF8, 0x0 0x1040
AdslCoreHwReset: AdslOemDataAddr = 0xA0FFD3D4
AnnexCParam=0x7FFF7EA8 AnnexAParam=0x00000980 adsl2=0x00000000
dgasp: kerSysRegisterDyingGaspHandler: dsl0 registered
ATM proc init !!!
ip_tables: (C) 2000-2002 Netfilter core team
ip_conntrack version 2.1 (125 buckets, 0 max) - 376 bytes per conntrack
ip_conntrack_pptp version 2.1 loaded
ip_nat_pptp version 2.0 loaded
ip_ct_h323: init success
ip_nat_h323: init success
ip_conntrack_rtsp v0.01 loading
##################
ip_url_filter_ops: load success
ip_nat_rtsp v0.01 loading
device eth0 entered promiscuous mode
br0: port 1(eth0) entering learning state
br0: topology change detected, propagating
br0: port 1(eth0) entering forwarding state
device nas_0_0_35 entered promiscuous mode
br0: port 2(nas_0_0_35) entering learning state
br0: topology change detected, propagating
br0: port 2(nas_0_0_35) entering forwarding state
device eth0 left promiscuous mode
br0: port 1(eth0) entering disabled state
device eth0 entered promiscuous mode
br0: port 1(eth0) entering learning state
br0: topology change detected, propagating
br0: port 1(eth0) entering forwarding state
ip_url_filter_ops: unload success
##################
ip_url_filter_ops: load success

(Last edited by spadkins on 29 Dec 2011, 17:13)

Spadkins, i had spended one morning downloading GPL Dlink source code, modifying that for "firmware not name recognizing" and then compiling it .

The result was a firmware image , ready to flash from ( in theory)  any original firmware of DSL-2640B  and after that, your router will be ready to flash OPENWRT image from TFTP server via TELNET as described on the OPENWRT WIKI PAGE.

** ON MY CASE **

1- First i downloaded DSL-2640B B2 FW UK_4.00 for UK  from http://tsd.dlink.com.tw/downloads2008detailgo.asp

2- Then i flash it , and then , i flash the "source code modified and compiled" you can get the firmware image that i had  build here :

http://www.hagotuweb.com/EU_DSL-2640B_E … l_3.06L.06

3- then i did a telnet and flash the OPENWRT IMAGE via tftp.

NICE!! IT WORKS.

(Last edited by lute on 23 Sep 2012, 17:37)

Hi Lute,

I followed your procedure but I wasn't very lucky. Well, I probably did something wrong.

Actually, I got the firmware v3.06 correctly uploaded. Then, I connected through telnet to the DLINK and executed in there the command tftp -g -f openwrt-DSL2640B-squashfs-cfe.bin 192.168.1.2

I got the messages from the tftp image get process, got disconnected and then nothing. Power and status leds are green but I have no DHCP and if I try to connect to 192.168.1.1 I get no reply. Any idea what it might be the problem? I guess now the only way to connect is through console serial, right?

Thanks!!

lute wrote:

1- First i downloaded DSL-2640B B2 FW UK_4.00 for UK  from http://tsd.dlink.com.tw/downloads2008detailgo.asp

It's probably obvious to you, but for the sake of readers (I for sure got confused at first): you have a different hardware revision (B2) than spadkins (B3). Your modified firmware won't work with B3 (I tried on mine, it is not accepted). Notice B2 was already known to run openwrt (but still, thanks for the details you reported on the "software only" method): http://wiki.openwrt.org/toh/d-link/dsl-2640u

That clearly doesn't mean your procedure could not work for B3, I will try when I have time... but it would be probably interesting to know if you did something particular in the "source code modified and compiled" step.

elwylly: you have a B2 (no external serial port) right?

does anyone know if this method will work on a dsl-2740B F1? im having issues flashing as well

Joeyxl wrote:

does anyone know if this method will work on a dsl-2740B F1? im having issues flashing as well

Don't know... never heard about this rev, and there seem to be no GPL sources for its firmware on tsd.dlink.com. There are some with no rev. number specified, though, and they could possibly be general ones. You could check if they do have a "EU_DSL-2640B_F1" folder inside the "targets" dir, inside the "EU_DSL-2640B_*_consumer.tar.gz" (replace "*" with anything) archive, inside the main archive you download (at least, that was the structure in the one I downloaded for B3.

For B3, I just was able to recompile an image with the firmware check disabled, I will test it soon (at the moment, I don't have my DSL-2540B at hand).

pbat wrote:

For B3, I just was able to recompile an image with the firmware check disabled, I will test it soon (at the moment, I don't have my DSL-2540B at hand).

WARNING: this post is _only_ about rev. B3.

I finally tried my recompiled image. It was loaded simply fine through the http interface (message "Uploading is in progress. The DSL Router will reboot upon completion. Please wait... "), but it doesn't solve the problem - I still get an error ("Fatal error during image uploading.") if I try to load an openwrt firmware via the http interface, and if I try with tftp, the router simply reboots back in its previous state.
But the craziest part is that I get a "fatal error" if I try to upload a firmware from d-link (downloaded from the product support page: http://www.dlink.com.my/support/support … roduct=414 ). The upload functionality is not simply broken, though: I'm still able to reupload my modified image.

For the moment, I'm giving up. If anyone wants to try, here:
http://pietrobattiston.it/t/EU_DSL-2640 … _3.12L.01.
is the firmware image compiled from source after applying the modification described in https://dev.openwrt.org/ticket/5472#comment:4 .

But (before trying it) I would ask someone to simply try to upload to the router the image (even just through the http interface) from the official website:
http://www.dlink.com.my/support/Support … upport=964
and report if it is accepted.

pbat wrote:

For the moment, I'm giving up. If anyone wants to try, here:
http://pietrobattiston.it/t/EU_DSL-2640 … _3.12L.01.
is the firmware image compiled from source after applying the modification described in https://dev.openwrt.org/ticket/5472#comment:4 .

By the way: setting up the system for the compilation was pretty annoying, but now it's ready, if somebody has some clever idea of how to modify the sources and sends me a patch, I can compile them and upload the resulting image.
(though if one wants to do many different tests, I'll rather share my Virtualbox image in which to run the compilation)

lute wrote:

Spadkins, i had spended one morning downloading GPL Dlink source code, modifying that for "firmware not name recognizing" and then compiling it .

The result was a firmware image , ready to flash from ( in theory)  any original firmware of DSL-2640B  and after that, your router will be ready to flash OPENWRT image from TFTP server via TELNET as described on the OPENWRT WIKI PAGE.

** ON MY CASE **

1- First i downloaded DSL-2640B B2 FW UK_4.00 for UK  from http://tsd.dlink.com.tw/downloads2008detailgo.asp

2- Then i flash it , and then , i flash the "source code modified and compiled" you can get the firmware image that i had  build here :

http://www.hagotuweb.com/EU_DSL-2640B_E … l_3.06L.06

3- then i did a telnet and flash the OPENWRT IMAGE via tftp.

NICE!! IT WORKS.


Link from hagotuweb.co not valid. Plese REPOST.

(Last edited by saraj on 21 Oct 2013, 14:18)

Quick update: (based on the D-Link sources for the two boards) rev. B3 seems to have major differences from rev. B2. In particular:

  • SoC: 6338 rather than 6348

  • wireless: 4312 instead than 4318

  • a "psi_size" of 48 - but I have no idea of what this means

In short: do not try to flash the current B2 firmware on a B3 - id doesn't work, luckily (I guess if it did, it would brick your device).

(Last edited by pbat on 21 Apr 2014, 11:05)

elwylly wrote:

Hi Lute,

I followed your procedure but I wasn't very lucky. Well, I probably did something wrong.

Actually, I got the firmware v3.06 correctly uploaded. Then, I connected through telnet to the DLINK and executed in there the command tftp -g -f openwrt-DSL2640B-squashfs-cfe.bin 192.168.1.2

I got the messages from the tftp image get process, got disconnected and then nothing. Power and status leds are green but I have no DHCP and if I try to connect to 192.168.1.1 I get no reply. Any idea what it might be the problem? I guess now the only way to connect is through console serial, right?

Thanks!!

you don't need the serial cable. if you press the reset button for 30 seconds, and then open the browser on 192.168.1.1, you fill find a simple html page where you can select the original DLINK firmware and flash it.

(Last edited by gaucho on 29 Apr 2014, 17:02)

i have the B2 revision of the DSL-2640B.
I downloaded the openwrt firmware from http://downloads.openwrt.org/backfire/10.03.1/brcm63xx/
( http://downloads.openwrt.org/backfire/1 … fs-cfe.bin)

I downloaded the modified dlink firmware (created as described on the wiki page of openwrt http://wiki.openwrt.org/toh/d-link/dsl-2640u ) from http://ul.to/3ygyfth0
since this link is banned in my country, i re-uploaded here: http://www.speedyshare.com/ZeDBc/EU-DSL … 022900.zip

I downloaded tftpd from here: http://tftpd32.jounin.net/

I setted up my pc on the static ip 192.168.1.10, and i connected via ethernet cable the dlink router.

Once uploaded the modified dlink firmware using the router webpage, i started the tftpd on the computer and i copied the openwrt firmware on the tftp folder, then i logged via telnet, and i used tftp as reported on the wikipage.
this is the log of my actions via telnet, where you can read the command that i hitted:

BCM96348 ADSL Router
Login: admin
Password:
> tftp
BusyBox v1.00 (2012.01.11-13:34+0000) multi-call binary

Usage: tftp [OPTION]... tftp_server_ip

Update firmware image and configuration data from OR backup configuration
data to a tftp server.

Options:
-g      Get file. (Update image/configuration data)
-p      Put file. (backup configuration data)
-f      remote file name.
-t      i for image and c for configuration data.


> tftp -ti -g -f openwrt-DSL2640B-squashfs-cfe.bin 192.168.1.10
bcmUploadPrepare ... curPid[340] ifPid[0] ifName[br0]

Number of processes: 23
 12:01am  up 1 min,
load average: 1 min:0.06, 5 min:0.03, 15 min:0.00
              total         used         free       shared      buffers
  Mem:        14004        13056          948            0         1860
 Swap:            0            0            0
Total:        14004        13056          948
  PID  Uid     VmSize Stat Command
    1 admin       264 S   init
    2 admin           SWN [ksoftirqd/0]
    3 admin           SW< [events/0]
    4 admin           SW< [khelper]
    5 admin           SW< [kblockd/0]
   17 admin           SW  [pdflush]
   18 admin           SW  [pdflush]
   19 admin           SW  [kswapd0]
   20 admin           SW< [aio/0]
   25 admin           SW  [mtdblockd]
   34 admin       300 S   -sh
   70 admin      1624 S   cfm
  106 admin       152 S   pvc2684d
  210 admin       268 S   dhcpd
  220 admin       180 S   sntp -s ntp.dlink.com.tw -s None -t Greenwich Mean Ti
  251 admin      1852 S   httpd
  252 admin      1620 S   cfm
  335 admin      1640 S   telnetd
  336 admin      1660 S   telnetd
  339 admin       260 S   sh -c tftp -ti -g -f openwrt-DSL2640B-squashfs-cfe.bi
  340 admin       252 S   tftp -ti -g -f openwrt-DSL2640B-squashfs-cfe.bin 192.
  343 admin       260 S   sh -c ps > /var/psList
  344 admin       252 R   ps
kill process [pid: 210] [dhcpd]...
kill process [pid: 220] [sntp]...
kill process [pid: 339] [sh]...
> iptables v1.2.11: can't initialize iptables table `filter': iptables who? (do
you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.

Remaining modules:
wl 928896 0 - Live 0xc01aa000
bcm_enet 24320 0 - Live 0xc003f000
bcmprocfs 14656 0 - Live 0xc000c000
br2684 65984 0 - Live 0xc002e000
blaa_dd 7104 0 - Live 0xc000a000
adsldd 143024 0 - Live 0xc005f000
atmapi 59296 3 br2684,blaa_dd,adsldd, Live 0xc001f000

Memory info:
Number of processes: 21
 12:01am  up 1 min,
load average: 1 min:0.06, 5 min:0.03, 15 min:0.00
              total         used         free       shared      buffers
  Mem:        14004        12988         1016            0         1892
 Swap:            0            0            0
Total:        14004        12988         1016
... done bcmUploadPrepare

Allocating 2752524 bytes for broadcom image.
Memory allocated
Total image size: 2752516
Skip check model name

after this i had to wait few minutes, then the router started to answer to ping and to respond to http://192.168.1.1.

it works! even if i lost 1 entire day to find the right files. and the precise commands to use.


note: if do you need the ordiginal dlink FW version you can find them here: http://tsd.dlink.com.tw/downloads2008.asp

In case anyone is still interested in this device, here are compiled firmware images of 3C GPL firmware for DSL-2640U, h/w B2: archive.org/download/DSL-2640U_3-06-04-3C_GPL_firmware (direct link to modified firmware that skips model name check: archive.org/download/DSL-2640U_3-06-04-3C_GPL_firmware/RU_DSL-2640U_3-06-04-3C_GPL_no_check.BIN .

Here are brief instructions on how to do it from scratch (if you are going to use compiled firmware, the compilation stage can be obviously skipped):

Hardware: D-Link DSL-2640U (P/N ISL2640UBRU0.B2G, H/W version B2, original F/W version RU_3-06-04-1C00)
GPL firmware version: RU_DSL-2640U_3-06-04-3C_GPL (file name RU_DSL-2640U_3-06-04-3C_GPL.tar.gz, size 103781274 bytes, md5 hash  989762a64aec9554c71ace3b7c1d9a7d)

*) Install Red Hat 9.0, unpack firmware, install sources and tools as specified in instructions.

*) Remove model name check in firmware. File RU_DSL-2640U_3-06-04-3C_src/userapps/opensource/ftpd/fwsyscall.c, line 300:
replace if(result==0) with if(1).

patch:

--- RU_DSL-2640U_3-06-04-3C_original/userapps/opensource/ftpd/fwsyscall.c    2006-09-16 06:21:03.000000000 +0400
+++ RU_DSL-2640U_3-06-04-3C_no_check/userapps/opensource/ftpd/fwsyscall.c    2017-02-05 01:19:41.906250000 +0300
@@ -297,7 +297,7 @@ UPLOAD_RESULT verifyTag(PFILE_TAG pTag,
 
     //If new firmware model name is "cj86gji4adsl1234cj86gji4adsl1234" then we skip check model name
     result=memcmp(((char*)pTag + TAG_LEN + totalImageSize-32), "cj86gji4adsl1234cj86gji4adsl1234",32);
-    if(result==0)//skip check model name
+    if(1)//skip check model name
     {
         printf("Skip check model name\n");     
     }

*) Compile firmware.

*) Set up tftpd server and run it.

*) Flash patched gpl firmware using telnet (web interface is somewhat buggy).
#telnet router_ip
#tftp -g -t i -f patched_fw_name client_ip

*) Flash OpenWRT firmware using telnet.
Same as above.
NB: For this router (h/w version B2) last OpenWRT version in 10.03.1: file name openwrt-DSL2640B-squashfs-cfe.bin, size 2752516 bytes, md5 hash c610f83f714db8abdd85b74aac53ff31).

Debricking:
*) Set up client computer ip to 192.168.1.2.
*) Press and hold "reset" button.
*) Turn on router.
*) Keep holding "reset" button for 10 seconds. Power indicator should be red, status green, connected lan port - green and blinking.
*) Connect to 192.168.1.1 with web browser. A minimalistic firmware flash page will open.
*) Flash firmware: pre-compiled binary, compiled from source or patched. OpenWRT won't be accepted at this stage.

The discussion might have continued from here.