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

Dear Tarask1n,

I have TL-WR1043ND v1 modded to 16Mb Flash (and 64MB ram).
As "ar71xx uses dynamic partition table in case of your device which is no longer available in ath79 target".

Can your "kernel_patcher.py" script file to be used with my device?

What I found:
1043nd is by default: $(Device/tplink-8m), no lzma
i can make a $(Device/tplink-16m) definition and use it in the .mk configuration, but
i "think" this way the script is not compatible.

Or can i set to $(Device/tplink-16mlzma) ?

Thank You!

Dear @keleticsaba,

In case of your router it is not so simply as in case with WR703N. Your router has precompilled loader in kernel module + OpenWrt kernel packed with lzma. You should not replace 16m with 16mlzma and vice versa, because it is a different technology of forming kernel module. If you familiar with restore the bricked router I will spend some time to analyze how the kernel module is packed and write other script for your model.

1 Like

Dear Tarask1n!
I have a tl866ii plus universal programer, so i can re-flash bricked unit offline.
Thank you for your help!

Ps, also have a usb-ttl converter ... somewhere.

  1. Download ImageBuilder_19.07.1
  2. Unpack ImageBuilder - tar xvf openwrt-imagebuilder-19.07.1-ath79-generic.Linux-x86_64.tar.xz
  3. Download, rename and replace kernel image (~/openwrt-imagebuilder-19.07.1-ath79-generic.Linux-x86_64/build_dir/target-mips_24kc_musl/linux-ath79_generic/tplink_tl-wr1043nd-v1-kernel.bin)
    tplink_tl-wr1043nd-v1-kernel_19.07.1_16mb
  4. Replace $(Device/tplink-8m) with $(Device/tplink-16m) in image definition file
  5. Build your own image make image PROFILE=tplink_tl-wr1043nd-v1

Crossfingers

P.S. I've got no factory image was built when I replaced $(Device/tplink-8m) with $(Device/tplink-16m).
But if I leave default $(Device/tplink-8m) I successfully build an image. Try it anyway.

taras@taras-VirtualBox:~/openwrt-imagebuilder-19.07.1-ath79-generic.Linux-x86_64$ ls -la build_dir/target-mips_24kc_musl/linux-ath79_generic/tmp/
total 11612
drwxr-xr-x 2 taras taras    4096 feb  3 22:26 .
drwxr-xr-x 4 taras taras   20480 feb  3 22:20 ..
-rw-r--r-- 1 taras taras 8126464 feb  3 22:26 openwrt-19.07.1-ath79-generic-tplink_tl-wr1043nd-v1-squashfs-factory.bin
-rw-r--r-- 1 taras taras 3735822 feb  3 22:26 openwrt-19.07.1-ath79-generic-tplink_tl-wr1043nd-v1-squashfs-sysupgrade.bin
1 Like

It is done.
This thing is working. (I think, even the ART partition was came back, i have wifi.)

Made a few changes in the generic and common tp-link definition file. (added 16M definition).
Factory image was built. (Not tested by me.)
Sysupgrade image was bulit. (Personaly i used this, after a "failed" openwrt-ath97-sysupgrade.)

http://s000.tinyupload.com/index.php?file_id=63999568473426190687

Thank you!

Had one problem:
In the definition file i added luci, but it was compiled without it (?why?), had to add trought ssh.

I'm glad that all works fine for you. Not all definition files are used during ImageBuilder work. You should add required packages through command line. Example

make image PROFILE=tplink_tl-wr1043nd-v1 PACKAGES="luci luci-ssl"

Put Like to topic post, if you wish.

1 Like

Dear Tarask1n,

I am planing to refresh https://openwrt.org/toh/tp-link/tl-wr1043nd "Flash Mod" section regarding the new ATH79 target informations. (no overlay autoresize, ATH79 build instructions, ect)

My question is:
When new/updated openwrt version came out to the device (1043NDv1/ATH79), how can the user get/produce the 16M modified kernel?

@keleticsaba, I'll write the similar 'kernel_patcher' script for 1043ND devices on weekend. Great that you could confirm what that method works for other devices. I'm thinking about some universal solution script, but I'm not sure that we will have big enough amount of volunteers who can test that approach on other devices.

1 Like

I have discovered a much universal way to generate kernel with modified device tree as described here.

@Tarask1n, could you scriptify this rather than making your script device specific?

@Hirsupp The way you proposed requires linux kernel re-compilation. It requires much more resources. My way is much more simpler just patch kernel without any compilation.

@keleticsaba As I promised the script for TP-Link wr1043nd v1:
tl_wr1043nd_v1_kernel_patcher

taras@taras-VirtualBox:~/openwrt_extender$ python3.8 wr1043v1_kernel_patcher.py tplink_tl-wr1043nd-v1-kernel.bin 
2020-02-08 08:32:23,446 INFO TP-Link WR1043 v1 Openwrt kernel DTS partition resizer v 0.9
2020-02-08 08:32:23,449 INFO Processing kernel image file: tplink_tl-wr1043nd-v1-kernel.bin
2020-02-08 08:32:23,449 INFO Build info:  MIPS OpenWrt Linux-4.14.167
2020-02-08 08:32:23,449 INFO Kernel ofs:  0x00001e40
2020-02-08 08:32:23,449 INFO Kernel size: 0x00185868
2020-02-08 08:32:23,449 INFO Extracting kernel...
2020-02-08 08:32:23,455 INFO Decompressing kernel...
2020-02-08 08:32:23,619 INFO Decompressed kernel size: 0x004c6d88
2020-02-08 08:32:23,619 INFO Resizing kernel DTS...
2020-02-08 08:32:23,622 INFO Found DTS partition table at: 0x004c63c4
2020-02-08 08:32:23,622 INFO Compressing kernel...
2020-02-08 08:32:26,295 INFO Compressed kernel size: 0x00185869
2020-02-08 08:32:26,296 WARNING Re-compressed kernel is bigger than original.
2020-02-08 08:32:26,296 INFO Assembling new image...
2020-02-08 08:32:26,297 INFO Done

Thank You!

I am trying to replicate the method, but (i have to confess) i am a bit of noob in linux/openwrt.
(And my goal is to make an "Avarage Joe" howto to the openwrt 1043 wiki.)
On ubuntu bionic, updated pyton3 to 3.8 using snap update ... no problemo. (evaded shity ppa's)

But i am in trouble with the recommended lzma utility "LZMA 4.65 : Igor Pavlov".
The one I found is on sourceforge/7zip (version 4.65 is popular), but it is MS .exe and source files.
Could you help a bit?

Seting the env value is not that complicated as i googled.

where is the origin dts to modify if compile from source?

@keleticsaba I suggested the LZMA SDK is used from that repository LZMA SDK 4.65 with patches from here OpenWrt LZMA SDK patches.

Originally I cloned OpenWrt current repository and make menuconfig. In this case you can find the LZMA utility by path ~/openwrt/build_dir/host/lzma-4.65/CPP/7zip/Compress/LZMA_Alone/lzma_alone/lzma

1 Like

@youxiaojie You can find DTS description at OpenWrt repository OpenWrt ath79 dts. Look for your corresponding model description file <your_router_model>.dtsi

Success!
Now, next week I can update the wiki.
The hardest part for a beginner is to compile the openwrt patched lzma utility.
... so many missing package

1 Like

19.07.2 Tplink tl-wr703n 16/64Mb

Can't get work my modded wr703n 16/64Mb. After flashing your firmware I get fast blinking led. Laptop can't get ip from router via ethernet, so I can't get connection with it. Same result with image and kernel 19.07.0, 19.07.1, 19.07.2 patched by myself or from attachments.
So I try to make my own patch for compiling from source of official repository:

diff --git a/target/linux/ath79/dts/ar9331_tplink_tl-wr703n_tl-mr10u.dtsi b/target/linux/ath79/dts/ar9331_tplink_tl-wr703n_tl-mr10u.dtsi
index 2bacd08245..e821eab264 100644
--- a/target/linux/ath79/dts/ar9331_tplink_tl-wr703n_tl-mr10u.dtsi
+++ b/target/linux/ath79/dts/ar9331_tplink_tl-wr703n_tl-mr10u.dtsi
@@ -67,12 +67,12 @@
 
 			partition@20000 {
 				compatible = "tplink,firmware";
-				reg = <0x20000 0x3d0000>;
+				reg = <0x20000 0xfd0000>;
 				label = "firmware";
 			};
 
-			art: partition@3f0000 {
-				reg = <0x3f0000 0x10000>;
+			art: partition@ff0000 {
+				reg = <0xff0000 0x10000>;
 				label = "art";
 				read-only;
 			};
diff --git a/target/linux/ath79/image/tiny-tp-link.mk b/target/linux/ath79/image/tiny-tp-link.mk
index c533de3f4c..96d6664df6 100644
--- a/target/linux/ath79/image/tiny-tp-link.mk
+++ b/target/linux/ath79/image/tiny-tp-link.mk
@@ -160,7 +160,7 @@ endef
 TARGET_DEVICES += tplink_tl-wa901nd-v2
 
 define Device/tplink_tl-wr703n
-  $(Device/tplink-4mlzma)
+  $(Device/tplink-16mlzma)
   SOC := ar9331
   DEVICE_MODEL := TL-WR703N
   DEVICE_PACKAGES := kmod-usb-chipidea2

All works great but not usb. Can't get usb flash drive or 4g modem working.. Even led on them is not blinking... Any suggestions?

1 Like

@Tarask1n
Would you make please the script for a 16/64MB TL-MR3020 please.
Another thing, would you also please post the exact ram memory you used to mod/upgrade your router.

@knightrider007
Sorry for delayed reply, exactly I used Hynix HY5DU121622CTP-J desoldered from laptop SO-DIMM DDR 512Mb 4 chip module.