DIR-882 in Linux over TFTP

I have a D-Link DIR-882 that I am trying to install OpenWrt on. All of my systems run Linux, and I see from various posts here that because of the HTTP 100-continue issue with the DIR-882 it isn't going to be possible for me to install using the recover GUI method while using Linux. I've tried three early versions of Firefox, including the 13.0.1 suggested on this forum, and it always hangs. So my aim now is to do a TFTP installation, but the info on this in the DIR-882 page here is a little sparse (no shade, really! With the large number of devices, this is perfectly understandable). I have established serial communications with the 882, and get this menu at boot:

Please choose the operation: 

   1: Load system code to SDRAM via TFTP. 

   2: Load system code then write to Flash via TFTP. 

   3: Boot system code via Flash (default).

   4: Entr boot command line interface.

   6: System Enter UBoot to Update Img or Bin. 

   7: Load Boot Loader code then write to Flash via Serial. 

   9: Load Boot Loader code then write to Flash via TFTP. 

default: 3

I also have successfully set up a TFTP server on my main computer and shown that I can transfer the firmware to another computer, as described in Documentation/User Guide/Troubleshooting/Setting up a TFTP server.

So what do I do next?

Which menu item do I choose? Looks like #2 to me, but I don't want to brick this thing quite so quickly if that's wrong.

Do I use the firmware openwrt-21.02.0-ramips-mt7621-dlink_dir-882-a1-squashfs-factory.bin?

If so, do I need to rename it to something specific that the TFTP client will recognize?

Thanks for any help!

Yup, should be option 2.

The serial console will tell you the proper file name.

Post the outcome, especially the details the wiki is missing.

1 Like

So far it's not looking good. I changed my static IP address to 192.168.0.101 and my gateway to 192.168.0.1, then started tftp with

dnsmasq --port=0 --enable-tftp --tftp-root=/path/to/firmware/directory --tftp-no-blocksize --user=root --group=root

(with the correct path inserted). This works to transmit tftp to another computer, so I know it's right.

I then boot the DIR-882, select menu item 2, and I get:

Warning!! Erase Linux in Flash then burn new one. Are you sure?(Y/N)

 Please Input new ones /or Ctrl-C to discard

	Input device IP (192.168.0.1) ==:192.168.0.1

	Input server IP (192.168.0.101) ==:192.168.0.101

	Input Linux Kernel filename () ==:xx.bin


 NetTxPacket = 0x87FE4240 


 KSEG1ADDR(NetTxPacket) = 0xA7FE4240 


 NetLoop,call eth_halt ! 


 NetLoop,call eth_init ! 

Trying Eth0 (10/100-M)


 Waitting for RX_DMA_BUSY status Start... done



 ETH_STATE_ACTIVE!! 

TFTP from server 192.168.0.101; our IP address is 192.168.0.1

Filename 'xx.bin'.


 TIMEOUT_COUNT=10,Load address: 0x84000000

Loading: checksum bad

Got ARP REQUEST, return our IP

Got ARP REQUEST, return our IP

Got ARP REQUEST, return our IP

Got ARP REQUEST, return our IP

Got ARP REQUEST, return our IP

Got ARP REQUEST, return our IP

Got ARP REQUEST, return our IP

Got ARP REQUEST, return our IP

Got ARP REQUEST, return our IP

It keeps doing this for a while, occasionally throwing in the letter 'T', and then it times out (I think after 10 Ts or so). After timing out, it starts over.

Is it objecting to the checksum of the firmware file, or something else?

Also - this is embarrassing - I can't find the shar256sum file for this firmware file (or any file, for that matter) on this site.

I would use option 1 and the initramfs build file. This should boot OpenWrt from RAM then you can log into that OpenWrt and use sysupgrade to install a sysupgrade file to the flash.

But if you can't TFTP that isn't going to work either. Make sure the netmask on the PC static IP is set correctly (255.255.255.0 or /24) and the PC is not connected to any other wired or wifi networks. You don't have to set a gateway you just need the router and the PC under the same netmask.

sha256 sums are on the download page next to each file.

1 Like

7 posts were split to a new topic: OpenWrt on MT7621/MT7615N devices with 5GHz problems

try 4, and see if the DIRs uboot is capable of accessing a flash drive inserted into the USB port.

The current Stable release is: dlink_dir-882-a1-squashfs-factory.bin

I'm just checking you have tried the recommended
curl -v -i -F "firmware=@file.bin" 192.168.0.1

if you are still having problems i'll make you a web flash able version

https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=73e8f23579bcb87764dae9ed0aefe28be3183d3e

here is a web flashable version from the dlink web interface
http://luckys.onmypc.net/openwrt/DIR-878/openwrt-21.02.0-ramips-mt7621-dlink_dir-882-a1-squashfs-factory.enc.bin

A quick and preliminary update on this. I've been continuing attempting TFTP installation, and I randomly decided to try switching the ethernet cable (coming from the TFTP-transmitting computer) from the 882's WLAN port, which is what I've been using all along because it seemed sensible at the time, to the LAN 1 port. All of a sudden it worked. Wish I'd thought of that before.

I will try in the next few days to post a précis of the steps I've gone through to get to this point.

Thanks, Lucky, for your effort on the web flashable version - looks like I don't need it, though. Also thanks to everyone offering advice.

Here's how I got TFTP installation working on the DIR-882:

Installation of OpenWrt on a D-Link DIR-882 router via TFTP

21 Sep 2021

Installing OpenWrt on the DIR-882 using the standard D-Link Recover GUI method, as described on the OpenWrt page for this unit, is not possible from a machine running Linux. This is apparently due to the combination of an error in D-Link's firmware that causes a missing "100 - continue" message, and Linux's strict implementation of HTTP.

The solution is to install via TFTP. This requires a serial connection from the DIR-882's board, through an appropriate serial adapter, to a computer running a serial terminal program. It also requires a computer - which can be the same computer - with an ethernet port, that will be used to send the firmware to the DIR-882 over ethernet.

  1. Open the DIR-882 (invalidating the warranty, of course) by removing the four rubber feet and unscrewing the four screws underneath them. Then use a spudger tool, or a screwdriver if you're not fastidious, to pry the top cover off. There are about 11 attachment tabs, one of which will probably break, but once you get one corner up it comes off easily.

  2. With the unit open and oriented so that the LEDs are toward you and the yellow WAN port connector is away from you, you will see four PC pads in a horizontal line just to the left of the yellow WAN port connector. From left to right, they are +3.3 V, Rx, Tx, GND. Ignore the +3.3 V pad, and solder a standard 3 pin (tenth inch) header to the other three. Or you can just solder wires to the pads. (The GND pad is difficult to solder to because it appears to be connected to the ground plane without benefit of a thermal relief. A bit amateurish, that!)

  3. You will need some kind of adapter to provide a non-inverted RS-232 type connection at 3.3 V (not 5 V TTL level, and especially not the genuine RS-232 inverted ±12 V!). Somebody must offer something like this on ebay somewhere, I expect. Mine is homebrew, consisting of an FT230X chip and a few resistors. This connects to a USB port. I suppose you could kludge together something simple that would work with a standard PC serial port as well. The serial terminal software should be set for 57600 baud, 8N1. See the OpenWrt DIR-882 page for details. Remember Tx goes to Rx, and vice-versa.

  4. Test the serial connection by switching on the router. You should get a stream of intelligible stuff. It all goes by quickly, but within a couple of seconds, you get a menu with nine items. When you get the TFTP running via ethernet, you will be selecting item 2, which you'll have to do quickly before the router self-selects item 3, which is its standard boot sequence.

  5. Download the firmware to the computer with the ethernet port and rename it to something short and simple.

  6. Go into your network configuration and edit your ethernet connection IPv4 settings to

    Method: manual
    Address: 192.168.0.101
    Netmask: 24
    Gateway: 192.168.0.1
    

    Then - important! - select disconnect, then reconnect the connection. Physically pulling the connector out and then reconnecting it would probably have the same effect. Without this, the connection may not change over to the new address.

  7. In a terminal, do:

    dnsmasq --port=0 --enable-tftp --tftp-root=/path/to/firmware/directory --tftp-no-blocksize --user=root --group=root

    where /path/to/firmware/directory is something like /home/myname/Desktop/ , if that's where you've put the firmware. You may need to precede this by sudo (or the equivalent for your Linux flavor). This computer should now be primed to send out TFTP.

    You can test this by sending a file to another computer, following the procedure outlined in the OpenWrt Documentation/User Guide, under Troubleshooting/Setting up a TFTP server for TFTP Recovery/Install. Note that the receiving computer has to be connected directly - not through a router - and has to be set to the same domain as the transmitting one, i.e. 192.168.0.......

  8. Connect the ethernet cable directly between the transmitting computer and the router's LAN 1 port (not the WAN port!) Turn the router off, then on. As described above, you quickly get a menu - select item 2. You will be asked if you want to proceed, then for the device IP and the output device IP. Accept the defaults (respectively 192.168.0.1 and 192.168.0.101). Then you are asked for the filename. After that, the firmware loads and then is written to flash. After all activity has stopped, wait a few minutes to make sure, then you're done.