Installing Openwrt on Devolo Magic 2 wifi next

First, I'm a newbie and have difficulty following this git commit instructions (https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=d3c88811942a9dc9bbb01ca0443ae9cd790d1988 ).

  1. Please; is there any where I could find a clear way to perform the task of installing Openwrt on my adapter for a newbie like me who isn't used to CLI? I know I need putty to access the machine via ssh plus a TFTP server. My problem starts from step 4 to step 6; unfortunately.

  2. If l install Openwrt, do I loose the ability to use Devolo-Cockpit to boot and configure the G.hn chip? Asking because of the Notice at the end of the instructions.

Hi, this device requires changing uboot settings. This has the potential to soft-brick the device if you do not know what you're doing and also means you cannot return to stock.

Also, while I don't have this device, the notes at the end appear to state that the PLC functions are not working in openwrt, if you need these do not proceed. You may want to contact the submitter to see if they have a work around (like installing the non-free components from the original firmware). To do that you will need to get familiar with the command line.

lf this is the first time you've installed openwrt on a device - perhaps try with a device that is better supported first, such as a router and get yourself familiar with ssh and commandline uci - before tackling a more complex device like a PLC access point.

1 Like

@ jdwl1o1
Whoa, l assumed the issue of G.hn had been resolved!! That git commit is over a year old.

I also assumed there was a way to install Openwrt without touching the PLC soft/ hard- ware, like is the case with Tl-wpa8630p.

Thanks for the reply.

Hi, it's possible that the device maintainer did come up with a solution that doesn't require non-free components - but you will be 'rolling the dice' with no clear path back to stock.

The device support was added by the manufacturer, so I think you can assume if it was possible to make it work they would have done so.

Some PLCs present as an ethernet interface to the SOC running openwrt, but this is not always the case, if the committer states it won't work I'd be inclined to think this is one of the 'other' cases.

You can always boot the initramfs and try it out, without impacting the stock OS, but booting initramfs that will require uboot and serial/UART access and can be painful on these plug devices.

I am also interested in the installation process if that makes the device a Wi-Fi router.

I can now explain to you in detail what you want to do and what you want to know.

  1. Configure your network adapter with the IP address 192.168.0.100/255.255.255.0 and also add an alias of 192.168.1.2/255.255.255.0. The 192.168.0.100/24 is for the tftp server while the 192.168.1.2/24 will ultimately help you access the device once it reboots after you install the initial OpenWrt firmware into the device.
  2. Download the TFTP Server application from https://bitbucket.org/phjounin/tftpd64/downloads/Tftpd64-4.64-setup.exe and install it.
    Now you need to configure the TFTP server app (via the settings button) with two parameters:
    (a) The interface for it to listen on - should be 192.168.0.100
    (b) The "Base directory" - Here I created C:\tftpdroot\
    2.1. Download the OpenWrt firmware from here:
    https://firmware-selector.openwrt.org/?version=21.02.3&target=ipq40xx%2Fgeneric&id=devolo_magic-2-wifi-next
    For simplicity, save the two files in C:\tftpdroot
    (a) Rename the Kernel file to "uploadfile"
    (b) Rename the sysupgrade file to sysupgrade.bin
  3. Now open your Devolo Cockpit application and connect to your device. Go to its settings and change the password to manage it to something like "pass987" or whatever. Write this password somewhere or just remember it.
    Now you need to upload the kernel file to the device via TFTP. Basically, connect a cable between your laptop and the device. You can use a switch for that.
    Power off the Devolo device.
    Press and hold the small button next to the Ethernet ports while you plug it into the power socket.
    On your TFTP server app, on the Log Viewer tab, you will see the device fetching the "uploadfile" from the TFTP application.
    Once it has done that, give it about 5 minutes. You can open a CMD prompt on your laptop and do a continuous ping to 192.168.1.1 (ping 192.168.1.1 -t). Once you see the pings are steady, it's time to go to the next step.
  4. Download WinSCP from https://winscp.net/download/WinSCP-5.21-Setup.exe and install it. Create a new site in WinSCP. The site IP is 192.168.1.1, the File Protocol is SCP, the username is root and the password is the one you created earlier.
    Navigate to C:\tftpdroot, right-click on the sysupgrade.bin and from the context menu select "send to -> WinSCP (for upload)". WinSCP will prompt you to connect to the site you had created and also to login. Once it connects, you will see the file destination path as "/root/.". Change it to "/tmp/." then click ok for the file to be uploaded. Once done, we go to the next step.
  5. Using putty, connect to 192.168.1.1 using the username "root" and password "pass987" or whatever you had assigned earlier. Once you login with putty copy and paste/execute this command:
    (a) fw_printenv
    Copy the output of the above command to a text file and save it. Next copy and execute the next command:
    (b) fw_setenv bootcmd 'sf probe && sf read 0x84000000 0x180000 0x400000 && bootm'
    Give the command some time to run, until you see the shell prompt (#) again. Once that is done, it is time to install the sysupgrade.bin file.
    (c) cd /tmp
    (d) sysupgrade -v /tmp/sysupgrade.bin
    At this point, you will probably be thrown out (as happened to me! ), but don't despair. Go back to your CMD prompt on your laptop and wait until you see the pings steady again. Once that happens, you can open your browser and go to http://192.168.1.1 and log in without a password initially. Then you can configure the device from there.

On your 2nd question, my observation is that you do lose the ability to use Devolo-Cockpit to boot and configure the G.hn chip. If you find a solution to this, please let me know also.

BTW, I'd also be happy to find out if there is a way to configure the device as a router - instead of an AP :slight_smile:

Let me know if I missed something in the procedure. I hope I did not.

1 Like

The OEM firmware is also based on OpenWRT. Sources and extractable firmware images are provided by Devolo. Possibly it would be easier to enable the PLC after first getting a shell prompt with that firmware? Maybe ssh or telnet could be enabled for the OEM firmware.

Jschwart
I figured what you just said, but l am still trying to enable ssh, scp and telnet. I know it's locked by Devolo.

Have you or do you know how l could enable this/ these?


@linknetgear I was looking at this yesterday evening.

What you can do to find out more.

  1. Download the image from the Devolo site.
  2. Unpack it with binwalk -Me
  3. There'll be some squashfs file.
  4. Unpack that with 7z x

This should give you a filesystem. Check out:
/etc/init.d/dropbear
/lib/delos-functions.sh
/lib/delos/functions.sh

Now check out the web interface. There is a way to get a back-up of the configuration. This will give you a tarball.

Now it's interesting how restoring from back-up ends up working out. If that simply unpacks the tarball, then possibly the init script could just be overwritten with one that doesn't have a check.

The startup section of the dropbear init script contains a line to just 'return' when some condition is true, which depends on a few more conditions. Those you can derive from the other scripts. Note that some of those conditions also have other side effects.

There's quite a bit to study, maybe you could continue based on this? :slight_smile:

For the PLC, check out the opkg packaging data, you'll find quite some packages related to g.hn that seem to contain the tools needed to set this up.

1 Like

And another resource that might be useful, the source package from Devolo:
https://sl.devolo.global/oss-magic-2-wifi-next

Edit: The file behind this URL changes over time. It is updated as new firmware versions are released. It might be useful to keep back-ups.

@linknetgear I won't have time myself to look more at this, but I'm curious if you will manage to get somewhere :slight_smile:

Actually, it is quite straight forward: Add this to the configuration tarball:

root@devolo-133:~# cat /etc/config/delos
[...]
config baptization 'baptization'
        option ssh '1'
1 Like

That's a great find! I hope I will be able to try this soon. To move fully to OpenWRT with working G.hn I think the following steps would make sense:

  1. Have one device with SSH access on OEM installation
  2. Have one device on latest/recent OpenWRT
  3. Have a third device that talks to device 1

Step by step investigate what needs to be transplanted from device 1 to device 2 so that also device 2 starts talking over G.hn to device 3.

I can confirm this works!

BusyBox v1.30.1 () built-in shell (ash)

      _      _
   __| | ___| | ___  ___
  / _` |/ _ \ |/ _ \/ __|  (c) 2022 devolo AG
 | (_| |  __/ | (_) \__ \  powered by OpenWrt 15.05.1
  \__,_|\___|_|\___/|___/  powered by QSDK SPF 11.4
-----------------------------------------------------
delos 5.10.3 for devolo Magic 2 WiFi next

Just note that you need something like this in ~/.ssh/config:

Host devolo-???
        User root
        HostKeyAlgorithms +ssh-rsa

And the root password is the password configured in the web interface.

Some package repositories are configured point to directories below:
http://delos.devolo.net/5.10.3/palma/
and
http://delos.devolo.net/5.10.3/ipq/

Not all of them exist however and some packages installed on the device do not seem to be in the directories that are there.

The command ghn_console provides insight in the G.hn powerline network. The ver command outputs a version number that seems to fit in the numbering scheme used by the Magic 2 LAN firmware (the device without WiFi that doesn't seem to use OpenWRT). Possibly the G.hn device runs fully independently and this is the entry point into it.

I do not see a distinct ethernet device for the G.hn interface. The one listed is using the MAC address of the LAN interface and is according to brctl only bridge with the wireless interfaces. I suspect that there is another independent switch and the G.hn interface and UTP wired ethernet interface are hooked up together to that. This independent separate environment might resemble a Magic 2 LAN, but running a lighter version of its firmware.

The ghn_console tool thus gives entry into that separate device. It also has its own filesystem. Here some commands:

#delos@/>help
Console Help
-------------

h/help    -> Show this help
q/quit    -> Quit the console
exit      -> Exit Console Session
uid       -> Return Console User Id
..        -> Go up one menu
/         -> Go to root menu
ls [-a]   -> List commands in current menu (-a: extended)
lsall [-a]-> List ALL commands and menus in the console (-a: extended)
his       -> Command history
run <file>-> Executes commands present in <file> located in FFS

OK
#delos@/>ls
Name                Alias         Description
----                -----         -----------

activatesocket      as            Activate the socket console task.
afe/                afe/          Analog Front End Commands
agc/                a/            Automatic Gain Control Commands
apiver              av            Information about the API version
assert/             asrt/         Assert Commands
bpcdriver/          bpcdr/        Bpcdriver commands
bridge_tables/      bft/          Commands for the bridge forwarding table
bridgedriver/       b/            Bridgedriver commands
channelestimator/   chest/        Channel Estimator commands
cldriver/           cld/          Cl Driver commands
clock/              clock/        Clock commands
configlayer/        cfl/          Configuration Layer related commands
consoleexit         ce            Change Console exit mode, set timeout time or get num of timeouts. Usage: ce e [0|1]|ce t <seconds>|ce tg
crypto/             cr/           Crypto commands
didm/               didm/         DIDMng commands
dns/                dns/          DNS commands
dro/                dro/          DRO Driver commands 
ethifdriver/        ethd/         Ethernet interface driver commands
ethphyconf/         ethp/         EthPhyConf commands
factoryreset/       frst/         Factory Reset-related commands
filesystem/         fs/           File System related commands
flash/              flash/        HDL Flash commands
flowmanager/        flm/          Flow Manager commands
flup/               flup/         Flash Upgrade commands
hw/                 hw/           Hardware-related commands
info                i             General information about the modem
lcdu/               lcdu/         LCDU commands
lcmp/               lcmp/         Lcmp commands
linkadaptation/     la/           Link_adaptation commands
linktable/          lt/           Link Table commands
macdriver/          md/           Macdriver commands
machal/             msh/          MacHAL commands
macsynch/           ms/           MAC commands
malloc/             malloc/       Malloc commands
mapmanager/         map/          MAP manager commands
masterselection/    msel/         Master Selection commands
mcast/              mcast/        Mcast commands
measuremanager/     measm/        Measure Manager commands
memoryController/   mc/           Memory Controller Debug commands
mnmtmsgmng/         m3/           MnmtMsgMng commands
mode                mode          Change Console mode. Usage: mode [user|admin <password>]
nap/                nap/          Nap commands
ndim/               ndim/         Ndim commands
net/                n/            NET Commands
networkclock/       nc/           Network Clock Driver commands
node/               node/         L2 Database commands
osinfo/             os/           Display information about OS Execution
packetdet/          pckd/         PacketDetector commands
pairing/            pair/         Pairing commands
password            passwd        Change Local Console Password
phydriver/          phy/          Phydriver commands
plcmng/             pm/           PLC Manager commands
posix/              posix/        POSIX layer management
powersaving/        powsav/       POWER SAVING console commands
qadriver/           qadriver/     QA Driver debug commands.
qossynch/           qs/           QoS commands
queueconfig/        qconf/        QueueConfig commands
rfa/                rfa/          Rfa  commands
rtm/                rtm/          RTM commands
sync/               s/            Sync console commands
syslog/             log/          System log configuration
system_manager/     sys/          System Manager Commands
tcpip/              tcpip/        TCPIP stack manipulation
topologymanager/    topo/         Topology Manager commands
txmodes/            tm/           Transmission Modes console commands
version             ver           Information about the firmware
watchdog/           w/            Watchdog Commands


OK
#delos@/>fs

OK
#delos@/filesystem/>ls
Name                Alias         Description
----                -----         -----------

aginginfo           aginfo        Show flash erase statistics
blockinfo           blinfo        Show internal ffs block structure
cat                 c             Shows the content of a file directly in console. Usage cat <file>
cd                  cd            Changes directory. Usage cd <new firectory>
chdrv               cdr           Changes the current drive. Usage chdrv <drive number (0, 1...)>
crcval              crc           Check CRC (for image files only!). Usage crcval <file>
delete              del           Removes a file. Usage delete <file>
dir                 dir           Shows the content of the current directory
flashfilesysmount   ffsm          Mount Flash File system and start ConfigLayer. Usage flashfilesysmount
flashfilesysunmount ffsu          Unmount Flash File system and stop Configlayer. Usage flashfilesysunmount
hexdump             hd            Shows the content of a file in HEX/ASCII format. Usage hexdump <file> [offset [size]]
mkdir               md            Creates a new directory. Usage mkdir <new directory>
move                mv            Renames a file. Usage move <old name> <new name>
new                 n             Creates a new file. Usage new <file> <length> [content]
permits             pmt           Set/Get permits to file or directory. Usage: permits <path> [+RO|-RO]
pwd                 pwd           Prints current working directory
ramdiskmount        rdm           Mount RAM Disk. Usage ramdiskmount
ramdiskunmount      rdu           Unmount RAM Disk. Usage ramdiskunmount
read                r             Reads a byte from a file. Usage read <file> <position> 
rmdir               rd            Removes an empty directory. Usage rmdir <directory>
write               w             Writes a byte to a file. Usage write <file> <position> <value>


OK
#delos@/filesystem/>dir


Current directory is: B:\

01/01/1970  0:00:00                 RW       22332      configuration_settings.bin
31/08/2092  9:39:26      <DIR>      RW                  diagnostics
08/15/2028 16:32:24                 RW       22332      factory_settings.bin
08/15/2028 16:32:24                 RW        8736      factory_settings_profile_1.bin
08/15/2028 16:32:24                 RW        8736      factory_settings_profile_2.bin
08/15/2028 16:32:24                 RW        8736      factory_settings_profile_3.bin
08/15/2028 16:32:24                 RW        8736      factory_settings_profile_32.bin
08/15/2028 16:32:24                 RW        8736      factory_settings_profile_33.bin
08/15/2028 16:32:24                 RW        8736      factory_settings_profile_34.bin
08/15/2028 16:32:24                 RW        8736      factory_settings_profile_35.bin
08/15/2028 16:32:24                 RW        8736      factory_settings_profile_6.bin
08/15/2028 16:32:24                 RW          88      fw
08/15/2028 16:32:24                 RW         580      mbr.bin


**************************************************
  Total:             969216 bytes 
  Free :             835584 bytes 
  Used :             133632 bytes 
  Bad  :                  0 bytes 

OK
#delos@/filesystem/>pwd


Current directory is: B:\


OK
#delos@/filesystem/>

Some information on the CPUs:
OpenWRT environment:

root@devolo-435:~# cat /proc/cpuinfo 
processor       : 0
model name      : ARMv7 Processor rev 5 (v7l)
BogoMIPS        : 96.00
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xc07
CPU revision    : 5

processor       : 1
model name      : ARMv7 Processor rev 5 (v7l)
BogoMIPS        : 96.00
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xc07
CPU revision    : 5

processor       : 2
model name      : ARMv7 Processor rev 5 (v7l)
BogoMIPS        : 96.00
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xc07
CPU revision    : 5

processor       : 3
model name      : ARMv7 Processor rev 5 (v7l)
BogoMIPS        : 96.00
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm 
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xc07
CPU revision    : 5

Hardware        : Qualcomm (Flattened Device Tree)
Revision        : 0000
Serial          : 0000000000000000

G.hn environment:

#delos@/system_manager/cpu/>info
The CPU of this modem is an Xtensa 8 from Tensilica.

OK
#delos@/system_manager/cpu/>extra
Xtensa core ID: "xtensa8_z2001".

OK

So it seems these devices have two environments running in tandem. To use the regular OpenWRT without losing G.hn, it needs to be figured out what is necessary to initialize the extra G.hn part. I am afraid it would be difficult to replace the proprietary G.hn firmware, it could only be used as-is.

Edit: I got the G.hn to work, important is to switch first to 100 MBit/s as this is needed to allow the device to start:

ethtool -s ghn speed 100

Then it should work:

root@OpenWrt:/tmp/ghn# LD_LIBRARY_PATH=lib2:lib /lib/ld-musl-armhf.so.1 ./ghn_host -i eth0 -b /tmp/ghn/base/ --name "Magic 2 WiFi next" --serial 1234567890123456 --mac 01:23:45:67:89:AB
 --mt MT3056 --profile 0 --script /tmp/ghn/script  --verbose
Firmware CRC: 0x0bb58890 OK
Successfully validated firmware image
Device MBR/sector0 configuration:
  Factory Profile = 0
  MAC Address = 01:23:45:67:89:AB
  Serial Number = 1234567890123456
  MT = MT3056
  Name = Magic 2 WiFi next
Option user_notches_enable not found in uci config, using default '1'
Option user_notches not found in uci config
Option dhcp_ipv4_enabled not found in uci config
Option rtm_general_unknown_suppression not found in uci config, using default '0'
Option ghn_threshold not found in uci config, using default '20'
Option dm_selection_node_type not found in uci config, using default '0'
Option dslcoex_initial_reduction not found in uci config, using default '-40'
Option dslcoex_lnpe_offset not found in uci config, using default '0'
Option dslcoex_threshold_upper not found in uci config, using default '5'
Option dslcoex_probeframe_duration not found in uci config, using default '5'
Option dslcoex_measurement_interval not found in uci config, using default '15'
Option dslcoex_max_reduction not found in uci config, using default '-60'
Option dslcoex_minimum_plc_rate not found in uci config, using default '625'
Option dslcoex_psd_decrement not found in uci config, using default '4'
Option dslcoex_force_enable not found in uci config, using default '1'
Option dslcoex_detection_mode not found in uci config, using default '1'
Option dslcoex_snr_deembedding not found in uci config, using default '1'
Option dslcoex_auto_threshold not found in uci config, using default '1'
Option dslcoex_psd_increment not found in uci config, using default '4'
Option dslcoex_mode not found in uci config, using default '2'
Option dslcoex_threshold_lower not found in uci config, using default '3'
Option dslcoex_monitoring_int not found in uci config, using default '3600'
Option dslcoex_overwrite_shapedef not found in uci config, using default '1'
Option dslcoex_minimum_plc_rate_percent not found in uci config, using default '0'
Option dslcoex_notch_distance not found in uci config, using default '5000'
Option dslcoex_notch_width not found in uci config, using default '400'
Option dslcoex_low_traffic_threshold not found in uci config, using default '1'
Option dslcoex_low_traffic_duration not found in uci config, using default '5'
Option dslcoex_measurement_timeout not found in uci config, using default '0'
Option diagnostics_ghnmonitor_mintime not found in uci config, using default '120'
Option dmselection_general_nodetype not found in uci config, using default '4'
Option dmselection_general_config not found in uci config
Rebuilt image filesystem
Found recovery device 00:13:9D:00:05:00
Successfully downloaded ethloader and firmware
Untracked write to 37.0.7
Untracked write to 19.0.7
Untracked write to 35.0.0
Untracked write to 36.9.0
Untracked write to 36.9.1
Untracked write to 36.9.5
Device boot finished in 17.18 seconds
Flash is already disabled, skipping migration
Initialized ubus api
Listening on port 40000 locally for console access
Untracked write to 61.0.3
Device is now connected to network, device_state=1

I couldn't add another post here, so I deleted the final one and put all information in the prior posts.

Short version, I managed to get the G.hn PLC working with regular OpenWRT using the files from Devolo's firmware.

so you need to run that command every time the device boots?

Yes, if you look at Devolo's firmware, you will find they also run this command each time the device boots.

2 Likes

Hello good sir,

I hope you can help me with my devolo wifi adapter, my device is stuck in a bootloop i was wondering if there is a way to connect it to my pc and somehow unbrick it by flashing oem software to it if possible, i total noob in netwroking but this is this only thread i could find where people are in depth into these devices, hopefully u havent abanded this site and can give me some guidance, Cheers.

I'll try to help, but you'll have to provide a bit more info:

  1. What's the specific model of your adapter?
  2. Did you do anything specifically that made the device get stuck in a bootloop?
  3. Did you try anything already to try to resolve this problem?

Thanks for responding so quickly!

1- The model is MT:3058, its a Devolo Magic Wifi 2 Next.

2- I thinks the reason was it was updating the frimware and my 3 year old turned off the socket it was in, before that it was working normally.

3- Firslt i tried to look up what the flashing pattern means, didn't find it in the manual, the device has a red light on the PLC button which stays on for about 10 seconds then turns off and is back on after 2-3 seconds and this cycle continues, What made me think this is a bootloop is that its suppoused to have a solid red for at least 60 seconds after which its strarts the pairing process, i tried resseting through the pin point button near the LAN ports but they appear to do nothing ( The manual says the device should be on for at least q minute before using the reset button for any reason so i think thats why its not working), i tried connecting to my pc but it nothing showed up, tried pressisg and holding diffrenet buttons, nothing worked.
I read online that some people who after reseting the device get a red light instead of flashing white, but not sure if its the same issue as they didnt have any videos or other detials and no solution was given.

Sorry for the long details, i really appreciate your time feel free to respond at any time and Thank you for caring and responding.