ts-7000
[Top] [All Lists]

Re: [ts-7000] Re: qemu & native arm compilation

To:
Subject: Re: [ts-7000] Re: qemu & native arm compilation
From: Christopher Friedt <>
Date: Tue, 24 Jul 2007 12:55:39 +0200
embedded gentoo is a good place to start for building a cross-toolchain 
- i.e. linux-headers, binutils, gcc, and the libc, as well as gdb, 
optionally. The only trick at the moment, is figuring out which versions 
will safely compile together. This morning I just compiled an EABI 
toolchain and was testing out a new kernel on my 7250 ;-)

Once the toolchain is out of the way, it's a piece of cake to 
cross-compile custom software. I've found though, that when cross 
compilation starts to veer away from just a libc, kernel, busybox, etc, 
architecture-dependent procedures in configuration start to mess things 
up. A good example of this is pkgconfig - i hate it with a passion. 
Also, there are a lot of autoconf / automake scripts out there that make 
really bad assumptions about your host, target, and build systems and 
report error after error if you're trying to compile for a different 
architecture. I feel like I wasted so much time doing this at the beginning.

Qemu just solves all of those problems at the sacrifice of some speed. 
I'm confident though, that if you were compiling everything natively 
with Qemu, you could emerge gnome with very little hassle (not that that 
would be necessary).

So generally, I use 'crossdev' to build a toolchain, and then I'll 
create a kernel that is a) reasonably compatible to my target system and 
  b) will also run in qemu. Then I either take a pre-existing root 
filesystem from a stage1,2,3 tarball or something and voila, the 
userland is there.

What's great though, is that after you make this userland, you can load 
up qemu and compile everything natively arm -> arm. I use the 
'tinygentoo' method after that, and emerging packages is as simple as 
saying

ROOT=/tinygentoo PORTAGE_CONFIGROOT=/tinygentoo emerge -av <pkg>

it will install everything in /tinygentoo (and also read configuration 
from there, i.e. /etc/make.conf )

Then, if you want to get a bit more advanced, you can set up a portage 
overlay in /tinygentoo under /usr/portage/local/tinygentoo/overlay (you 
should also have /tinygentoo/usr/portage -> /usr/portage and set 
PORTDIR_OVERLAY in /tinygentoo/etc/make.conf )

See

http://gentoo-wiki.com/TinyGentoo

After that it becomes a piece of cake to copy any frustrating ebuilds to 
your own overlay and edit / patch things until it works.

Some might fear that portage is way too huge, but you can actually cut 
out 90% of the portage tree (or however much you want to synchronize) 
with /etc/portage/rsync_excludes. You could literally have a portage 
tree of 5MB if you wish.

See http://gentoo-wiki.com/TIP_Exclude_categories_from_emerge_sync

TS_FOLKS:

Would TS be willing to host a public portage overlay + wiki ?? ... I've 
tried writing the howtos myself, and it seems that they just take 
forever. Plus having a public overlay would certainly help out many of 
us. I would be happy to contribute everything that I have (except for 
private stuff for my company and our clients of course) ... my post has 
started growing... maybe I'll post this in a new subject so the TS folks 
see it more clearly.

~/Chris

j.chitte wrote:
> --- In  Christopher Friedt <> 
> wrote:
>> Hi again everyone,
>>
>> Instead of cross-compiling these days, I've started using Qemu for 
>> native arm compilation. A cross compiler is still necessary to 
> build the 
>> kernel unless you use a pre-compiled one, like this:
>>
>> http://vaiprime.visibleassets.com/~cfriedt/zImage-versatile-2.6
>>
>>
> 
> Hi Christopher,
> 
> this is very interesting I have not got deeply into this yet but if 
> there was a good howto it would surely be helpful.
> 
> I use gentoo as my main dev system so if I could set up cross 
> compiling from there it would be great. Though I am going to need to 
> get more familiar with Debian anyway.
> 
> I had a look embedded gentoo , especially ARM a couple of weeks ago 
> and it looked rather dead. Have I missed where it's all happening?!
> 
> TIA.
> 
> 
>> There is 1 shortcoming: it's generally not as fast as cross-
> compilation. 
>> There are, however several more benefits:
>>
>> * no limitations on RAM except what your system has free (for 
>> compilations that take HUGE amounts of ram, like jikes compiling 
> the 
>> classpath)
>> * no oddities when it comes to pkg-config dependencies
>> * odd arch-dependent autoconf / automake things can be dealt with 
> easier.
>> If anyone here would like to start compiling software this way, you 
> will 
>> need an arm kernel that works w/ Qemu (versatile PB), and a root 
>> filesystem. I'm using Gentoo's stage3 root filesystem for the arm
>>
>> Following the 'tinygentoo' methodology, I've built a gnu userland, 
>> uclibc userland, and am working now on a gnueabi userland, all 
> using 
>> stock ebuilds, or slightly modified ebuilds in my own portage 
> overlay. 
>> I've built several packages with ease, ranging from wireless tools, 
> to 
>> libc's.
>>
>> If anyone would be interested in collaborating on a good howto for 
>> cross-development of this nature, particularly using gentoo's 
> portage / 
>> ebuild system, I'm sure I could get the gentoo-embedded people to 
> post 
>> soemthing on their site.
>>
>> My Qemu command is here:
>>
>> qemu-system-arm -kernel zImage-versatile-2.6 -m 256 -M versatilepb 
>> -append "root=/dev/nfs nfsroot=192.168.7.1:/usr/
> gentoo_root,port=2049 
>> ip=192.168.7.2:192.168.7.1:192.168.7.1:255.255.255.0:qemu" -net 
>> nic,macaddr=52:54:00:12:34:56,model=smc91c111 -net nic,vlan=0 -net 
>> tap,vlan=0,ifname=tap0,script=./qemu-ifup
>>
>> qemu-ifup looks like this:
>> ================================================
>> #!/bin/sh
>>
>> if [ "$(/sbin/ifconfig | grep $1)" != "" ]; then
>>          echo "shutting down old device $1"
>>          sudo ifconfig $1 down
>>          sleep 1
>>          tunctl -d $1
>>          sleep 1
>> fi
>>
>> tunctl -t $1
>> sleep 1
>> sudo /sbin/ifconfig $1 up 192.168.7.1
>> ================================================
>>
>> My kernel .config is here:
>>
>> http://vaiprime.visibleassets.com/~cfriedt/config-versatile-2.6
>>
>> On the first boot, you should always add 'init=/bin/sh' to append 
> above 
>> so that you can get around the default root password.
>>
>>
>> ~/Chris
>>
> 
> 
> 


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
     
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU