Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Add support for RHEL kernel forks (RHEL, CentOS, Oracle Linux) and changed INSTALL.sh #61

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 42 additions & 14 deletions INSTALL.sh
Original file line number Diff line number Diff line change
@@ -1,19 +1,47 @@
#!/usr/bin/env bash

# First install the configuration files:
sudo cp anbox.conf /etc/modules-load.d/
sudo cp 99-anbox.rules /lib/udev/rules.d/
# Autoescalate script
anbox-installsh=$(readlink -f "$0")

# Then copy the module sources to /usr/src/:
sudo cp -rT ashmem /usr/src/anbox-ashmem-1
sudo cp -rT binder /usr/src/anbox-binder-1
if [ "$UID" != "0" ] ; then
sudo exec anbox-installsh
fi

# Finally use dkms to build and install:
sudo dkms install anbox-ashmem/1
sudo dkms install anbox-binder/1
# Installation prompt to make it more user-friendly
while true ; do
echo -e "Do you want to compile and install Anbox modules? (y/n)"
read hprompt
if [ "$hprompt" != "${hprompt#[Yy]}" ] ; then
install # Call installer function
elif [ "$hprompt" != "${hprompt#[Nn]}" ] ; then
echo -e "\nInstallation aborted."
exit 1
else
echo -e "Invalid input $hprompt. Please input either (y)es or (n)o"
fi
done

# Verify by loading these modules and checking the created devices:
sudo modprobe ashmem_linux
sudo modprobe binder_linux
lsmod | grep -e ashmem_linux -e binder_linux
ls -alh /dev/binder /dev/ashmem
install () {
echo -e "Started installing Anbox modules...\n\n\n"
# First install the configuration files:
cp anbox.conf /etc/modules-load.d/
cp 99-anbox.rules /lib/udev/rules.d/

# Check if running RHEL kernel fork, and copy the files
if uname -r | grep -q "el" ; then
cp -rT el-linux/ashmem /usr/src/anbox-ashmem-1
cp -rT el-linux/binder /usr/src/anbox-ashmem-1
fi
cp -rT ashmem /usr/src/anbox-ashmem-1
cp -rT binder /usr/src/anbox-binder-1

# Finally use dkms to build and install:
dkms install anbox-ashmem/1
dkms install anbox-binder/1

# Verify by loading these modules and checking the created devices:
modprobe ashmem_linux
modprobe binder_linux
lsmod | grep -e ashmem_linux -e binder_linux
ls -alh /dev/binder /dev/ashmem
}
18 changes: 18 additions & 0 deletions el-linux/ashmem/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
ccflags-y += -I$(src) -Wno-error=implicit-int -Wno-int-conversion
obj-m := ashmem_linux.o
ashmem_linux-y := deps.o ashmem.o

KERNEL_SRC ?= /lib/modules/$(shell uname -r)/build
VZ= $(shell uname -r | grep vz)
ifneq ($(VZ),)
ccflags-y += -DVZKERNEL
endif

all:
$(MAKE) -C $(KERNEL_SRC) V=0 M=$$PWD

install:
cp ashmem_linux.ko $(DESTDIR)/

clean:
rm -rf deps.h *.o *.ko *.mod.c *.symvers *.order .*.cmd .tmp_versions
Loading