Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FS#3601 - tplink-safeloader: Unexpected firmware offset when reading oem firmware for TL-WPA8630p V2.1 #8630

Open
openwrt-bot opened this issue Jan 28, 2021 · 3 comments
Labels

Comments

@openwrt-bot
Copy link

robho:

I was trying to return to oem firmware for TL-WPA8630P V2.1 by following the instructions at https://openwrt.org/toh/tp-link/tp-link_tl-wpa8630p_v2#reverting_to_stock

When running tplink-safeloader it fails with the error message:

DEBUG: can not find fwuphdr
Error can not read the partition table (fwup-ptn): Success

I think the problem is that the firmware offset is "wrong" in tplink-safeloader or in the firmware file.

Here's what the firmware file looks like:
00000000 fb b0 40 4b 3d ef 81 6e ed 61 ac 42 7a 7a 86 e4 |..@k=..n.a.Bzz..|
00000010 00 6d 79 d7 3f 4e 45 57 00 00 00 28 00 64 de 8f |.my.?NEW...(.d..|
00000020 00 6d 22 8f 00 00 00 00 00 64 de 53 c8 cb b9 c0 |.m"......d.S....|
00000030 25 21 80 2a d0 c6 39 eb 17 c6 73 64 00 64 de 53 |%!.*..9...sd.d.S|
00000040 0b a1 cb 12 8c 9e 34 9e 40 9d c8 9d 92 a5 03 cd |......4.@.......|
00000050 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
*
00001050 66 77 75 70 2d 70 74 6e 20 6f 73 2d 69 6d 61 67 |fwup-ptn os-imag|
00001060 65 20 62 61 73 65 20 30 78 30 31 30 30 30 20 73 |e base 0x01000 s|

Ie, "fwup-ptn" is at 0x1050 while tplink-safeloader seems to look at 0x1014:
size_t firmware_offset = 0x1014;

I changed firmware_offset to 0x1050 and recompiled tplink-safeloader, then it works (but I don't know if the output firmware is correct or not).

  • Steps to reproduce
  1. Get the firmware file from https://www.tp-link.com/en/support/download/tl-wpa8630p/v2.1/#Firmware
  2. Extract the firmware archive
  3. Run "tplink-safeloader -z wpa8630pv2_uk-up-ver2-1-0-P1-20171117-rel42724-APPLC.bin -o oem-sysupgrade.bin"
@openwrt-bot
Copy link
Author

robho:

Just FYI.. The firmware file that was produced after I changed firmware_offset to 0x1050 works. I could use it to revert to oem firmware.

@deanfourie1
Copy link

deanfourie1 commented Jan 21, 2023

Hi, I am getting the same issue. Can you please help me. I need to return to factory firmware but i am receiving

DEBUG: can not find fwuphdr Error can not read the partition table (fwup-ptn): Success

I am on a V3 hardware version.

Thanks

@jwmullally
Copy link
Contributor

I suggest changing the thread title to: tplink-safeloader: Unexpected firmware offset when reading oem firmware from newer *-APPLC.bin files

@andyboeh sent a patch to the mailing list here.

To compile tplink-safeloader by hand, you can do:

curl -LO https://git.openwrt.org/?p=project/firmware-utils.git;a=blob_plain;f=src/tplink-safeloader.c;h=d9e16058883cea37e43175c18bf5b62f94c13563
curl -LO https://git.openwrt.org/?p=project/firmware-utils.git;a=blob_plain;f=src/md5.h;h=d9e16058883cea37e43175c18bf5b62f94c13563
# Patch the files then build:
gcc -Wall -o tplink-safeloader tplink-safeloader.c -lcrypto -lssl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants