Tutorial  Updated

Run x86 apps on l4t switch with box86

There are two methods for running x86 apps on the switch:

1) This tutorial uses box86 for running x86 apps in general in L4T ubuntu: This is useful for old opengl apps in general especially if they are from the early 2000s.

2) The second method uses Exagear windows emulator in switchroot Android 10. This method supports very limited range of directx games. It is however quite useful for visual novels. Go to the discord for https://www.reddit.com/r/AndroidVisualNovels. Use the "alternate method" for Exagear emulator in #faq-and-guide. I tested umineko chiru (2017- steam version) with ps3 sprites. There is lag (which should not matter much for a vn) but sound and voices works perfectly.




Box86 tutorial:

Hello everyone, if you have been in the official switchroot discord you would have noticed that @Heasterian have managed to run opengl x86 apps on l4t. This tutorial will cover what he did in the most noob-friendly way possible.


Tested games after UPDATE:
GTA Vice City: Average 15 fps, unstable, stutters when driving and fps drops when loading the map
Star Wars Battlefront II: stable 10 fps on the spawn screen, Xephyr has an issue with mouse input so could not get into the game
Worms 4 mayhem: stable 25 fps
Warcraft 3 demo: stable 27 fps






Outcome
If you follow this guide step-by-step you should be at the very least capable of running x86 apps on l4t. FPS will vary depending on what app and configurations you use (See above for tested games). For this tutorial, we will run Warcraft III demo on the switch.

Setting up schroot and box86
Source rna on armbian: https://forum.armbian.com/topic/16584-install-box86-on-arm64/

1) Open a terminal on l4t and enter the following commands one by one:
Code:
sudo apt install schroot debootstrap

sudo mkdir /srv/chroot

sudo mkdir /srv/chroot/debian-armhf

sudo debootstrap --arch armhf --foreign buster /srv/chroot/debian-armhf http://debian.xtdv.net/debian

sudo chroot "/srv/chroot/debian-armhf" /debootstrap/debootstrap --second-stage

2) Create a config file for the chroot by entering the following command:
Code:
sudo nano /etc/schroot/chroot.d/debian-armhf.conf

3) Copy and paste the following and replace <username> with your ubuntu username: (to save in nano press CTRL+X, Then Y, then Enter)
Code:
[debian-armhf]
description=Debian Armhf chroot
aliases=debian-armhf
type=directory
directory=/srv/chroot/debian-armhf
profile=desktop
personality=linux
preserve-environment=true
root-users=<username>
users=<username>

4) Edit the nssdatabases like so:
Code:
sudo nano /etc/schroot/desktop/nssdatabases

5) Overwrite what is already there with the following: (Use CTRL+SHIFT+6 with the cursor in the beginning of the file then use the arrow keys to move to the end of the file, then press CTRL+K to delete the selection)
Code:
# System databases to copy into the chroot from the host system.
#
# <database name>
#passwd
shadow
#group
gshadow
services
protocols
#networks
#hosts
#user

6) Edit the stateoverride like so:
Code:
sudo nano /srv/chroot/debian-armhf/var/lib/dpkg/statoverride

7) Overwrite what is already there with the following:
Code:
root root 2755 /usr/bin/crontab

8) Now you can schroot with:
Code:
sudo schroot -c debian-armhf

9) Edit the bashrc like this:
Code:
nano ~/.bashrc

10) Add the following: (if the file is not empty, add the following at the end of the file)
Code:
export LANGUAGE="C"
export LC_ALL="C"
export DISPLAY=:1
export LIBGL_ALWAYS_SOFTWARE=1
export GALLIUM_DRIVER=virpipe

11) Edit sources.list in chroot like so:
Code:
nano /etc/apt/sources.list

12) Overwrite what is there with:
Code:
deb http://deb.debian.org/debian buster main contrib non-free
deb-src http://deb.debian.org/debian buster main contrib non-free

deb http://security.debian.org/debian-security buster/updates main contrib
deb-src http://security.debian.org/debian-security buster/updates main contrib

13) Run update and upgrade like so: (enter y when prompted after apt upgrade)
Code:
apt update

apt upgrade

14) Install some required packages like so: (enter y when prompted)
Code:
apt install git wget cmake build-essential python3

apt install gcc-arm-linux-gnueabihf

apt install python3-setuptools

apt install sudo

15) Clone and compile box86 like this:
Code:
git clone https://github.com/ptitSeb/box86

cd box86

mkdir build; cd build; cmake .. -DARM_DYNAREC=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo; make

16) Install wine like this:
Code:
wget https://twisteros.com/wine.tgz

tar zxvf wine.tgz

17) Install Zenity like this:
Code:
apt install zenity

18) Exit schroot with:
Code:
exit

Build mesa on schroot

1) Enter schroot with:
Code:
sudo schroot -c debian-armhf

2) Install build dependencies like this:
Code:
sudo apt-get build-dep mesa

3) Clone mesa and build: (run these commands one by one):
Code:
git clone https://gitlab.freedesktop.org/mesa/mesa.git -b 20.1

cd mesa

meson build

cd build

ninja && sudo ninja install

4) Exit schroot:
Code:
exit


Build virglrenderer on host

1) Open a new terminal window and run the following commands:
Code:
sudo apt update

sudo apt upgrade

sudo apt install python3-pip

sudo pip3 install meson

Code:
sudo apt install libegl1-mesa-dev

sudo apt install libgbm-dev

sudo apt install ninja-build

sudo apt install git-all

git clone https://github.com/anholt/libepoxy

cd libepoxy

mkdir _build && cd _build

meson

ninja

sudo ninja install

Code:
git clone https://gitlab.freedesktop.org/virgl/virglrenderer.git

cd virglrenderer

git checkout c7c102ba

meson build

cd build

ninja && sudo ninja install

2) Mount host tmp to chroot like this:
Code:
sudo mount --bind /tmp /srv/chroot/debian-armhf/tmp

3) Close the terminal window

Run a game

1) Open a terminal window and enter schroot with:
Code:
sudo schroot -c debian-armhf

2) Open a new terminal window and enter the following commands:
Code:
cd virglrenderer/build/vtest

./virgl_test_server --use-glx

3) Open a new terminal and enter the following command:
Code:
sudo DISPLAY=:0 Xephyr :1

4) Download W3demo.exe from https://archive.org/details/WarcraftIiiReignOfChaosDemo

5) On the schroot terminal run: (replace path to exe with where you downloaded W3demo.exe)
Code:
sudo ~/box86/build/box86 ~/wine/bin/wine 'path to exe'


UPDATE : virgl server was not using the gpu but was doing software rendering. To fix this delete the lines in nano ~/.bashrc, restart the switch then type the following lines on a terminal then run schroot in that terminal.
Code:
export LANGUAGE="C"
export LC_ALL="C"
export DISPLAY=:1
export LIBGL_ALWAYS_SOFTWARE=1
export GALLIUM_DRIVER=virpipe
Note: I do not know if this is safe so proceed at your own risk. Afterwards, overclock your switch and use
Code:
sudo jetson_clocks
0MUnWLb
 
Last edited by ,

nex86

Well-Known Member
Newcomer
Joined
May 19, 2017
Messages
45
Trophies
0
Age
37
XP
118
Country
Gambia, The
ok I'm at the point to start a game, but wine is bitching..
err: winediag:nodrvr_CreateWindow Make sure that your X server is running and that $Display is set correctly.

fixed my issue.
I forgot to start the virgl test server.

I got an old demo to run, but with an abysmal framerate of 1fps.
I don't think its using the GPU, even though I followed the steps in the update part.
 
Last edited by nex86,
D

Deleted User

Guest
OP
ok I'm at the point to start a game, but wine is bitching..
err: winediag:nodrvr_CreateWindow Make sure that your X server is running and that $Display is set correctly.

fixed my issue.
I forgot to start the virgl test server.

I got an old demo to run, but with an abysmal framerate of 1fps.
I don't think its using the GPU, even though I followed the steps in the update part.

What demo are you using? And yes, it does not seem to be using the GPU.

1) First use binfmt to automatically run box86 like this (in chroot):
Code:
cd box86/build
sudo make install box86

2) Copy box86.conf in /srv/chroot/debian-armhf/etc/binfmt.d to /etc/binfmt.d
To do that I used:
Code:
sudo nautilus

3) Then in host use :
Code:
sudo systemctl restart systemd-binfmt

4) Exit chroot and then enter again with:
Code:
exit
sudo schroot -c debian-armhf

5) In chroot use:
Code:
sudo apt install mesa-utils

6) Then in chroot post the output of of the following commands:
Code:
sudo GALLIUM_DRIVER=virpipe glxinfo -B


The output you should get should be similar to this:
Code:
name of display: :1
display: :1  screen: 0
direct rendering: Yes
Extended renderer info (GLX_MESA_query_renderer):
    Vendor: Red Hat (0x1af4)
    Device: virgl (0x1010)
    Version: 20.1.10
    Accelerated: yes
    Video memory: 0MB
    Unified memory: no
    Preferred profile: core (0x1)
    Max core profile version: 4.3
    Max compat profile version: 3.1
    Max GLES1 profile version: 1.1
    Max GLES[23] profile version: 3.1
OpenGL vendor string: Red Hat
OpenGL renderer string: virgl
OpenGL core profile version string: 4.3 (Core Profile) Mesa 20.1.10 (git-bdf94921c0)
OpenGL core profile shading language version string: 4.30
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile

OpenGL version string: 3.1 Mesa 20.1.10 (git-bdf94921c0)
OpenGL shading language version string: 1.40
OpenGL context flags: (none)

OpenGL ES profile version string: OpenGL ES 3.1 Mesa 20.1.10 (git-bdf94921c0)
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10

Notice that its using the gpu:
Code:
Device: virgl (0x1010)

7) So if you get this output then run wine with GALLIUM_DRIVER=virpipe. The command can get quite messy so first copy the wine executable to the bin folder like this (in chroot):
Code:
cd /wine/bin

sudo ln -s wine /usr/local/bin/wine
sudo ln -s wineserver /usr/local/bin/winserver
sudo ln -s winecfg /usr/local/bin/winecfg
sudo ln -s winefile /usr/local/bin/winefile

8) Now typing wine in chroot should automatically run box86 and wine and you should get an output like this:
Code:
Box86 with Dynarec v0.2.1 9cc69095 built on Feb 16 2021 14:56:19
Usage: wine PROGRAM [ARGUMENTS...]   Run the specified program
       wine --help                   Display this help and exit
       wine --version                Output version information and exit


9) Now run wine with explorer mode and GALLIUM_DRIVER=virpipe then navigate to the exe file like this:
Code:
sudo GALLIUM_DRIVER=virpipe winefile /desktop=shell,800x600
 
Last edited by ,

nex86

Well-Known Member
Newcomer
Joined
May 19, 2017
Messages
45
Trophies
0
Age
37
XP
118
Country
Gambia, The
is it normal that /srv in chroot is empty?
I see chroot/debian-armhf only in host.

Also did that:


cd /wine/bin

sudo ln -s wine /usr/local/bin/wine
sudo ln -s wineserver /usr/local/bin/winserver
sudo ln -s winecfg /usr/local/bin/winecfg
sudo ln -s winefile /usr/local/bin/winefile

but its not /wine/bin, its ~/wine/bin
but still, its saying command not found when I just type wine
I checked and the symbolic link exists.
 
Last edited by nex86,
D

Deleted User

Guest
OP
is it normal that /srv in chroot is empty?
I see chroot/debian-armhf only in host.

Also did that:


cd /wine/bin

sudo ln -s wine /usr/local/bin/wine
sudo ln -s wineserver /usr/local/bin/winserver
sudo ln -s winecfg /usr/local/bin/winecfg
sudo ln -s winefile /usr/local/bin/winefile
but its not /wine/bin, its ~/wine/bin
but still, its saying command not found when I just type wine
I checked and the symbolic link exists.

Solved gpu usage on discord, for others just use GALLIUM_DRIVER=virpipe on wine commands. Symbolic link did not work because of a wrong directory.
 
Last edited by ,

magelof

Well-Known Member
Newcomer
Joined
Jul 29, 2006
Messages
53
Trophies
0
XP
419
Country
United States
Hi, thank you very much for this tutorial. I'm trying to install the Sims (no-install, rip version as seen here)

I need to edit the registry file in order for it to find the game files. The registry file currently reads:
[HKEY_LOCAL_MACHINE\Software\Maxis]

[HKEY_LOCAL_MACHINE\Software\Maxis\The Sims]
"SIMS_SKU"=dword:00000001
"SIMS_LANGUAGE"="USEnglish"
"SIMS_MUSIC"=".\\Music\\"
"SIMS_SOUND"=".\\SoundData"
"SIMS_DATA"=".\\"
"InstallPath"=".\\"
"Version"="1.0"
"Language"=dword:00000409
"BetaSite"=dword:00000001
"Installed"="1"

[HKEY_LOCAL_MACHINE\Software\Maxis\The Sims\1.00.001]

How can I change the HKEY paths above to point to my game files in Ubuntu? What is the windows path in box86/wine? Where should I put my game files? Thank you in advance for your insight here.
 

BrandonSWITCH

Active Member
Newcomer
Joined
Nov 13, 2021
Messages
28
Trophies
0
XP
212
Country
United Kingdom
Thanks for the tutorial, I am gonna test this later on after I have moved my Atmpsphere EmuMMC, Android 10, L4T Ubuntu, and Lakka across to my new 512GB SD Card. Hopefully then I will have enough space after resizing my EXT4 partition for ubuntu. :)
 

franatl182

New Member
Newbie
Joined
Dec 18, 2021
Messages
1
Trophies
0
Age
29
XP
23
Country
Argentina
Hi guys! Thanks for your work. I am having the Error: File is not found (check BOX86_PATH) and I can't get the game to run. Any ideas?
 

Hongtm77

Well-Known Member
Newcomer
Joined
Jan 13, 2019
Messages
59
Trophies
0
Age
38
XP
296
Country
Malaysia
Hi guys, i came across that l4t Megascript can install Box64 to run 64bit of Windows Applications.

My questions is:-

1. If I installed Box64 from l4t Megascript, can I still use the above methods if i wanted to get Box86?

2. Do I need 32 bit libraries to run Wine64? (for some reason, I installed Wine64 with Box64 but still got 'it looks like wine32 is missing' error)

3. Im planning to get PKHEX.exe to run on my triple boot switch to edit my save files. And since PKHEX is a 64bit windows app, what are the suggestions do you guys think I should go for?

Hopefully someone can help, thanks
 
  • Like
Reactions: BraxtonTheNerd

BraxtonTheNerd

New Member
Newbie
Joined
Feb 6, 2022
Messages
1
Trophies
0
Age
23
Location
Queensland
XP
41
Country
Australia
Hi guys, i came across that l4t Megascript can install Box64 to run 64bit of Windows Applications.

My questions is:-

1. If I installed Box64 from l4t Megascript, can I still use the above methods if i wanted to get Box86?

2. Do I need 32 bit libraries to run Wine64? (for some reason, I installed Wine64 with Box64 but still got 'it looks like wine32 is missing' error)

3. Im planning to get PKHEX.exe to run on my triple boot switch to edit my save files. And since PKHEX is a 64bit windows app, what are the suggestions do you guys think I should go for?

Hopefully someone can help, thanks

1. Yes
2.no just install from the play on linux wine binaries
cant link due to Being a newbie or whatever lol

Then extract

and run the Wine64 in bin folder Done

3. It should run
 
  • Like
Reactions: Hongtm77

Hongtm77

Well-Known Member
Newcomer
Joined
Jan 13, 2019
Messages
59
Trophies
0
Age
38
XP
296
Country
Malaysia
1. Yes
2.no just install from the play on linux wine binaries
cant link due to Being a newbie or whatever lol

Then extract

and run the Wine64 in bin folder Done

3. It should run
Hi, Thanks for the reply. I have installed play on linux but still cannot run the exe. And I tried to install the list of exe provided by play onlinux, and kept getting errors. No luck
 

Hongtm77

Well-Known Member
Newcomer
Joined
Jan 13, 2019
Messages
59
Trophies
0
Age
38
XP
296
Country
Malaysia
Hi, have anyone tried PlayStation Plus for PC before? It's a cloud streaming for PS games that doesn't need high end hardware to run
 

josephgrey

New Member
Newbie
Joined
Nov 14, 2022
Messages
1
Trophies
0
Age
37
XP
24
Country
United States
ive been trying to get some 32bit games working with debian schroot xephyr and virglrenderer with box86 and only having success with installer exes. tried different apps with similar errors.
0024:fixme:msvcrt:MSVCRT__stdio_common_vfprintf_s options 24 not handled
0024:fixme:msvcrt:MSVCRT__stdio_common_vfprintf_s options 24 not handled
0024:fixme:msvcrt:MSVCRT__stdio_common_vfprintf_s options 24 not handled
0024:err:dbghelp:SymCleanup this process has not had SymInitialize() called for it!
read somewhere to wait a few minutes but nothing ever populates, curious if any of you had similar issues
 

ruje0504

Member
Newcomer
Joined
Aug 25, 2022
Messages
9
Trophies
0
Age
32
Location
abcdghj
XP
127
Country
Algeria
Thanks for the tutorial.
Before this tutorial, I destroyed the l4t system more than once to install box86.
Your tutorial is very detailed, thank you again.
Unfortunately, you have deleted your account?
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    Sicklyboy @ Sicklyboy: *teleports behind you* "Nothing personnel, kiddo" +1