chroot-distro with xfce & box64 & wine64 & zink installaton scipt
This is my own installation script for fast installing xfce & box64 & wine64 & Turnip + zink driver & DXVK.
Tested on Snapdragon 8 gen 3( Adreno 750). Required module for magisk/kernelsu: https://github.com/Magisk-Modules-Alt-Repo/chroot-distro
#!/bin/bash
# install_pkgs_and_proot.sh
set -e
pkg update
pkg install x11-repo -y
pkg install termux-x11-nightly -y
pkg install tsu -y
pkg install pulseaudio -y
read -p "Enter distro name (debian/ubuntu): " distro_name
su -c chroot-distro download $distro_name
su -c chroot-distro install -a $distro_name
CHROOTPATH=/data/local/chroot-distro/$distro_name
# Create start script
cat > ~/start_${distro_name}.sh << EOF
#!/bin/bash
su -c "settings put global settings_enable_monitor_phantom_procs false"
unset LD_PRELOAD
echo "Creating shm..."
sudo mkdir -p /dev/shm
echo "Starting Termux-x11..."
termux-x11 :0 &>/dev/null &
sleep 1
echo "Starting PulseAudio..."
pulseaudio --start --load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" --exit-idle-time=-1 &>/dev/null &
sudo mount -o remount,dev,suid /data
sudo mount --bind $PREFIX/tmp/ $CHROOTPATH/tmp/
echo "Fixing permissions..."
sudo chmod 777 /dev/shm
sudo chmod -R 1777 $PREFIX/tmp
sudo chroot-distro login $distro_name
EOF
chmod +x ~/start_${distro_name}.sh
sudo mkdir -p $CHROOTPATH/root
## Create installation script in chroot
cat > ~/install_first.sh << 'EOF'
#!/bin/bash
apt update
apt install software-properties-common
add-apt-repository ppa:mastag/mesa-turnip-kgsl
apt update
## Disable snap
echo '
# To prevent repository packages from triggering the installation of Snap,
# this file forbids snapd from being installed by APT.
# For more information: https://linuxmint-user-guide.readthedocs.io/en/latest/snap.html
Package: snapd
Pin: release a=*
Pin-Priority: -10' >> /etc/apt/preferences.d/nosnap.pref
apt dist-upgrade
apt install xfce4 dbus-x11 xz-utils gpg wget sudo xfconf-query -y
## Install box64
wget https://ryanfortner.github.io/box64-debs/box64.list -O /etc/apt/sources.list.d/box64.list
wget -qO- https://ryanfortner.github.io/box64-debs/KEY.gpg | gpg --dearmor -o /etc/apt/trusted.gpg.d/box64-debs-archive-keyring.gpg
apt update && apt install box64-android -y
echo '
MESA_LOADER_DRIVER_OVERRIDE=zink
VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/freedreno_icd.aarch64.json:/usr/share/vulkan/icd.d/freedreno_icd.armv7l.json
TU_DEBUG=noconform
MESA_VK_WSI_PRESENT_MODE=mailbox
ZINK_DESCRIPTORS=lazy
ZINK_DEBUG=compact
lastres="nothing"
mesa_glthread=true
BOX64_DYNAREC_BIGBLOCK=0
BOX64_ALLOWMISSINGLIBS=1
BOX64_DYNAREC_STRONGMEM=0
BOX64_DYNAREC_X87DOUBLE=0
BOX64_DYNAREC_FASTNAN=0
BOX64_DYNAREC_FASTROUND=1
BOX64_DYNAREC_SAFEFLAGS=1
BOX64_DYNAREC_BLEEDING_EDGE=1
BOX64_DYNAREC_CALLRET=0
WINEDEBUG=-all
WINEESYNC=1
CMST=1
WINE_FULLSCREEN_FSR=1
DXVK_ASYNC=1
' >> /etc/environment
# Create user
read -p "Enter username: " username
adduser $username
usermod -aG sudo $username
su - $username << 'USEREOF'
# Install Wine
wget https://github.com/Kron4ek/Wine-Builds/releases/download/10.0-rc4/wine-10.0-rc4-staging-tkg-amd64-wow64.tar.xz
tar xf ~/wine-10.0-rc4-staging-tkg-amd64-wow64.tar.xz
wget https://gitlab.com/Ph42oN/dxvk-gplasync/-/raw/main/releases/dxvk-gplasync-v2.5.3-1.tar.gz
tar xf ~/dxvk-gplasync-v2.5.3-1.tar.gz
mkdir -p ~/wine
cd ~/wine-10.0-rc4-staging-tkg-amd64-wow64
mv bin lib share ~/wine/
sudo ln -s ~/wine/bin/wine /usr/local/bin/ \
&& sudo ln -s ~/wine/bin/winecfg /usr/local/bin/ \
&& sudo ln -s ~/wine/bin/wineserver /usr/local/bin/ \
&& sudo ln -s ~/wine/bin/wine64 /usr/local/bin/
## Install Mesa Zink Vulkan
sudo apt install mesa* vulkan*
# Configure environment
xfconf-query -c xfwm4 -p /general/vblank_mode -s off
echo 'export DISPLAY=:0
export PULSE_SERVER=tcp:127.0.0.1:4713' ' > ~/.bashrc
echo "DefaultLimitNOFILE=524288" | sudo tee -a /etc/systemd/system.conf
echo "DefaultLimitNOFILE=524288" | sudo tee -a /etc/systemd/user.conf
echo "$username hard nofile 524288" | sudo tee -a /etc/security/limits.conf
## Offscreen Rendering Mode
box64 wine64 reg add "HKEY_CURRENT_USER\Software\Wine\Direct3D" /v OffscreenRenderingMode /t REG_SZ /d fbo /f
## Strict Shader Math
box64 wine64 reg add "HKEY_CURRENT_USER\Software\Wine\Direct3D" /v StrictShaderMath /t REG_DWORD /d 1 /f
# Create Wine explorer shortcut
mkdir -p ~/Desktop
echo '
sudo rm -rf /tmp/.wine-1000
box64 wine64 explorer &>/dev/null
' > ~/Desktop/wine-explorer.sh
chmod +x ~/Desktop/wine-explorer.sh
# Create start script
echo '
pulseaudio --start --load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" --exit-idle-time=-1 &
dbus-launch --exit-with-session startxfce4
' > ~/start.sh
chmod +x ~/start.sh
USEREOF
EOF
su -c cp ~/install_first.sh $CHROOTPATH/root/
rm ./install_first.sh
su -c chmod +x $CHROOTPATH/root/install_first.sh
echo "
____ _ ___
/ __ \| |/ / |
| | | | ' /| |
| | | | < | |
| |__| | . \|_|
\____/|_|\_(_)
"
echo "Installation completed, now run ./start_${distro_name}.sh, then ./install_first.sh within $distro_name system"
@kivinblue1 I'm having trouble running you script:
su -c chroot-distro install -a $distro_name
the -a parameter seems to not be supported anymore, making the process crash. I don't really know what it was meant to do, but i suspect not using it gives problems down the line.
apt install software-properties-common add-apt-repository ppa:mastag/mesa-turnip-kgsl
I read debian does not support ppa's as they are meant for ubuntu. The script encounters a problem here. I also tried manually setting ubuntu, copying and pasting your lines, but i encounter an error when trying to setup software-properties-common, because it tries to setup systemd "after install script".
Anyway, do you still use this script, or did you modify it? I'm trying to replicate your installation but with no success for now.
@kivinblue1 I'm having trouble running you script:
su -c chroot-distro install -a $distro_name
the -a parameter seems to not be supported anymore, making the process crash. I don't really know what it was meant to do, but i suspect not using it gives problems down the line.
apt install software-properties-common add-apt-repository ppa:mastag/mesa-turnip-kgsl
I read debian does not support ppa's as they are meant for ubuntu. The script encounters a problem here. I also tried manually setting ubuntu, copying and pasting your lines, but i encounter an error when trying to setup software-properties-common, because it tries to setup systemd "after install script".
Anyway, do you still use this script, or did you modify it? I'm trying to replicate your installation but with no success for now.
I don't use Linux distro anymore.