Welcome! Log In Create A New Profile

Advanced

setting up cross compiling enverment on a pc

Posted by bigdog 
bigdog
setting up cross compiling enverment on a pc
November 26, 2010 11:55PM
Hi all,
Thanks to this forum, I learned a tremendous amount about linux and the dockstar. But I do have a question about compiling programs for the dockstar. Is there a way to use a pc (amd 64 ) to cross compile a program? I have compiled, for example, transmission (a bittorrent program ) on the dockstar , but it takes a lot of time to finish compiling and hoping that there was a quicker way to do this? I'll appreciate it if any one can give some information how to do this.
Re: setting up cross compiling enverment on a pc
November 27, 2010 12:06AM
Ref: Jeff's Uboot build page
http://general.nas-central.org/wiki/Setting_up_the_codesourcery_toolchain_for_X86_to_ARM9_cross_compiling

I executed these on my Ubuntu Maverick PC as root, ie sudo su.

1.
wget http://ftp.maddes.net/hardware/Linkstation/setup_codesourcery.sh

2.
sh ./setup_codesourcery.sh

3. The install ended up in /usr/local and if /usr/local/bin is in your shell's path, invoke
codesourcery-arm-2009q3.sh

4. exit when done.
exit.

The cross-compile toolchain is good for kernel compiles too.

Side-tracking slightly, to setup a syscall emulation under qemu to execute arm binaries on the PC, ie the binaries that you cross-compile ref: https://wiki.ubuntu.com/ARM/RootfsFromScratch/QemuDebootstrap

1.
sudo apt-get install qemu-kvm-extras-static

2. Check that the armeb and arm executables are registered.
cat /proc/sys/fs/binfmt_misc/qemu-arm
cat /proc/sys/fs/binfmt_misc/qemu-armeb

3. sudo to the usb drive that contained the dockstar debian partition, I mounted mine under /mnt.
sudo cp /usr/bin/qemu-arm-static /mnt/usr/bin
sudo chroot /mnt
If there are no errors, you are able to execute arm executables on the PC.



Edited 1 time(s). Last edit at 11/27/2010 12:19AM by jasonp.
bigdog
Re: setting up cross compiling enverment on a pc
November 27, 2010 12:22PM
jasonp Wrote:
-------------------------------------------------------
> Ref: Jeff's Uboot build page
> http://general.nas-central.org/wiki/Setting_up_the
> _codesourcery_toolchain_for_X86_to_ARM9_cross_comp
> iling
>
> I executed these on my Ubuntu Maverick PC as root,
> ie sudo su.
>
> 1.
>
> wget
> http://ftp.maddes.net/hardware/Linkstation/setup_c
> odesourcery.sh
>
>
> 2.
>
> sh ./setup_codesourcery.sh
>
>
> 3. The install ended up in /usr/local and if
> /usr/local/bin is in your shell's path, invoke
>
> codesourcery-arm-2009q3.sh
>
>
> 4. exit when done.
>
> exit.
>
>
> The cross-compile toolchain is good for kernel
> compiles too.
>
> Side-tracking slightly, to setup a syscall
> emulation under qemu to execute arm binaries on
> the PC, ie the binaries that you cross-compile
> ref:
> https://wiki.ubuntu.com/ARM/RootfsFromScratch/Qemu
> Debootstrap
>
> 1.
> sudo apt-get install qemu-kvm-extras-static
>
>
> 2. Check that the armeb and arm executables are
> registered.
>
> cat /proc/sys/fs/binfmt_misc/qemu-arm
> cat /proc/sys/fs/binfmt_misc/qemu-armeb
>
>
> 3. sudo to the usb drive that contained the
> dockstar debian partition, I mounted mine under
> /mnt.
>
> sudo cp /usr/bin/qemu-arm-static /mnt/usr/bin
> sudo chroot /mnt
>
> If there are no errors, you are able to execute
> arm executables on the PC.

Hi,
Thanks for quick reply. I setup the codesourcey compiler using that script setup_codesourcery.sh. After that I tried compiling the program transmission to test the cross compiler. But ran into a problem. here are the steps that used.

1. Went into the cross-compiler environment on my pc
$ codesourcery-arm-2009q3.sh

2 . used configure and make to compile the program
$ ./configure
$ make

3. At this point every thing seems to be fine. I wanted transmission to be installed on my dockstar, so at this point I used tar to back up the directory that I compiled in, and transfered it to my dockstar.
$ tar jcvf test.tar.bz2 /transmission-2.12
$ scp test.tar.bz2 root@[my ip address of the dockstar]:/usr/src/test.tar.bz2

4. At this point I decompress the file on the dockstar and go into the directory
# cd /usr/src/transmission-2.12
and type make install
# make install
But, at this point, make starts recompiling the whole program instead of just installing the already compiled binaries I did in step two. Did miss something ? I successfully created the kernel using the instructions on the forum page, but unlike the kernel, I do not know how package transmission in .deb file and put in the dockstar.
Re: setting up cross compiling enverment on a pc
November 27, 2010 07:25PM
From man page of make:

The make program uses the makefile data base and the last-modification times of the files to decide which of the files need to be updated. For each of those files, it issues the commands recorded in the data base.

1. Is the dockstar's date/time set correctly?
2. make install usually invokes the install program. You can do a dry run on the PC with the -n or --dry-run parameter passed to make on the PC and mimic the actions on the dockstar manually, ie an example from another program, lcd4linux:

make -n install

output is:
if test ! -f config.h; then \
	  rm -f stamp-h1; \
	  make  stamp-h1; \
	else :; fi
make  install-exec-am install-data-am
make[1]: Entering directory `/home/dockstar/lcd4linux-0.11.0-SVN'
if test ! -f config.h; then \
	  rm -f stamp-h1; \
	  make  stamp-h1; \
	else :; fi
:
test -z "/usr/local/bin" || /bin/mkdir -p "/usr/local/bin"
list='lcd4linux'; for p in $list; do \
	  p1=`echo $p|sed 's/$//'`; \
	  if test -f $p \
	  ; then \
	    f=`echo "$p1" | sed 's,^.*/,,;s,x,x,;s/$//'`; \
	   echo "  /usr/bin/install -c '$p' '/usr/local/bin/$f'"; \
	    /usr/bin/install -c "$p" "/usr/local/bin/$f" || exit 1; \
	  else :; fi; \
	done
make[1]: Nothing to be done for `install-data-am'.
make[1]: Leaving directory `/home/dockstar/lcd4linux-0.11.0-SVN'
Re: setting up cross compiling enverment on a pc
March 14, 2011 06:44PM
Hi there.

I followed all the steps, but I am still not producing arm binaries. My build host is running Ubuntu 10.10. What I'd like to know is if there is a special way to pass the arch info to ./configure, make etc. Can someone provide a step by step for compiling Transmission BitTorrent, for example?

I'd appreciate it.

Daze
Super
Re: setting up cross compiling enverment on a pc
November 01, 2011 09:23AM
Hi,

is there a solution for the problem?

I've tried to build hd-idle, thats a tool for managing spin down on hdds.
It has no .config file. Every time i run make (with or without parameters for arm) the result will be an intel binary.

When i try to compile by my own (using the arm-gcc provided by codesourcery) i get what i want, an arm binary ...

What is going wrong with make ?!?

Thank's a lot!




bigdog Wrote:
-------------------------------------------------------
> jasonp Wrote:
> --------------------------------------------------
> -----
> > Ref: Jeff's Uboot build page
> >
> http://general.nas-central.org/wiki/Setting_up_the
>
> >
> _codesourcery_toolchain_for_X86_to_ARM9_cross_comp
>
> > iling
> >
> > I executed these on my Ubuntu Maverick PC as
> root,
> > ie sudo su.
> >
> > 1.
> >
> > wget
> >
> http://ftp.maddes.net/hardware/Linkstation/setup_c
>
> > odesourcery.sh
> >
> >
> > 2.
> >
> > sh ./setup_codesourcery.sh
> >
> >
> > 3. The install ended up in /usr/local and if
> > /usr/local/bin is in your shell's path, invoke
> >
> > codesourcery-arm-2009q3.sh
> >
> >
> > 4. exit when done.
> >
> > exit.
> >
> >
> > The cross-compile toolchain is good for kernel
> > compiles too.
> >
> > Side-tracking slightly, to setup a syscall
> > emulation under qemu to execute arm binaries on
> > the PC, ie the binaries that you cross-compile
> > ref:
> >
> https://wiki.ubuntu.com/ARM/RootfsFromScratch/Qemu
>
> > Debootstrap
> >
> > 1.
> > sudo apt-get install qemu-kvm-extras-static
> >
> >
> > 2. Check that the armeb and arm executables are
> > registered.
> >
> > cat /proc/sys/fs/binfmt_misc/qemu-arm
> > cat /proc/sys/fs/binfmt_misc/qemu-armeb
> >
> >
> > 3. sudo to the usb drive that contained the
> > dockstar debian partition, I mounted mine under
> > /mnt.
> >
> > sudo cp /usr/bin/qemu-arm-static /mnt/usr/bin
> > sudo chroot /mnt
> >
> > If there are no errors, you are able to execute
> > arm executables on the PC.
>
> Hi,
> Thanks for quick reply. I setup the codesourcey
> compiler using that script setup_codesourcery.sh.
> After that I tried compiling the program
> transmission to test the cross compiler. But ran
> into a problem. here are the steps that used.
>
> 1. Went into the cross-compiler environment on my
> pc
> $ codesourcery-arm-2009q3.sh
>
> 2 . used configure and make to compile the
> program
> $ ./configure
> $ make
>
> 3. At this point every thing seems to be fine. I
> wanted transmission to be installed on my
> dockstar, so at this point I used tar to back up
> the directory that I compiled in, and transfered
> it to my dockstar.
> $ tar jcvf test.tar.bz2 /transmission-2.12
> $ scp test.tar.bz2
> root@:/usr/src/test.tar.bz2
>
> 4. At this point I decompress the file on the
> dockstar and go into the directory
> # cd /usr/src/transmission-2.12
> and type make install
> # make install
> But, at this point, make starts recompiling
> the whole program instead of just installing the
> already compiled binaries I did in step two. Did
> miss something ? I successfully created the
> kernel using the instructions on the forum page,
> but unlike the kernel, I do not know how package
> transmission in .deb file and put in the
> dockstar.
Re: setting up cross compiling enverment on a pc
November 02, 2011 04:17PM
I'm not sure I understand where you are at now w/ this process... but couldn't you just locate the binaries (ARM binaries from crosscompilation), copy them into a dir, tar that, copy to your to your dockstar, untar & copy them into the appropriate dir, chmod them to be executable ...

OTOH, I've compiled plenty of stuff on my Pogoplug and Dockstar... using Debian's tools... seems to work great there, and surprisingly, it isn't that slow. ... Transmission doesn't have _that_ many dependencies, does it? Native compliing to get the latest-and-greatest-bleeding-edge-features shouldn't be that difficult... Sorry, not trying to sound flippant, just thinking out loud, trying to be helpful.

=====================================================
Re: setting up cross compiling enverment on a pc
November 02, 2011 04:21PM
Usually it's
codesourcery-arm-2009q3.sh
make ARCH=arm CC=arm-none-linux-gnueabi-gcc
but there's no guarantee that it always works. If it doesn't, you have to take a closer at the Makefile and figure out, what's going wrong.

However, compiling hd-idle is pretty easy, because it is a source for a deb package. On Ubuntu you can do sth like this to get a final deb package
wget http://freefr.dl.sourceforge.net/project/hd-idle/hd-idle-1.04.tgz
tar zxf hd-idle-1.04.tgz
cd hd-idle
sudo apt-get install devscripts build-essential wget fakeroot cdbs patchutils debhelper
sudo apt-get install binutils-arm-linux-gnueabi
debuild -aarmel -us -uc -b
cd ..
ls hd-idle_1.04_armel.deb



Edited 1 time(s). Last edit at 11/02/2011 05:04PM by Vlad.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: