Skip to content
This repository has been archived by the owner on Aug 27, 2021. It is now read-only.

Allow for use with multiple ROMs #1

Open
wants to merge 14 commits into
base: lineage-17.1
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
anbox-halium/
tmp/
78 changes: 78 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
Anbox-halium
===========

Getting started
---------------

To get started with Android/LineageOS/BlissROM, you'll need to get
familiar with [Repo](https://source.android.com/source/using-repo.html) and [Version Control with Git](https://source.android.com/source/version-control.html).

To initialize your local repository using the LineageOS trees, use a command like this:
```
repo init -u git://github.com/LineageOS/android.git -b lineage-17.1
```
or... to initialize your local repository using the BlissROM trees, use a command like this:
```
repo init -u https://github.com/BlissRoms/platform_manifest.git -b q
```
And do an initial sync:
```
repo sync
```
Adding Anbox-halium
-------------------
Clone in anbox vendor:
```
git clone https://github.com/Anbox-halium/anbox-patches vendor/anbox
```
Then we generate the manifest:
```
. build/envsetup.sh
anbox-generate-manifest
```
Then sync again:
```
repo sync
```
Then to apply anbox patches:
```
apply-anbox-patches
```
How to build
---------------
Please see the [LineageOS Wiki](https://wiki.lineageos.org/) for building environment setup.

To build anbox for LineageOS:
```
. build/envsetup.sh
lunch lineage_anbox_arm64-userdebug
make systemimage -j$(nproc --all)
make vendorimage -j$(nproc --all)
```
To build anbox for BlissROM:
```
. build/envsetup.sh
lunch bliss_anbox_arm64-userdebug
make systemimage -j$(nproc --all)
make vendorimage -j$(nproc --all)
```

How to install
---------------
Execute command blew:
```
wget -O - https://github.com/Anbox-halium/anbox-halium/raw/lineage-17.1/scripts/install.sh | bash
```
Note: Run installer on the user you are willing to install anbox on

Patching kernel
---------------
Running anbox requires:
* Veth for networking
* Ashmem
* Specific binder nodes (anbox-binder anbox-hwbinder anbox-vndbinder)
Checkout defconfig kernel patcher [script](https://github.com/Anbox-halium/anbox-halium/blob/lineage-17.1/scripts/check-kernel-config.sh) for patching halium devices kernel.
```
check-kernel-config.sh halium_device_defconfig -w
```
On mainline devices it is highly recommanded to use needed drivers as module. (binder_linux and ashmem_linux)
27 changes: 0 additions & 27 deletions apply-patches.sh

This file was deleted.

163 changes: 163 additions & 0 deletions autopatch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
#!/bin/bash
# -*- coding: utf-8; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-

# autopatch.sh: script to manage patches on top of repo
# Copyright (c) 2018, Intel Corporation.
# Author: sgnanase <[email protected]>
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This program is distributed in the hope it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.

top_dir=`pwd`
vendor_path="anbox"
utils_dir="$top_dir/vendor/$vendor_path"
patch_dir="$utils_dir/base-patches"
private_utils_dir="$top_dir/vendor/anbox/PRIVATE"
private_patch_dir="$private_utils_dir/patches/$TARGET_PRODUCT"

#setup colors
red=`tput setaf 1`
green=`tput setaf 2`
yellow=`tput setaf 3`
blue=`tput setaf 4`
purple=`tput setaf 5`
teal=`tput setaf 6`
light=`tput setaf 7`
dark=`tput setaf 8`
ltred=`tput setaf 9`
ltgreen=`tput setaf 10`
ltyellow=`tput setaf 11`
ltblue=`tput setaf 12`
ltpurple=`tput setaf 13`
CL_CYN=`tput setaf 12`
CL_RST=`tput sgr0`
reset=`tput sgr0`
current_project=""
previous_project=""
conflict=""
conflict_list=""
goodpatch=""
project_revision=""

tag_project() {
cd $top_dir/$1
git tag -f autopatch/`basename $patch_dir` > /dev/null
}

apply_patch() {

pl=$1
pd=$2

echo -e ${reset}""${reset}
echo -e ${teal}"Applying Patches"${reset}
echo -e ${reset}""${reset}

for i in $pl
do
current_project=`dirname $i`
if [[ $current_project != $previous_project ]]; then
if [[ -n "$previous_project" ]]; then
tag_project $previous_project
fi
echo -e ${reset}""${reset}
echo -e ${ltblue}"Project $current_project"${reset}
echo -e ${reset}""${reset}
cd $top_dir
project_revision=`repo info $current_project | grep 'Current revision: ' | sed 's/Current revision: //'`
fi
previous_project=$current_project

conflict_project=`echo $conflict_list | grep " $current_project "`
if [[ -n "$conflict_project" ]]; then
echo -e ${reset}""${reset}
echo -e ${ltgreen}" Skipping $i"${reset}
echo -e ${reset}""${reset}
fi

cd $top_dir/$current_project
a=`grep "Date: " $pd/$i | sed -e "s/Date: //"`
b=`grep "Subject: " $pd/$i | sed -e "s/Subject: //" | sed -e "s/^\[PATCH[^]]*\] //"`
c=`git log --pretty="format:%aD, %s" $project_revision.. | grep -F "$a, $b"`

if [[ "$c" == "" ]] ; then
git am -3 $pd/$i >& /dev/null

if [[ $? == 0 ]]; then
echo -e ${reset}""${reset}
echo -e ${ltgreen}" Applying $i"${reset}
echo -e ${reset}""${reset}

else
echo -e ${reset}""${reset}
echo -e ${ltred}" Conflicts $i"${reset}
echo -e ${reset}""${reset}
git am --abort >& /dev/null

echo " Searching other vendors for patch resolutions..."
while IFS= read -r agvendor_name; do
echo " looking in $agvendor_name for that patch..."
if [[ -f "$utils_dir/$agvendor_name/patches/$i" ]]; then
echo " Found $utils_dir/$agvendor_name/patches/$i!!"
echo " trying..."
git am -3 $utils_dir/$agvendor_name/patches/$i >& /dev/null
if [[ $? == 0 ]]; then
echo " Applying $i $?"
goodpatch="y"
break
else
echo " Conflicts $i"
git am --abort >& /dev/null
conflict="y"

fi

fi
done < $top_dir/vendor/$vendor_path/roms.lst
if [[ "$goodpatch" != "y" ]]; then
echo " No resolution was found"
git am --abort >& /dev/null
echo " Setting $i as Conflicts"
conflict="y"
conflict_list="$current_project $conflict_list"

fi
fi
else
echo -e ${reset}""${reset}
echo -e ${green}" Already applied $i"${reset}
echo -e ${reset}""${reset}
fi
done

if [[ -n "$previous_project" ]]; then
tag_project $previous_project
fi
}

#Apply common patches
cd $patch_dir
patch_list=`find * -iname "*.patch" | sort -u`

apply_patch "$patch_list" "$patch_dir"

echo ""
if [[ "$conflict" == "y" ]]; then
echo -e ${yellow} "==========================================================================="${reset}
echo -e ${yellow} " ALERT : Conflicts Observed while patch application !! "${reset}
echo -e ${yellow} "==========================================================================="${reset}
for i in $conflict_list ; do echo $i; done | sort -u
echo -e ${yellow} "==========================================================================="${reset}
echo -e ${yellow} "WARNING: Please resolve Conflict(s). You may need to re-run build..."${reset}
# return 1
else
echo -e ${green} "==========================================================================="${reset}
echo -e ${green} " INFO : All patches applied fine !! "${reset}
echo -e ${green} "==========================================================================="${reset}
fi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 14b812d586679092031fab8eade8edd7ce2dc815 Mon Sep 17 00:00:00 2001
From 3f91aae2f62035de92d608edab1498616df4fe48 Mon Sep 17 00:00:00 2001
From: Asriel Dreemurr <[email protected]>
Date: Sun, 15 Nov 2020 00:24:05 +0700
Subject: [PATCH] (anbox) disable SELinux parts
Subject: [PATCH 01/25] (anbox) disable SELinux parts

Change-Id: I1bee5fb7f9f879e3bc9dc0c69cfb004fde8a320a
---
Expand All @@ -10,7 +10,7 @@ Change-Id: I1bee5fb7f9f879e3bc9dc0c69cfb004fde8a320a
2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp
index 440988b1bd4..d83bac8ab3a 100644
index 440988b1bd4f..d83bac8ab3a0 100644
--- a/core/jni/com_android_internal_os_Zygote.cpp
+++ b/core/jni/com_android_internal_os_Zygote.cpp
@@ -1135,13 +1135,14 @@ static void SpecializeCommon(JNIEnv* env, uid_t uid, gid_t gid, jintArray gids,
Expand Down Expand Up @@ -55,7 +55,7 @@ index 440988b1bd4..d83bac8ab3a 100644
/*
* Storage Initialization
diff --git a/services/core/java/com/android/server/pm/Settings.java b/services/core/java/com/android/server/pm/Settings.java
index a3dbfdc099d..84241e93dec 100644
index a3dbfdc099d2..84241e93dec9 100644
--- a/services/core/java/com/android/server/pm/Settings.java
+++ b/services/core/java/com/android/server/pm/Settings.java
@@ -2636,18 +2636,18 @@ public final class Settings {
Expand All @@ -81,5 +81,5 @@ index a3dbfdc099d..84241e93dec 100644
}

--
2.28.0
2.25.1

Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
From bdf1502ae29eea2dcf9073b3d84e11d632e6aa30 Mon Sep 17 00:00:00 2001
From 8ee21b531153f4e22f8ddf74428d5bf830e2c1dc Mon Sep 17 00:00:00 2001
From: Asriel Dreemurr <[email protected]>
Date: Sun, 15 Nov 2020 00:24:46 +0700
Subject: [PATCH] (anbox) disable suspend control
Subject: [PATCH 02/25] (anbox) disable suspend control

Change-Id: I1c8cbb5980efc063fae25597b3c6e927a682c1ca
---
.../com_android_server_power_PowerManagerService.cpp | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/services/core/jni/com_android_server_power_PowerManagerService.cpp b/services/core/jni/com_android_server_power_PowerManagerService.cpp
index bf0599fe18a..671b649c579 100644
index 523f802141ec..27f7aaf11ac2 100644
--- a/services/core/jni/com_android_server_power_PowerManagerService.cpp
+++ b/services/core/jni/com_android_server_power_PowerManagerService.cpp
@@ -260,8 +260,9 @@ sp<ISuspendControlService> getSuspendControl() {
@@ -248,8 +248,9 @@ sp<ISuspendControlService> getSuspendControl() {
void enableAutoSuspend() {
static bool enabled = false;
if (!enabled) {
Expand All @@ -24,7 +24,7 @@ index bf0599fe18a..671b649c579 100644
}

{
@@ -276,9 +277,10 @@ void enableAutoSuspend() {
@@ -264,9 +265,10 @@ void enableAutoSuspend() {
void disableAutoSuspend() {
std::lock_guard<std::mutex> lock(gSuspendMutex);
if (!gSuspendBlocker) {
Expand All @@ -38,5 +38,5 @@ index bf0599fe18a..671b649c579 100644
}

--
2.28.0
2.25.1

Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
From 0e4ffed63bf89dad6a5cead06584ec70f65933d8 Mon Sep 17 00:00:00 2001
From ec9ee01a00655e64da31f0abf437711ced9ea63c Mon Sep 17 00:00:00 2001
From: Asriel Dreemurr <[email protected]>
Date: Sun, 15 Nov 2020 00:25:07 +0700
Subject: [PATCH] [temp] (halbox) neutralize sound pool audio sample
loading
Subject: [PATCH 03/25] (halbox) neutralize sound pool audio sample loading

Change-Id: I395137bec139e0bfc33792d06e11db212eb9434a
---
media/jni/soundpool/SoundPoolThread.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/media/jni/soundpool/SoundPoolThread.cpp b/media/jni/soundpool/SoundPoolThread.cpp
index ba3b482935d..b0d0b9fc506 100644
index ba3b482935dd..b0d0b9fc5060 100644
--- a/media/jni/soundpool/SoundPoolThread.cpp
+++ b/media/jni/soundpool/SoundPoolThread.cpp
@@ -105,9 +105,10 @@ void SoundPoolThread::loadSample(int sampleID) {
Expand All @@ -27,5 +26,5 @@ index ba3b482935d..b0d0b9fc506 100644
}

--
2.28.0
2.25.1

Loading