2016 08 on Mil años de solitario https://CoderSherlock.github.io/categories/2016-08/ Recent content in 2016 08 on Mil años de solitario Hugo -- gohugo.io en-us haopengzhan@gmail.com (CoderSherlock) haopengzhan@gmail.com (CoderSherlock) Mon, 15 Aug 2016 15:44:05 -0400 Cross Compile RSync ARM https://codersherlock.github.io/post/Cross-Compile-RSync-ARM/ Mon, 15 Aug 2016 15:44:05 -0400 haopengzhan@gmail.com (CoderSherlock) https://codersherlock.github.io/post/Cross-Compile-RSync-ARM/ <h1 id="cross-compile-rsync-to-arm-platform">Cross Compile Rsync to ARM platform</h1> <p>As always, feel free to ask. // Sherlock</p> <h2 id="motivation">Motivation</h2> <p>I got some issues about compile seafile to android, so instead of doing so, I start to figure out some other synchronize workflow. <a href="https://rsync.samba.org/">Rsync</a> is one of the most mature synchronization solution. So I made the decision on planting rsync to android.</p> <h2 id="pre-work">Pre-work</h2> <p>Rsync is a sync program with delta sync feature and based on SSH connection. So all we need to do is SSH support and cross compile tool-chain. Similar to what I mentioned in <a href="https://codersherlock.github.io/post/Cross-Compile-Seafile-2-ARM/">previews blog</a>, Android NDK and environment export need to be done before compilation. To enable normally use of compiled program, we need to make android support SSH. My solution is just install <a href="https://play.google.com/store/apps/details?id=berserker.android.apps.sshdroid&amp;hl=en">SSHDroid</a> from Google Play Store.</p> <h2 id="cross-compile-rsync">Cross-Compile Rsync</h2> <p>Running following script to build rsync. It will generate a executable file named rsync in the root directory.</p> <pre><code>$ ./configure --build=${BUILD_SYS} --host=${TOOLCHAIN} $ make </code></pre> <h2 id="push-rsync-to-android">Push RSync to Android.</h2> <p>After installing SSHDroid, we can now push our arm-version-rsync to target machine.</p> <pre><code>$ adb push rsync /data/local/tmp $ adb shell $ cd /data/data/berserker.android.apps.sshdroid/dropbear $ mv ../../../local/tmp/rsync . </code></pre> <h2 id="run-rsync-with-argument">Run Rsync with argument</h2> <p>Now we can easily use rsync in android shell. Similar to what we use on PC.</p> <pre><code>$ ./rsync -e &quot;./ssh&quot; {target-data} {target-location}:{target-directory} </code></pre> <h2 id="references">References</h2> <p><a href="http://stackoverflow.com/questions/8130889/build-rsync-for-android">Build Rsync for Android</a></p>