-
-
Save xmesaj2/178dd22219d8503a5bee48dc59f9d0c6 to your computer and use it in GitHub Desktop.
Automated Script to Install Anbox Ashmem and Binder to WSL2 Linux Kernel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo apt install build-essential cmake cmake-data debhelper dbus google-mock \ | |
libboost-dev libboost-filesystem-dev libboost-log-dev libboost-iostreams-dev \ | |
libboost-program-options-dev libboost-system-dev libboost-test-dev \ | |
libboost-thread-dev libcap-dev libexpat1-dev libsystemd-dev libegl1-mesa-dev \ | |
libgles2-mesa-dev libglm-dev libgtest-dev liblxc1 \ | |
libproperties-cpp-dev libprotobuf-dev libsdl2-dev libsdl2-image-dev lxc-dev \ | |
pkg-config protobuf-compiler python3-minimal | |
git clone https://github.com/anbox/anbox.git --recurse-submodules | |
cd anbox | |
mkdir build | |
cd build | |
cmake .. | |
make |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -o pipefail | |
KERNEL_WORKING_DIRECTORY="/usr/src" | |
KERNEL_VERSION=$(uname -r) | |
REQUIRED_DEPENDENCIES="git bison flex elfutils-libelf-devel openssl-devel" | |
KERNEL_SRC_DIR="$KERNEL_WORKING_DIRECTORY/WSL2-Linux-Kernel-$(uname -r)" | |
echo "Warning: This script has to be run on sudo permissions. If you encounter issues please report it immediately." | |
sleep 3 | |
# Check if we have this installed first things first. | |
# We need this to install our Anbox stuff later | |
dnf install $REQUIRED_DEPENDENCIES -y | |
if [ ! -d "$KERNEL_SRC_DIR" ]; then | |
git clone --branch "$KERNEL_VERSION" --depth=30 https://github.com/microsoft/WSL2-Linux-Kernel "$KERNEL_SRC_DIR" | |
fi | |
cd "$KERNEL_SRC_DIR" && \ | |
cp /proc/config.gz $(pwd) && \ | |
gzip -d config.gz && \ | |
mv config .config && \ | |
make prepare && \ | |
make modules_prepare && \ | |
make modules && \ | |
make scripts; | |
if [ ! -d /lib/modules/$KERNEL_VERSION/ ]; then | |
mkdir -p /lib/modules/$KERNEL_VERSION | |
ln $KERNEL_SRC_DIR -s /lib/modules/$KERNEL_VERSION/build | |
fi | |
git clone https://github.com/anbox/anbox-modules.git $HOME/anbox-modules && \ | |
cd $HOME/anbox-modules && \ | |
bash INSTALL.sh | |
rm -rf $HOME/anbox-modules | |
(source /etc/os-release && sudo dnf copr enable yanqiyu/anbox ${ID_LIKE}-${VERSION_ID}-$(uname -m)) && \ | |
dnf install anbox -y | |
wget -O - https://build.anbox.io/android-images/2018/07/19/android_amd64.img > /var/lib/anbox/android.img | |
bash /usr/share/anbox/anbox-bridge.sh start && \ | |
daemonize /usr/bin/anbox container-manager --daemon --privileged --data-path=/var/lib/anbox |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eo pipefail | |
KERNEL_WORKING_DIRECTORY="/usr/src" | |
KERNEL_VERSION=$(uname -r) | |
REQUIRED_DEPENDENCIES="git bison flex libelf-dev elfutils libssl-dev dkms" | |
KERNEL_BRANCH="linux-msft-wsl-5.10.y" | |
KERNEL_SRC_DIR="$KERNEL_WORKING_DIRECTORY/WSL2-Linux-Kernel-$KERNEL_BRANCH" | |
echo "Warning: This script has to be run on sudo permissions. If you encounter issues please report it immediately." | |
sleep 3 | |
# Check if we have this installed first things first. | |
# We need this to install our Anbox stuff later | |
apt install $REQUIRED_DEPENDENCIES -y | |
if [ ! -d "$KERNEL_SRC_DIR" ]; then | |
git clone --branch "$KERNEL_BRANCH" --depth=30 https://github.com/microsoft/WSL2-Linux-Kernel "$KERNEL_SRC_DIR" | |
fi | |
cd "$KERNEL_SRC_DIR" && \ | |
cp /proc/config.gz $(pwd) && \ | |
gzip -d config.gz && \ | |
mv config .config && \ | |
make prepare && \ | |
make modules_prepare && \ | |
make modules && \ | |
make scripts; | |
if [ ! -d /lib/modules/$KERNEL_BRANCH/ ]; then | |
mkdir -p /lib/modules/$KERNEL_BRANCH | |
ln $KERNEL_SRC_DIR -s /lib/modules/$KERNEL_BRANCH/build | |
fi | |
git clone https://github.com/anbox/anbox-modules.git $HOME/anbox-modules && \ | |
cd $HOME/anbox-modules && \ | |
bash INSTALL.sh | |
rm -rf $HOME/anbox-modules |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eo pipefail | |
KERNEL_WORKING_DIRECTORY="/usr/src" | |
KERNEL_VERSION=$(uname -r) | |
REQUIRED_DEPENDENCIES="git bison flex libelf-dev elfutils libssl-dev dkms" | |
KERNEL_SRC_DIR="$KERNEL_WORKING_DIRECTORY/WSL2-Linux-Kernel-$(uname -r)" | |
echo "Warning: This script has to be run on sudo permissions. If you encounter issues please report it immediately." | |
sleep 3 | |
# Check if we have this installed first things first. | |
# We need this to install our Anbox stuff later | |
apt install $REQUIRED_DEPENDENCIES -y | |
if [ ! -d "$KERNEL_SRC_DIR" ]; then | |
git clone --branch "$KERNEL_VERSION" --depth=30 https://github.com/microsoft/WSL2-Linux-Kernel "$KERNEL_SRC_DIR" | |
fi | |
cd "$KERNEL_SRC_DIR" && \ | |
cp /proc/config.gz $(pwd) && \ | |
gzip -d config.gz && \ | |
mv config .config && \ | |
make prepare && \ | |
make modules_prepare && \ | |
make modules && \ | |
make scripts; | |
if [ ! -d /lib/modules/$KERNEL_VERSION/ ]; then | |
mkdir -p /lib/modules/$KERNEL_VERSION | |
ln $KERNEL_SRC_DIR -s /lib/modules/$KERNEL_VERSION/build | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment