Build for TP-Link Archer C1200-AC1200

Squashfs is quite tricky, managed to boot it, but it threw few errors I mentioned above, however initramfs goes well

Hey,

Anyone have updates on this? I see the chip in question is in the target for 17.01.4 but I don't see this specific router on the list.
Has anyone been able to actually install OpenWRT on it? If so, how?
Are there plans to support this router? I can't find a wiki page for it (also, tp-link's naming scheme doesn't help)

Also interested in a build for C1200-AC1200 v2 model.
By the way has anybody tried to build GPL code provided by manufacturer? I tried a couple of times but failed.

I don't know if this has any relevancy but Tenda AC9 which i supported seems to have very similar hardware to TP-Link Archer C1200 V1

Hi All!

I'm a user of ASUS N16 with OpenWrt worked very good without any troubles

Recently I bought C1200 V2 EU router to get 5G WiFi band.
In my case change of the country code to MY only for 5G band settings was enough to unlock channels, 149, 153, 157 and 161.
As there is no OpenWrt support for this hardware and most probably it will not come, so the only way to make any other fixes/updates is to apply changes on fly.
My router work in my home network in AP mode with DHCP and DNS.
While TPLINK firmware is based on OpenWrt, it's GUI looks terrible and lucks a lot of futures, which existed in OpenWrt for years. For example, there is no way to control any advanced settings like firewall, MAC address settings for DHCP, DNS, etc when switch to AP mode. With default settings working firewall doesn't allow router dnsmasq to serve DNS requests for the local devices, all DNS requests are just forwarded to the upper gateway and all local device names always failed to resolve.

It is much easier to make any changes with root ssh access.

Many thanks to quaqo and ashleylai87 for details instructions how to activate ssh and get root.

Firmware dropbear (ssh) server is built without shadow support, so in order to allow ssh root login, changing setting:

<SysAccountLogin>on</SysAccountLogin>

is not enough. The root password should be copied from /etc/shadow to /etc/passwd file.
if you want admin user access in this mode, the shell for the admin acc in /etc/passwd file should be changed from /bin/false to /bin/ash

Also firmware proftpd server is build without sftp support, which make access to the router files from wan totally unsafe, busybox luck some applets.

I already managed to build some applications with missed futures activated, thanks to the GPL code from TpLink.
My plan (maximum) is after some testing to rebuild root-fs and upload it to the router, without touching the u-boot and kernel partitions.

Update:
I put some applications here:
https://mega.nz/#F!sQt1CIqD!w1Y-m-gm5srWybXFrlog6g

Rebuilt from TPLINK GPL sources

  • busybox built with maximum applets
  • dnsmasq with IPv6 support
  • dropbear with shadow and compression
  • proftpd with sftp and tls modules and IPv6 support

Other applications

  • tcpdump v4.2.1 mini build
  • minidlnad v1.2.1 (firmware version 1.1.2)

Kind Regards
D

2 Likes

I would be amazingly thankful for at least minimal guide how to properly build GPL sources. (I had some experience with gcc and I'm linux user). And how you're making changes to busybox, because I want to make at least the same for router Touch P5, which as I know is similar to this one.

There is some information that I've got from it, maybe you'll have any ideas what to do next

Thanks in advance.

Привет Артур! :wink:

As I was too lazy to fulfill the full build system configuration, so I used this simple bash script executed on Ubuntu to build the busybox for AC1200.

#/bin/bash

# Cross-compiller toolchain base path
toolchain=/var/tmp/hndtools-arm-linux-2.6.36-uclibc-4.5.3

export PATH=$toolchain/bin:$PATH
export LD_LIBRARY_PATH=$toolchain/lib 

host=arm-brcm-linux-uclibcgnueabi

export CROSS_COMPILE=$host-

# Enter the directory with busybox sources
cd opensource/busybox/src

# create busybox applets configuration or use some default
make menuconfig
#make defconfig
#
# build application
#
make

$host-readelf -a busybox > busybox.elf

Now you can transfer the application to the destination system. I did it just 'scp' busybox file to /tmp directory of the router. If you need permanent update, then you'll probably have to rebuild rootfs squashfs, replacing the files you wish and then flash it into the ROM

Regards
D

2 Likes

Hello,sir.
Mine is C1200 V2(EU) same as yours.
The file you shared now is not available.

Would you please share it again,I'll be really appreciate that.
I really need my router have 5Ghz channel 36-165

Have anyone try to change the wifi country code to US or AU? Both are well-known strongest txpower for many routers, not sure if it runs the same in C1200 V1

wl show maximum txpower for the US country as 22.50(dbm), for some channel configurations it is less. Maximum txpower for AU is 22.00(dbm)
EU is less: 21.00(dbm) maximum, and limited to 16.00(dbm) for wide channels

PS you need to achieve root access to change the country code without rebooting the router.

1 Like

What about EU and MY?

I wasn't able to build anything with your script (maybe something different in toolchain), but I was able to build executable that works! (And yes, I wasn't able to create proper Makefile, so building manually)
Thank you!
out

Next point is to compile something like htop.
And figure out hot to properly rebuild rootfs squashfs or connect overlayfs.

toolchain variable in the script should point to the root directory of the unpacked tar archive with tool chain.
I'd used the busybox sources, distributed with the firmware, only had changed the configuration.
busybox sources are located one level below - in the src directory. Script enter this directory first, then run make menuconfig and then make.
It shouldn't be difficult to rebuild rootfs itself, but firmware update binary. There is some tool in the OpenWrt distribution, but I'm not sure that TPLink web GUI will accept the file it produce.
If you have ssh root access, then you can flash rootfs image file directly with nvrammanager utility into the nvram partition.
Why you need htop, as there is the top applet included in the busybox?
No way for the overlay at least on the AC1200, as the kernel version they provided is just one step before the kernel overlay support. It was introduced in the 2.6.37, but the version from TPLink is 2.6.36 :rage:, and rebuilding the whole kernel will be a separate story...

1 Like

I need that,too:cold_sweat:

Dose anyone could teach me how to change the country code,I can't use 5Ghz

in WiFi 3dBm=100% more power, so if we use US means we will have 50% more txpower than EU, not bad

There is probably additional variable needed like CC or CXX. I don't know exactly yet...

I just like it more.
But for it I need to build ncurses, and then htop. And I hade some difficulties with it...
Also I've tried to build openwrt sources that is provided by GPL license, but it just stuck on make menuconfig in some point.

In nvrammanager I can see different partitions, logs are here and I'm not sure which one I should use (there is no nvram partition)...

Yes... Kernel is old and same version as in AC1200 Linux Akronite 2.6.36.4brcmarm #32 SMP PREEMPT Tue Dec 15 13:55:41 CST 2015 armv7l GNU/Linux
Also please check private messages on site. I've sent some text in russian :wink:

There is probably additional variable needed like CC or CXX

No, not for busybox.

But for it I need to build ncurses

The is pre-built ncurses library, you can find it in GPL codes

In nvrammanager I can see different partitions

Your target is one of the file-system -s. Only one such partition exists in my router.

1 Like

Can u please show us how to change the region? I mean step by step, bcoz we have no idea how to do it, thanks ya

Hello,
If anyone is interested in editing rootfs here's how:

To enable root account I used 10-usb method

  • passwd and set new one
  • copy /etc/shadow to usb or your PC

Read rootfs:

  • nvrammanager --read=/tmp/yourfilenamehere --partition=file-system
  • copy to your Linux distro

Editing rootfs:

  • unsquash it, replace shadow
  • mksquashfs squashfs-root/ yournewrootfs -noappend -all-root
    (for making rootfs I used mksquashfs from GPL source code, you can get it here)

I had an issue replacing stock binaries (busybox/proftpd...) with newer ones as this drove system unbootable so to obtain busybox with more features I simply copied it under /root directory with permissions 4755, after that I log in to root with /root/busybox login

If the result is bigger than 13 107 200 bytes, it won't fit into flash, I gained space by removing unwanted languages under /www/webpages/locale and linking them to en_US

To copy new file-system back, use scp (write under /tmp)

Rewriting file-system:

  • nvrammanager --write=/tmp/yournewfilesystem --partition=file-system
  • reboot

If everything went well, you should have working busybox and passworded root.
If not, reflash firmware via recovery.
I also removed startup of few modules from init.d/ and modules.d/ (you can experiment with that if you feel for it)

About overlay:
I was going through uci config and noticed fstab mentioning it

root@Akronite:~# uci show fstab
fstab.automount=global
fstab.automount.from_fstab=1
fstab.automount.anon_mount=1
fstab.autoswap=global
fstab.autoswap.anon_swap=0
fstab.autoswap.from_fstab=1
fstab.@mount[0]=mount
fstab.@mount[0].enabled_fsck=0
fstab.@mount[0].options=rw,sync
fstab.@mount[0].device=/dev/sda1
fstab.@mount[0].fstype=ext4
fstab.@mount[0].target=/overlay
fstab.@mount[0].enabled=0
fstab.@swap[0]=swap
fstab.@swap[0].device=/dev/sda2
fstab.@swap[0].enabled=0

I haven't tested it out, but it looks like formatting usb drive with ext4 fs and setting enabled to 1 might do the trick (although it's not the jffs2 overlay)

I tried to port my old patches to new kernel, but I quickly found out that my serial is no longer working (I can send commands, but I can't see anything) so I can't debug and progress. I built both squashfs and initramfs (both in drive), but only the latter might boot. None of them has working ethernet link out of the box. You can send me dmesg log if there is an issue, I can't really tell. I recommend doing full flash backup before proceeding. (I managed to overwrite tp-link partition once and had to write my backup directly to the unsoldered flash...)

2 Likes