Ylianst / MeshAgent

MeshAgent used along with MeshCentral to remotely manage computers. Many variations of the background management agent are included as binaries in the MeshCentral project.
https://meshcentral.com
230 stars 88 forks source link

OpenWRT #80

Open 1001crew opened 3 years ago

1001crew commented 3 years ago

I'm trying to figure out why all the mesh agents build for linux are not working in their correspondent same architecture version of Open WRT. One example is : Raspberry PI 3 (cortex_a53) If I use Raspbian or Dietpi linux, mesh agent work smoothly If I use OpenWRT (for Raspberry pi3), mesh agent return me the following error: './meshagent: line 1: syntax error: unexpected word (expecting ")")'

We have no clue on that, except that probably OpenWRT for Rpi3 has kernel build without Hard FP.

Is there anybody that experienced the same problem ? This type of problem we are facing with any ARM board and with majority of routers using OpenWRT based on ARM chipset.

krayon007 commented 3 years ago

Which agent are you using?

krayon007 commented 3 years ago

Most standard linux builds will not work on openwrt, because openwrt does not use glibc. It typically uses musl or uclibc. In order to work on openwrt, you need to use a cross compiler for whatever openwrt version you are using.

I used a cross compiler for openwrt v18 on MIPS24Kc, for agent 28

1001crew commented 3 years ago

25 : Linux ARM - Hard Float

It's not working neither with RASPBERRY PI (openWRT), nor FRIENDLYARM NANOPI ZERO (FriendlyWT) and also not with FRIENDLYARM NANOPI R1 (OpenWRT). All three have the same CPU. All three board are okay with meshagent #25 if used with RASPBIAN (RPI3B), DIETPI (NANOPI)

1001crew commented 3 years ago

Most standard linux builds will not work on openwrt, because openwrt does not use glibc. It typically uses musl or uclibc. In order to work on openwrt, you need to use a cross compiler for whatever openwrt version you are using.

I used a cross compiler for openwrt v18 on MIPS24Kc, for agent 28

Okay thanks for clarification. I have forwarded your reply to OpenWRT developer in charge of this. Let's see his comments.

In case of chipset MediaTek MT7620A or MediaTek MT7621A is there a way to have meshagent work/compiled for OpenWRT ?

krayon007 commented 3 years ago

In case of chipset MediaTek MT7620A or MediaTek MT7621A is there a way to have meshagent work/compiled for OpenWRT ?

The current MIPS24KC meshagent build doesn't work? I built the OpenWRT toolchain for that using ATH79 as the target. The only MediaTek target I see in the OpenWRT build config tools, is MediaTek Ralink MIPS. What version of OpenWRT did you say are running? The toolchain I built is based on Openwrt v18.06.1

1001crew commented 3 years ago

The current MIPS24KC meshagent build doesn't work? NOPE, sadly! I tried to upload all versions linux 32bit...

root@OpenWrt:~# uname -a Linux OpenWrt 4.14.209 #0 Sun Dec 6 07:31:03 2020 mips GNU/Linux

https://downloads.openwrt.org/releases/19.07.5/targets/ramips/mt7620/ https://downloads.openwrt.org/releases/19.07.5/targets/ramips/mt7620/config.buildinfo

1001crew commented 3 years ago

And this is for chipset mediatek7621 https://downloads.openwrt.org/releases/19.07.5/targets/ramips/mt7621/ https://downloads.openwrt.org/releases/19.07.5/targets/ramips/mt7621/config.buildinfo

krayon007 commented 3 years ago

And this is for chipset mediatek7621 https://downloads.openwrt.org/releases/19.07.5/targets/ramips/mt7621/ https://downloads.openwrt.org/releases/19.07.5/targets/ramips/mt7621/config.buildinfo

I'm building the toolchain for MT7620 right now... I'll post back with a meshagent for you to test, when I get it compiled with this toolchain.

krayon007 commented 3 years ago

Ok, try this agent. Unzip this file, and run the command to see if it works: ./meshagent_mipsel24kc -info

From what I found, it looks like the Atheros build target I used for OpenWRT mips24kc is big endian, but the MediaTek one is little endian. (Or vice versa, I can't remember what the description said) So I built a new toolchain for MediaTek 7620, and used it to build the agent below.

meshagent_mipsel24kc.zip

1001crew commented 3 years ago

BINGO !!!!!!

Working perfectly !!!

Screenshot 2021-01-03 at 10 13 11
1001crew commented 3 years ago

Thank you so much !!!!!

I will try this with other MT7620 chipset router....

Great Job. My infinite Thanks once again...

I would suggest you to add this agent in the '/meshagent' list of those downloadable

1001crew commented 3 years ago

Too rush... Is it normal that TERMINAL tab is missing ??? And also info about agents, and other details are missing...

Screenshot 2021-01-03 at 10 15 41

This is another SBC (NANOPI ZERO which run Raspberry Pi agent):

Screenshot 2021-01-03 at 10 17 32
krayon007 commented 3 years ago

This would be a good @Ylianst question. There should be a file and terminal tab. I assume all your other agents connecting to your server have these tabs?

1001crew commented 3 years ago

Yes indeed. All connected agents have both terminal and files except this OpenWrt

-------- Original Message -------- On Jan 3, 2021, 10:55, Bryan Roe wrote:

This would be a good @Ylianst question. There should be a file and terminal tab. I assume all your other agents connecting to your server have these tabs?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

r1bnc commented 1 year ago

How do we build if the target arch is not within makefile.

I am trying to build for Orange Pi R1 Openwrt openwrt-toolchain-sunxi-cortexa7_gcc-7.3.0_musl_eabi, I have the toolchain already. Any help if much appreciated.

krayon007 commented 1 year ago

The first step is to compile openssl using the tool chain. Then you'll need to copy the two .a files into the libstatic folder, then modify the makefile.

If you post the tool chain somewhere, or show me where to get it, I can make the changes for you.

r1bnc commented 1 year ago

Hello @krayon007 ,

This is the link for the toolchain https://github.com/r1bnc/openwrt18-orangepi-r1-toolchain-sunxi-cortexa7_gcc-7.3.0_musl_eabi

r1bnc commented 1 year ago

Hello @krayon007, any update?