Run linux x86 on arm

Is it possible to run an x86 binary on an ARM processor?

Is it possible to convert/recompile an already compiled x86 binary into an ARM binary? I’m using a BeagleBoard with a command-line Ubuntu (Maverick) and want to run a Ventrilo server but the x86 executable they supply cannot be run on the hardware as far as I can tell (most likely due to differing architecture). Unfortunately I don’t have access to the source to allow me to recompile it natively. If not, is there any other way I can get the binary to run (emulation for example)?

Many years ago, there were emulators of older x86 such as 80286 DOS machines for Acorn Risc OS machines. That might be a starting point to see if those involved have progressed the idea to live on today. Other than that it’s an interesting question given ARM’s apparent move into the server space, displacing x86 binary apps, such an emulator might facilitate the displacement of x86 in this area.

3 Answers 3

You may want to switch to an alternative software available natively on your architecture, murmur and mumble come to mind.

Great, thank you, I didn’t know this existed. Might take some convincing to get the others using it but I think the fact that it’s the highest quality coupled with the lowest latency helps massively.

Short version : if you don’t have the source code then no.

Long version : you can use qemu (or kvm or virtualbox, etc) and use a minimal x86 emulated system to run the server.

I guess the answer is «maybe». Usually you can de-compile an executable file, if you know enough about it. If you decompile the code to a language that has an ARM compiler, and the libraries required to compile that binary to your ARM platform, than it should be possible.

For example: If your Ventrilo server can be decompiled into C source code, and this source code is ANSI Standard, you may have enough support with your ARM compiler to recompile the code.

I really don’t know if you can do it legally, though, since you would be reverse-engineering a software that you are not the owner.

Just a small problem here: most decompiled programs don’t compile again without modification — decompilers aren’t that good 🙁

«if you know enough about it» covers a few years of microprocessor design, assembly, instruction sets, hex editors, etc.

Well, in the specific case OP stated, he has a X86 compiled program. I’m assuming that the number of X86 decompilers available is good. I’m also assuming that since Ventrilo is used for communication, it may not leverage some high-level bytecode language such as Java or C#. So it may decompile well enough to C++ / C. And X86 assembly is well understood, and instructions may be ported/simulated on other architectures. It may not be easy, but it’s definitely doable.

Читайте также:  Realtek rtl8812au linux driver

Another 2 cents: I based the answer on my personal experience porting Lua to PalmOS, a few years ago. Lua was (is) 100% done in ANSI-C, but PalmOS didn’t have an ANSI-C compatible compiler. I had to write a small translation layer without knowledge of Motorola 68k architecture and/or great knowledge of C. Thankfully the «thing» worked, and I assume that’s more of Lua’s fault than my code’s merit. 🙂

Источник

Run linux x86 on arm

I would recommend you overclock before doing this: https://magpi.raspberrypi.org/articles/ . berry-pi-4
WARNING: DO NOT USE THIS WITH STEAM! IT WILL BASICALLY BRICK YOUR OS!
If you have doubts (and I recommend this), use a spare sd card

Download the tools needed to run Box86:

sudo apt update && sudo apt install git build-essential cmake -y
git clone https://github.com/ptitSeb/box86

Download whatever program you need (from what I know, only tar.gz and .deb is supported) from the website or wherever you got it.

cd box86 mkdir build; cd build; cmake .. -DRPI4=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo; make

Now to extract the contents of the package with the ar command (replace with the package that you want to run):

Pi4 with 4gb of RAM, clocking at 2 ghz

I’ll reply as soon as possible, but don’t trust me to answer everything within 10 minutes

Re: (TUTORIAL) How to run x86 Linux Apps on ARM using Box86

Having followed another web-page (not on this forum) to install box86 and a 32-bit zoom client, where box86 and zoom were specified as being in different directories, attempts to run zoom failed with an error message from box86 referring to a missing file. I’ve removed both box89 and zoom and started again using your tutorial, getting as far as completing the installation of box86. In contrast to my earlier attempt, your post seem to imply that the zoom application should also be extracted in the box86 directory, so I wonder if using different directories was a mistake. Or doesn’t it matter? I’m not a systems person, and am also slightly puzzled by your use of both ar and tar, since both commands appear to result in extraction. However, am I correct in assuming that having downloaded the 32-bit zoom client software (into whatever directory) I need to extract it as the pi user with ar x zoom. and then run the command

Re: (TUTORIAL) How to run x86 Linux Apps on ARM using Box86

part after the make to actually install box86 in the system. Also, if you don’t want to reboot after 1st install, a simple

sudo systemctl restart systemd-binfmt

Re: (TUTORIAL) How to run x86 Linux Apps on ARM using Box86

part after the make to actually install box86 in the system. Also, if you don’t want to reboot after 1st install, a simple

sudo systemctl restart systemd-binfmt

Pi4 with 4gb of RAM, clocking at 2 ghz

I’ll reply as soon as possible, but don’t trust me to answer everything within 10 minutes

Re: (TUTORIAL) How to run x86 Linux Apps on ARM using Box86

Having followed another web-page (not on this forum) to install box86 and a 32-bit zoom client, where box86 and zoom were specified as being in different directories, attempts to run zoom failed with an error message from box86 referring to a missing file. I’ve removed both box89 and zoom and started again using your tutorial, getting as far as completing the installation of box86. In contrast to my earlier attempt, your post seem to imply that the zoom application should also be extracted in the box86 directory, so I wonder if using different directories was a mistake. Or doesn’t it matter? I’m not a systems person, and am also slightly puzzled by your use of both ar and tar, since both commands appear to result in extraction. However, am I correct in assuming that having downloaded the 32-bit zoom client software (into whatever directory) I need to extract it as the pi user with ar x zoom. and then run the command

Читайте также:  Boot flash from linux

Pi4 with 4gb of RAM, clocking at 2 ghz

I’ll reply as soon as possible, but don’t trust me to answer everything within 10 minutes

Re: (TUTORIAL) How to run x86 Linux Apps on ARM using Box86

part after the make to actually install box86 in the system. Also, if you don’t want to reboot after 1st install, a simple

sudo systemctl restart systemd-binfmt

Re: (TUTORIAL) How to run x86 Linux Apps on ARM using Box86

Thanks to AbyssDev for the pointer to PiApps. I got the Zoom client up and running quickly, but the outgoing sound broke up so badly as to be unusable. Does anybody have a solution to this?

Re: (TUTORIAL) How to run x86 Linux Apps on ARM using Box86

Yes, Pi-Apps suffered this problem with Steam, but it has since been fixed. The Steam deb did brick your OS when directly extracting the data.tar.xz to root, but installing the deb with dpkg works fine.
This perplexes me, since Tom’s Hardware (a reputable tutorial website) recommended the manual decompression of the data.tar.xz archive to /. And it always worked fine, for everybody, for years. And then one day, it started bricking SD cards for everyone who tried it. What happened is still a total mystery to me, and nobody was able to figure out what exactly was causing unbootable cards.
Fortunately, the problem was solved ASAP by the Pi-Apps team (okay, it was me), and since then, it *should* be safe to install. But of course, keep in mind the usual «Don’t try this at home», «keep a backup», «YMMV», etc.

Thanks to AbyssDev for the pointer to PiApps. I got the Zoom client up and running quickly, but the outgoing sound broke up so badly as to be unusable. Does anybody have a solution to this?

This is yet another instance when PulseAudio ruins everything. Zoom worked fine in ALSA days, but once Raspberry Pi Foundation switched to Pulseaudio, many people report crackling audio, or no sound at all.
No known solutions.

Источник

Run linux x86 on arm

To run x86 code we are going to utilize qemu-user-static.

Install necessary packages

[email protected]:~$ sudo apt update [email protected]:~$ [email protected]:~$ sudo apt install -y qemu-user-static binfmt-support [email protected]:~$ [email protected]:~$ sudo dpkg --add-architecture amd64 [email protected]:~$ [email protected]:~$ sudo apt update [email protected]:~$ [email protected]:~$ sudo apt install libc6:amd64 [email protected]:~$ 

Please keep in mind that more libraries may need to be installed depending on what package is being ran. In some cases these libraries will be installed automatically with the package install, however in others some research must be done to learn what is missing.

Читайте также:  Линукс звук фиктивный выход

Running x86 code

[email protected]:~$ sudo dpkg --add-architecture amd64 [email protected]:~$ [email protected]:~$ sudo apt install -y powershell [email protected]:~$ [email protected]:~$ file /opt/microsoft/powershell/7/pwsh /opt/microsoft/powershell/7/pwsh: ELF 64-bit LSB pie executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=9c3feab2531f770c71d023f031faf37758181701, stripped [email protected]:~$ [email protected]:~$ pwsh zsh: exec format error: pwsh [email protected]:~$ # After qemu-user-static install [email protected]:~$ sudo apt install -y qemu-user-static binfmt-support [email protected]:~$ [email protected]:~$ pwsh PowerShell 7.1.3 Copyright (c) Microsoft Corporation. https://aka.ms/powershell Type 'help' to get help. ┌──(kali㉿kali)-[/home/kali] └─PS> 

If there is a downloaded binary that is x86 that is not automatically being ran under qemu-user-static , you can invoke it with the following command:

[email protected]:~$ qemu-x86_x64-static my_x86_code [email protected]:~$ 

Updated on: 2023-Mar-06
Author: gamb1t

Источник

How-To: Run x86 Linux Applications on ARM Linux with Box86

Box86 will let you run x86 Linux programs (games) on non-x86 Linux, like ARM (needs to be 32bit little-endian).

Also, Box86 uses the native version for some «system» libraries, like libc, libm, or SDL and OpenGL, leading to more performance and easier integration with the host system.

Most x86 Games need OpenGL, so on ARM platforms, a solution like gl4es is probably needed.

Box86 now integrate a DynaRec for ARM platform. While the Dynarec is still incomplete, it already gives some speed boost on certain cases

The current version is still experimental, so some stuff still wont run. But many do work, like for example, WorldOfGoo (at least on the Pandora), Airline Tycoon Deluxe or new FTL. Many of the GameMaker linux games also run fine.

If you are serious about developing Box86, you should install ccache and activate it’s support in the cmake project (use ccmake for example) To have TRACE enabled (i.e. dumping to stdout all individual x86 instructions executed, with dump of registers), you’ll also need Zydis library accessible on your system.

Some x86 internal opcodes use parts of «Realmode X86 Emulator Library», see x86primop.c for copyright details

A note about Unity game emulation

Running Unity games is not possible for now. Mono itself uses signals that are not well emulated enough. So the solution is to use a native version of the libmono used by Unity. It can be found here: https://github.com/Unity-Technologies/mono and it needs to be built from source. When built copy libmonosgen-2.0.so to libmonounity.so and put it somewhere it can be dlopen’d (so in usr/lib or friend or somewhere in your LD_LIBRARY_PATH ). Note that libmonounity is not completely wrapped yet, and the mechanism to call x86 library from libmonounity is not done yet

«Airline Tycoon Deluxe» running on a gigahertz OpenPandora:

«Heretic 2» running on a gigahertz OpenPandora using the dynarec:

«Bit.Trip.Runner» running on an ODROID-XU4 / ODROID-XU4Q :

«Neverwinter Night» running on an ODROID-XU4 / ODROID-XU4Q :

«Shovel Knight» (video from @ITotalJustice) running on a Raspberry Pi 4 :

«Freedom Planet» (video from @djazz) running on a Raspberry Pi 4 :

Источник

Оцените статью
Adblock
detector