far2l icon indicating copy to clipboard operation
far2l copied to clipboard

scp and crossload to the same host

Open unxed opened this issue 2 years ago • 26 comments

When both panels use the same SCP connection to same SCP host, why do we need to download and upload files when doing copy and move? Can't we just do "cp" and "mv" on a server side?

unxed avatar Nov 27 '22 11:11 unxed

1 Still only limited functionality possible - no visible progress etc 2 Too narrow usecase 3 Also you may just run far2l remotely there and you'll get this and more

elfmz avatar Nov 27 '22 12:11 elfmz

Spent two evenings investigating how to build far2l for openwrt/ddwrt. They even have no glibc there, musl or uClibc is used instead. Also mips architecture. Cross compilation with also cross compiling half of deps with another c lib... Not an easy task.

About progress — may it be an option disabled by default?

unxed avatar Nov 27 '22 13:11 unxed

Building far2l for such minimalistic env is separate issue. Theoretically it must be buildable, may be with some missing plugins, like colorer (due to xerces dependency), anx wx of course is under big question, but other parts should work.

elfmz avatar Nov 27 '22 16:11 elfmz

tried to crosscompile under buildroot for arm and eventually faced with issue that farlng (iternal tool) needs to be built for host arch.. may be rewrite it in perl to simplify cross-compilation? Otherwise need to do it in two phases - one host compilation another - cross compilation partially using results of host build..

elfmz avatar Nov 28 '22 13:11 elfmz

I'm familiar with Perl, will look into it

unxed avatar Nov 28 '22 19:11 unxed

As for target architecture, the router I can test build on is big endian mips with uClibc: system type : Atheros AR9132 rev 2 (0xb9) cpu model : MIPS 24Kc V7.4

unxed avatar Nov 28 '22 19:11 unxed

Do I understand right that for build process only "generator" mode is required?

unxed avatar Nov 28 '22 19:11 unxed

yes, i already bit started implementing such lightweight (hardread) perl generator so dont bother.. for now)

elfmz avatar Nov 28 '22 20:11 elfmz

router is big endian? it can make some troubles :)

elfmz avatar Nov 28 '22 20:11 elfmz

router is big endian? it can make some troubles :)

Just googled "AR9132" a bit. Could not find data sheet. Found this: https://github.com/Deoptim/atheros/blob/master/JTAG/AR9132.cfg:

target create $TARGETNAME mips_m4k -endian big -chain-position $TARGETNAME

The same is written here: https://www.virtualhere.com/comment/1276#comment-1276 One more proof: https://forum.dd-wrt.com/phpBB2/viewtopic.php?p=636565&sid=0e6b3141d3d64abafe63754f6ba3d3bc#636565

unxed avatar Nov 28 '22 20:11 unxed

As embedded systems are often single user, we can introduce embedded build mode without sudo releated stuff to save build time and storage space.

unxed avatar Nov 28 '22 21:11 unxed

i dont think sudo-related stuff consumes lot of space and build time

elfmz avatar Nov 28 '22 21:11 elfmz

tried to crosscompile under buildroot

Isn't buildroot a tool for generating firmware images, not individual software packages?

unxed avatar Nov 28 '22 23:11 unxed

yes, but IMHO its cross compilation as target is not same as host

elfmz avatar Nov 28 '22 23:11 elfmz

yes, but IMHO its cross compilation as target is not same as host

I just don't really understand how to make build, for example, for a openwrt/ddwrt router. Okay, I can tell cmake to use a different compilation toolchain with a different target platform, but where do I get the necessary header files for different libraries, and how do I tell cmake to use them, not the system ones?

unxed avatar Nov 29 '22 00:11 unxed

need to google steps for it.. isnt it this: https://openwrt.org/docs/guide-developer/toolchain/crosscompile ?

elfmz avatar Nov 29 '22 08:11 elfmz

need to google steps for it.. isnt it this: https://openwrt.org/docs/guide-developer/toolchain/crosscompile ?

Unfortunately, this is nothing there about where to get headers for dependency libs and how to pass them to cmake. Some search gives me two cmake examples, an application and a library it depending on: Libubox Ubox

But it still does not explain, how ubox build recipe knows where to get libubox header files. Ubox CMakeLists.txt has INCLUDE_DIRECTORIES(/opt/local/include). But I still do not understand a way how library header files for target platform should appear at this path.

unxed avatar Nov 29 '22 09:11 unxed

From link above: If compilation aborts due to missing header files or shared objects, you might need to override CFLAGS and LDFLAGS to point to the staging_dir/target-architecture_uClibc-libcver/usr/include and …/usr/lib directories So first you have to compile full buildroot image for your device - it will build also toolchain, libc and then compiler and necessary headers will be useable

elfmz avatar Nov 29 '22 09:11 elfmz

So first you have to compile full buildroot image for your device - it will build also toolchain, libc and then compiler and necessary headers will be useable

Yes, got it. But this is about system libs. And that about headers for libs that far2l depends on like libxerces? However, such dependencies seem to apply only to plugins. In theory, far2l itself should build without them, right?

unxed avatar Nov 29 '22 10:11 unxed

Yes, buildroot appeared to have xerces and many others (but no wx and no uchardet), dependencies are decribed in buildroot package files that i've just added (however they little bit drafts for now, need some refinement) - need just to add them to buildroot/packages directory, then reference added package from some category in packages/Config.in then run make menuconfig and enable there far2l - then make - and it will create full image with far2l and libs inside

elfmz avatar Nov 29 '22 10:11 elfmz

At least thats how i was able add far2l into image i build for my Olinuxino Lime2 that i use as kind of smart home brains :)

elfmz avatar Nov 29 '22 10:11 elfmz

You mean I should build dependencies in buildroot also? But many of them, like libssh, are already availble as openwrt packages, seems better to use them to save router space.

unxed avatar Nov 29 '22 11:11 unxed

Building them needed to get properly configured headers and libs, no need to copy them on target if they're already there

elfmz avatar Nov 29 '22 12:11 elfmz

Got it, thanks! And libs abi stays the same within changes of minor versions, am i right?

unxed avatar Nov 29 '22 14:11 unxed

There is still two use cases for "crossload via cp/mv" feature:

  1. router has too little flash memory to install far2l
  2. router has ssh, but do not support installing any additional software

unxed avatar Dec 02 '22 20:12 unxed

на shell такое совсем несложно должно делаться, по идее

unxed avatar Oct 04 '23 13:10 unxed