Klink on ARM (Raspberry Pi, BeagleBone)

164 views
Skip to first unread message

Dominick Pastore

unread,
Aug 31, 2014, 6:41:18 PM8/31/14
to favese...@googlegroups.com
Hello!

Thanks for a great tethering app! I really appreciate the Linux port for the companion program. It works perfectly with my laptop. I have a request though, if at all possible. Is there any chance you be willing to provide a version of the companion program for ARM?

I have a BeagleBone Black that I would like to tether to, and it is running Ubuntu, but it's ARM-based. Looking at the i386 package, I saw the "klink-up" and "klink-down" scripts, the "klink" binary, and adb. I assume the scripts will be fine as is, and I've got a working adb compiled (attached, if you or anyone else might be interested, though I've only tested it on the BeagleBone Black), but the klink binary is stuck in x86-land, of course. There is a gcc cross compiler, though: arm-linux-gnueabihf-gcc (Ubuntu packages are "gcc-arm-linux-gnueabihf" and "binutils-arm-linux-gnueabihf", other distros are probably similar).

Would it be at all possible for you to cross compile it? I know this is asking a lot, but I've tried to do as much of the work as I can myself. If you can, I would really appreciate it. I have been trying to find a way to tether this for quite a while now.

Thanks,

Nick Pastore
adb.gz

Sean McNamara

unread,
Sep 1, 2014, 1:36:43 AM9/1/14
to favese...@googlegroups.com
Hi,

I haven't tried this in a couple of years (almost 2 years now), but we had a build of Klink for MIPS along with instructions for how to use it and info on how it was compiled, located here: https://groups.google.com/d/msg/faveset-klink/08K9b0rhDf0/xovP_2Wz68QJ

I know that the MIPS build will not help you with an ARM system, but I just wanted to drop a quick note linking to our previous work with MIPS (above), which may perhaps also serve as an encouragement to you that between you and Kevin, you'll be able to get a build that works.

Your Raspberry Pi is probably a bit more capable than the low-end stuff they put in routers, so I'd wager you'll have a fairly good time at tethering once you get it set up. I don't speak for Kevin, but I've been on this list for years, and he has never failed to respond to a request like this with as much help as he can spare, and when folks indicate they know what they're doing (like you), and have provided a build of adb and the toolchain they need (like you), they've been able to get a custom compiled build of Klink for other architectures.

So here's a little general encouragement and wishing you luck that you'll be able to get a build. :-)

-Sean




--
You received this message because you are subscribed to the Google Groups "Klink" group.
To unsubscribe from this group and stop receiving emails from it, send an email to faveset-klin...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kevin Ko

unread,
Sep 1, 2014, 1:49:37 AM9/1/14
to favese...@googlegroups.com, dominic...@dcpx.org
Hi, Nick.

I don't have a similar setup, so I can't test things.  However, I ran a quick cross-compile for you.  Does this build of the "klink" console binary work on your board?


Kevin

Dominick Pastore

unread,
Sep 1, 2014, 11:24:34 AM9/1/14
to favese...@googlegroups.com, dominic...@dcpx.org
Kevin,

That's no problem at all. I just tested it and it worked perfectly. I really appreciate that you were willing to take the time to do this. I hope it was not too much trouble. Thank you very much!

Nick

Ben Clouser

unread,
Nov 11, 2014, 9:33:18 PM11/11/14
to favese...@googlegroups.com, dominic...@dcpx.org
I am trying to do the same thing on my raspberry pi, but I run into library issues. The raspberry pi is using glibc 2.13 and the cross compiled version is looking for 2.15.  I guess you might not be running on Raspbian? but I am curious if you are, how you got it working?


Thanks,
   Ben

Kevin Ko

unread,
Nov 12, 2014, 11:23:13 PM11/12/14
to favese...@googlegroups.com, bclo...@gmail.com
Hi,

I have little experience with these boards, but I can try to cross-compile a version for your raspberry pi.  Is there a pre-built cross-compiler/toolchain for Raspbian?  A cursory inspection seems to imply that I need to build one from scratch (crosstool-ng?).  I'll see if I can do this later this week.

Kevin

Ben Clouser

unread,
Nov 13, 2014, 7:31:12 AM11/13/14
to favese...@googlegroups.com, bclo...@gmail.com
https://github.com/raspberrypi/tools/tree/master/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/share/doc/gcc-linaro-arm-linux-gnueabihf-raspbian has it prebuilt. Though, it seems the community accepted way is to build the toolchain manually using crosstool-ng as you suggested.

Thank you so much for even trying! That would be splendid!

   Ben

Kevin Ko

unread,
Nov 14, 2014, 9:51:13 PM11/14/14
to favese...@googlegroups.com, Ben Clouser
Hi, Ben.

I looked into the toolchain that you linked to, and it looks like that one is using glibc 2.18.  Am I mistaken?

./arm-linux-gnueabihf/libc/lib/arm-linux-gnueabi/libc-2.18-2013.10.so 

crosstool-ng is spitting out some errors for me.  Could you share with me any specific ct-ng menuconfig settings that you're using for your environment?

Kevin

Ben Clouser

unread,
Nov 15, 2014, 12:13:45 PM11/15/14
to favese...@googlegroups.com, bclo...@gmail.com

Hi Kevin,

So I usually just build using the pre-compiled version tracked in git that I linked to above... because, well, lazy. I am using Ubuntu (at the moment) and it seems to work well.

uname -a: 3.2.0-70-generic #105-Ubuntu SMP Wed Sep 24 19:49:16 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

Your comment got me thinking though, so I dug in and threw a verbose flag on a build of a simple hello world program.

Here is the program (just to be thorough):

#include <stdio.h>

int main()
{
        printf("Hello World \n");
}


And my command to build: (the directory "tools" is what git clone brings down)
./tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/arm-linux-gnueabihf-gcc test.c --verbose

And this spit out a whole lot of information. Including the configuration options:

Configured with: /home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/.build/src/gcc-linaro-4.8-2014.03/configure --build=x86_64-build_unknown-linux-gnu --host=x86_64-build_unknown-linux-gnu --target=arm-linux-gnueabihf --prefix=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/install --with-sysroot=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/install/arm-linux-gnueabihf/libc --enable-languages=c,c++,fortran --disable-multilib --enable-multiarch --with-arch=armv6 --with-tune=arm1176jz-s --with-fpu=vfp --with-float=hard --with-pkgversion='crosstool-NG linaro-1.13.1+bzr2650 - Linaro GCC 2014.03' --with-bugurl=https://bugs.launchpad.net/gcc-linaro --enable-__cxa_atexit --enable-libmudflap --enable-libgomp --enable-libssp --with-gmp=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static --with-mpfr=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static --with-mpc=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static --with-isl=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static --with-cloog=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static --with-libelf=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/.build/arm-linux-gnueabihf/build/static --enable-threads=posix --disable-libstdcxx-pch --enable-linker-build-id --enable-plugin --enable-gold --with-local-prefix=/home/zhehe01/work/bzr/pi-build/builds/arm-linux-gnueabihf-raspbian-linux/install/arm-linux-gnueabihf/libc --enable-c99 --enable-long-long --with-float=hard


It also shows the include paths that get set... the important one being:
--sysroot=/home/bclouser/workspace/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/../arm-linux-gnueabihf/libc

I went further into this directory( libc/lib/arm-linux-gnueabihf) and found libc.so.6 is a symlink to libc-2.13.so!

There is a lot more information when using --verbose so if you are curious you could check it out yourself.

Hopefully that helps. I guess my resolve is that you should be able to build using the pre-compiled toolchain and it will link against libc 2.13


Again, Thanks for giving this a go!
   Ben

Kevin Ko

unread,
Nov 15, 2014, 11:29:02 PM11/15/14
to favese...@googlegroups.com, Ben Clouser
Hi, Ben.

Could you try this build of the klink binary?  You'll also need adb, which you can probably find under the android-tools-adb debian package.

Ben Clouser

unread,
Nov 16, 2014, 2:51:02 PM11/16/14
to favese...@googlegroups.com, bclo...@gmail.com
I have adb on my board and it runs, when I run klink however, I get a segFault.  I tried running gdb but it probably wasn't compiled with "-g" flag so no debug symbols exist...

I am on board to keep debugging like this, but it is hardly optimal.

I sometimes get segfaults when I have built with a regular arm compiler instead of the rpi toolchain. How did you end up building it?

Thanks again!
   Ben

Kevin Ko

unread,
Nov 16, 2014, 11:28:35 PM11/16/14
to favese...@googlegroups.com, Ben Clouser
Yeah, this is not a great way to debug things.  The segfault is most likely due to the wrong toolchain being used.

There was a link to precompiled binaries hosted in the github that you mentioned:


That page is acting up at the moment, but I found a pre-compiled tarball there.  I've copied the output of gcc -v at the end of this message.

The actual executable was built in the same way as for Dominick's earlier request, which is also the same way that my build system creates the official executables.  I just subbed in a different set of toolchain vars.

Kevin

=====

Using built-in specs.
COLLECT_GCC=./arm-linux-gnueabihf-gcc
COLLECT_LTO_WRAPPER=/home/kevin/local/stow/linaro/bin/../libexec/gcc/arm-linux-gnueabihf/4.8.2/lto-wrapper
Target: arm-linux-gnueabihf
Configured with: /cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/src/gcc-linaro-4.8-2013.10/configure --build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu --target=arm-linux-gnueabihf --prefix=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/install --with-sysroot=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/install/arm-linux-gnueabihf/libc --enable-languages=c,c++,fortran --enable-multilib --with-arch=armv7-a --with-tune=cortex-a9 --with-fpu=vfpv3-d16 --with-float=hard --with-pkgversion='crosstool-NG linaro-1.13.1-4.8-2013.10 - Linaro GCC 2013.10' --with-bugurl=https://bugs.launchpad.net/gcc-linaro --enable-__cxa_atexit --enable-libmudflap --enable-libgomp --enable-libssp --with-gmp=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/arm-linux-gnueabihf/build/static --with-mpfr=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/arm-linux-gnueabihf/build/static --with-mpc=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/arm-linux-gnueabihf/build/static --with-isl=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/arm-linux-gnueabihf/build/static --with-cloog=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/arm-linux-gnueabihf/build/static --with-libelf=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/arm-linux-gnueabihf/build/static --enable-threads=posix --disable-libstdcxx-pch --enable-linker-build-id --enable-gold --with-local-prefix=/cbuild/slaves/oorts/crosstool-ng/builds/arm-linux-gnueabihf-linux/install/arm-linux-gnueabihf/libc --enable-c99 --enable-long-long --with-mode=thumb
Thread model: posix
gcc version 4.8.2 20131014 (prerelease) (crosstool-NG linaro-1.13.1-4.8-2013.10 - Linaro GCC 2013.10) 

Ben Clouser

unread,
Nov 16, 2014, 11:52:35 PM11/16/14
to favese...@googlegroups.com
Hmmm. I was able to run the version you made for Dominick, it just complained about the library. Huh.

The only obvious thing I see in the config you posted is the target configuration. I would expect it to be --with-arch=armv6 --with-tune=arm1176jz-s instead of armv7 and a9.

I don't know if that will help at all

Thanks again
Ben

Reply all
Reply to author
Forward
0 new messages