DHP-1565 OpenWrt

From NURDspace

Jump to: navigation, search
OpenWrt Powerline Support D-Link DHP-1565
NoPicture.png
Participants Dennis
Skills Reading docs, Building OpenWrt
Status In progress
Niche Software
Purpose Infra
Tool No
Location
Cost
Tool category

OpenWrt Powerline Support D-Link DHP-1565

"File:{{{Picture}}}" cannot be used as a page name in this wiki.

{{{Picture}}} {{#if:No | [[Tool Owner::{{{ProjectParticipants}}} | }} {{#if:No | [[Tool Cost::{{{Cost}}} | }}

Description

I bought a D-Link DHP-1565 router. As with al my routers, I'd like to run OpenWrt on it. The official images however do not support the Powerline (PLC) functionality built in in this model, this is why I did something similar as described here. I can now successfully use the PLC functionality of this device together with two D-Link DHP-500AV Powerline AV 500 adapters.

How to get this to work

Built image with patched kernel

I succesfully built an image that has this patch applied. Images (18.06-SNAPSHOT, r7853-f6de1fa6c6) can be downloaded here. With this patch the link on port 6 is there, this means the switch can talk to the AR7400 PLC chipset now.

Note: since this is a snapshot, this image might give you dependency troubles when installing kernel modules from the default feed.

Add port 6 to a VLAN

Edit /etc/config/network such that port 6 is in a VLAN you want. I chose VLAN 2, which means the WAN interface. Of course you should be aware of the security implications when your WAN interface is actually connected to the outside world.

Install stuff from open-plc-utils

Looks like we do not need to build this, since there are packages in the OpenWrt repo's. I started with installing open-plc-utils-amptool, open-plc-utils-ampboot, open-plc-utils-ampstat and openplc-utils-modpib.

Extracting PLC firmware from downloaded router firmware

  • Download firmware from https://tsd.dlink.com.tw/
  • Extract the .rar, it should give you a .bin file
  • Install binwalk and sasquatch
apt install binwalk
git clone https://github.com/devttys0/sasquatch
cd sasquatch/
./build.sh
  • Run binwalk on the .bin
binwalk -e DHP1565A1_FW100B35.bin

PLC stuff can be found in _DHP1565A1_FW100B35.bin.extracted/squashfs-root/plc.

  • On the device, create /overlay/upper/plc/
  • Copy .pib and .nvm files to /overlay/upper/plc/ (ceb is for Europa, na for North America)

Set the NMK

The Network Management Key (NMK) is the key used to join a network. You can use hpavkey to generate one. I did this on my laptop, but you can do it on the device when you install open-plc-utils-hpavkey.

hpavkey -M myverysecurepassword

This example will give you the following to use as NMK:

17EFC430E2A9A9D746210878D68E6B19

You can put the NMK it in the .pib file that we will load later on:

modpib -N 17EFC430E2A9A9D746210878D68E6B19 /overlay/upper/plc/plc.ceb.pib

Loading the firmware

The command listed in here did not seem to show that the bootloader is waiting for firmware:

# amptool -i eth0.2 -Iar
eth0.2 00:B0:52:00:00:01 Request Version Information
eth0.2 00:B0:52:00:00:01 Fetch Device Attributes
eth0.2 00:B0:52:00:00:01 Device Identity

But when we try it on br-lan, it does!

# amptool -i br-wan -Iar
br-wan 00:B0:52:00:00:01 Request Version Information
br-wan 00:B0:52:00:00:01  AR7400 BootLoader
br-wan 00:B0:52:00:00:01 Fetch Device Attributes
br-wan 00:B0:52:00:00:01 Device Identity

Loading the firmware looked succesful:

root@loetje:~# ampboot -i br-wan -P /plc/plc.ceb.pib -N /plc/plc.nvm
br-wan 00:B0:52:00:00:01 Write /plc/plc.nvm (0) (00000040:17256)
br-wan 00:B0:52:00:00:01 Start /plc/plc.nvm (0) (000000C0)
br-wan 00:B0:52:00:00:01 Write /plc/plc.ceb.pib (0) (00200000:16352)
br-wan 00:B0:52:00:00:01 Write /plc/plc.nvm (3) (00341194:423788)
br-wan 00:B0:52:00:00:01 Start /plc/plc.nvm (3) (00341A88)
br-wan 00:01:23:45:67:8B INT7400-MAC-5-2-5203-01-913-20110713-FINAL-B is running

Autoload at boot

I simply put following line in /etc/rc.local:

ampboot -i br-wan -P /plc/plc.ceb.pib -N /plc/plc.nvm

Note: this only works when power was disabled. If power stays on and you reboot the device, the old firmware will stay loaded and the AR7400 will not go into bootloader mode, so the command above will fail. This is mainly an issue when you want another firmware (nvm) or change settings (pib).

Todo

  • Paint the damn thing like in https://www.youtube.com/watch?v=HDiD7xdG1kM
  • Measure power consumption
  • Try the build again, either to get a release version (no snapshot), or include the right kernel modules for USB disk support

Links used in getting stuff working

Other links

 
Our site is hosted by Site4U
Site4U
Our connectivity is made available by BIT
To BIT's website