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: 5690
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: 5690
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: 449
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.

snowballEarth
Posts: 77
Joined: Wed Feb 18, 2015 9:05 pm

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

Fri Aug 14, 2020 3:41 pm

Will anyone kindly upload the working, compiled qemu to the repositories?

Using dosbox-x to emulate win9x is painfully slow

fruitoftheloom
Posts: 26850
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

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

Fri Aug 14, 2020 4:33 pm

snowballEarth wrote:
Fri Aug 14, 2020 3:41 pm
Will anyone kindly upload the working, compiled qemu to the repositories?

Using dosbox-x to emulate win9x is painfully slow

https://github.com/ptitSeb/box86

https://www.hackster.io/news/run-x86-ga ... ab2ebefd51
The information is out there....you just have to let it in.

My other Linux machines: ChromeBox
https://www.aliexpress.com/item/32966393971.html
& Stone Desktop Intel CoreDuo circa 2010

snowballEarth
Posts: 77
Joined: Wed Feb 18, 2015 9:05 pm

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

Fri Aug 14, 2020 5:38 pm

Thanks for the help. Box86 will eventually be the best way to run individual x86 programs on arm, if it isn't already.

I'm following the latest magpi96 guide to run the entire windows 98 operating system on the pi 4, using dosbox-x. It takes hours just to install one set of drivers. From what I've played with so far win98 is kind of usable after initial setup, if you stick to simple apps.

I've seen reports and watched YouTube videos of win 98 running better through qemu though. So if anyone has a guide on installing win9x on qemu

itainelken
Posts: 21
Joined: Tue Oct 20, 2020 3:12 pm

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

Wed Feb 24, 2021 4:45 pm

snowballEarth wrote:
Fri Aug 14, 2020 3:41 pm
Will anyone kindly upload the working, compiled qemu to the repositories?

Using dosbox-x to emulate win9x is painfully slow
I have compiled and packaged debian packages of qemu 5.2.50:
armhf: https://archive.org/download/macos_921_ ... -armhf.deb
arm64: https://archive.org/download/macos_921_ ... _arm64.deb

if you don't want to download those debs because of security reasons, I compiled qemu using those steps:
armhf:
compiled and packaged using my script: https://github.com/Itai-Nelken/qemu2deb ... ses/latest
if you want to see the exact steps to compile, see the arm64 steps or read my script.
arm64:
the following steps will compile all qemu machine types, and will take ~1 hour on a ssd and ~1-2 hours on a sd card.

Code: Select all

sudo apt install build-essential ninja-build libepoxy-dev libdrm-dev libgbm-dev libx11-dev libvirglrenderer-dev libpulse-dev libsdl2-dev git libglib2.0-dev libfdt-dev libpixman-1-dev zlib1g-dev libepoxy-dev libdrm-dev libgbm-dev libx11-dev libvirglrenderer-dev libpulse-dev libsdl2-dev git
git clone https://git.qemu.org/git/qemu.git
cd qemu
git submodule init
git submodule update --recursive
./configure --enable-sdl  --enable-opengl --enable-virglrenderer --enable-system --enable-modules --audio-drv-list=pa --enable-kvm
ninja -C build
sudo ninja install -C build
to make a deb, I used checkinstall (from here: https://github.com/giuliomoro/checkinstall, I have made a deb for it here:
armhf: https://archive.org/download/macos_921_ ... _armhf.deb
arm64: https://archive.org/download/macos_921_ ... _arm64.deb)
replace 'sudo ninja install -C build' with 'sudo checkinstall'.

Return to “Troubleshooting”