Using release ATH79 19.07.0 kernel and packages on hardware modded TP-Link WR703N (16MB/64MB) without SNAPSHOT compilation

Its seems OK. Thanks

did you finaly figure out yourself or just give up @martinkura

Would you make please the script for a 16/64MB tl-wr740n V4 please and instructions the same?

Hynix H5DU5162ETR-E3C work fine in my TL-WR740N

@Tarask1n I am trying to use your script for the TL-WR1043ND V1 kernel for the openwrt-imagebuilder-21.02.3 but I am getting this error:

PS C:\Users\User\Desktop\lzma> python3.exe .\wr1043v1_kernel_patcher.py .\tplink_tl-wr1043nd-v1-kernel.bin
2022-06-17 10:58:07,821 INFO TP-Link WR1043 v1 Openwrt kernel DTS partition resizer v 0.9
2022-06-17 10:58:07,821 INFO Processing kernel image file: tplink_tl-wr1043nd-v1-kernel.bin
2022-06-17 10:58:07,821 INFO Build info:  MIPS OpenWrt Linux-5.4.188
2022-06-17 10:58:07,821 INFO Kernel ofs:  0x00001e40
2022-06-17 10:58:07,821 INFO Kernel size: 0x001f45d1
2022-06-17 10:58:07,821 INFO Extracting kernel...
2022-06-17 10:58:07,836 INFO Decompressing kernel...

LZMA 4.65 : Igor Pavlov : Public domain : 2009-02-03
2022-06-17 10:58:07,977 INFO Decompressed kernel size: 0x00629fef
2022-06-17 10:58:07,993 INFO Resizing kernel DTS...
2022-06-17 10:58:07,993 INFO Found DTS partition table at: 0x0062964c
Traceback (most recent call last):
  File "C:\Users\User\Desktop\lzma\wr1043v1_kernel_patcher.py", line 188, in <module>
    main()
  File "C:\Users\User\Desktop\lzma\wr1043v1_kernel_patcher.py", line 171, in main
    resize_kernel_dts(kernel_raw_path)
  File "C:\Users\User\Desktop\lzma\wr1043v1_kernel_patcher.py", line 116, in resize_kernel_dts
    raise RuntimeError('Partition pattern not found')
RuntimeError: Partition pattern not found

With the openwrt-imagebuilder-19.07.10 the script runs fine and generates the patched kernel.

PS C:\Users\User\Desktop\lzma> python3.exe .\wr1043v1_kernel_patcher.py .\tplink_tl-wr1043nd-v1-kernel.bin
2022-06-17 11:00:28,547 INFO TP-Link WR1043 v1 Openwrt kernel DTS partition resizer v 0.9
2022-06-17 11:00:28,562 INFO Processing kernel image file: tplink_tl-wr1043nd-v1-kernel.bin
2022-06-17 11:00:28,562 INFO Build info:  MIPS OpenWrt Linux-4.14.275
2022-06-17 11:00:28,562 INFO Kernel ofs:  0x00001e40
2022-06-17 11:00:28,562 INFO Kernel size: 0x00187c01
2022-06-17 11:00:28,562 INFO Extracting kernel...
2022-06-17 11:00:28,562 INFO Decompressing kernel...

LZMA 4.65 : Igor Pavlov : Public domain : 2009-02-03
2022-06-17 11:00:28,687 INFO Decompressed kernel size: 0x004cce88
2022-06-17 11:00:28,687 INFO Resizing kernel DTS...
2022-06-17 11:00:28,687 INFO Found DTS partition table at: 0x004cc4c4
2022-06-17 11:00:28,687 INFO Compressing kernel...

LZMA 4.65 : Igor Pavlov : Public domain : 2009-02-03
2022-06-17 11:00:30,923 INFO Compressed kernel size: 0x00187c00
2022-06-17 11:00:30,931 INFO Assembling new image...
2022-06-17 11:00:30,931 INFO Done

Can you please update your script to cater for the newer kernel version?

Thanks in advanced!

@luketanti Please upload or publish wr1043v1_kernel_patcher.py I'll try to help you.

Sure thing @Tarask1n . I have found it here WR1043ND_16MB_Kernel_Patch

This was uploaded by @keleticsaba on the TL-WR1043ND Wiki

Thanks again for your support!

1 Like

@luketanti Please apply this patch or edit the file manually.

$ git diff wr1043v1_kernel_patcher.py wr1043v1_kernel_patcher_fix.py
diff --git a/wr1043v1_kernel_patcher.py b/wr1043v1_kernel_patcher_fix.py
index 18ff514..e3dada9 100755
--- a/wr1043v1_kernel_patcher.py
+++ b/wr1043v1_kernel_patcher_fix.py
@@ -110,16 +110,16 @@ def resize_kernel_dts(krnl_path: Path):
             raise RuntimeError('Could not find DTS partition table')
         f_out.seek(ofs_part)
         data = bytearray(f_out.read(0x100))
-        if (offset := data.find(b'\xaa\0\x02\0\0\0\x7d\0\0')) > 0:
-            data[offset+6] |= 0xc0
+        if (offset := data.find(b'\0\x02\0\0\0\x7d\0\0')) > 0:
+            data[offset+5] |= 0xc0
         else:
             raise RuntimeError('Partition pattern not found')
         if (offset := data.find(b'partition@7F0000')) > 0:
             data[offset+10] = ord('F')
         else:
             raise RuntimeError('Partition pattern not found')
-        if (offset := data.find(b'\xaa\0\x7f\0\0\0\x01\0\0')) > 0:
-            data[offset+2] |= 0xc0
+        if (offset := data.find(b'\0\x7f\0\0\0\x01\0\0')) > 0:
+            data[offset+1] |= 0xc0
         else:
             raise RuntimeError('Partition pattern not found')
         f_out.seek(ofs_part)

It is applicable for 19.07.X kernels too.

$ python3.8 wr1043v1_kernel_patcher.py build_dir/target-mips_24kc_musl/linux-ath79_generic/tplink_tl-wr1043nd-v1-kernel.bin
2022-06-18 20:51:17,743 INFO TP-Link WR1043 v1 Openwrt kernel DTS partition resizer v 0.9
2022-06-18 20:51:17,745 INFO Processing kernel image file: build_dir/target-mips_24kc_musl/linux-ath79_generic/tplink_tl-wr1043nd-v1-kernel.bin
2022-06-18 20:51:17,746 INFO Build info:  MIPS OpenWrt Linux-5.4.188
2022-06-18 20:51:17,746 INFO Kernel ofs:  0x00001e40
2022-06-18 20:51:17,746 INFO Kernel size: 0x001f45d1
2022-06-18 20:51:17,746 INFO Extracting kernel...
2022-06-18 20:51:17,747 INFO Decompressing kernel...
2022-06-18 20:51:17,876 INFO Decompressed kernel size: 0x00629fef
2022-06-18 20:51:17,877 INFO Resizing kernel DTS...
2022-06-18 20:51:17,880 INFO Found DTS partition table at: 0x0062964c
2022-06-18 20:51:17,880 INFO Compressing kernel...
2022-06-18 20:51:21,152 INFO Compressed kernel size: 0x001f45d0
2022-06-18 20:51:21,152 INFO Assembling new image...
2022-06-18 20:51:21,154 INFO Done
1 Like

@Tarask1n The script fix works :smiley:
I will now build the new factory and sys-upgrade images and hopefully they should work for the 16MB flash.

Thank you very much!

Hello felix_ardyansyah.
Please share a guide on how to replace flash with 16 Mb for my TP-LINK TL-WR1043 V2 router.
The link above doesn't work.

23.05.0 TP-Link TL-WR703N 16/64 MB
23.05.0 and others on GoogleDrive

The second life of the tiny router. I've got 70/50 Mbits WiFi speedtest with Software flow offloading enabled.

1 Like

Thanks for sharing.

Could you explain how you compile mod on new versions? I get a "RuntimeError: Partition pattern not found" when trying to use old method with kernel_patcher.py and editing tiny-tp-link.mk.

Regards.

You can find kernel_patcher.py by GoogleDrive link from the previous message.

1 Like

Thanks, you're great!

New life for TL-WR703N !!!

Regards.