User avatar
RET80
Posts: 22
Joined: Mon Dec 19, 2016 10:52 pm

Raspberry Pi 4 and QEMU (x86/x64)

Fri Jul 26, 2019 1:47 am

Hello folks!

So I've been trying to get any x86-based OS working using QEMU and AQEMU as the front-end GUI and for the life of me, I have not been able to install any operating system. Be it any windows distribution from 95 onwards, to Linux or ReactOS. It seems as if the tinycode translator is not translating the x86 code properly and causing faults. Just about every single OS install breaks.

Has anyone here attempted to use Qemu at all with the Pi 4 and had any success? Or is Qemu's tinycode translator totally broken?

Or maybe any workarounds?

Depending on the OS install, it will fail, fault or lockup at various places during the install process.

Any help would be amazing.
"Just because you invested your valuable time in compensating for a software designer’s madness, does not mean the software is good. It means you don’t value your own time as much as you should. "

User avatar
RET80
Posts: 22
Joined: Mon Dec 19, 2016 10:52 pm

Re: Raspberry Pi 4 and QEMU (x86/x64)

Fri Jul 26, 2019 10:15 pm

Sorry to push a thread back up - but anyone? I've been desperately trying to find a solution to this. Someone had to have run into this by now in some way?

Is there anything you'd like for me to run to any info to give to the forum/thread?
"Just because you invested your valuable time in compensating for a software designer’s madness, does not mean the software is good. It means you don’t value your own time as much as you should. "

User avatar
Gavinmc42
Posts: 4479
Joined: Wed Aug 28, 2013 3:31 am

Re: Raspberry Pi 4 and QEMU (x86/x64)

Sat Jul 27, 2019 1:25 am

No one knows, because no one has done it?

Most will be able to help with ARM QEMU on a x86 box.
You want to do x86 QEMU on a ARM box.

That might take longer to answer as only the Pi4 is perhaps good enough to do it and not enough have been out in the wild long enough.
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

User avatar
RET80
Posts: 22
Joined: Mon Dec 19, 2016 10:52 pm

Re: Raspberry Pi 4 and QEMU (x86/x64)

Sat Jul 27, 2019 5:23 am

Gavinmc42 wrote:
Sat Jul 27, 2019 1:25 am
No one knows, because no one has done it?

Most will be able to help with ARM QEMU on a x86 box.
You want to do x86 QEMU on a ARM box.

That might take longer to answer as only the Pi4 is perhaps good enough to do it and not enough have been out in the wild long enough.
Right, I think so as well. The Pi 4 is still just so new, there haven't been enough people fiddling with x86 emulation on its latest ARM platform.
Well I'll keep hammering away at it and see if anyone has anything to add.

I might just compile from source, I just need to find the repo to get the absolute latest.
"Just because you invested your valuable time in compensating for a software designer’s madness, does not mean the software is good. It means you don’t value your own time as much as you should. "

User avatar
RET80
Posts: 22
Joined: Mon Dec 19, 2016 10:52 pm

Re: Raspberry Pi 4 and QEMU (x86/x64)

Wed Jul 31, 2019 3:57 pm

Here is the solution.

Compile it right from source.
https://github.com/qemu/qemu

It will take about 4 hours to compile on a Pi 4.
Just be sure to read the instructions and be sure to call a 'make install' after it successfully compiles (with sudo preferably) to install it in the proper directories so that libvirt or AQEMU can see that QEMU exists.


In short, the QEMU from the Raspberry Pi 4 from aptitude repositories are completely broken (e.g. the apt-get install of qemu). Compile it yourself to fix it.
"Just because you invested your valuable time in compensating for a software designer’s madness, does not mean the software is good. It means you don’t value your own time as much as you should. "

User avatar
Gavinmc42
Posts: 4479
Joined: Wed Aug 28, 2013 3:31 am

Re: Raspberry Pi 4 and QEMU (x86/x64)

Thu Aug 01, 2019 5:52 am

Make sure your swap file is big enough when compiling.
I have mine set at 1GB on a 4B1.

I think the Pi4B4 can only handle upto to 3GB at the moment, USB driver conflict?
Use the other 1GB as swap?

One day Win95/98?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

jdonald
Posts: 440
Joined: Fri Nov 03, 2017 4:36 pm

Re: Raspberry Pi 4 and QEMU (x86/x64)

Wed Aug 14, 2019 4:27 am

I ended up cross-compiling to save those four hours. In a Buster x86_64 container:

Code: Select all

git clone git://git.qemu-project.org/qemu.git
cd qemu
sudo dpkg --add-architecture armhf
sudo apt-get update
sudo apt-get install -y g++-arm-linux-gnueabihf flex bison libglib2.0-dev:armhf # and possibly some other lib*-dev:armhf deps
./configure --cross-prefix=arm-linux-gnueabihf- --prefix=/usr/local --target-list="i386-softmmu i386-linux-user x86_64-softmmu x86_64-linux-user " --enable-linux-user --enable-user --enable-system
make
sudo make install
# then copy installed /usr/local contents to the Pi
Windows 95 then installed properly as I followed the wiki on qemu.org. Took about 30 minutes step-by-step which felt a lot faster than I recall from doing this on a Pi 3B+ long ago.

I didn't test any Raspbian qemu binaries but I believe you RET80. Thanks for letting us all know before we have that heartache after a long wait on a slow emulated OS install.
Gavinmc42 wrote:
Thu Aug 01, 2019 5:52 am
I think the Pi4B4 can only handle upto to 3GB at the moment, USB driver conflict?
That was only for the 64-bit kernel. For the purpose of this thread users can compile on 32-bit Raspbian even if intending to emulate 64-bit Intel.

Return to “Troubleshooting”