qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Cross-compiling QEMU for ARM


From: Leonid Bloch
Subject: Re: [Qemu-devel] Cross-compiling QEMU for ARM
Date: Mon, 11 Mar 2013 12:16:09 +0200

On Mon, Mar 11, 2013 at 10:54 AM, KONRAD Frédéric
<address@hidden> wrote:
> On 10/03/2013 17:28, Leonid Bloch wrote:
>>
>> On Sun, Mar 10, 2013 at 4:59 PM, Peter Maydell <address@hidden>
>> wrote:
>>>
>>> On 10 March 2013 14:36, Leonid Bloch <address@hidden> wrote:
>>>>
>>>> I want to cross compile QEMU itself to run on ARM, but all my searches
>>>> lead me to tutorials for cross compiling other programs for ARM and
>>>> testing them with QEMU, which is not what I need.
>>>> The only relevant link I found was this:
>>>> http://lists.gnu.org/archive/html/qemu-devel/2011-05/msg00099.html
>>>> But this doesn't work for me as well.
>>>>
>>>> I am using Buildroot as my toolchain, and the farthest I got was:
>>>> $ ./configure --cpu=armv7hl --static --cc=arm-linux-cc
>>>
>>> Don't specify --cpu : this is almost always going to break things,
>>> and you should just let configure work it out based on your compiler.
>>> Don't just specify --cc, because we want to run other cross tools
>>> too. Instead, use --cross-prefix=arm-linux-gnueabi- (or whatever
>>> the correct prefix is for your toolchain).
>>
>> Tried that at first, but then getting an error:
>> Error: pkg-config binary 'arm-linux-pkg-config' not found
>>
> I compiled qemu for ARM with buildroot:
>
> - You have to install pkg-config for your buildroot toolchain.
> - fdt, glib, zlib...
>
> Some of them are really tricky to cross-compile, if I remember right.
>
> Which buildroot version are you using?
>
> Fred
>
>>> You'll also need to have a cross-build environment with the minimal
>>> set of libraries/includes that QEMU needs to build, including
>>> but not limited to zlib and glib. How to set this up depends on
>>> what your cross compilation setup is; in this case you'll need to
>>> ask the buildroot folks.
>>>
>>> Question for the qemu-devel folks: does anybody have a situation
>>> where they genuinely need to pass --cpu to configure (ie the
>>> autodetection is wrong or insufficient)? [configure does mention
>>> one case, which is when cross-compiling to x86 Darwin and SunOS,
>>> but the latter at least is busted anyway because later on we
>>> do things based on SunOS uname results which there is no way
>>> to override for the cross-compile case.] I'm tempted to suggest
>>> we should drop --cpu entirely...
>>>
>>> -- PMM
>
>

OK, finally managed to compile:

I installed the necessary libs from within Buildroot config menu (just
marked zlib etc. until it worked)
The problem with pkg-config was that it was named "pkg-config" and not
"arm-linux-pkg-config", like all the other cross compiling tools, so I
just renamed it.
Then:
./configure --target-list=arm-linux-user --cpu=armv7hl --static
--cross-prefix=arm-linux-
(kept the "--cpu" because it didn't do any harm, and kept "--static"
because I need a static binary.
did "make" and there was an error:

~/Compile/qemu-1.4.0/user-exec.c: In function 'cpu_arm_signal_handler':
~/Compile/qemu-1.4.0/user-exec.c:440:25: error: 'mcontext_t' has no
member named 'gregs'
make[1]: *** [user-exec.o] Error 1
make: *** [subdir-arm-linux-user] Error 2

So I just changed "pc = uc->uc_mcontext.gregs[R15];" in line 440 of
user-exec.c to "pc = uc->uc_mcontext.arm_pc;"
(I know, this is the farthest thing from elegant, and will work only
for my needs, but couldn't think of anything better right now)
Does anyone have an idea how to fix it properly?
It appears after:
#if defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 &&
__GLIBC_MINOR__ <= 3))
And I use uClibc, so I don't understand why this condition is true...

Anyway, after I changed the above, it compiled, and all I was left to do is:
arm-linux-strip ~/Compile/qemu-1.4.0/arm-linux-user/qemu-arm
to strip the binary.


Leonid.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]