Author Topic: Help making QEMU run on the GCW0  (Read 932 times)

gameblabla (OP)

  • *
  • Posts: 467
Help making QEMU run on the GCW0
« on: December 16, 2016, 04:02:20 am »
Yo,
so i wanted to port pebble's fork of QEMU on the GCW0, just for the kicks.
Now, i'm not talking about running the QEMU emulator on a PC to run the GCW0's buildroot,
i'm talking about running QEMU on the actual GCW0.
Here's the repo for reference :
https://github.com/pebble/qemu


It worked just fine on my Ubuntu PC. (it was a straight compile)
Unfortunately, this isn't the case on the GCW0.
And the annoying thing is that the bug is not even graphics-related or stupid, it seems to be a uclibc issue.
(no, this time i'm not lying)

I compiled like so for the GCW0 :
Code: [Select]
./configure --disable-werror --target-list="arm-softmmu" --extra-cflags=-DSTM32_UART_NO_BAUD_DELAY --cross-prefix=mipsel-linux- --disable-linux-aio --disable-curl --disable-curses --audio-drv-list=sdl --disable-kvm --disable-vhdx
make
Then you have your binary in arm-softmmu called qemu-system-arm.

But anyway, you have download the emery firmware files (here) and you run like so:
Code: [Select]
./qemu-system-arm -rtc base=localtime -pflash ./qemu_micro_flash.bin  -machine pebble-robert-bb -cpu cortex-m4 -pflash ./qemu_spi_flash.bin -display sdl,frame=off

Once, you run it, you get this error message :
Code: [Select]
Unexpected error in aio_context_new() at async.c:338:
qemu-system-arm: Failed to initialize event notifier
Aborted
Nooooooo
If you look at the offending line, apparently it has failed to init the event notifier.
It doesn't tell you why it has failed of course, mind you.
Looking at util/event_notifier-posix.c, we can see it uses by default eventfd for initialising the vent notifier.
This function apparently returns -1 (for some reason it fails) so it tries to manually force it i guess.
Since errno doesn't return ENOSYS, it exists there and throws an error. (line 42,43)

So where errno is set ? I don't know, maybe that eventfd function...
In any case, if you try to force it, it will throw you a bunch of asserts errors.
Remove the event notifier and it won't work at all. (on both the pc and the gcw0)
Disabling the assets will instead throw you a Seg fault so it's a never-ending-story.

Has anyone managed to get Qemu to work on the GCW0 ?
Obviously not. (at least not the latest version)
I don't know how eventfd is implemented in uclibc but it doesn't seem to work. (not a big surprise)
Any ideas ?
« Last Edit: December 16, 2016, 02:39:29 pm by gameblabla »

pcercuei

  • ***
  • Posts: 1397
    • GitHub
Re: Help making QEMU run on the GCW0
« Reply #1 on: December 16, 2016, 11:53:04 am »
Well, you compile with --disable-linux-aio, no? So that sounds normal that AIO doesn't work.

gameblabla (OP)

  • *
  • Posts: 467
Re: Help making QEMU run on the GCW0
« Reply #2 on: December 16, 2016, 02:36:32 pm »
Well, you compile with --disable-linux-aio, no? So that sounds normal that AIO doesn't work.
Ok, i recompiled it, this time with --enable-linux-aio and the error message is unfortunely still the same.
It doesn't seem to matter whetever aio is enabled or not.
The eventfd function, whatever that is, is supposed to return 0 or value higher than that.
Instead, it returns -1 and it does not set errno to ENOSYS. This of course results in an error message.
Do you know what eventfd is ? 'Cause i don't.
Any alternatives to eventfd ?

I'm surprised no one tried to get QEMU to work on this.

zhongtiao1

Re: Help making QEMU run on the GCW0
« Reply #3 on: December 18, 2016, 07:05:20 am »
@gameblabla , in your error it says qemu-arm. Would that be the problem as the GCW is MIPS?

Sent from my Q5 using Tapatalk 2


gameblabla (OP)

  • *
  • Posts: 467
Re: Help making QEMU run on the GCW0
« Reply #4 on: January 01, 2017, 06:40:12 pm »
@gameblabla , in your error it says qemu-arm. Would that be the problem as the GCW is MIPS?

Sent from my Q5 using Tapatalk 2
Sorry, i have not seen your answer.
No, qemu-arm is called like that because it's the qemu that emulates ARM devices, like the Pebble.

Whatever eventfd is, it's not implemented in uclibc. (or its implementation is buggy)
I also still have no idea what this function is supposed to do.

Also, i must mention that i forced it to return 0 and qemu returns some assert errors...
so it seems that i have no choice.
« Last Edit: January 01, 2017, 06:41:51 pm by gameblabla »

Aeter

  • *
  • Posts: 290
Re: Help making QEMU run on the GCW0
« Reply #5 on: January 01, 2017, 08:52:08 pm »
Not sure if this is the same eventfd but perhaps something useful is in this manual:
http://man7.org/linux/man-pages/man2/eventfd.2.html
~cucullus non facit monachum~

gameblabla (OP)

  • *
  • Posts: 467
Re: Help making QEMU run on the GCW0
« Reply #6 on: January 05, 2017, 04:17:26 am »
Thanks Aeter for the man page !
Our kernel should support it and they also seem to mention eventfd2...
I should try it to see if this makes any difference.

 

Post a new topic