How to restore RavPower RP-WD009 OEM Firmware

I need to restore the OEM firmware on my RavPower RP-WD009, but didn't back it up before installing OpenWrt. Is it possible to restore the OEM version?

Hi Sadie,

The original firmware can be downloaded from the RAVPOWER website (latest is V. 2.000.022 as of 2020-10-21).

The question which seems to be unclarified as of now is, whether or not this can be actually applied again after OpenWRT flashing has been done already (and how)...

Has anyone tried to revert back from OpenWRT to RAVPOWER firmware?

Would you please be so kind as to as to explain why exactly you are in need to restore the original firmware?
I am curious, whether or not you managed to make the SD card work?

Cheers

I installed OpenWRT on a ravpower filehub,and now i want to restore it to the original firmware. I dont have backups of the system

...you can get some howtos and procedures on how to revert back to stock firmware from here: [SOLVED] Procedure for going back to OEM firmware for RP-WD03

The way is the same as for WD009.

Cheers
V

Hello @sadie and @carloserizo !

It is possible to restore the OEM version.

You need to download OEM firmware, extract it, and flash it to your device.

Download OEM firmware

Extract it

With the sunvalleytek-fw-extract.sh script below! You need a 7z binary to extract the ext2 payload!
It's based on cryptographrix's Download-and-split.sh.

sunvalleytek-fw-extract.sh
#!/bin/bash

if [ -z "$1" ]; then
	echo "Usage: $0 <HooToo, RAVPower firmware update file>"
	exit 0
fi

UPDATE_FILENAME="$1"
TARGET_DIR="$UPDATE_FILENAME".extracted
CRCSUM=`head $UPDATE_FILENAME|grep ^CRCSUM|cut -d= -f2`
SPLITLINE=`awk '/^END_OF_STUB/ { print NR + 1; exit 0; }' ${UPDATE_FILENAME}`
SEVENZIP=`which 7z`

if [ -z "$SEVENZIP" ]; then
	echo "Please install a 7z archiver/extractor. E.g. 'p7zip' will do it."
	exit 1
fi

if [ -z "$SPLITLINE" ]; then
	echo "$UPDATE_FILENAME is not a compatible firmware file"
	exit 1
fi

echo "check firmware crc"
crcsum=`sed '1,3d' $UPDATE_FILENAME|cksum|sed -e 's/ /Z/' -e 's/   /Z/'|cut -dZ -f1`
[ "$crcsum" != "$CRCSUM" ] && {
	echo "firmware crc error!"
	exit 1
}
echo "firmware crc success!"

if [ -e "$TARGET_DIR" ]; then
	echo "The directory for the extracted files is already exists! Directory: $TARGET_DIR"
	exit 1
else
	mkdir -p "$TARGET_DIR"
fi

tail -n +$SPLITLINE "$UPDATE_FILENAME" > "$TARGET_DIR/upfs.gz"
gzip -d "$TARGET_DIR/upfs.gz"

echo ""
echo "extract firmware"
$SEVENZIP x -o$TARGET_DIR $TARGET_DIR/upfs firmware
if [ $? -eq 0 ]; then
	echo "success!"
else
	echo "SevenZip had no success trying with 'sudo mount' ..."
	mkdir $TARGET_DIR/mounted
	set -e
	sudo mount $TARGET_DIR/upfs $TARGET_DIR/mounted
	cp -ar $TARGET_DIR/mounted/firmware $TARGET_DIR
	sudo umount $TARGET_DIR/mounted
	set +e
fi
echo ""
echo "extracted files in "$TARGET_DIR"/firmware:"
ls -hgG "$TARGET_DIR"/firmware
echo ""
echo "firmware info:"
cat "$TARGET_DIR"/firmware/firmware.conf

Example run:

$ ./sunvalleytek-fw-extract.sh fw-7688-972_16_64_7628-RAVPower-WD09-16MFlash-2.000.022
check firmware crc
firmware crc success!

extract firmware

7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,8 CPUs Intel(R) Core(TM) i5-8400H CPU @ 2.50GHz (906EA),ASM,AES-NI)

Scanning the drive for archives:
1 file, 16777216 bytes (16 MiB)

Extracting archive: fw-7688-972_16_64_7628-RAVPower-WD09-16MFlash-2.000.022.extracted/upfs
--
Path = fw-7688-972_16_64_7628-RAVPower-WD09-16MFlash-2.000.022.extracted/upfs
Type = Ext
Physical Size = 16777216
Cluster Size = 1024
Free Space = 4200448
Modified = 2020-04-28 03:15:54
Created = 2020-04-28 03:15:53
Mount Time = 2020-04-28 03:15:53
Last Check Time = 2020-04-28 03:15:53
Host OS = Linux
Revision = 1
inode Size = 128
Code Page = UTF-8
ID = 9823521A462D4C1BAA694DFACC8AB301
Characteristics = EXT_ATTR RESIZE_INODE DIR_INDEX
Incompatible Features = FILETYPE
Readonly-compatible Features = SPARSE_SUPER

Everything is Ok

Folders: 1
Files: 4
Size:       8186605
Compressed: 16777216
success!

extracted files in fw-7688-972_16_64_7628-RAVPower-WD09-16MFlash-2.000.022.extracted/firmware:
total 8.6M
-rw-r--r-- 1 131K Apr 28  2020 bootloader
-rw-r--r-- 1   41 Apr 28  2020 firmware.conf
-rw-r--r-- 1 1.3M Apr 28  2020 kernel
-rw-r--r-- 1 6.5M Apr 28  2020 rootfs

firmware info:
NEWFILE=WD09
NEWVER=2.000.022
NEWBUILD=7

Example run with old 7z:

$ ./sunvalleytek-fw-extract.sh fw-7688-972_16_64_7628-RAVPower-WD09-16MFlash-2.000.022
check firmware crc
firmware crc success!

extract firmware

7-Zip [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,2 CPUs)

Processing archive: fw-7688-972_16_64_7628-RAVPower-WD09-16MFlash-2.000.022.extracted/upfs

Error: Can not open file as archive

SevenZip had no success trying with 'sudo mount' ...

extracted files in fw-7688-972_16_64_7628-RAVPower-WD09-16MFlash-2.000.022.extracted/firmware:
total 7.9M
-rwxr-xr-x 1 131K Apr 28  2020 bootloader
-rw-r--r-- 1   41 Apr 28  2020 firmware.conf
-rw-r--r-- 1 1.3M Apr 28  2020 kernel
-rwxr-xr-x 1 6.5M Apr 28  2020 rootfs

firmware info:
NEWFILE=WD09
NEWVER=2.000.022
NEWBUILD=7

Flash it to your device

Use the files kernel and rootfs for flash:

  • scp them to /tmp of the router
  • mtd write /tmp/kernel loader
  • mtd write /tmp/rootfs firmware

If both files are flashed successfully, then you should reboot your device and there will be the OEM firmware.

1 Like

What program i have to use?

Based on the above you'll need either a Linux distribution, or a Windows 10 system with WSL (Windows Subsystem for Linux) configured with a Linux distribution of choice to run the firmware extraction script.

After that, you can either use ssh from your linux distro / WSL setup or use PuTTY on Windows to do the file upload and flash procedure.

1 Like

@carloserizo, you could skip running the firmware extraction script, but in this case you have to trust somebody who do that work for you!


@ergamus, thanks for answering!

I don´t get it working, i use windows 10 with WSL and ubuntu 20.04

Do you get an error message when running the script, or is there some other issue?

An error in: CRCSUM=head $UPDATE_FILENAME|grep ^CRCSUM|cut -d= -f2

Did you copy and paste the entire script that @xabolcs posted in one piece? Can you post an image of the terminal window? Usually the terminal will output something else alongside, if a variable is empty or a file is missing or etc.

The text above (sunvalleytek-fw-extract.sh) need to be pasted into a new file (name it sunvalleytek-fw-extract.sh), and marked as executable with: chmod u+x sunvalleytek-fw-extract.sh.

You need to run that script as: ./sunvalleytek-fw-extract.sh firmware_filename. If you only copy the text to the terminal, it won't work.

Fantastic, I was able to restore the OEM firmware by following your instructions.

Thank you!

1 Like

I see your problem :frowning:

mount: fw-7688-972_16_64_7628-RAVPower-WD09-16MFlash-2.000.022.extracted/mounted: mount failed: Operation not permitted.

$ ./sunvalleytek-fw-extract.sh fw-7688-972_16_64_7628-RAVPower-WD09-16MFlash-2.000.022
check firmware crc
firmware crc success!
mount: fw-7688-972_16_64_7628-RAVPower-WD09-16MFlash-2.000.022.extracted/mounted: mount failed: Operation not permitted.

extract firmware
cp: cannot stat 'fw-7688-972_16_64_7628-RAVPower-WD09-16MFlash-2.000.022.extracted/mounted/firmware': No such file or directory
umount: fw-7688-972_16_64_7628-RAVPower-WD09-16MFlash-2.000.022.extracted/mounted: not mounted.
success!

extracted files in fw-7688-972_16_64_7628-RAVPower-WD09-16MFlash-2.000.022.extracted/firmware:
ls: cannot access 'fw-7688-972_16_64_7628-RAVPower-WD09-16MFlash-2.000.022.extracted/firmware': No such file or directory

firmware info:
cat: fw-7688-972_16_64_7628-RAVPower-WD09-16MFlash-2.000.022.extracted/firmware/firmware.conf: No such file or directory
no info

The script uses mount command to mount that ext2 filesystem image.
And that mount command fails with Operation not permitted on WSL.

@carloserizo looks like you had to try it with WSL 2:

Source: Mounting .img files (Operation not permitted.) on Reddit.


I could confirm the script is working after upgrading WSL 1 to 2:

> wsl --list --verbose
  NAME            STATE           VERSION
* Debian          Running         1
  Ubuntu-20.04    Stopped         2

WSL 2:

Welcome to Ubuntu 20.04.1 LTS (GNU/Linux 4.19.128-microsoft-standard x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Fri Nov  6 12:41:14 CET 2020

  System load:  0.03               Processes:             8
  Usage of /:   0.5% of 250.98GB   Users logged in:       0
  Memory usage: 0%                 IPv4 address for eth0: 172.26.131.151
  Swap usage:   0%

126 updates can be installed immediately.
50 of these updates are security updates.
To see these additional updates run: apt list --upgradable


$ ./sunvalleytek-fw-extract.sh fw-7688-972_16_64_7628-RAVPower-WD09-16MFlash-2.000.022
check firmware crc
firmware crc success!

extract firmware
success!

extracted files in fw-7688-972_16_64_7628-RAVPower-WD09-16MFlash-2.000.022.extracted/firmware:
total 7.9M
-rwxr-xr-x 1 131K Apr 28  2020 bootloader
-rw-r--r-- 1   41 Apr 28  2020 firmware.conf
-rw-r--r-- 1 1.3M Apr 28  2020 kernel
-rwxr-xr-x 1 6.5M Apr 28  2020 rootfs

firmware info:
NEWFILE=WD09
NEWVER=2.000.022
NEWBUILD=7

I use WSL 1, as it's more compatible to my use case.

@carloserizo, I managed to make my extractor script compatible to WSL 1! :tada:
Now it uses 7z instead mount! :+1:

Please try it, it's in my original post, above!

My first post ... attempt to help those of us using Windows. FWIW, I installed OpenWRT hoping to get a few improvements - its been a massive fail - couldn't connect to Internet, to two days to get internet connection and install LuCI and then just couldn't get similar functionality as the RAVPower software. Numerous re-installs of OpenWRT ... I threw in the towel ... too steep a learning curve. So - how to revert back to RAVPower software - using the threads above - I used 7zip for Windows 10 with the RAVPower firmware, Open the file in 7zip (right click on file, open with 7zip), double click on 'initrdup', double click folder 'firmware' ... then click on 'kernel' and chose 'Extract' - save it somewhere, do the same with 'rootfs'. Next - you have to be able to connect to the RAVPower (w/OpenWRT installed) - I used WinSCP, file protocol SCP, host name "root@192.168.1.1" ...
Then use SCP to copy the 'kernel' and 'rootfs' to the /tmp folder on the RAVPower, still in SCP right click on each file and set the properties - 'kernel' to -rw-r--r-- and 'rootfs' to '-rwxr-xr-x' ... then exit or close WinSCP. Next ssh in ... I used Windows Powershell - type "ssh root@192.168.1.1" or whatever IP you've got working - enter password, etc. Then the commands from above "mtd write /tmp/kernel loader" , and then "mtd write /tmp/rootfs firmware" ... if you don't get errors, then reboot ... and the OEM firmware is back.

Merry Christmas, good luck to all ... and everyone else keep posting how to get OpenWRT setup on the RAVPower WD009 - I'd really like to use it, but two solid days never got me to a reliable way to connect it to a wifi hotspot from my phone, computer, or even the lan port of my router ... enough learning for two days.
JimC