Compile python3.6 script for OpenWrt 10.03.1

Hello there, let me preface this by pointing out how much of a noob i am. So much of a noob, in fact, that i can't really comprehend let alone write a fancy bash script.

I wish to execute python scripts on a WRT54GL(2005 blue Linksys machine).

A no-nonsense way to compile python to a binary on my(local) machine, then uploading & executing to the router could work well. I do not know how to do this and have found no meaningful documentation so far on how to compile for another architecture and pack all required libraries.

Another way is installing python interpreter and libraries directly to the router itself. This second method is probably unfeasible, as the router is very limited. Any help, feedback, or ideas are very much appreciated. (thank you for reading, you're cool.)

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

With 16 MB RAM the wrt-54gl is not supportable in the first place (you already have to run through quite some hoops to even make it boot today, with severely stripped down basic functionality). python in any shape or form is relatively big for mips routers, there is no way to get its dependencies installed on a 4 MB flash device, let alone run it with 16 MB RAM (the OOM killer is a regular occurance with 16 MB RAM with the most basic firmware installation already).

These days even 32 MB RAM devices are facing serious limitations and are on the brink of being unsupported, 16 MB RAM really are insufficient. Devices like those deserve retirement and you will find much better ones for very little money on the used market.

Even with much better system requirements one would usually avoid running python on router targets for size and performance reasons, but without actually confirming it, I'd put the minimum system requirements for a basic python runtime environment to at least 16 MB flash (maybe 8 MB, if you really push the envelope) and 128 MB RAM.

1 Like

Just installing a basic Python interpreter and the "essential" core libraries will likely require a device with 16 MB of flash. It's a tight fit into an Archer C7 v2. Adding in more of the "standard" libraries for Python (those generally expected to be part of the distribution) is beyond the 16 MB of flash available and requires an extended file system.

Python code doesn't "compile" in the way that C code or the like does. It requires a run-time interpreter.

2 Likes

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