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

Here is another way of building images using official kernel's with more complicated DTS files: link that should be easy to maintain. It uses github for builds and file serving, and has a few other advantages.

It works for snapshot (and upcoming 21.02 release), not sure about 19.07.*

The ImageBuilder almost provides enough support for custom DTS builds, but there are some tricky bits.

1 Like

please check why "Partition pattern not found"

2021-03-07 15:00:04,370 INFO OpenWrt TP-Link WR703N kernel DTS patcher v0.9
2021-03-07 15:00:04,376 INFO Processing kernel image file: /home/scott/workprg/wr703n/ath79-tiny.Linux-x86_64/build_dir/target-mips_24kc_musl/linux-ath79_tiny/tplink_tl-wr703n-kernel.bin
2021-03-07 15:00:04,376 INFO Origin kernel size: 0x001aabfb
2021-03-07 15:00:04,376 INFO /home/scott/workprg/wr703n/ath79-tiny.Linux-x86_64/build_dir/target-mips_24kc_musl/linux-ath79_tiny/tplink_tl-wr703n-kernel
2021-03-07 15:00:04,376 INFO Decompressing kernel...
2021-03-07 15:00:04,376 INFO /home/scott/workprg/openwrt/build_dir/host/lzma-4.65/CPP/7zip/Compress/LZMA_Alone/lzma -d --suffix=.bin /home/scott/workprg/wr703n/ath79-tiny.Linux-x86_64/build_dir/target-mips_24kc_musl/linux-ath79_tiny/tplink_tl-wr703n-kernel.bin
2021-03-07 15:00:04,526 INFO Decompressed kernel size: 0x00563059
2021-03-07 15:00:04,526 INFO Resizing kernel DTS...
2021-03-07 15:00:04,531 INFO Found DTS partition table at: 0x00562740
Traceback (most recent call last):
  File "/home/scott/workprg/wr703n/ath79-tiny.Linux-x86_64/kernel_patcher.py", line 134, in <module>
    main()
  File "/home/scott/workprg/wr703n/ath79-tiny.Linux-x86_64/kernel_patcher.py", line 122, in main
    resize_kernel_dts(kernel_raw_path)
  File "/home/scott/workprg/wr703n/ath79-tiny.Linux-x86_64/kernel_patcher.py", line 83, in resize_kernel_dts
    raise RuntimeError('Partition pattern not found')
RuntimeError: Partition pattern not found

Could you please upload to another service, it seems to be unavailable

@rakanskiy 19.07.7

1 Like

@scottliu You have applied a patch to tplink_tl-wr703n-kernel.bin that has been already patched.
Example for 19.07.7 kernel.

Linux-x86_64$ python3.8 kernel_patcher.py build_dir/target-mips_24kc_musl/linux-ath79_tiny/tplink_tl-wr703n-kernel.bin
rget/linux/ath79/image/tiny-tp-link.mk
2021-03-24 19:56:57,271 INFO OpenWrt TP-Link WR703N kernel DTS patcher v0.9
2021-03-24 19:56:57,274 INFO Processing kernel image file: build_dir/target-mips_24kc_musl/linux-ath79_tiny/tplink_tl-wr703n-kernel.bin
2021-03-24 19:56:57,274 INFO Origin kernel size: 0x0015c526
2021-03-24 19:56:57,274 INFO Decompressing kernel...
2021-03-24 19:56:57,351 INFO Decompressed kernel size: 0x00441565
2021-03-24 19:56:57,351 INFO Resizing kernel DTS...
2021-03-24 19:56:57,354 INFO Found DTS partition table at: 0x00440c0c
2021-03-24 19:56:57,354 INFO Compressing kernel...
2021-03-24 19:56:58,893 INFO Compressed kernel size: 0x0015c528
2021-03-24 19:56:58,894 WARNING Re-compressed kernel is bigger than original.
2021-03-24 19:56:58,894 INFO Done

Linux-x86_64$ python3.8 kernel_patcher.py build_dir/target-mips_24kc_musl/linux-ath79_tiny/tplink_tl-wr703n-kernel.bin
2021-03-25 07:04:49,994 INFO OpenWrt TP-Link WR703N kernel DTS patcher v0.9
2021-03-25 07:04:49,997 INFO Processing kernel image file: build_dir/target-mips_24kc_musl/linux-ath79_tiny/tplink_tl-wr703n-kernel.bin
2021-03-25 07:04:49,997 INFO Origin kernel size: 0x0015c528
2021-03-25 07:04:49,997 INFO Decompressing kernel...
2021-03-25 07:04:50,076 INFO Decompressed kernel size: 0x00441565
2021-03-25 07:04:50,076 INFO Resizing kernel DTS...
2021-03-25 07:04:50,079 INFO Found DTS partition table at: 0x00440c0c
Traceback (most recent call last):
  File "kernel_patcher.py", line 129, in <module>
    main()
  File "kernel_patcher.py", line 117, in main
    resize_kernel_dts(kernel_raw_path)
  File "kernel_patcher.py", line 79, in resize_kernel_dts
    raise RuntimeError('Partition pattern not found')
RuntimeError: Partition pattern not found

Offtopic here, but ...

Just wanted to say thanks for your work and your mail on the ML.

I wanted to create a new 19.07 release for HooToo HT-TM02 since it was disabled in February.

With your work I was able to modify the partitions and create the appropriate flash files for that device while maintaining compatibility with the official release!

Thanks! :+1:

1 Like

its solved, everything is ok now.
instead of using the profile tplink_tl-wr703n, I created a new one, that caused the problem.


update 1:
I can confirm that 19.07.4 and 19.07.6 worked well, the following happened on 19.07.7


thank you for your guide. I followed it until the end. however, I am currently stuck in failsafe mode for some unknown reason like WebInMe, the blue led is blinking fast.

I used the 'run firmware_upg' from the uboot. then immediately it boots up in that failsafe mode that I do not know how to exit. the 'mount_root' command also failed.

the ram and flash chip seemed to be fine, the ram passed mtest, and the old 17.01.7 worked fine on this hardware also.

the following is the serial boot log, any help is appreciated.


*********************************************
*   U-Boot 1.1.4  (Nov 19 2014, 09:43:51)   *
*********************************************

AP121 (AR9331) U-Boot for TL-WR703N

DRAM:   64 MB DDR 16-bit
FLASH:  Winbond W25Q128 (16 MB)
CLOCKS: 400/400/200/33 MHz (CPU/RAM/AHB/SPI)

LED on during eth initialization...

Hit any key to stop autobooting:  0 

Booting image at: 0x9F020000

   Image name:   OpenWrt r11306-c4a68
   Image type:   MIPS Linux Kernel Image (lzma compressed)
   Data size:    1426728 Bytes = 1.4 MB
   Load address: 0x80060000
   Entry point:  0x80060000

Uncompressing kernel image... OK!
Starting kernel...

[    0.000000] Linux version 4.14.221 (builder@buildhost) (gcc version 7.5.0 (OpenWrt GCC 7.5.0 r11306-c4a6851c72)) #0 Mon Feb 15 15:22:37 2021
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019374 (MIPS 24Kc)
[    0.000000] MIPS: machine is TP-Link TL-WR703N
[    0.000000] SoC: Atheros AR9330 rev 1
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] random: get_random_bytes called from 0x804796ec with crng_init=0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 16256
[    0.000000] Kernel command line: console=ttyATH0,115200 rootfstype=squashfs,jffs2
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Writing ErrCtl register=00000000
[    0.000000] Readback ErrCtl register=00000000
[    0.000000] Memory: 58924K/65536K available (3552K kernel code, 144K rwdata, 492K rodata, 1180K init, 203K bss, 6612K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 51
[    0.000000] CPU clock: 400.000 MHz
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 9556302233 ns
[    0.000014] sched_clock: 32 bits at 200MHz, resolution 5ns, wraps every 10737418237ns
[    0.007594] Calibrating delay loop... 265.42 BogoMIPS (lpj=1327104)
[    0.092175] pid_max: default: 32768 minimum: 301
[    0.096907] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.102947] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.115779] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.123872] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.129765] pinctrl core: initialized pinctrl subsystem
[    0.138289] NET: Registered protocol family 16
[    0.176198] clocksource: Switched to clocksource MIPS
[    0.181248] NET: Registered protocol family 2
[    0.185510] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.190867] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.196927] TCP: Hash tables configured (established 1024 bind 1024)
[    0.203179] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.208601] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.214860] NET: Registered protocol family 1
[    0.223281] Crashlog allocated RAM at address 0x3f00000
[    0.228999] workingset: timestamp_bits=30 max_order=14 bucket_order=0
[    0.242447] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.246711] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.270782] io scheduler noop registered
[    0.273154] io scheduler deadline registered (default)
[    0.278688] ar7200-usb-phy usb-phy: phy reset is missing
[    0.283794] pinctrl-single 18040028.pinmux: 64 pins at pa b8040028 size 8
[    0.291212] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[    0.299937] 18020000.uart: ttyATH0 at MMIO 0x18020000 (irq = 9, base_baud = 1562500) is a AR933X UART
[    0.307877] console [ttyATH0] enabled
[    0.307877] console [ttyATH0] enabled
[    0.314653] bootconsole [early0] disabled
[    0.314653] bootconsole [early0] disabled
[    0.346095] m25p80 spi0.0: w25q128 (16384 Kbytes)
[    0.349471] 3 fixed-partitions partitions found on MTD device spi0.0
[    0.355688] Creating 3 MTD partitions on "spi0.0":
[    0.360503] 0x000000000000-0x000000020000 : "u-boot"
[    0.366816] 0x000000020000-0x000000ff0000 : "firmware"
[    0.371873] 2 tplink-fw partitions found on MTD device firmware
[    0.376527] Creating 2 MTD partitions on "firmware":
[    0.381397] 0x000000000000-0x00000015c728 : "kernel"
[    0.387520] 0x00000015c728-0x000000fd0000 : "rootfs"
[    0.392334] mtd: device 3 (rootfs) set to be root filesystem
[    0.397036] 1 squashfs-split partitions found on MTD device rootfs
[    0.403113] 0x0000003e0000-0x000000fd0000 : "rootfs_data"
[    0.409713] 0x000000ff0000-0x000001000000 : "art"
[    0.415370] libphy: Fixed MDIO Bus: probed
[    0.756687] libphy: ag71xx_mdio: probed
[    0.760077] libphy: ar8xxx-mdio: probed
[    0.765600] switch0: Atheros AR724X/AR933X built-in rev. 2 switch registered on mdio-bus.0
[    1.147967] ag71xx 19000000.eth: connected to PHY at mdio-bus.0:1f:04 [uid=004dd041, driver=Generic PHY]
[    1.157065] eth0: Atheros AG71xx at 0xb9000000, irq 4, mode: mii
[    1.165011] NET: Registered protocol family 10
[    1.174546] Segment Routing with IPv6
[    1.177011] NET: Registered protocol family 17
[    1.181267] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[    1.195080] 8021q: 802.1Q VLAN Support v1.8
[    1.202128] usb_vbus: disabling
[    1.211416] VFS: Mounted root (squashfs filesystem) readonly on device 31:3.
[    1.226250] Freeing unused kernel memory: 1180K
[    1.229320] This architecture does not have kernel memory protection.
[    2.546218] random: fast init done
[    3.818153] init: Console is alive
[    3.820456] init: - watchdog -
[    5.585914] kmodloader: loading kernel modules from /etc/modules-boot.d/*
[    5.933039] usbcore: registered new interface driver usbfs
[    5.937296] usbcore: registered new interface driver hub
[    5.942494] usbcore: registered new device driver usb
[    5.963910] SCSI subsystem initialized
[    5.976565] usbcore: registered new interface driver usb-storage
[    5.982504] kmodloader: done loading kernel modules from /etc/modules-boot.d/*
[    5.991891] init: - preinit -
[    6.067207] random: procd: uninitialized urandom read (4 bytes read)
[    7.302501] random: jshn: uninitialized urandom read (4 bytes read)
[    7.758968] random: jshn: uninitialized urandom read (4 bytes read)
[    7.815850] random: jshn: uninitialized urandom read (4 bytes read)
[    8.117677] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
[   10.168123] eth0: link up (100Mbps/Full duplex)
[   10.171246] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
- failsafe button reset was pressed -
- failsafe -
[   11.951080] urandom_read: 4 callbacks suppressed
[   11.951095] random: dropbearkey: uninitialized urandom read (32 bytes read)
Generating 1024 bi[   11.963672] random: dropbearkey: uninitialized urandom read (32 bytes read)
t rsa key, this may take a while...
Public key portion is:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCuOsNYaXtLkwZtVOssTujTqfRFBYR02TEvjiqTiCF+Q5cfh9Z7jeELLxqZQUysrVOt3LreQCqW1t2nh0blnvu52rf5w+8WBVZkeRQIcKzNy2PO+aeIYcnzt18cs7qMoc9HLioG3+ou9jBfoMbWgNNpPiNIY2g3cFNJjbbamsV/kw== root@(none)
Fingerprint: sha1!! bd:5e:6b:73:b5:14:2c:09:74:f2:45:d4:de:38:57:ef:f3:38:6f:1a


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

ash: can't access tty; job control turned off
  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt 19.07.7, r11306-c4a6851c72
 -----------------------------------------------------
================= FAILSAFE MODE active ================
special commands:
* firstboot	     reset settings to factory defaults
* mount_root	 mount root-partition with config files

after mount_root:
* passwd			 change root's password
* /etc/config		    directory with config files

for more help see:
https://openwrt.org/docs/guide-user/troubleshooting/
- failsafe_and_factory_reset
- root_password_reset
=======================================================

root@(none):/# mount_root
[   24.533044] mount_root: jffs2 not ready yet, using temporary tmpfs overlay
root@(none):/# [  127.696282] random: crng init done

root@(none):/# mount_root
[ 1254.121127] mount_root: jffs2 not ready yet, using temporary tmpfs overlay
root@(none):/# mount_root
[ 1262.036850] mount_root: jffs2 not ready yet, using temporary tmpfs overlay
[ 1262.085785] overlayfs: maximum fs stacking depth exceeded
[ 1262.127120] mount_root: mount failed: lowerdir=/,upperdir=/tmp/root/upper,workdir=/tmp/root/work, options No such device
root@(none):/# 

According to your log, reset button was pressed during the boot process. Check hardware first or GPIO assignment in your profile.

Thank you so much for sharing the method, which brings this old router with a new life!
After the release of the 21.02 series, I noticed that the script does not seem to work. Is it possible if you can update the script for 21.02 when you have time? That will be much appreciated.

 [ ! -f "build_dir/target-mips_24kc_musl/linux-ath79_tiny/tplink_tl-wr703n-kernel.bak" ]; then
  python3 kernel_patcher.py build_dir/target-mips_24kc_musl/linux-ath79_tiny/tplink_tl-wr703n-kernel.bin
fi
2021-09-04 22:53:20,624 INFO OpenWrt TP-Link WR703N kernel DTS patcher v0.9
2021-09-04 22:53:20,642 INFO Processing kernel image file: build_dir/target-mips_24kc_musl/linux-ath79_tiny/tplink_tl-wr703n-kernel.bin
2021-09-04 22:53:20,643 INFO Origin kernel size: 0x0018b064
2021-09-04 22:53:20,644 INFO Decompressing kernel...
2021-09-04 22:53:20,888 INFO Decompressed kernel size: 0x004e3b79
2021-09-04 22:53:20,889 INFO Resizing kernel DTS...
2021-09-04 22:53:20,900 INFO Found DTS partition table at: 0x004e3260
Traceback (most recent call last):
  File "/home/theuser/Openwrt/openwrt-imagebuilder-21.02.0-ath79-tiny.Linux-x86_64/kernel_patcher.py", line 129, in <module>
    main()
  File "/home/theuser/Openwrt/openwrt-imagebuilder-21.02.0-ath79-tiny.Linux-x86_64/kernel_patcher.py", line 117, in main
    resize_kernel_dts(kernel_raw_path)
  File "/home/theuser/Openwrt/openwrt-imagebuilder-21.02.0-ath79-tiny.Linux-x86_64/kernel_patcher.py", line 79, in resize_kernel_dts
    raise RuntimeError('Partition pattern not found')
1 Like

@wyf88 I won't to support release 21.02 and higher due to dramatic performance degradation on device. speedtest

21.02.0 For testing purposes only.

1 Like

Hi,

Download link is not working for me, could you share image on a different server?
Also if you could share patching instructions for 21.02 to be able to compile images and test I would appreciate.

Regards.

21.02.0 updated.

From the topic title:

(16Mb/64Mb)

Do you mean Mega bit or Mega Byte?

" The file you requested has been deleted".

:frowning:

21.02.0 - FexNet will be accessible within one week.

1 Like

MB (megabyte) flat, you are right.

Thanks a lot!
Just curious what causes the performance degradation, whether it is because the software flow offloading is disabled due to the bug in 21.02.0.

I think it is due to Linux kernel 5.x requires more powerful hardware.
I'm not sure but ath9330 does not have hardware acceleartion for traffic flow.

19.07.8 and others on GoogleDrive

need new 21.0.2 version with dts!