landley / aboriginal

Aboriginal Linux - http://landley.net/aboriginal/about.html
199 stars 32 forks source link

cross-compile for ARM based embedded system running busybox #4

Open erdosnew opened 7 years ago

erdosnew commented 7 years ago

hi, i found about aboriginal through busybox, https://busybox.net/FAQ.html#build

i've got an ARM-based system running busybox. and i'm trying to learn how to compile simple programs for it. the examples i use were from busybox-tiny utilities (i.e. Dropbear SMTP, ntpclient).

i downloaded prebuilt compiler for arm to my linux machine (http://landley.net/aboriginal/downloads/binaries/cross-compiler-armv6l.tar.gz) and unzipped into a working directory.

what i'm not sure is how to cross compile the program on my linux machine. i navigated to directory containing 'ntpclient' and run the following:

CROSS_COMPILE="$PWD/cross-compiler-armv5l/bin/armv6l-" CROSS_COMPILE="$CROSS_COMPILE" make

but the resulted 'ntpclient' executable seems still is for linux instead of 'arm' (it won't run on my embedded system).

need some pointers on how to use aborginal Prebuilt Binaries.

landley commented 7 years ago

On 11/29/2016 03:24 PM, erdosnew wrote:

hi, i found about aboriginal through busybox, https://busybox.net/FAQ.html#build

Hello.

i've got an ARM-based system running busybox. and i'm trying to learn how to compile simple programs for it. the examples i use were from busybox-tiny utilities (i.e. Dropbear SMTP, ntpclient).

i downloaded prebuilt compiler for arm to my linux machine (http://landley.net/aboriginal/downloads/binaries/cross-compiler-armv6l.tar.gz) and unzipped into a working directory.

Use armv5l, it's backwards compatibleand the system image works. The armv6l target won't boot under qemu due to kernel version skew. (The kernel needed a patch I stopped forward porting.)

what i'm not sure is how to cross compile the program on my linux machine. i navigated to directory containing 'ntpclient' and run the following:

CROSS_COMPILE="$PWD/cross-compiler-armv5l/bin/armv6l-"

v5 vs v6 doesn't match?

CROSS_COMPILE="$CROSS_COMPILE" make

You could should need to set it to itself, you can just do:

CROSS_COMPILE="$PWD/cross-compiler-armv6l/bin/armv6l-" make

but the resulted 'ntpclient' executable seems still is for linux instead of 'arm' (it won't run on my embedded system).

I dunno what ntpclient package you're trying to build. In theory if it's listening to CROSS_COMPILE the build should die if you point it at a nonexistent file. So possibly that package doesn't know about the CROSS_COMPILE variable?

need some pointers on how to use aborginal Prebuilt Binaries.

These days I'm migrating to http://github.com/richfelker/musl-cross-make toolchains, but haven't had time to work on this recently. ($DAYJOB is in frantic deadline mode, I'm a week into a 2-week stay in san francisco, then I head to san diego for 2 weeks, then I get back to austin long enough to start a road trip to visit family for christmas...)

Rob

erdosnew commented 7 years ago

thanks for the quick response!

I've tried as suggested this time:

[erdos@quantum ntpclient-2015]$ ls HOWTO adjtimex.1 log2date.pl ntpclient.h rate2.awk Makefile adjtimex.c ntpclient.1 phaselock.c test.dat README envelope ntpclient.c rate.awk todo

[erdos@quantum ntpclient-2015]$ CROSS_COMPILE="/home/erdos/embedded/cross-compiler-armv6l/bin/armv6l-" make make: Nothing to be done for 'all'.

'ntpclient~' is the directory for the sources files, acquired from 'http://doolittle.icarus.com/ntpclient/' '/home/erdos/embedded/cross-compiler-armv6l/bin/' is where the arm binaries locate.

any advice what should i do to compile it?