qemu always hangs on macos 10.8.2


8 posts
by cmason » Mon Dec 31, 2012 6:33 am
I'm trying to get qemu working on my Mac running 10.8.2 so I can cross compile compilers and various other things for the raspberry. I've followed instructions:

http://www.rpiforum.net/forum/tutorials ... -osx-lion/
http://igor.gold.ac.uk/~mas01mjy/wp/?p=95
https://github.com/jeremyckahn/pine/wik ... MU-on-OS-X

I've tried both qemu 1.1.0 and 1.3.0 using homebrew. I've also tried manually compiling 1.3.0 with clang (default cc) and with gcc-4.2. I've used the configure options:

Code: Select all
./configure --disable-sdl --disable-kvm --enable-cocoa --cc=gcc-4.2 --host-cc=gcc-4.2


(I've also tried with standard clang cc.)

All of these combinations simply result in an empty white window when launching the raspbian wheezy 2012-12-16 image and a kernel I compiled locally (which boots on the teensy) using:

Code: Select all
qemu-system-arm -M versatilepb -cpu arm1176 -m 256 -hda raspberry-qemu.ext4 -kernel zImage -append "root=/dev/sda2" -serial stdio


Figuring it might be something with this raspberry pi kernel or image, I've also tried the exact debian squeeze image, initrd, and vmlinuz this page claims to have working:
http://psellos.com/2012/08/2012.08.qemu-arm-osx.html

This results in

Code: Select all
> qemu-system-arm -nographic -M versatilepb -kernel vmlinuz-2.6.32-5-versatile -initrd initrd.img-2.6.32-5-versatile -hda debian_squeeze_armel_standard.qcow2 -append "root=/dev/sda1 console=ttyAMA0"
Uncompressing Linux... done, booting the kernel.
[Hangs, basically indefinitely; I've waited hours.]


Since this supposedly works for others, it must have something to do with my setup but I can't figure out what it is. I've read about folks with similar white screen hanging problems due to clang, but as said above, I've tried with gcc-4.2, and with the 1.3.0, which indicates it works with clang anyway.

Any help would be most appreciated. My little brother's robot project is blocked by this. :-P

-c

Here are the compilers version outputs:
Code: Select all
gcc-4.2 -v
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /Volumes/Media/Builds/gcc-5666.3/build/obj/src/configure --disable-checking --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++,fortran --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Apple Inc. build 5666) (dot 3)

cc -v
Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)
Target: x86_64-apple-darwin12.2.1
Thread model: posix

 gcc -v
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.11~67/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~67/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)

qemu-system-arm --version
QEMU emulator version 1.3.0, Copyright (c) 2003-2008 Fabrice Bellard
Posts: 7
Joined: Thu Aug 09, 2012 4:38 am
by efflandt » Mon Dec 31, 2012 8:22 am
Is there a pre-compiled qemu-system or package for Mac.

I followed this tutorial for Linux or Windows and it worked in 64-bit Ubuntu 12.04 Linux (I just had to install qemu-system package). However, that kernel is hard coded for -m 256 only (I got a hang like you do if I tried giving it more RAM).

http://xecdesign.com/qemu-emulating-ras ... -easy-way/
Posts: 359
Joined: Mon Dec 03, 2012 2:47 am
Location: Elgin, IL USA
by cmason » Mon Dec 31, 2012 1:15 pm
efflandt wrote:http://xecdesign.com/qemu-emulating-raspberry-pi-the-easy-way/


I tried the kernel listed in the above post with:

Code: Select all
qemu-system-arm -kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "root=/dev/sda2 panic=1" -hda 2012-12-16-wheezy-raspbian.img


and I see the same behavior: "Uncompressing Linux... done, booting the kernel" and an empty white window.

Thanks,

-c
Posts: 7
Joined: Thu Aug 09, 2012 4:38 am
by jeremyp » Thu Jan 03, 2013 10:12 am
I'm using QEMU for my bare metal operating system and I was seeing a similar issue. I think it might be a bug in QEMU when using the "built in" console. I tried it with the VNC console and it seemed to work.

The options I used are

Code: Select all
-vnc 127.0.0.1:5500,reverse

and that fixed it.

For this to work, you need a VNC client already running in "listen mode" on port 5500.
Posts: 9
Joined: Wed Sep 26, 2012 3:58 pm
by jeremyp » Thu Jan 03, 2013 10:13 am
Also, I'm using the Mac Ports version of QEMU.
Posts: 9
Joined: Wed Sep 26, 2012 3:58 pm
by ShiftPlusOne » Thu Jan 03, 2013 10:14 am
efflandt wrote:Is there a pre-compiled qemu-system or package for Mac.

I followed this tutorial for Linux or Windows and it worked in 64-bit Ubuntu 12.04 Linux (I just had to install qemu-system package). However, that kernel is hard coded for -m 256 only (I got a hang like you do if I tried giving it more RAM).

http://xecdesign.com/qemu-emulating-ras ... -easy-way/


It's not the kernel that's hard coded for 256mb, but the 'versatile' qemu platfrom target..
Forum Moderator
Forum Moderator
Posts: 1519
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy
by cmason » Sun Jan 06, 2013 8:45 pm
I tried using VNC as suggested with:

Code: Select all
qemu-system-arm -nographic -M versatilepb -kernel vmlinuz-2.6.32-5-versatile -initrd initrd.img-2.6.32-5-versatile -hda debian_squeeze_armel_standard.qcow2 -append "root=/dev/sda1 console=ttyAMA0" -vnc 127.0.0.1:5500,reverse


and I still see the hang/crash. Which version of MacOS X are you using? I'm becoming convinced that this is something specific to recent MacOS versions since no one else seems to see this crash.

Thanks,

-c
Posts: 7
Joined: Thu Aug 09, 2012 4:38 am
by jeremyp » Wed Jan 09, 2013 5:18 pm
Hi,

I'm on 10.8.2, but my problem seems to have gone away since my last update to Mac Ports which took qemu to 1.3.0.

I am also using the flag -cpu arm1176 which is the correct CPU for Raspberry Pi. My current (working) config is

Code: Select all
$ qemu-system-arm --version
QEMU emulator version 1.3.0, Copyright (c) 2003-2008 Fabrice Bellard
$ qemu-system-arm -M versatilepb -cpu arm1176 -kernel kernel-qemu.img
Posts: 9
Joined: Wed Sep 26, 2012 3:58 pm