Tl-wr741n v1/ imagebuilder: Images are too big (override command doesn't work)

I'm trying to build a image with the following command

make image PROFILE="tplink_tl-wr741-v1" PACKAGES="luci kmod-usb-storage block-mount kmod-fs-ext4 e2fsprogs" FILES="files"

But the original router only had 4mb of storage, with mine I did a 16mb upgrade as you can see below

root@OpenWrt:/# df -h
Filesystem ‎ ‎ ‎ ‎ ‎ ‎‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎‎ ‎ ‎ ‎ ‎ Size‎ ‎ ‎ ‎ ‎ ‎ ‎‎ ‎ Used‎ ‎ Available‎ ‎ ‎ ‎ ‎ ‎ Use%‎ ‎ ‎ ‎ ‎ Mounted on
/dev/root‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎‎ ‎ ‎ 2.5M‎ ‎ ‎ ‎ ‎ ‎‎ ‎ ‎ 2.5M‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ 0‎ ‎ ‎ ‎ ‎ ‎ 100%‎ ‎ ‎ ‎ ‎‎ ‎ /rom
tmpfs‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎‎ ‎ ‎ ‎14.0M‎ ‎ ‎‎ ‎ ‎ 340.0K‎ ‎ ‎ ‎ ‎ ‎ ‎ 13.7M‎ ‎ ‎ ‎ ‎ ‎ ‎‎ ‎ ‎ ‎ 2%‎‎ ‎ ‎ ‎ ‎‎ ‎ /tmp
/dev/mtdblock3‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ 12.3M‎ ‎ ‎ ‎ ‎ 476.0K‎ ‎ ‎ ‎ ‎ ‎ ‎ 11.8M‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎‎ 4%‎ ‎ ‎ ‎ ‎ ‎ /overlay
overlayfs:/overlay‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ 12.3M‎ ‎ ‎ ‎ ‎ 476.0K‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎11.8M‎ ‎ ‎ ‎ ‎ ‎‎ ‎ ‎ ‎ ‎ 4%‎ ‎ ‎ ‎ ‎ ‎‎ /
tmpfs‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ 512.0K ‎ ‎ ‎ ‎‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ ‎ 0‎ ‎ ‎ ‎ ‎ ‎‎ 512.0K‎ ‎ ‎ ‎ ‎‎ ‎ ‎ ‎ ‎ ‎ 0%‎ ‎ ‎ ‎ ‎ ‎ /dev

So when I tried building the image is too big, so I tried adding ROOTFS_PARTITION="12" to the end of the command, it didn't work, I tried to edit the .config file by adding the CONFIG_TARGET_ROOTFS_PARTSIZE=12, but it didn't work either

So what's left to do? and another minor question, this "rootfs partition size" command is only to configure the maximum allowed image size, as if even if I set it to "6" it would, after the installation, expand to all available space?

You can't use the imagebuilder for this (well, maybe, but not easily and not in a supported manner), as you have to make multiple changes to DTS, image recipes and consequently even firstboot scripts. Examples of the changes can be found here or elsewhere on the web (e.g. various freifunk repositories are covering patches for the tl-wr741/ tl-wr841 series of devices).

Keep in mind that these devices are unsupported by now, both due to their low flash size and their low RAM size - while you might have solved the former, the later still remains an issue (and fitting the upgrade for a 16 MB flash chip in 32 MB might be a challenge as well).

When I installed the new flash chip I flashed the sysupgrade openwrt and it automatically recognized the extra space, I don't understand why I can't "just" ignore the size and install anyways.
Sorry If this sound's stupid, software modding isn't my strong suit, but other than using the image builder is there any way to circumvent this?

I also tried building from source, but that didn't work either (was my first option), it wasn't generating any factory.bin/sysupgrade.bin files, so I guess the flash size was also the problem.

Because the DTS for ath79 hardcodes the flash partitioning (as do a couple of other places) and the RAM size.

Well, I upgraded the RAM, so now that shouldn't be a problem anymore, for building a newer firmware I tried this See the solution but it wasn't booting, so I did the same modification but to a 19.07 and it booted, but with only 160kb of space left, what I don't understand is that I have other 18.06.9 that identifies the full amount of storage

I used the "Build system" and successfully created the 23.05.2-initramfs-kernel.bin and flashed using the Breed web interface, the system boot just fine.

So I tried making the squashfs-sysupgrade.bin, first I modified the file "openwrt/target/linux/ath79/dts/ar7240_tplink.dtsi" and changed the firmware partitions to the full size of the 16mb flash, then I modified the "openwrt/target/linux/ath79/image/common-tp-link.mk", it generates the squashfs-sysupgrade.bin but the router won't boot, I already tried the command "make -j16 clean"

Here are the modifications I made to the ar7240_tplink.dtsi

partition@20000 {
  compatible = "tplink,firmware";
  reg = <0x20000 0xfd0000>;
  label = "firmware";
};

partition@ff0000 {
  reg = <0xff0000 0x10000>;
  label = "art";
  read-only;
};

And the modifications of the common-tp-link.mk

define Device/tplink-4m
  $(Device/tplink-nolzma)
  TPLINK_FLASHLAYOUT := 16M
  #TPLINK_FLASHLAYOUT := 4M
  #IMAGE_SIZE := 3904k
  IMAGE_SIZE := 15872k
  DEFAULT := n
endef

IT WORKS, thank you for pointing me the right direction (modifying the DTS was the problem solving)

Turns out after doing all the modifications I just needed to flash a fresh firmware with only the uboot, then proceed to install the openwrt and art partition, the only downside is that it took forever for it to initialize (about 6 minutes), the booting light kept flashing for a very long time, I was already into the luci web interface, overlayfs was mounted in the ram, the system memory utilization was slowly increasing util the complete booting.
Other than that, the system works fine.

The last thing I want to modify is the usb support, I tried following these steps WR741 V1, V2 USB mod on trunk (Barrier Breaker) but the files are different and honestly I don't now what I'm doing hhahaha
Can you help-me with this last thing?

I found someone that already discover how to patch the necessary files, Ar7240 (wa801-v1, wr741) usb patches (for v23.05.2) all I needed to do was to follow his instructions and install the following modules

kmod-usb-ohci
kmod-usb-core
kmod-usb-storage
kmod-scsi-core
kmod-nls-base

After that I use the "make menuconfig" to go into "Global build settings" and checked the "Select all kernel module packages by default"
And run the commands inside the main openwrt folder

sed -i '/is not set/d' .config
make defconfig

So that way it will build all kernel modules and I'm able to install them afterwards if I want
Everything is working now

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.