Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openwrt(emedded) support(Question) #38

Open
NewUse opened this issue Dec 9, 2024 · 4 comments
Open

openwrt(emedded) support(Question) #38

NewUse opened this issue Dec 9, 2024 · 4 comments

Comments

@NewUse
Copy link

NewUse commented Dec 9, 2024

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?

@chux0519
Copy link
Owner

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:

  1. Using compile options to disable unused components in libevent (though I feel this might not be very promising since resources are extremely limited).
  2. Possibly implementing an embedded tinypegas (this isn’t a field I’m very familiar with, but I might try when I have time).

@NewUse
Copy link
Author

NewUse commented Dec 10, 2024

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.

@NewUse
Copy link
Author

NewUse commented Dec 10, 2024

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.
#39 (comment)

@NewUse
Copy link
Author

NewUse commented Dec 15, 2024

I think my #39 is redy to be reviewed, thanks to chatgpt :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants