Building 19.07 for EAP120, no sysupgrade being built

Hey friends, how are you doing.
Currently i'm giving it a try, and i built OpenWrt 18.06, and now 19.07 for my TP-Link EAP 120.
Even though the last supported release is 18.06, it is still available as a target in 19.07, and i would like to try it out at least.
I received 21 of these APs as they were meant to be scrapped by my employer.
Unfortunately, when building for 19.07, the build finishes successfully, but there is no sysupgrade, nor factory.bin file.
Is there a way to build such a file without hassle? I'm asking, because before trying to cat something together, maybe there is another way to do so. Or do i have to tick some box in the menuconfig maybe to get it generated?
I'm trying to get a minimal build without LuCi.

Maybe someone can help me :slight_smile: Thanks in advance!

Usually, this happens in case image too large for available flash.


Ahhh thanks for this hint. I'll check out and see what i can do!

Hmm. I'm wondering a bit. Is there a way to tweak it somehow?
The flash size of the device is 16M, the files itself are 100kB larger than the other ones of the 18.06 build.
Even though, the factory.bin file of the 18.06 is only 3.5M in size. So according to that, the factory.bin for should not be that large as well.
I've set the image size to something huge in the regarding target/linux/image file, unfortunately still there is no sysupgrade nor factory.bin file.
Am i missing something?

You can strip packages. Start with PPP and friends e.g. that should give you quite done headroom again. Maybe even allows you to build 21.02, which is actively supported still.

Thanks that's a great idea. I've found quite a few unnecessary packages. What's the appropriate way to get rid of them? Most of them can't be unticked in menuconfig, because they depend on the target. Stuff like kmod-ppp as well etc.
The squashfs rootfs is 2.2M on both, 18.06 and 19.07
uImage is 200kb larger on 19.07, and vmlinux 600kb more.

Maybe some additional information i gathered.
Do i have to adjust the partition alignment maybe?

root@OpenWrt:/# cat /proc/mtd 
dev:    size   erasesize  name
mtd0: 00020000 00010000 "u-boot"
mtd1: 00010000 00010000 "partition-table"
mtd2: 00010000 00010000 "product-info"
mtd3: 00180000 00010000 "kernel"
mtd4: 00e00000 00010000 "rootfs"
mtd5: 00b80000 00010000 "rootfs_data"
mtd6: 00030000 00010000 "config"
mtd7: 00010000 00010000 "ART"
mtd8: 00f80000 00010000 "firmware"
define Device/eap120-v1
  MTDPARTS := spi0.0:128k(u-boot)ro,64k(partition-table)ro,64k(product-info)ro,1536k(kernel),14336k(rootfs),192k(config)ro,64k(ART)ro,15872k@0x40000(firmware)
  IMAGE_SIZE := 15872k
  LOADER_TYPE := elf
  KERNEL := kernel-bin | patch-cmdline | lzma | loader-kernel
  IMAGES := sysupgrade.bin factory.bin
  IMAGE/sysupgrade.bin := append-rootfs | tplink-safeloader sysupgrade
  IMAGE/factory.bin := append-rootfs | tplink-safeloader factory
TARGET_DEVICES += eap120-v1```

No LuCI, first of all. Get rid of the IPv6 stuff, in case you do not really need it.

Alright thanks for your advice. I was able to reduce the space by 50% removing LuCi and it's libraries. So one step forward i guess.
I think i've found the issue.

According to

chairman@compile:/tmp$ /tmp/openwrt/staging_dir/host/bin/tplink-safeloader -B EAP120 -V r11431-83b0e20711 -k /tmp/openwrt/build_dir/target-mips_24kc_musl/linux-ar71xx_generic/eap120-v1-kernel.bin -r /tmp/openwrt/build_dir/target-mips_24kc_musl/linux-ar71xx_generic/tmp/openwrt-ar71xx-generic-eap120-v1-squashfs-sysupgrade.bin -o /tmp/openwrt/build_dir/target-mips_24kc_musl/linux-ar71xx_generic/tmp/ -j  -S && mv /tmp/openwrt/build_dir/target-mips_24kc_musl/linux-ar71xx_generic/tmp/ /tmp/openwrt/build_dir/target-mips_24kc_musl/linux-ar71xx_generic/tmp/openwrt-ar71xx-generic-eap120-v1-squashfs-sysupgrade.bin
os-image partition too big (more than 1572864 bytes): Success

The kernel partition seems to be slightly too small. The kernel is 31 byte larger than it's partition. I've stripped it as much as possible.
Is there a way to change the partiton layout to get it in there? Let's say take away 1M from the rootfs partition (which has plenty of space left), and assign 1M more to the kernel part. I've tried to apply these changes by adjusting the values in target/linux/ar71xx/image/, but seems like my changes have no effect.

That's how /tools/firmware-utils/tp-link-safeloader looks like.
I'll try to adjust the upper boundary of os-image to 0x1bFFFF and see what happens.

EDIT: Seems like the second value is the length of the partition, not the upper boundary. So i have to adjust the file-system offset.

/** Firmware layout for the EAP120 */
                .id     = "EAP120",
                .vendor = "EAP120(TP-LINK|UN|N300-2):1.0\r\n",
                .support_list =
                .support_trail = '\xff',
                .soft_ver = NULL,

                .partitions = {
                        {"fs-uboot", 0x00000, 0x20000},
                        {"partition-table", 0x20000, 0x02000},
                        {"default-mac", 0x30000, 0x00020},
                        {"support-list", 0x31000, 0x00100},
                        {"product-info", 0x31100, 0x00100},
                        {"soft-version", 0x32000, 0x00100},
                        {"os-image", 0x40000, 0x180000},
                        {"file-system", 0x1c0000, 0x600000},
                        {"user-config", 0x7c0000, 0x10000},
                        {"backup-config", 0x7d0000, 0x10000},
                        {"log", 0x7e0000, 0x10000},
                        {"radio", 0x7f0000, 0x10000},
                        {NULL, 0, 0}
                .first_sysupgrade_partition = "os-image",
                .last_sysupgrade_partition = "file-system"

Yeah it's there! I'm curious if it works.

I doubt it. First, check kernel modules for ppp*. Only the ones required, if any, included ? (pppoe ? ppp ? ...)

1 Like

Yeah, i've even removed USB support, PPP, Misc filesystem support, almost everything during kernel_menuconfig, and it's still 31 bytes off.

Disable debug for kernel. When done in menuconfig, do 'menuconfig clean' before 'menuconfig make'. May be, you even need 'menuconfig dirclean' instead of 'menuconfig clean'. Get rid of ipv6.

Thanks a lot friend. So with 19.07 i'm now exactly filling up the available space + 2 byte exceeding. But unfortunately with latest builds i have to extend the partiton space because it won't fit at all. I need around 1MB more.

I was able to adjust the partition sizes accordingly in the target file and the tplink safeloader file.
Unfortunately something is still wrong.
I think there is some issue, because i need to get the new partition table somehow onto the device. Don't know if that's the case when i use the sysupgrade image.

Can you port this device to the ath79 target? If you could concatenate these two partitions into one (dynamically split) "firmware" partition, your size issues would go away. 7.5MiB of available space isn't terribly great, but you should be able to keep LuCI. As an added bonus, you'll get access to the latest features, and may be able to save those devices from recycling a bit longer.

The partition table also looks like they only use half of the available flash :man_facepalming:


Oh thanks for your reply! I remember, you have ported the EAP245 as well.
Unfortunately i have never ported something. But i am able to figure a lot of things out on myself when i know what i have to do. Can you guide me maybe a little on what exactly i have to do?

My suggestion would be to have a look at similar TP-Link devices. For example the CPE-series uses the same SoC, so that could be a good starting point. The main DTS include for that series (target/linux/ath79/dts/ar9344_tplink_cpe.dtsi) appears to match the EAP120; at least superficially. I suppose the EAP120 board file from ar71xx also contains the necessary details on GPIOs etc. (haven't checked).

The dtsi's history can also be interesting:;a=history;f=target/linux/ath79/dts/ar9344_tplink_cpe.dtsi
Also check out some of the device specific files. git log is your friend :slight_smile:

Use the bootloader console liberally: run initramfs images to test your changes. Get it booting first, then add the hardware details (flash, GPIOs, radios) bit by bit and verify that the added parts work.

Good luck porting!