summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2018-07-13 09:56:16 +0100
committerdakkar <dakkar@thenautilus.net>2018-07-13 09:56:16 +0100
commit51179e2339edce30927d94b033118319be7b19f3 (patch)
tree9f5bcde55d31a7976ed2d95d08010e0c12ad7b6a
downloaddakkar-android-huawei-m5-51179e2339edce30927d94b033118319be7b19f3.tar.gz
dakkar-android-huawei-m5-51179e2339edce30927d94b033118319be7b19f3.tar.bz2
dakkar-android-huawei-m5-51179e2339edce30927d94b033118319be7b19f3.zip
first attempt
-rw-r--r--README.txt6
-rw-r--r--apply-patches.sh34
-rw-r--r--build.sh49
-rw-r--r--dakkar.xml6
-rw-r--r--dakkargsi_huawei_m5/BoardConfig.mk4
-rw-r--r--foss.xml10
-rw-r--r--manifest.xml10
-rw-r--r--patches/platform_frameworks_base_services/0001-disable-frp.patch66
-rw-r--r--treble_dakkar_m5.mk13
9 files changed, 198 insertions, 0 deletions
diff --git a/README.txt b/README.txt
new file mode 100644
index 0000000..ff8a032
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,6 @@
+This repo should build an Android image for my Huawei M5 tablet.
+
+It's strongly inspired by
+https://github.com/phhusson/treble_experimentations/
+
+Don't use this if you're not me.
diff --git a/apply-patches.sh b/apply-patches.sh
new file mode 100644
index 0000000..44d416e
--- /dev/null
+++ b/apply-patches.sh
@@ -0,0 +1,34 @@
+#!/bin/bash
+# copied from github.com:phhusson/treble_experimentations
+
+set -e
+
+patches="$(readlink -f -- $1)"
+
+for project in $(cd $patches/patches; echo *);do
+ p="$(tr _ / <<<$project |sed -e 's;platform/;;g')"
+ [ "$p" == build ] && p=build/make
+ repo sync -l --force-sync $p
+ pushd $p
+ git clean -fdx; git reset --hard
+ for patch in $patches/patches/$project/*.patch;do
+ #Check if patch is already applied
+ if patch -f -p1 --dry-run -R < $patch > /dev/null;then
+ continue
+ fi
+
+ if git apply --check $patch;then
+ git am $patch
+ elif patch -f -p1 --dry-run < $patch > /dev/null;then
+ #This will fail
+ git am $patch || true
+ patch -f -p1 < $patch
+ git add -u
+ git am --continue
+ else
+ echo "Failed applying $patch"
+ fi
+ done
+ popd
+done
+
diff --git a/build.sh b/build.sh
new file mode 100644
index 0000000..60e33b6
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+# mostly copied from github.com:phhusson/treble_experimentations
+set -e
+
+thisdir="$(readlink -f "$(dirname "$0")")"
+
+release_name="$(date +%y%m%d)"
+mkdir -p release/"$release_name"
+
+jobs=$(nproc)
+
+repo init -u https://github.com/LineageOS/android.git -b lineage-15.1
+
+function clone_or_checkout() {
+ local dir="$1"
+ local repo="$2"
+ local branch="$3"
+
+ if [[ -d "$dir" ]];then
+ (
+ cd "$dir"
+ git fetch
+ git reset --hard
+ git checkout origin/"$branch"
+ )
+ else
+ git clone "$repo" "$dir" -b "$branch"
+ fi
+}
+
+clone_or_checkout .repo/local_manifests "$thisdir" master
+clone_or_checkout dakkar-patches "$thisdir" master
+clone_or_checkout patches https://github.com/phhusson/treble_patches android-8.1
+
+repo sync -c -j$jobs --force-sync
+
+rm -f device/*/sepolicy/common/private/genfs_contexts
+
+bash "$thidir/apply-patches.sh" patches
+bash "$thidir/apply-patches.sh" dakkar-patches
+
+. build/envsetup.sh
+
+lunch treble_dakkar_m5
+make WITHOUT_CHECK_API=true BUILD_NUMBER="$release_name" installclean
+make WITHOUT_CHECK_API=true BUILD_NUMBER="$release_name" -j$jobs systemimage
+make WITHOUT_CHECK_API=true BUILD_NUMBER="$release_name" vndk-test-sepolicy
+cp $OUT/system.img release/"$release_name"/system-dakkar-m5.img
diff --git a/dakkar.xml b/dakkar.xml
new file mode 100644
index 0000000..32e4af0
--- /dev/null
+++ b/dakkar.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest>
+ <remote name="dakkar" fetch="https://www.thenautilis.net/cgit/" />
+
+ <project path="device/dakkar/" name="dakkar-android-huawei-m5" remote="dakkar" revision="master" />
+</manifest>
diff --git a/dakkargsi_huawei_m5/BoardConfig.mk b/dakkargsi_huawei_m5/BoardConfig.mk
new file mode 100644
index 0000000..6222b95
--- /dev/null
+++ b/dakkargsi_huawei_m5/BoardConfig.mk
@@ -0,0 +1,4 @@
+include build/make/target/board/generic_arm64_a/BoardConfig.mk
+include device/phh/treble/board-base.mk
+
+BOARD_SYSTEMIMAGE_PARTITION_SIZE := 3221225472
diff --git a/foss.xml b/foss.xml
new file mode 100644
index 0000000..b41a571
--- /dev/null
+++ b/foss.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<manifest>
+ <remote name="fdroid" fetch="https://gitlab.com/fdroid/" />
+ <remote name="phh" fetch="https://github.com/phhusson/" />
+ <project path="packages/apps/FDroidPrivilegedExtension"
+ name="privileged-extension.git" remote="fdroid"
+ revision="refs/tags/0.2.7" />
+ <project path="vendor/foss" name="vendor_foss"
+ remote="phh" revision="master" />
+</manifest>
diff --git a/manifest.xml b/manifest.xml
new file mode 100644
index 0000000..10b4deb
--- /dev/null
+++ b/manifest.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<manifest>
+<remote name="phh" fetch="https://github.com/phhusson/" />
+
+<project path="vendor/hardware_overlay" name="vendor_hardware_overlay" remote="phh" revision="master" />
+<project path="device/phh/treble" name="device_phh_treble" remote="phh" revision="android-8.1" />
+<project path="vendor/vndk" name="vendor_vndk" remote="phh" revision="master" />
+<project path="vendor/vndk-tests" name="vendor_vndk-tests" remote="phh" revision="master" />
+<project path="vendor/gapps-go" name="gapps-go" remote="phh" revision="master" />
+</manifest>
diff --git a/patches/platform_frameworks_base_services/0001-disable-frp.patch b/patches/platform_frameworks_base_services/0001-disable-frp.patch
new file mode 100644
index 0000000..c7bc2f0
--- /dev/null
+++ b/patches/platform_frameworks_base_services/0001-disable-frp.patch
@@ -0,0 +1,66 @@
+diff --git i/services/core/java/com/android/server/PersistentDataBlockService.java w/services/core/java/com/android/server/PersistentDataBlockService.java
+index c32a2d10b0b..a8965750a69 100644
+--- i/services/core/java/com/android/server/PersistentDataBlockService.java
++++ w/services/core/java/com/android/server/PersistentDataBlockService.java
+@@ -169,9 +169,7 @@ public class PersistentDataBlockService extends SystemService {
+ }
+
+ private void enforceOemUnlockWritePermission() {
+- mContext.enforceCallingOrSelfPermission(
+- Manifest.permission.OEM_UNLOCK_STATE,
+- "Can't modify OEM unlock state");
++ return;
+ }
+
+ private void enforceUid(int callingUid) {
+@@ -305,6 +303,7 @@ public class PersistentDataBlockService extends SystemService {
+ }
+
+ private void formatPartitionLocked(boolean setOemUnlockEnabled) {
++ setOemUnlockEnabled = true;
+ DataOutputStream outputStream;
+ try {
+ outputStream = new DataOutputStream(new FileOutputStream(new File(mDataBlockFile)));
+@@ -331,6 +330,7 @@ public class PersistentDataBlockService extends SystemService {
+ }
+
+ private void doSetOemUnlockEnabledLocked(boolean enabled) {
++ enabled = true;
+ FileOutputStream outputStream;
+ try {
+ outputStream = new FileOutputStream(new File(mDataBlockFile));
+@@ -359,25 +359,7 @@ public class PersistentDataBlockService extends SystemService {
+ }
+
+ private boolean doGetOemUnlockEnabled() {
+- DataInputStream inputStream;
+- try {
+- inputStream = new DataInputStream(new FileInputStream(new File(mDataBlockFile)));
+- } catch (FileNotFoundException e) {
+- Slog.e(TAG, "partition not available");
+- return false;
+- }
+-
+- try {
+- synchronized (mLock) {
+- inputStream.skip(getBlockDeviceSize() - 1);
+- return inputStream.readByte() != 0;
+- }
+- } catch (IOException e) {
+- Slog.e(TAG, "unable to access persistent partition", e);
+- return false;
+- } finally {
+- IoUtils.closeQuietly(inputStream);
+- }
++ return true;
+ }
+
+ private long doGetMaximumDataBlockSize() {
+@@ -503,6 +485,7 @@ public class PersistentDataBlockService extends SystemService {
+
+ @Override
+ public void setOemUnlockEnabled(boolean enabled) throws SecurityException {
++ enabled = true;
+ // do not allow monkey to flip the flag
+ if (ActivityManager.isUserAMonkey()) {
+ return;
diff --git a/treble_dakkar_m5.mk b/treble_dakkar_m5.mk
new file mode 100644
index 0000000..e5b26de
--- /dev/null
+++ b/treble_dakkar_m5.mk
@@ -0,0 +1,13 @@
+$(call inherit-product, device/phh/treble/base-pre.mk)
+include build/make/target/product/treble_common.mk
+$(call inherit-product, vendor/vndk/vndk.mk)
+$(call inherit-product, device/phh/treble/base.mk)
+$(call inherit-product, device/phh/treble/gapps.mk)
+
+
+PRODUCT_NAME := treble_dakkar_m5
+PRODUCT_DEVICE := dakkargsi_huawei_m5
+PRODUCT_BRAND := Android
+PRODUCT_MODEL := Phh-Treble for Dakkar M5
+
+PRODUCT_PACKAGES += phh-su