Remove kernel module building inside the snap
This commit is contained in:
parent
c32e200638
commit
2e3a82c429
2 changed files with 12 additions and 50 deletions
|
|
@ -16,45 +16,18 @@ if [ ! -e $ANDROID_IMG ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
build_kernel_modules() {
|
|
||||||
kversion=$1
|
|
||||||
|
|
||||||
rm -rf $SNAP_COMMON/kernel-*
|
|
||||||
|
|
||||||
$SNAP/bin/classic-create || true
|
|
||||||
|
|
||||||
rm -rf $SNAP_COMMON/classic/build
|
|
||||||
mkdir -p $SNAP_COMMON/classic/build
|
|
||||||
cp -rav $SNAP/ashmem $SNAP_COMMON/classic/build/
|
|
||||||
cp -rav $SNAP/binder $SNAP_COMMON/classic/build/
|
|
||||||
|
|
||||||
cat<<EOF > $SNAP_COMMON/classic/build/run.sh
|
|
||||||
#!/bin/sh
|
|
||||||
set -ex
|
|
||||||
apt update
|
|
||||||
apt install -y --force-yes linux-headers-$kversion build-essential
|
|
||||||
cd /build/ashmem
|
|
||||||
make
|
|
||||||
cd /build/binder
|
|
||||||
make
|
|
||||||
EOF
|
|
||||||
|
|
||||||
chmod +x $SNAP_COMMON/classic/build/run.sh
|
|
||||||
$SNAP/bin/classic /build/run.sh
|
|
||||||
|
|
||||||
mkdir -p $SNAP_COMMON/kernel-$kversion
|
|
||||||
cp $SNAP_COMMON/classic/build/ashmem/ashmem_linux.ko \
|
|
||||||
$SNAP_COMMON/kernel-$kversion/
|
|
||||||
cp $SNAP_COMMON/classic/build/binder/binder_linux.ko \
|
|
||||||
$SNAP_COMMON/kernel-$kversion/
|
|
||||||
}
|
|
||||||
|
|
||||||
load_kernel_modules() {
|
load_kernel_modules() {
|
||||||
kversion=`uname -r`
|
kversion=`uname -r`
|
||||||
rmmod ashmem_linux binder_linux || true
|
rmmod ashmem_linux binder_linux || true
|
||||||
echo "Loading kernel modules for version $kversion.."
|
echo "Loading kernel modules for version $kversion.."
|
||||||
insmod $SNAP_COMMON/kernel-$kversion/binder_linux.ko
|
if ! `modprobe binder_linux` ; then
|
||||||
insmod $SNAP_COMMON/kernel-$kversion/ashmem_linux.ko
|
echo "ERROR: Failed to load kernel binder driver"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
if ! `modprobe ashmem_linux` ; then
|
||||||
|
echo "ERROR: Failed to load kernel ashmem driver"
|
||||||
|
return
|
||||||
|
fi
|
||||||
sleep 0.5
|
sleep 0.5
|
||||||
chmod 666 /dev/binder
|
chmod 666 /dev/binder
|
||||||
chmod 666 /dev/ashmem
|
chmod 666 /dev/ashmem
|
||||||
|
|
@ -81,18 +54,10 @@ start() {
|
||||||
# possible. See snapcraft.yaml for further details.
|
# possible. See snapcraft.yaml for further details.
|
||||||
$SNAP/bin/anbox-bridge.sh start
|
$SNAP/bin/anbox-bridge.sh start
|
||||||
|
|
||||||
# Building and loading the necessary kernel modules is only possible
|
# This will try to load the kernel modules. If this fails we will
|
||||||
# on Ubuntu 16.04 (xenial)
|
# continue as normal and anbox will fail later on and report a
|
||||||
if [ -e /var/lib/snapd/hostfs/etc/os-release ]; then
|
# visible error message to the user.
|
||||||
. /var/lib/snapd/hostfs/etc/os-release
|
load_kernel_modules
|
||||||
if [ $UBUNTU_CODENAME = xenial ]; then
|
|
||||||
kversion=`uname -r`
|
|
||||||
if [ ! -e $SNAP_COMMON/kernel-$kversion ]; then
|
|
||||||
build_kernel_modules $kversion
|
|
||||||
fi
|
|
||||||
load_kernel_modules
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Ensure FUSE support for user namespaces is enabled
|
# Ensure FUSE support for user namespaces is enabled
|
||||||
echo Y | sudo tee /sys/module/fuse/parameters/userns_mounts || echo "WARNING: kernel doesn't support fuse in user namespaces"
|
echo Y | sudo tee /sys/module/fuse/parameters/userns_mounts || echo "WARNING: kernel doesn't support fuse in user namespaces"
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,6 @@ parts:
|
||||||
source: android-images
|
source: android-images
|
||||||
files:
|
files:
|
||||||
android.img: android.img
|
android.img: android.img
|
||||||
kernel-modules:
|
|
||||||
plugin: dump
|
|
||||||
source: kernel
|
|
||||||
anbox-common:
|
anbox-common:
|
||||||
plugin: copy
|
plugin: copy
|
||||||
source: .
|
source: .
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue