openwrt(emedded) support(Question)
Hi @chux0519 , thank you for this project! I am trying to port yours project to embedded devices like routers and wireless access points running open source firmware, known as OpenWRT. There are very small flash memory at such devices i.e. 4-8MB, most of them is used by system, so for additional application only 300-1000kB is usually available, so I wonder if it is possible to reduce dependencies, i.e. libevent2? For what does libevent2 library used, is it possible to avoid this dependency?
Thank you for your interest. In this project, libevent is actually quite central as it provides a cross-platform abstraction for the event loop (on Linux, it's likely implemented with epoll). It might not be easy to remove it.
Another potentially significant dependency is libcrypto / libssl (if using OpenSSL). The former provides commonly used cryptographic algorithms, and the latter is used for TLS (e.g., Trojan utilizes it). However, I think this component might already be installed on OpenWRT since it's very widely used.
I think running this on such embedded devices would be really cool. Could you share the testing hardware you're using? I might try it out when I have some free time. The approaches I can think of are:
- Using compile options to disable unused components in libevent (though I feel this might not be very promising since resources are extremely limited).
- Possibly implementing an embedded tinypegas (this isn’t a field I’m very familiar with, but I might try when I have time).
Thank you for your interest. In this project, libevent is actually quite central as it provides a cross-platform abstraction for the event loop (on Linux, it's likely implemented with epoll). It might not be easy to remove it.
Thanks for clarification, I am trying to compile it with mbedtls, unfortunately it seems to be supported only at alpha version of libevent2, if it is possible to avoid just ssl dependency of libevent2 it would help much to port to OpenWRT.
Another potentially significant dependency is libcrypto / libssl (if using OpenSSL). The former provides commonly used cryptographic algorithms, and the latter is used for TLS (e.g., Trojan utilizes it). However, I think this component might already be installed on OpenWRT since it's very widely used.
Unfortunately, OpenSSL is very large, it takes about 1MB of space, it's too much for embedded usage, that's why mbedtls is default ssl library for OpenWRT. There are also openssl, wolfssl and gnutls as ssl libraries options but mbedtls is a recommended one.
I think running this on such embedded devices would be really cool. Could you share the testing hardware you're using? I might try it out when I have some free time. The approaches I can think of are:
I am trying to compile for Mediatek MT7628 MIPS 24KEc architecure SoC with 8MB flash and 64RAM memory
1. Using compile options to disable unused components in **libevent** (though I feel this might not be very promising since resources are extremely limited).
As I said previously, it would be cool to avoid ssl dependency of libevent2, if it possible.
2. Possibly implementing an embedded **tinypegas** (this isn’t a field I’m very familiar with, but I might try when I have time).
Thanks! Also it seems that yours mbedtls support relays on version 2.x and is a little bit incompatible with current 3.x, I think I could fix it and create a PR of supporting both.
Btw. OpenWRT has amazing cross compilation system, it's very easy to port any linux compatible application to any of supported architecture, so I am using it to crosscompile.
Have added mbedtls v3.x support PR, but it is draft, I haven't test it with project cmake files, for OpenWRT I had to rewrite cmake config and I am not sure if it will work at others systems. https://github.com/chux0519/pegasocks/pull/39#issue-2731303003
I think my #39 is redy to be reviewed, thanks to chatgpt :)