TP-Link WR740N EXTROOT Build

I have a WR740N (4/32) that I did the USB mod on and I want to set up extroot on it.
I've already tried installing a regular prebuilt openwrt release for the model and it works fine.

How many packages do I need to remove to fit the required packages for extroot? From what I've read the required ones are:

  • block-mount
  • kmod-fs-ext4
  • kmod-usb-storage-extras (and consequently kmod-usb-storage)
  • kmod-usb2

I can partition the flash drive with gparted on a pc so I don't believe I need to include parted into the base firmware.
I presume it would be wise to keep the most used packages in the base firmware since (I'm guessing) the built in flash is much faster than
> "With fat32 formatted USB flash drive, I got 24MB/s read and 14MB/s write"

I can connect using SSH just fine so I don't need Luci in the base install either.

Also, in the make menuconfig the "ramdisk" was preselected in the filesystem, is this required? Wouldn't I just need squashfs and nothing else?

https://openwrt.org/supported_devices/432_warning

Chances to get any security supported version to fit are just about zero, the device is no longer supported.

EXTRoot - using an external flash drive connected to the USB to get extra storage.
I just need to fit the bare minimum to mount the USB then I can put whatever needed packages on the USB drive itself where there's ample space

I know what extroot is, but you aren't going to "fit the bare minimum to mount the USB" into 4 MB, you aren't even going to fit the bare minimum to get it booting in the first place. …and even if you would, the whole thing would explode (OOM) once the wireless drivers get loaded into 32 MB RAM.

If there were easy cooking recipes, these devices were still supported - and even the hard decisions won't get it fit into 4 MB anymore.

If you are willing to make even harder decisions, be my guest, but that's going to be your homework.

How hard could it be squeezing down ~5.3MB to 4MB? When I don't need any networking capability other than a connection through SSH on the internal flash?
I don't need wireless either.
(Ofc with extroot I mean external swap as well)

Humor me, we're just talking about 30% after all.

Where does the space get used up on then? Does the kernel use most of it?
I was under the impression that the increase in size on newer versions was because of larger packages.
Luci already is ~500kB

Everywhere, quite literally - and yes, the kernel is a significant part of it - even more so if you want to include USB- and filesystem drivers.

Let's just be realistic.

4096 KB physical flash
 128 KB bootloader && bootloader-env
  64 KB wifi calibration
 320 KB free space hard-required to mount an overlay (5 free erase blocks, at 64 KB each)
=======
3564 KB would be your maximum firmware size (less in practice, padding, et al)

If you're coming from "~5.3 MB", you have a long way to go - and I can't really take it serious, if you're raising "Luci already is ~500kB", that has long left the building - and you still have a mountain of space to recover.

"It's dead, Jim."

I don't buy it... I can believe that it's not possible just that your reasons seem exaggerated...
Again I need 0 networking. 0 wifi
Just:
USB mount; SSH access

And after more digging I found this thread of someone claiming to have built 21.02 with Luci for 4MB flash: https://ashus.ashus.net/thread-192.html
And that still has networking, which I don't need in the base firmware.

Also, couldn't I use squashfs on the USB drive and therefor avoid having to add the kmod-fs-ext4 package? kmod-usb2 also isn't absolutely critical
SquashFS isn't recommended with USB

That would boil it down to just block-mount and kmod-usb-storage-extras. And there's Luci that I can remove.

PS. From what I've read it seems the bootloader takes up only 64KB

Incorrect, bootloader+bootloader-env uses 128 KB.
https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=target/linux/ath79/dts/ar9331_tplink_tl-mr3020-v1.dts;h=551782daa8d550c94df18a9e77108f323bb2200a;hb=HEAD#l116

But I had to revise my calculation, you lose another 64 KB to OEM config, 3520 KB max.

Apologies, wrong device (mixed it up with someone else on this path right now):

https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=target/linux/ath79/dts/ar9331_tplink_tl-wr703n_tl-mr10u.dtsi;h=6c702a7eb33af84c38cc253673e7890572bbffd3;hb=HEAD#l59
128 KB uboot+ubootenv
64 KB ART

It's the WR740N V4.23
https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=target/linux/ath79/dts/ar9331_tplink_tl-wr740n-v4.dts;h=43f0484cd97f4ab1b75a42abea35931ff6f21da4;hb=HEAD
https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=target/linux/ath79/dts/ar9331_tplink_tl-wr741nd-v4.dtsi;h=b1b6577ae22889ce034c687c240d24194a3d7353;hb=HEAD

The sysupgrade file of my current firmware is 3564KB, But the 21.02 build from the thread I linked has it at 3520KB

Well, these TP-Link devices are all the same in in this regard,

So following your own link: https://git.openwrt.org/?p=openwrt/openwrt.git;a=blob;f=target/linux/ath79/dts/ar9331_tplink_tl-wr741nd-v4.dtsi;h=b1b6577ae22889ce034c687c240d24194a3d7353;hb=HEAD#l103
128 KB.

What you'll likely find is that if you can get an image to fit, you will need to remove so much stuff that it will no longer be functional at a practical level.

That said, in order to attempt this in any meaningful way, you'll need to spin up the full toolchain and change compile time options, remove packages, etc. The image builder (online or local) alone is not sufficient for this task.

Then, if you succeed in building an image that fits, you will need to pivot to extroot and install any 'must have' packages that you had to omit from the initial build. If that succeeds, see how far you get before you get an OOM error and kernel panic because of the extremely limited RAM.

All this effort for a 15 year old low end router, if it actually works, will probably get you 50Mbps or so of routing bandwidth... seems like you'll be investing more personal energy and time than it is worth, when a properly supported device with sufficient flash storage and RAM can be purchased new or on the used market for ~$25 USD. For that matter, before you're done with the WR740N, you might even spend half of that or more on the actual electrical energy required to compile an image that can physically be loaded onto the device.

https://openwrt.org/docs/guide-developer/toolchain/start

if you don't need Wi-Fi, then just change the flash memory to a 16MB chip, having previously written the DUMP taken from the original chip to it (without a correct recording of the Wi-Fi setup block, it won't work) and you can already try to assemble the firmware version you need with the necessary packages. There is still information on the Internet and there are ready-made assemblies for 16MB flash.
Good luck.

That's an exaggeration.

Depends on compile time (and how many times you need to repeat the process) multiplied by the power consumption of your computer and then multiplied by your electrical costs. It may be an exaggeration, but in all seriousness it is possible to increase your electrical bill enough to make it a net loss.