Related
Hello all,
Just got my first android phone. I need to port a tiny C application I have to my phone. It worked when I compiled a static binary but now I'm trying to compile a dynamic one, but before that, I'm trying to run a native hello world on it but not having much luck. When I run it on the emulator, it prints "Hello world" and then segfaults after that. When I run it on the phone, it doesn't even get that far. It says link_image[1995] CANNOT LINK EXECUTABLE.
These are my test files
test.c
Code:
#include <stdio.h>
int main (int argc, char *argv[])
{
printf ("Hello world!\n");
return 0;
}
Makefile
Code:
APP := test
ROOT:=$(HOME)/Projects/Android
NDK_PLATFORM_VER := 8
INSTALL_DIR := /data/tmp
ANDROID_NDK_ROOT:=$(ROOT)/android-ndk-r5b
ANDROID_NDK_HOST:=linux-x86
ANDROID_SDK_ROOT:=$(ROOT)/android-sdk-linux_x86
PREBUILD:=$(ANDROID_NDK_ROOT)/toolchains/arm-eabi-4.4.0/prebuilt/$(ANDROID_NDK_HOST)
BIN := $(PREBUILD)/bin
CPP := $(BIN)/arm-eabi-g++
CC := $(BIN)/arm-eabi-gcc
CFLAGS := -I$(ANDROID_NDK_ROOT)/platforms/android-$(NDK_PLATFORM_VER)/arch-arm/usr/include -fno-short-enums
LDFLAGS := -Wl,--entry=main,-rpath-link=$(ANDROID_NDK_ROOT)/platforms/android-$(NDK_PLATFORM_VER)/arch-arm/usr/lib,-dynamic-linker=/system/bin/linker -L$(ANDROID_NDK_ROOT)/platforms/android-$(NDK_PLATFORM_VER)/arch-arm/usr/lib
LDFLAGS += -nostdlib -lc -disable-multilib
all: $(APP)
OBJS += $(APP).o
$(APP): $(OBJS)
$(CPP) $(LDFLAGS) -o [email protected] $^
%.o: %.c
$(CC) -c $(INCLUDE) $(CFLAGS) $< -o [email protected]
install: $(APP)
$(ANDROID_SDK_ROOT)/platform-tools/adb push $(APP) $(INSTALL_DIR)/$(APP)
$(ANDROID_SDK_ROOT)/platform-tools/adb shell chmod 777 $(INSTALL_DIR)/$(APP)
shell:
$(ANDROID_SDK_ROOT)/platform-tools/adb shell
run:
$(ANDROID_SDK_ROOT)/platform-tools/adb shell $(INSTALL_DIR)/$(APP)
r: $(APP)
$(ANDROID_SDK_ROOT)/platform-tools/adb push $(APP) $(INSTALL_DIR)/$(APP)
$(ANDROID_SDK_ROOT)/platform-tools/adb shell chmod 777 $(INSTALL_DIR)/$(APP)
$(ANDROID_SDK_ROOT)/platform-tools/adb shell $(INSTALL_DIR)/$(APP)
clean:
@echo "Cleaning up..."
rm -f $(APP).o $(APP)
Output:
Code:
[[email protected] app]$ make run
/home/hacker/Projects/Android/android-sdk-linux_x86/platform-tools/adb shell /data/tmp/test
Hello world!
[1] Segmentation fault /data/tmp/test
[[email protected] app]$
Output (on the phone):
Code:
# /data/local/test
link_image[1995]: failed to link /data/local/test
CANNOT LINK EXECUTABLE
#
What am I doing wrong?
I've never been successful with dynamic executables using a plain Makefile. I've always had to use the JNI approach with an appropriate Android.mk configuration. To do this, make an empty directory for your project. Within this directory, make a dir called "jni" and cd to it and copy your "hello.c" source file there. Add an Andriod.mk file that looks like this:
Code:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := hello
LOCAL_SRC_FILES := hello.c
include $(BUILD_EXECUTABLE)
Then, with the ndk path set appropriately (ie, on my system):
Code:
export PATH=${PATH}:/usr/src/android-ndk-r4b/build/prebuilt/linux-x86/arm-eabi-4.4.0/bin/
just run the ndk-build script (again, modify to point to your ndk installation):
Code:
/usr/src/android-ndk-r4b/ndk-build
This will produce two additional directories in the dir above "jni": "obj" and "libs". In the libs/armeabi/ dir, you'll find your (non-stripped) executable.
Just curious, where'd you get the Makefile? It looks like it should work, but I can't really see where it is getting it's libc.so.
I got the Makefile from http://betelco.blogspot.com/2010/01/buildingdebugging-android-native-c.html
It's for Cygwin so I made a few changes. The last comment says I should link it against crtend_android.o to prevent the segfaults but that didn't work for me. Maybe I did something wrong. I'm not really a C programmer and the only experience I have is with writing extremely basic apps so, honestly, I don't know much about linking but I'm trying to let that not discourage me from trying. It usually takes me days to get something simple done but it feels great once I manage to get my app to work.
I'll try your approach in a few hours and post back.
Oh, and I thought I should mention my phone is running Froyo at the moment.
Since I'm completely new to writing code on the phone, I thought I should ask if it is a bad idea to push the app to the phone and run it directly or should I really be using the emulator instead (since I'm not an experienced programmer)? I've got a very old PC and the emulator is slow as hell on it so it'll be great if i can avoid that.
I visited that site and read over their comments and modified the makefile at the end to match my system (gentoo linux) and it works fine on my phone (HTC Inspire 4G). I didn't do the "make run" thing, but just "make" and then pushed it to my phone manually and ran it from an adb shell. Worked fine. I'm using the r4b plaform ndk so that might be something. I'll D/L the r5b ndk and check it out.
I tried what you suggested and it works perfectly. Thanks!
Gene Poole said:
I visited that site and read over their comments and modified the makefile at the end to match my system (gentoo linux) and it works fine on my phone (HTC Inspire 4G). I didn't do the "make run" thing, but just "make" and then pushed it to my phone manually and ran it from an adb shell. Worked fine. I'm using the r4b plaform ndk so that might be something. I'll D/L the r5b ndk and check it out.
Click to expand...
Click to collapse
I still do have a segmentation fault... I stated all what I did here :
http://stackoverflow.com/questions/20936770/android-command-line-executable
Any good idea would be appreciated !
Thx
hey guys,
I'm trying to write an addon.d script to keep Avast Anti-Theft installed after OpenDelta's upgrades.
it only has the ability to self add a backup script in CM roms.
I looked for the list of files being kept at the appropriate .sh file for CM, and wrote the following "91-antitheft.sh" :
Code:
#!/sbin/sh
#
# /system/addon.d/91-antitheft.sh
# During a system upgrade, this script backs up avast anti theft,
# /system is formatted and reinstalled, then the files is restored.
#
. /tmp/backuptool.functions
list_files() {
cat <<EOF
priv-app/com.avast.android.antitheft.apk
etc/com.avast.android.antitheft.backup.enc
EOF
}
case "$1" in
backup)
list_files | while read FILE DUMMY; do
backup_file $S/$FILE
done
;;
restore)
list_files | while read FILE REPLACEMENT; do
R=""
[ -n "$REPLACEMENT" ] && R="$S/$REPLACEMENT"
[ -f "$C/$S/$FILE" ] && restore_file $S/$FILE $R
done
;;
pre-backup)
# Stub
;;
post-backup)
# Stub
;;
pre-restore)
# Stub
;;
post-restore)
# Stub
;;
esac
unfortunately, that doesn't keep the files.
the 2 files are definitely the following:
com.avast.android.antitheft.apk located in /system/priv-app
com.avast.android.antitheft.backup.enc located in /system/etc
what is wrong with the code?
thanks
Just use the same .sh file they developed for CM - our backuptool implementation is fully compatible.
thanks for your answer!
I went from CM 4.3 to OmniROM 4.4, so for 4.3 this is what I found in my /system:
custom_backup_list.txt inside /system/etc
containing:
Code:
app/com.avast.android.antitheft.apk
etc/com.avast.android.antitheft.backup.enc
and 99-cm.sh containing:
Code:
#!/sbin/sh
#
# /system/addon.d/50-cm.sh
# During a CM10 upgrade, this script backs up /system/etc/hosts,
# /system is formatted and reinstalled, then the file is restored.
#
. /tmp/backuptool.functions
list_files() {
cat <<EOF
app/com.avast.android.antitheft.apk
etc/com.avast.android.antitheft.backup.enc
EOF
}
case "$1" in
backup)
list_files | while read FILE DUMMY; do
backup_file $S/"$FILE"
done
;;
restore)
list_files | while read FILE REPLACEMENT; do
R=""
[ -n "$REPLACEMENT" ] && R="$S/$REPLACEMENT"
[ -f "$C/$S/$FILE" ] && restore_file $S/"$FILE" "$R"
done
;;
pre-backup)
# Stub
;;
post-backup)
# Stub
;;
pre-restore)
# Stub
;;
post-restore)
# Stub
;;
esac
so, I'm not sure OmniROM supports "custom_backup_list.txt"
and for the 99-cm.sh file, it says "app/com..." so I changed it to "priv-app/com....".
and it doesn't work. the 2 files are not there after the upgrade is finished.
so it must be something with my code, no?
hmm, custom_backup_list is something I've never seen in CM... Just backuptool in /system/addon.d/
You should be able to take the example backuptool shell file, replace the files to be backed up with the ones you want, and it should work, although you might need to make sure the file mode/ownership match the other shell files in /system/addon.d/
I changed the hosts "template" file and it works.
it's super weird because there's no real difference to what I've previously wrote.
might be that last unused # dangs it all up.
thanks for your help, Entropy512.
I've attached the sh file to whom it may concern
shmizan said:
I changed the hosts "template" file and it works.
it's super weird because there's no real difference to what I've previously wrote.
might be that last unused # dangs it all up.
thanks for your help, Entropy512.
I've attached the sh file to whom it may concern
Click to expand...
Click to collapse
Where do we put the file once we download it? Will it autorun every time we flash a nightly?
inside /system/addon.d/
and yes it will.
I followed your instructions exactly, unfortunately avast anti-theft still isn't being kept whenever I flash a new nightly. Did I need to do something else or?
Jokerswild2412 said:
I followed your instructions exactly, unfortunately avast anti-theft still isn't being kept whenever I flash a new nightly. Did I need to do something else or?
Click to expand...
Click to collapse
I think u have to remove the .txt and then save it. (save it as a .sh file)
Thanks for the script. I was just wondering how to make a script for that and then I thought let's give Google a try
And I found your post. Thanks
There's also another method.
When installing Anti-theft from within Avast you are asked if you want to install it in the system directory or make a flashable update.zip. Select the update.zip method. Then you take that zip and rename it to Update1.zip and move it to /"sdcard folder"/OpenDelta/FlashAfterUpdate/
When storing the settings for hard reset protection selec also the update.zip method rename the zip to Update2.zip and move it to the same folder.
Those two files will be flashed after every update.
The problem with this method is that you'll have to update the zips whenever there's an update for Anti-theft, but that doesn't happen really often.
I am not using OmniRom so I dont think its gonna work for me.
But the script method isn't more useful ? I mean, it does work even after flashing a new rom, or I am mistaken ?
johnannis said:
I am not using OmniRom so I dont think its gonna work for me.
But the script method isn't more useful ? I mean, it does work even after flashing a new rom, or I am mistaken ?
Click to expand...
Click to collapse
The script method is more useful for ROMs that support addon.d. As far as lately, I've only ran omni and CM. But possibly other aosp derivatives like pac, carbon, PA, etc support this as well. Check your roms OP as well as code for better answers on this.
I am on PA, but nevermind I ll keep it script method, it seems better for my needs
Sent from my Nexus 5 using Tapatalk
Building AOSP for the Nexus 6!
I want to give thanks to @sykopompos and @GROGG88. This was pretty much a concerted effort between all of us!
Preface
This is to help you learn to build, for other developers to share knowledge, for you to ask questions, etc. The main focus is not the ROM but it is in post #2 if you want to check out out!
I built this guide do to lack of 100% clear / easy resources I could not find on the net. The Google AOSP page made it seem much more difficult than it needed to be.
The intent of this guide is to streamline the process of setting up for and building AOSP!
Feel free to ask any questions about the build process. Please do not ask questions about Ubuntu / Linux!
Check out some basic edits to source in Post #2
This guide assumes the following
Have Ubuntu 14.04 setup, fully operation, and up to date. Hard Machine or Virtual, makes no difference. Must meet the minimum specs for compiling. Info from Google HERE
Understand terminal command line entry as this is all command line processes.
You are not here to ask for help with Linux, only the Android build process!
If you want to try the ROM then I have the latest build of Lollipop in this thread HERE!
Lets Begin!
Add Java
Code:
sudo apt-get install openjdk-7-jdk
Add Build tools (Adds the required packages at the time of this posting)
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \
lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache \
libgl1-mesa-dev libxml2-utils xsltproc unzip
Add Repo command (Syncs Google Repository with your local machine)
Code:
mkdir ~/bin && curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo && chmod a+x ~/bin/repo
Add bin folder to path for repo command (After you do this close Terminal and re-open to institute changes (easy way))
Code:
sudo gedit .bashrc
export PATH=~/bin:$PATH <-(add to end of bashrc)
Identify Yourself to the Repo (One day you may make commits so think about that when choosing your info!)
Code:
git config --global user.email "[email protected]"
git config --global user.name "yourpreferredusername"
Sync Repo (Download source... Sit back and grab a pop and a sandwich...)
Code:
mkdir ~/AOSP
cd ~/AOSP
repo init -u https://android.googlesource.com/platform/manifest -b android-6.0.1_r10
repo sync
Note: I use AOSP as my directory name. You can use what you want. You could use "aosp" or "Source" or "android" or "whateveryoulike"
Set up ccache (this makes subsequent compiling much faster!)
First: Close then re-open the terminal so you are in the home root
Code:
sudo gedit .bashrc
export USE_CCACHE=1 <-Append that line to .bashrc then save and close
cd AOSP
prebuilts/misc/linux-x86/ccache/ccache -M 25G <-I use 25 gigs but you can change that value to any size you feel appropriate)
Install proprietary binaries (Needed for things like GPS and Bluetooth, they are not Open Source like Android) (Install proprietary binaries from here in the root of AOSP folder (or whatever you called yours))
Code:
[url]https://developers.google.com/android/nexus/drivers[/url]
Run envsetup.sh
Code:
source build/envsetup.sh
Choose Device
Code:
lunch
Build it!
Code:
make -j16 otapackage
Note: using -j16 means 16 worker threads. This is fine if you have 8 logical CPU's so you may need to adjust that to a smaller or larger number if you have more or less Logical CPU's. Example: I have an i7 K edition Haswell so I have 8 logical cores; so I build with -j16. If you have an i5 quad core CPU which is 4 logical cores then you may want to consider -j8 as the set number of worker threads. Oddly enough Google actually recommends 3 to 4 times the number of logical CPU's. When I do that I have nothing but build crashes. You may need to experiment to get the right blend of performance and stability during build!
Find it
Should be located here: /home/yourusername/AOSP/out/target/product/shamu
Congrats!
Your know among the elite enthusiast that can build from source! Pat yourself on the back!
Change Log
1/10/2016
Updated guide to reflect Android 6.0.1 repository
Updated list of tools to install
3/19/2015
Updated guide to reflect Android 5.1.0 repository
Fixed Youtube, Net flix DRM play back issue. Thanks to @sykopompos for pointing me to @ayysir git hub for the fix by @BeansTown106
1/17/2015
Added ccache instructions
Listed changes for AOSP Browser to not F/C on settings
12/14/2014
Initial Release
Congrats on building but you need to make some edits to make the ROM more "useable"
Note: Attached is a complete diff from pure AOSP to the changes made / noted in this post.
With AOSP defaults you to
Reload the stock recovery on boot
Doesn't utilize all Google Location services (all the way?)
Browser settings crash
Cant Play Youtube or Netflix, etc.
The following is a list of code changes to negate all that. Ignore the Flo and Deb specific files mentioned in there as I also build for those devices too! This is sorta hard to read but once you get it the first time it will make sense. Feel free to ask questions on how to read! I have attached a copy of the "ota_from_target_files" as it is modified in this guide.
My Changes
Code:
project build/
diff --git a/tools/releasetools/ota_from_target_files b/tools/releasetools/ota_from_target_files
index 755e5c2..620f5c6 100755
--- a/tools/releasetools/ota_from_target_files
+++ b/tools/releasetools/ota_from_target_files
@@ -522,8 +522,8 @@ def WriteFullOTAPackage(input_zip, output_zip):
# set up system to update recovery partition on first boot
# complete script normally (allow recovery to mark itself finished and reboot)
- recovery_img = common.GetBootableImage("recovery.img", "recovery.img",
- OPTIONS.input_tmp, "RECOVERY")
+# recovery_img = common.GetBootableImage("recovery.img", "recovery.img",
+# OPTIONS.input_tmp, "RECOVERY")
if OPTIONS.two_step:
if not OPTIONS.info_dict.get("multistage_support", None):
assert False, "two-step packages not supported by this build"
@@ -582,11 +582,11 @@ else if get_stage("%(bcb_dev)s") == "3/3" then
if not block_based:
def output_sink(fn, data):
- common.ZipWriteStr(output_zip, "recovery/" + fn, data)
+# common.ZipWriteStr(output_zip, "recovery/" + fn, data)
system_items.Get("system/" + fn, dir=False)
- common.MakeRecoveryPatch(OPTIONS.input_tmp, output_sink,
- recovery_img, boot_img)
+# common.MakeRecoveryPatch(OPTIONS.input_tmp, output_sink,
+# recovery_img, boot_img)
system_items.GetMetadata(input_zip)
system_items.Get("system").SetPermissions(script)
@@ -730,12 +730,12 @@ def WriteBlockIncrementalOTAPackage(target_zip, source_zip, output_zip):
updating_boot = (not OPTIONS.two_step and
(source_boot.data != target_boot.data))
- source_recovery = common.GetBootableImage(
- "/tmp/recovery.img", "recovery.img", OPTIONS.source_tmp, "RECOVERY",
- OPTIONS.source_info_dict)
- target_recovery = common.GetBootableImage(
- "/tmp/recovery.img", "recovery.img", OPTIONS.target_tmp, "RECOVERY")
- updating_recovery = (source_recovery.data != target_recovery.data)
+# source_recovery = common.GetBootableImage(
+# "/tmp/recovery.img", "recovery.img", OPTIONS.source_tmp, "RECOVERY",
+# OPTIONS.source_info_dict)
+# target_recovery = common.GetBootableImage(
+# "/tmp/recovery.img", "recovery.img", OPTIONS.target_tmp, "RECOVERY")
+# updating_recovery = (source_recovery.data != target_recovery.data)
system_src = GetImage("system", OPTIONS.source_tmp, OPTIONS.source_info_dict)
system_tgt = GetImage("system", OPTIONS.target_tmp, OPTIONS.target_info_dict)
@@ -1104,12 +1104,12 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip):
updating_boot = (not OPTIONS.two_step and
(source_boot.data != target_boot.data))
- source_recovery = common.GetBootableImage(
- "/tmp/recovery.img", "recovery.img", OPTIONS.source_tmp, "RECOVERY",
- OPTIONS.source_info_dict)
- target_recovery = common.GetBootableImage(
- "/tmp/recovery.img", "recovery.img", OPTIONS.target_tmp, "RECOVERY")
- updating_recovery = (source_recovery.data != target_recovery.data)
+# source_recovery = common.GetBootableImage(
+# "/tmp/recovery.img", "recovery.img", OPTIONS.source_tmp, "RECOVERY",
+# OPTIONS.source_info_dict)
+# target_recovery = common.GetBootableImage(
+# "/tmp/recovery.img", "recovery.img", OPTIONS.target_tmp, "RECOVERY")
+# updating_recovery = (source_recovery.data != target_recovery.data)
# Here's how we divide up the progress bar:
# 0.1 for verifying the start state (PatchCheck calls)
@@ -1313,9 +1313,9 @@ else
script.Print("Unpacking new vendor files...")
script.UnpackPackageDir("vendor", "/vendor")
- if updating_recovery and not target_has_recovery_patch:
- script.Print("Unpacking new recovery...")
- script.UnpackPackageDir("recovery", "/system")
+# if updating_recovery and not target_has_recovery_patch:
+# script.Print("Unpacking new recovery...")
+# script.UnpackPackageDir("recovery", "/system")
system_diff.EmitRenames(script)
if vendor_diff:
project device/asus/flo/
diff --git a/aosp_flo.mk b/aosp_flo.mk
index 6f1ad0c..c1c99fb 100644
--- a/aosp_flo.mk
+++ b/aosp_flo.mk
@@ -24,7 +24,7 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base.mk)
PRODUCT_NAME := aosp_flo
PRODUCT_DEVICE := flo
PRODUCT_BRAND := Android
-PRODUCT_MODEL := AOSP on Flo
+PRODUCT_MODEL := Nexus 7
PRODUCT_MANUFACTURER := ASUS
PRODUCT_RESTRICT_VENDOR_FILES := true
diff --git a/system.prop b/system.prop
index 937fbb7..dc3a07f 100644
--- a/system.prop
+++ b/system.prop
@@ -3,3 +3,4 @@
#LTE, GSM, WCDMA(9)
#
ro.telephony.default_network=9
+persist.sys.usb.config=mtp,adb
project device/moto/shamu/
diff --git a/aosp_shamu.mk b/aosp_shamu.mk
index e5fa301..ef53d06 100644
--- a/aosp_shamu.mk
+++ b/aosp_shamu.mk
@@ -26,7 +26,7 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk)
PRODUCT_NAME := aosp_shamu
PRODUCT_DEVICE := shamu
PRODUCT_BRAND := Android
-PRODUCT_MODEL := AOSP on Shamu
+PRODUCT_MODEL := Nexus 6
PRODUCT_MANUFACTURER := motorola
PRODUCT_RESTRICT_VENDOR_FILES := true
project frameworks/base/
diff --git a/core/res/res/drawable-sw600dp-nodpi/default_wallpaper.jpg b/core/res/res/drawable-sw600dp-nodpi/default_wallpaper.jpg
index 03a14c0..9ab8944 100644
Binary files a/core/res/res/drawable-sw600dp-nodpi/default_wallpaper.jpg and b/core/res/res/drawable-sw600dp-nodpi/default_wallpaper.jpg differ
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index 8006659..cfd55b1 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -946,6 +946,7 @@
-->
<string-array name="config_locationProviderPackageNames" translatable="false">
<!-- The standard AOSP fused location provider -->
+ <item>com.google.android.gms</item>
<item>com.android.location.fused</item>
</string-array>
project packages/apps/Browser/
diff --git a/src/com/android/browser/BrowserPreferencesPage.java b/src/com/android/browser/BrowserPreferencesPage.java
index 6e6da17..cd91f11 100644
--- a/src/com/android/browser/BrowserPreferencesPage.java
+++ b/src/com/android/browser/BrowserPreferencesPage.java
@@ -43,6 +43,12 @@ public class BrowserPreferencesPage extends PreferenceActivity {
}
}
+ @Override
+ protected boolean isValidFragment(String fragmentName) {
+ return true;
+ }
+
+
/**
* Populate the activity with the top-level headers.
*/
@@ -82,8 +88,7 @@ public class BrowserPreferencesPage extends PreferenceActivity {
} else {
finish();
}
- return true;
- }
+ return true; }
return false;
}
@@ -98,4 +103,5 @@ public class BrowserPreferencesPage extends PreferenceActivity {
return intent;
}
+
}
project system/core/
diff --git a/rootdir/init.rc b/rootdir/init.rc
index 8ba7c10..e5120f1 100644
--- a/rootdir/init.rc
+++ b/rootdir/init.rc
@@ -594,9 +594,8 @@ service installd /system/bin/installd
class main
socket installd stream 600 system system
-service flash_recovery /system/bin/install-recovery.sh
+service flash_recovery /system/etc/install-recovery.sh
class main
- seclabel u:r:install_recovery:s0
oneshot
service racoon /system/bin/racoon
Now to fix Youtube and Netflix, etc...
You will need to add the following changes from Ayysir's git hub Here: Add QCOM targert-specific cong & helper macros
Are we going to get a shamu clean rom? Glad to see you here @scrosler!
Sent from my Nexus 6
housry23 said:
Are we going to get a shamu clean rom? Glad to see you here @scrosler!
Sent from my Nexus 6
Click to expand...
Click to collapse
For sure!
I am just still playing with it. I had it barely over 24hrs... So far I am crazy impressed with it!
That's the best news I've heard so far! After running tons of different roms I always end up coming back to cleanrom, and I use it on all of my touchwiz devices.
xlemonhed1 said:
That's the best news I've heard so far! After running tons of different roms I always end up coming back to cleanrom, and I use it on all of my touchwiz devices.
Click to expand...
Click to collapse
Very cool. Dont know when I will get started but I hope this weekend.
I am going to make it identical to my Nexus 7 ROM.
They seem to like it :highfive:
scrosler said:
For sure!
I am just still playing with it. I had it barely over 24hrs... So far I am crazy impressed with it!
Click to expand...
Click to collapse
Nice! I ran Cleanrom on my nexus 7 and loved it. Thanks in advance. I'll be watching for it. It is an impressive device. Enjoy!
Sent from my Nexus 6
Well, congrats on the new device! I was window shopping them a week ago, and couldn't justify it yet. I'm sure you'll enjoy!
**edit**
Also, the patched source files in the Nexus 7 thread will work to a degree. I do have Shamu binaries added in, but some of the features I've added are device specific and have not been applied to Shamu. The last build I made for Shamu was on 11/23 and I decided not to continue with it.
Yes, I was window shopping too and could NOT resist!
They make it so tempting with these "Next" and "Edge" programs!
reported to moderator (with a request to make it sticky)
Wow amazing! I'm going to give this a try when I get home from work! Just two questions.. How to compile with another tool chain such as sabermod or linaro? And how to compile it with a different kernel?
Xileforce said:
Wow amazing! I'm going to give this a try when I get home from work! Just two questions.. How to compile with another tool chain such as sabermod or linaro? And how to compile it with a different kernel?
Click to expand...
Click to collapse
I am not an expert by any means but you will need to change the make files that point to the tool chain. It should not be that hard.
Same for the kernel.
IM sure another, more experienced AOSP developer will explain in greater detail (cough @GROGG88) :good:
scrosler said:
I am not an expert by any means but you will need to change the make files that point to the tool chain. It should not be that hard.
Same for the kernel.
IM sure another, more experienced AOSP developer will explain in greater detail (cough @GROGG88) :good:
Click to expand...
Click to collapse
Thanks man! I'm sure between this and Google I'll be able to figure it out!
For your code changes in the tutorial for building AOSP for the Nexus 6. Are there multiple files I need to change the code in or is it a single .mk file or different extension? I haven't been able to locate a file with similar code. If you could just let me know which files that is all I am asking, I can figure out the rest I think!
If anyone knows what files need to be edited feel free to reply!
Xileforce said:
And how to compile it with a different kernel?
Click to expand...
Click to collapse
It depends. To compile with another (prebuilt) kernel, you can just overwrite the prebuilt kernel in.. I think it's in ./device/moto/shamu-kernel. (If you rename the kernel image to match the existing file, that's all you have to do.)
On the other hand, if you want to compile a new kernel while building the rest of AOSP, there are several changes that you'll have to make (even for the stock kernel.) Here's a link to a page that might get you started: http://nosemaj.org/howto-build-android-kitkat-nexus-5 (The instructions are for kitkat on a nexus5, but they should be good enough to give you an idea of what you need to do.)
Take care
gary
EmptyGODFATHER said:
For your code changes in the tutorial for building AOSP for the Nexus 6. Are there multiple files I need to change the code in or is it a single .mk file or different extension? I haven't been able to locate a file with similar code. If you could just let me know which files that is all I am asking, I can figure out the rest I think!
If anyone knows what files need to be edited feel free to reply!
Click to expand...
Click to collapse
There are multiple files. Most of them pertain to the Nexus 7 and can be skipped. The Repo Diff command can be hard to read but I will tty to break it down a little bit so you can understand how to read that file....
I will use the "remove recovery" commit we found I think from @simpleaOSP.
Ex:
Project -> project build/ (So this means we ill make edits in the build folder)
diff --git a (Shows where the difference start)/tools/releasetools/ota_from_target_files b/tools/releasetools/ota_from_target_files (Name of file we will be modifying)
index 755e5c2..1951e95 100755
--- a/tools/releasetools/ota_from_target_files
+++ b/tools/releasetools/ota_from_target_files
(Prefaced lines to help you find your place in the file)
@@ -522,8 +522,8 @@ def WriteFullOTAPackage(input_zip, output_zip):
# set up system to update recovery partition on first boot
# complete script normally (allow recovery to mark itself finished and reboot)
Actual Changes...
- = Remove line
+ = Add line....
In this example: I put "#" to comment out building the recovery image.
Original
- recovery_img = common.GetBootableImage("recovery.img", "recovery.img",
- OPTIONS.input_tmp, "RECOVERY")
Modded
+# recovery_img = common.GetBootableImage("recovery.img", "recovery.img",
+# OPTIONS.input_tmp, "RECOVERY")
(More Prefaced lines to help you find your place in the file)
if OPTIONS.two_step:
if not OPTIONS.info_dict.get("multistage_support", None):
assert False, "two-step packages not supported by this build"
@@ -582,11 +582,11 @@ else if get_stage("%(bcb_dev)s") == "3/3" then
Click to expand...
Click to collapse
Now thare are more changes in that file and more files in the Diff. IM not savvy enough with git to post it all to a git but using tha tfile and taking the time to look at and search for the file locations will get you the same results.
I also know this is not a "great" explanation of the repo diff changes so if anyone can explain it better than me I will NOT be offended.
For @Xileforce
scrosler said:
IM sure another, more experienced AOSP developer will explain in greater detail (cough @GROGG88) :good:
Click to expand...
Click to collapse
Damnit Jim! I'm a Doctor, not a Shamu owner... Heck, I'm not even a "Developer". I"m a "Contributor"
garyd9 said:
It depends. To compile with another (prebuilt) kernel, you can just overwrite the prebuilt kernel in.. I think it's in ./device/moto/shamu-kernel. (If you rename the kernel image to match the existing file, that's all you have to do.)
On the other hand, if you want to compile a new kernel while building the rest of AOSP, there are several changes that you'll have to make (even for the stock kernel.) Here's a link to a page that might get you started: http://nosemaj.org/howto-build-android-kitkat-nexus-5 (The instructions are for kitkat on a nexus5, but they should be good enough to give you an idea of what you need to do.)
Take care
gary
Click to expand...
Click to collapse
Yes, those instructions work well! I fought for a little bit to get the Nexus 7 kernel to compile with the 4.8 toolchain. As a result I had things setup to compile the kernel before the firmware and using the output as my prebuilt directory specified in the device-common.mk which should be 'device.mk' for shamu. I have scripts setup for the 3 devices I'm building for that take care of cleaning and building everything. I have since modified my scripts to run the 4.8 toolchain within the AOSP tree instead of an external 4.6 toolchain... It's basically outlined here:
GROGG88 said:
AOSP PATCHES:
DOWNLOAD
(these are built into the firmware above)
**Patch/Build instruction**
Make sure your source tree is located in ~/AOSP
Clone kernel sources and checkout for devices using:
Code:
cd ~/AOSP
git clone https://android.googlesource.com/kernel/msm.git hh-kernel/kernel
git clone https://android.googlesource.com/kernel/msm.git flo-kernel/kernel
cd hh-kernel/kernel
git checkout 88fbc66
cd ../../flo-kernel/kernel
git checkout 154bef4
Download and copy my patches to ~/AOSP
Commit flo kernel changes if desired
Code:
cd ~/AOSP/flo-kernel/kernel
git commit -a
Enter a description, ctrl+x and then enter to commit.
You can now use the included scripts to build 1/3 devices:
Code:
$cd ~/AOSP
./build-hammerhead.sh
or
./build-flo.sh
or
./build-deb.sh
That's it!! Grab your custom firmware and FLASH!
Click to expand...
Click to collapse
It's turning it into a two step process, but the result is the same. As far as compiling with a different toolchain is concerned, I have yet to try. I shy away from many of the "optimizations" and really just target physical features that I feel are missing from stock AOSP.
Hahahaha! Your the man Dude!
We need DLMontage over here too. I hope he gets a Nex6.
You need to get one!
Thanks guys! I'll be giving the things you guys said a shot.. I'm sure I'll figure it out. This is my first try every compiling a rom,, so it should be interesting lol.. Though I'm sure it will be significantly easier after the first time.
Xileforce said:
Thanks guys! I'll be giving the things you guys said a shot.. I'm sure I'll figure it out. This is my first try every compiling a rom,, so it should be interesting lol.. Though I'm sure it will be significantly easier after the first time.
Click to expand...
Click to collapse
It does get easier each time... Or more frustrating depending on what changes you make, lol
Check out this script by @yuweng to auto(matically|magically) compile TWRP for your device!
Lately the TWRP Compiling guide, has been seeing a lot of newbies who were struggling with TWRP flags to ensure they compile a usable build. So without delay, here we go!
If no input has been suggested, assume true/false
CREDITS :
@Android-Andi for some explanations here
@SdtBarbarossa for some more explanations here
@yuweng for HUGE amount of explanations provided through PM!
# Automatically implies these:
BOARD_HAS_NO_REAL_SDCARD := true
TW_USE_TOOLBOX := true
TW_EXCLUDE_SUPERSU := true
TW_EXCLUDE_MTP := true
TW_OEM_BUILD := true
# Add EXT4 support
TARGET_USERIMAGES_USE_EXT4 := true
# Disable/enable SELinux. Only suggested when you want to enable SELinux support
TWHAVE_SELINUX := true
# Remove MTP support
TW_EXCLUDE_MTP := true
# No screen timeout
TW_NO_SCREEN_TIMEOUT := true
# disables things like sdcard partitioning and may save you some space if TWRP isn't fitting in your recovery patition
BOARD_HAS_NO_REAL_SDCARD := true
# this enables proper handling of /data/media on devices that have this folder for storage (most Honeycomb and devices that originally shipped with ICS like Galaxy Nexus
RECOVERY_SDCARD_ON_DATA := true
# HTC Dumlock for those devices which need it
TW_INCLUDE_DUMLOCK := true
Partition defines
Code:
TW_INTERNAL_STORAGE_PATH
TW_INTERNAL_STORAGE_MOUNT_POINT
TW_EXTERNAL_STORAGE_PATH
TW_EXTERNAL_STORAGE_MOUNT_POINT
# If your device has recovery as a second ramdisk of boot.img
TW_HAS_NO_RECOVERY_PARTITION := true
# To prevent /boot partition not found error
TW_HAS_NO_BOOT_PARTITION := true
# Removes the 'Reboot bootloader' button
TW_NO_REBOOT_BOOTLOADER := true
# Removes the 'Reboot recovery' button
TW_NO_REBOOT_RECOVERY := true
# Disable the battery percentage for devices where it doesn't work properly
TW_NO_BATT_PERCENT := true
# Same as above, for CPU Temperature
TW_NO_CPU_TEMP := true
# Allows you to map a custom keycode for power button, takes in a number, usually three digits
TW_CUSTOM_POWER_BUTTON := 107
# Always use rm -rf to wipe
TW_ALWAYS_RMRF := true
# Prevent TWRP from unmounting /system
TW_NEVER_UNMOUNT_SYSTEM := true
# Removes USB Storage capability
TW_NO_USB_STORAGE := true
# Inject TWRP as a second ramdisk for Samsung devices, which keep recoveries that way.
TW_INCLUDE_INJECTTWRP := true
TW_INCLUDE_BLOBPACK -- NEED HELP
# Specify a path to the lun file on device
TARGET_USE_CUSTOM_LUN_FILE_PATH := "/sys/class/android_usb/android0/f_mass_storage/lun0/file"
# Not very sure, I guess it allows you to simply pop in the lunfile itself
BOARD_UMS_LUNFILE :=
TW_HAS_DOWNLOAD_MODE -- For Samsung devices
TW_NO_SCREEN_BLANK -- NEED HELP
TW_SDEXT_NO_EXT4 -- Blocks EXT4 FS for SD-EXT partitions
# Forces use of /proc/cpuinfo for determining device id. Look here : https://github.com/omnirom/android_bootable_recovery/blob/android-6.0/data.cpp#l183-l184
TW_FORCE_CPUINFO_FOR_DEVICE_ID := true
# For older devices. See here :https://github.com/omnirom/android_bootable_recovery/blob/android-6.0/Android.mk#l383
TW_NO_EXFAT_FUSE := true
# Decryption support for /data
TW_INCLUDE_CRYPTO -- General decryption modules
# On some device, TWRP backup folder name will show 0000000000 bcos cpuinfo has no serial number. Using this flag then it will use ro.product.model as the folder name instead of all 0000000000
TW_USE_MODEL_HARDWARE_ID_FOR_DEVICE_ID := true
# Set the path to the sysfs entry which controls the brightness
TW_BRIGHTNESS_PATH := /sys/devices/platform/s3c24xx-pwm.0/pwm-backlight.0/backlight/pwm-backlight.0/backlight
# A seconday path for the above
TW_SECONDARY_BRIGHTNESS_PATH :=
# Max brightness to prevent display damage
TW_MAX_BRIGHTNESS := 255
# Default brightness for TWRP
TW_DEFAULT_BRIGHTNESS := 150
# Custom battery readout path, don't use the given path though, it is intended to be used for a full diagnostic.
TW_CUSTOM_BATTERY_PATH := /sys/class/power_supply/battery/batt_attr_text
# CPU temp sysfs path, if it is zero all the time.
TW_CUSTOM_CPU_TEMP_PATH := true
# Remove the ability to encrypt backups with a password
TW_EXCLUDE_ENCRYPTED_BACKUPS := true
# Timezone fixes for some Qcom devices.
TARGET_RECOVERY_QCOM_RTC_FIX
TW_NO_LEGACY_PROPS -- NEED HELP
# Supply a custom init.rc for the recovery
TARGET_RECOVERY_INITRC := device/htc/pico/ramdisk/recovery/init.recovery.rc
# Set the default language, if not english
TW_DEFAULT_LANGUAGE := en-US
# Specify architecture
TARGET_ARCH := arm
# For people who would want to have ToyBox rather than Busybox
TW_USE_TOOLBOX := true
# Remove exFAT formatting binaries
TW_NO_EXFAT := true
# Remove SuperSU and stop TWRP prompts to install it
TW_EXCLUDE_SUPERSU := true
# An awesome way to take screenshots. Back-end improvement, no noticeable user side changes. Screenshots work without it too
TW_INCLUDE_FB2PNG := true
BOARD_USES_BML_OVER_MTD -- NEED HELP
# include Logcat daemon for help in debugging
TWRP_INCLUDE_LOGCAT := true
# See here : https://github.com/omnirom/android_bootable_recovery/blob/android-6.0/Android.mk#L435
TARGET_RECOVERY_DEVICE_MODULES := true
TARGET_USERIMAGES_USE_F2FS -- Include mkfs.f2fs for formatting partitions as F2FS
# Include a custom hardwarekeyboard.cpp . Can't see the point though.
TWRP_CUSTOM_KEYBOARD := device/lge/hammerhead/recovery/hardwarekeyboard.cpp
# Log touch input
TWRP_EVENT_LOGGING := true
# @yuwneg :My experience on MTK tablet, typical is RECOVERY_TOUCHSCREEN_SWAP_XY & RECOVERY_TOUCHSCREEN_FLIP_Y is use is pair as MTK vendor tend to use landscape LCD but a normal portrait Touch Screen !
TW_X_OFFSET -- X-Axis offset for borked displays
TW_Y_OFFSET -- Y-Axis offset for borked displays
# Smartwatch optimisation
TW_ROUND_SCREEN := true
TW_THEME -- New flag, takes in the following : portrait_mdpi, landscape_mdpi, portrait_hdpi,landscape_hdpi,watch_mdpi . It should be caps but when I was compiling a minute ago, it threw me an error and asked to de-caps it. So, see for yourself what works
TW_CUSTOM_THEME -- Use a custom theme like materialised by @z31s1g . Give the path to the contents here.
TWRP_NEW_THEME -- Old is gold. Put false to use the old one.
TW_EXTRA_LANGUAGES -- Set to true and enable localisation
TW_MTP_DEVICE -- Specify a custom device name for MTP
TW_TARGET_USES_QCOM_BSP -- Qcom specific enhancements
TARGET_PREBUILT_KERNEL -- Use a prebuilt kernel rather than building from source
TARGET_RECOVERY_PIXEL_FORMAT -- Use RGBA,RGBX,ARGB and whatever, I don't remember, see the main thread for that info.
TARGET_RECOVERY_OVERSCAN_PERCENT -- Defines the padding to leave around the screen edges
BOARD_USE_CUSTOM_RECOVERY_FONT -- Specify a .ttf file to use as default font
BOARD_CUSTOM_GRAPHICS -- include customised graphics backends if 3.0.0-0 broke stuff for you
TARGET_CUSTOM_KERNEL_HEADERS -- NEED HELP
TW_NEW_ION_HEAP -- NEED HELP
Self Explanatory
Code:
RECOVERY_TOUCHSCREEN_SWAP_XY
RECOVERY_TOUCHSCREEN_FLIP_X
RECOVERY_TOUCHSCREEN_FLIP_Y
RECOVERY_GRAPHICS_FORCE_USE_LINELENGTH -- Fixes slanty graphics
TW_DISABLE_DOUBLE_BUFFERING -- NEED HELP
TARGET_RECOVERY_FORCE_PIXEL_FORMAT -- NEED HELP FOR POSSIBLE INPUTS
BOARD_HAS_FLIPPED_SCREEN -- For people whose screens were mounted the wrong side across
TW_IGNORE_MAJOR_AXIS_0 -- NEED HELP
TW_IGNORE_MT_POSITION_0 -- NEED HELP
TW_IGNORE_ABS_MT_TRACKING_ID -- NEED HELP
TW_INPUT_BLACKLIST -- NEED HELP
TW_WHITELIST_INPUT -- NEED HELP
TARGET_HW_DISK_ENCRYPTION -- NEED HELP
TW_HAVE_X86_ACCELERATED_PIXELFLINGER -- Improvements for x86 based devices
ARCH_ARM_HAVE_NEON -- Take advantage of ARM-NEON optimisations
# remove TrueType fonts
TW_DISABLE_TTF:= true
# building of an OEM friendly TWRP. excludes SuperSu, uses Toolbox instead busybox, disables themeing. MORE INFOS TO BE ADDED
TW_OEM_BUILD := true
# Adds EXT4 formatting binaries
TARGET_USERIMAGES_USE_EXT4 := true
# exclude mtp from twrp (disable if you are not able to fix it device/kernel side, safes some space)
TW_EXCLUDE_MTP := true
# screen will stay awake
TW_NO_SCREEN_TIMEOUT := true
# needed on devices without a recovery partition (some devices have recovery included im boot.img)
TW_HAS_NO_RECOVERY_PARTITION := true
# removes the reboot option to boot into boooader, needed e.g. on samsung devices which use Download mode instead
TW_NO_REBOOT_BOOTLOADER := true
# add an option in reboot menu to reboot into Download Mode
TW_HAS_DOWNLOAD_MODE := true
# some devices don't have a temp sensor, disable in such case to stop spamming recovery.log
TW_NO_CPU_TEMP := true
# recursive delete by default instead fotmatting (available optional inside recovery settings too)
TW_ALWAYS_RMRF := true
# system won't be unmounted,
TW_NEVER_UNMOUNT_SYSTEM := true
# don't blank screen (available optional inside recovery settings too)
TW_NO_SCREEN_BLANK := true
# deprecated, use TW_INCLUDE_CRYPTO instead
TW_INCLUDE_JB_CRYPTO := true
# add support for encryption
TW_INCLUDE_CRYPTO := true
# use a custom init.rc in recovery, add the path. Example:
TARGET_RECOVERY_INITRC := device/samsung/p3100/rootdir/init.twrp.rc
# ToyBox (disables busybox?)
TW_USE_TOOLBOX := true
# exclude SuperSu e.g. to save some space or for different other reasons (supersu still included bx default?)
TW_EXCLUDE_SUPERSU := true
# include f2fs support (make sure your kernel supports f2fs!)
TARGET_USERIMAGES_USE_F2FS := true
# device resolution - deprecated, use TW_THEME instead
DEVICE_RESOLUTION :=
# define the theme for your device resolution, note: you can also use smaller/bigger themes because the theme get scaled for your deviceresolution anyway):
# 240x240 280x280 320x320
TW_THEME := watch_mdpi
# 320x480 480x800 480x854 540x960
TW_THEME := portrait_mdpi
# 720x1280 800x1280 1080x1920 1200x1920 1440x2560 1600x2560
TW_THEME := portrait_hdpi
# 800x480 1024x600 1024x768
TW_THEME := landscape_mdpi
# 1280x800 1920x1200 2560x1600
TW_THEME := landscape_hdpi
# auto copy files placed in device/$VENDOR/$DEVICENAME/recovery/root inside recovery ramdisk (e.g. init.recivery*.rc which get removed from recoveryramdisk by default). example:
TARGET_RECOVERY_DEVICE_DIRS += device/samsung/espresso-common
# path to a prebuild kernel (can be used if you are unable to compile a kernel yourself, e.g. if no kernel source available)
TARGET_PREBUILT_KERNEL := $(LOCAL_PATH)/prebuilt/zImage
# swap x anf y axis for touch
RECOVERY_TOUCHSCREEN_SWAP_XY := true
# flip x axis for touch
RECOVERY_TOUCHSCREEN_FLIP_X := true
# flip y axis for touch,
RECOVERY_TOUCHSCREEN_FLIP_Y := true
Gesendet von meinem LG-H815 mit Tapatalk
---------- Post added at 05:23 PM ---------- Previous post was at 05:19 PM ----------
# don't include default init.recovery.usb.rc, provide your own or use needed defines inside init.recovery.$DEVICE.rc
TW_EXCLUDE_DEFAULT_USB_INIT := true
Gesendet von meinem LG-H815 mit Tapatalk
Android-Andi said:
...
Gesendet von meinem LG-H815 mit Tapatalk
Click to expand...
Click to collapse
Thanks sir for the suggestions. I can see I've included the descriptions for most of them already, but I'll be sure to attribute to and add the rest tomorrow. I would be grateful if you could shed some light on the ones I've marked "NEED HELP"
MSF Jarvis said:
Thanks sir for the suggestions. I can see I've included the descriptions for most of them already, but I'll be sure to attribute to and add the rest tomorrow. I would be grateful if you could shed some light on the ones I've marked "NEED HELP"
Click to expand...
Click to collapse
I've done those stuff offline from your gist[emoji14]have seen this thread after that but maybe you like the way i showed the defines as it's setup the way you would do in your BoardConfig.mk.
Haven't done those flags i am not sure about myself, maybe @_that or @Dees_Troy can bring light to some of them.
Gesendet von meinem LG-H815 mit Tapatalk
This thread is a great idea.
Especially with the update to twrp 3.0 with new flags.
I've been lucky enough to be able to guess/puzzle out/grab from other device trees enough to build and use the recovery on my personal devices, but information like this is very helpful to have consolidated.
Thanks for sharing.
Android-Andi said:
I've done those stuff offline from your gist[emoji14]have seen this thread after that but maybe you like the way i showed the defines as it's setup the way you would do in your BoardConfig.mk.
Haven't done those flags i am not sure about myself, maybe @_that or @Dees_Troy can bring light to some of them.
Gesendet von meinem LG-H815 mit Tapatalk
Click to expand...
Click to collapse
Yeah, I just didn't have enough time to beautify it. Will gradually do so.
TW_CUSTOM_THEME := /path/to/theme/
this one is used to replace the stocktheme with a different one (like material-play)
the theme will be directly in ramdisk
TW_INCLUDE_INJECTTWRP := true — adds ability to inject TWRP into some Samsung boot images for Samsung devices that have recovery as a second ramdisk in the boot image
the second flag is quotes by dees_troy!
TW_NEW_ION_HEAP
this has sonething to do with 3.10 kernels and a different naming in /include/linux/ion.h ... like a switch between old heap_mask and new heap_id_mask
Sent from my Xperia T using XDA Free mobile app
Nice initiative with this thread, this has been oh say 2 years too long in the making haha.
TARGET_RECOVERY_FORCE_PIXEL_FORMAT
Not sure but I would imagine it overrides what TWRP detects nor do I see the difference between it and TARGET_RECOVERY_PIXEL_FORMAT. The only possible varible right now is RGB_565. BGRA_8888, RGBA_8888 and RGBX_8888 are not yet implemented.
TW_INPUT_BLACKLIST
Black list input devices that interfere with touch. For multiple input devices the delimiter is \x0a. You would basically build a special TWRP with TWRP_EVENT_LOGGING := true. Put it on the device and read the more verbose log to see what inputs you want to blacklist.
EDIT: Ah here is a copy of the wording I had in one of my xda posts about the subject and the commit link https://github.com/omnirom/android_bootable_recovery/commit/5742a40b87dfdc26df3bd9fe94197ae414ece546
Usage:
TW_INPUT_BLACKLIST := accelerometer
TW_INPUT_BLACKLIST := "accelerometer\x0agyroscope"
This can be used to fix touch input on devices where an input
device is breaking touch processing in TWRP.
We are using new line chars to separate multiple devices and in
the make file you specify the new line character with \x0a which
is the hex code in ASCII for a new line.
The new line character might be a bit of a pain to use as a
delimeter, but it is highly unlikely that an OEM will ever name
an input device with a new line character in the name.
Change-Id: I255136b7a686909a23e649918c661843153c2853
Click to expand...
Click to collapse
and here is an example from my BoardConfig
TW_INPUT_BLACKLIST := "accelerometer\x0admard06\x0alis3dh_acc\x0alis3de_acc"
On a side note is there a link somewhere to fixing graphics issues induced in 3.0? I see a lot of talk about it but nothing substantial.
aicjofs said:
On a side note is there a link somewhere to fixing graphics issues induced in 3.0? I see a lot of talk about it but nothing substantial.
Click to expand...
Click to collapse
Not really. Slanty graphics can be fixed with linelength, but as such there's nothing on that front. You might wanna slap a recovery.log onto Dees_Troy at #twrp on webchat.freenode.net though.
Every version has new flags introduced & also flags deprecated...
TARGET_USES_LOGD => Source
TW_SCREEN_BLANK_ON_BOOT ( Deprecated on android-6.0 => Source, on some legacy devices, TWRP will not boot without this flag)
Dees_Troy said:
There are other build flags which you can locate by scanning the Android.mk files in the recovery source. Most of the other build flags are not often used and thus I won't document them all here.
Source
Click to expand...
Click to collapse
Use the_silver_searcher, its extremely fast ! :good:
Code:
cd ~/cm/bootable
ag -ia "[URL="https://gerrit.omnirom.org/#/c/16610/"]TW_INCLUDE_JPEG[/URL]" recovery/
recovery/minuitwrp/resources.cpp
34:#ifdef TW_INCLUDE_JPEG
256:#ifdef TW_INCLUDE_JPEG
361:#ifdef TW_INCLUDE_JPEG
367:#ifdef TW_INCLUDE_JPEG
recovery/minuitwrp/Android.mk
61:ifneq ($(TW_INCLUDE_JPEG),)
64: LOCAL_CFLAGS += -DTW_INCLUDE_JPEG
176:ifneq ($(TW_INCLUDE_JPEG),)
recovery/prebuilt/Android.mk
126:ifneq ($(TW_INCLUDE_JPEG),)
Code:
ag -ia "[COLOR="Blue"]TW_FLASH_FROM_STORAGE[/COLOR]" recovery/
recovery/Android.mk
262:#ifeq ($(TW_FLASH_FROM_STORAGE), true) [COLOR="Blue"]Making this the default behavior[/COLOR]
263: LOCAL_CFLAGS += -DTW_FLASH_FROM_STORAGE
As the code says, its already the default therefore you don't need to specify it again on BoardConfig.mk
Code:
ag -ia "[URL="https://gerrit.omnirom.org/#/c/14099/"]TW_INCLUDE_NTFS_3G[/URL]" recovery/
recovery/Android.mk
440:ifeq ($(TW_INCLUDE_NTFS_3G),true)
recovery/prebuilt/Android.mk
201:ifeq ($(TW_INCLUDE_NTFS_3G),true)
At the omnirom gerrit, you'll find all commits though you gotta search for it or try this or this for TWRP related
Code:
ag -ia "[COLOR="blue"]TW_BOARD_CUSTOM_GRAPHICS[/COLOR]" recovery/
recovery/minuitwrp/Android.mk
14:ifneq ($(TW_BOARD_CUSTOM_GRAPHICS),)
16: $(warning * TW_BOARD_CUSTOM_GRAPHICS support has been deprecated in TWRP. *)
Code:
ag -ia "[COLOR="Blue"]TW_DISABLE_TTF[/COLOR]" recovery/
recovery/minuitwrp/Android.mk
165:ifeq ($(TW_DISABLE_TTF), true)
167: $(warning * TW_DISABLE_TTF support has been deprecated in TWRP. *)
recovery/prebuilt/Android.mk
192:ifneq ($(TW_DISABLE_TTF), true)
Code:
BOARD_SUPPRESS_SECURE_ERASE := true
BOARD_SUPPRESS_EMMC_WIPE := true
Source, further explanation here
Code:
__bionic_open_tzdata: couldn't find any tzdata when looking for localtime!
__bionic_open_tzdata: couldn't find any tzdata when looking for GMT!
__bionic_open_tzdata: couldn't find any tzdata when looking for posixr!
Fix tzdata on recovery.log => Source
AIO-TWRP-Compiler on BBQLinux
First step
Refer to here on how to setup BBQLinux either native boot, dual-boot or on VBox... :good:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Download the script & extract it to your HOME or if you are 100% sure that you have already setup a fully working Build Environment on Ubuntu or any other linux distro then remark these lines.
Start Terminal => Edit => Profile Preferences => Colors => unchecked => Use colors from system theme => Built-in schemes => White on Black => Close
BBQLinux => Menu => Administration => BBQLinux Python Switcher => Python 2
BBQLinux => Menu => Administration => BBQLinux Java Switcher => OpenJDK 7
Start the script with below command
Code:
sh twrp
Menu 1
You can use either OmniROM or Cyanogenmod repo to build TWRP
Choose either to use TWRP branch android-5.1 or android-6.0. Typically, for legacy devices with ICS or JB doesn't support TTF so if TWRP android-6.0 doesn't boot then you'll have to use android-5.1 branch.
You can either choose to use Full-Source or Part-Source. Compiled out recovery.img will have exactly the same size & files on ramdisk.
Yes, Part-Source is only using 41 of the projects to build a fully working TWRP. Syncing in progress. After syncing, you can refer to ~/AIO-TWRP-Compiler/sync.log for any error
Typically, when you have already downloaded the base repo, re-syncing it will only take a few seconds
Menu 2
Copy either your boot or recovery.img to ~/AIO-TWRP-Compiler folder
Key-in your vendor name
Key-in your device name
This step is extracting the ro.product.device & ro.product.model from your device directly which is typically require for identification when flashing update.zip from your vendor
Credits to RD osm0sis, the script will auto download osm0sis's unpackbootimg for mkbootimg arguments required for repacking recovery.img . . . :good:
mkbootimg arguments will be display & auto updated to the BoardConfig.mk
Part of the original mkvendor.sh script is adapted for the extraction of boot or recovery.img which also does the git initialization. If the ramdisk can be unpack then the recovery.fstab will be copied to the device tree folder, if not then it will create a basic MTK recovery.fstab, boot.mk & also BOARD_CUSTOM_BOOTIMG_MK. If you're not building for MTK then remove that line from BoardConfig.mk
You will need to add/ remove TWRP flags accordingly & manual edit on the TARGET_CPU_VARIANT either cortex-a7 or cortex-a9 for older MTK, refer to your device spec. Possible values are cortex-a5, cortex-a7, cortex-a8, cortex-a9, cortex-a15, krait, scorpion. Use generic for devices that do not have a CPU similar to any of the supported cpu variants
You will need to manual edit on the recovery.fstab to suit your device or TWRP-ify the extracted stock recovery.fstab
Menu 3
omni.dependencies is only a warning, will continue to build when you choose OmniROM repo
Make 4.1 is only a warning, will continue to build
Java 1.7 is only a warning, will continue to build
When you have build earlier, subsequent build will only take few minutes bcos of CCACHE... :good:
Menu 4
Updated Menu 4 support for Others. Or you can use Flashify or Rashr or above Others to install compiled recovery.img to your device, do check if they are compatible or it will brick your recovery or worse, whole device !
Key-in your device recovery partition path. Above is typical for LG
Done, test TWRP on your device to make sure it is working properly if not then add or remove flags accordingly & use Menu 3 to build again
Menu 5
Choose either Option 1 or 2, Option 2 is recommended & it won't take long if you are using Part-Source.
Menu 6
The script will auto open up a new browser for you to register a new account on github
Your device tree on github
AIO-TWRP-Compiler
bash script itself is self-explanatory. Thanks to the OP, he has offer to take over the maintenance of this script so hit your Thanks button to him... :good: If you found any error/ bug or have any new ideas/ features for this script then pm the OP or do a git pull request... :good:
Above is the detail explanation on the script GUI front-end, here i'll explained what the script actually does.
Menu 1
This menu will create a local_manifest.xml to remove unwanted projects based on your selection. When select Full-Source, it will also create local_manifest.xml to remove existing recovery & replace it with TWRP based on your selection.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remove-project name="android_bootable_recovery" />
<project path="bootable/recovery" name="omnirom/android_bootable_recovery" revision="[COLOR="Blue"]android-6.0[/COLOR]" />
</manifest>
Part-Source
It is normal that OmniROM & CM will consistently add new projects to their repo when they introduce new features or functions to it. The beauty of this Part-Source is that even when projects grows, this script will grep -v only the needed projects for building TWRP on any base repo.
This Part-Source is the extreme minimal for building TWRP therefore some of the additional projects are needed when you use particular TWRP flags. As of today ( March 2016 ), it will build a fully working TWRP with only 44 projects on both OmniROM 4.4 & CM 11 base repo. In the future, Teamwin may also add a new feature or function then you will also need to add additional projects to it too or OP will update it based on your feedback. Refer to compile.log for details.
Code:
# Optional => TARGET_USERIMAGES_USE_F2FS := true
[COLOR="Red"]#[/COLOR]grep -v f2fs-tools ~/x > ~/x.tmp;mv ~/x.tmp ~/x
If you use TARGET_USERIMAGES_USE_F2FS := true then remove the remark #
Code:
# Optional => TW_INCLUDE_NTFS_3G := true
[COLOR="Red"]#[/COLOR]grep -v external/ntfs-3g ~/x > ~/x.tmp;mv ~/x.tmp ~/x
if you use TW_INCLUDE_NTFS_3G := true then remove the remark #
Code:
# Optional => TW_USE_TOOLBOX := true
[COLOR="red"][B]#[/B][/COLOR]grep -v external/toybox ~/x > ~/x.tmp;mv ~/x.tmp ~/x
[COLOR="Red"]#[/COLOR]grep -v external/mksh ~/x > ~/x.tmp;mv ~/x.tmp ~/x
If you use TW_USE_TOOLBOX := true then remove the remark #. toybox available on android-6.0/ cm-13.0 only, don't have such projects on android-4.4 but it'll work, refer to the end for more info.
Code:
# un-remark the below required for x64
[COLOR="Red"]#[/COLOR]grep -v linux-x86/aarch64/aarch64-linux-android-4.8 ~/x > ~/x.tmp;mv ~/x.tmp ~/x
[COLOR="red"]#[/COLOR]grep -v linux-x86/aarch64/aarch64-linux-android-4.9 ~/x > ~/x.tmp;mv ~/x.tmp ~/x
Code:
TARGET_ARCH := arm64
TARGET_CPU_ABI := arm64-v8a
TARGET_CPU_ABI2 := armeabi-v7a
TARGET_ARCH_VARIANT := armv8-a
TARGET_CPU_VARIANT := generic
TARGET_2ND_ARCH := arm
TARGET_2ND_ARCH_VARIANT := armv7-a-neon
TARGET_2ND_CPU_ABI := armeabi-v7a
TARGET_2ND_CPU_ABI2 := armeabi
TARGET_2ND_CPU_VARIANT := cortex-a7
If you are building x64 TWRP then remove the remark # & update BoardConfig.mk accordingly. Take note, not available on android-4.4/ cm-11.0 base repo, use later base repo.
Code:
# un-remark the below required for kernel compiling if not using TARGET_PREBUILT_KERNEL
[COLOR="red"]#[/COLOR]grep -v linux-x86/arm/arm-eabi-4.6 ~/x > ~/x.tmp;mv ~/x.tmp ~/x
[COLOR="red"]#[/COLOR]grep -v linux-x86/arm/arm-eabi-4.7 ~/x > ~/x.tmp;mv ~/x.tmp ~/x
[COLOR="red"]#[/COLOR]grep -v linux-x86/arm/arm-eabi-4.8 ~/x > ~/x.tmp;mv ~/x.tmp ~/x
if you are building your own kernel then remove the remark #
Code:
# Optional for x86 SoC
[COLOR="Red"]#[/COLOR]grep -v linux-x86/x86/i686-linux-android-4.7 ~/x > ~/x.tmp;mv ~/x.tmp ~/x
[COLOR="red"]#[/COLOR]grep -v linux-x86/x86/x86_64-linux-android-4.8 ~/x > ~/x.tmp;mv ~/x.tmp ~/x
[COLOR="red"]#[/COLOR]grep -v linux-x86/x86/x86_64-linux-android-4.9 ~/x > ~/x.tmp;mv ~/x.tmp ~/x
Code:
TARGET_ARCH := [COLOR="blue"]x86[/COLOR]
TARGET_CPU_ABI := armeabi
TARGET_ARCH_VARIANT := [COLOR="blue"]x86[/COLOR]
TARGET_CPU_VARIANT := [COLOR="blue"]x86[/COLOR]
if you are building for Intel SoC then remove the remark # & edit the BoardConfig.mk accordingly
This script has been tested & it works on any base repo from OmniROM android-4.4, 5.0, 5.1 & 6.0 & Cyanogenmod cm-11.0, cm-12.0, cm12.1 & cm13.0 using Full-Source or Part-Source but why use Full-Source to build TWRP when Part-Source works, most importantly, you are not building OmniROM or Cyanogenmod but TWRP.... Using android-4.4/ cm-11.0 base repo has its advantage, compiled TWRP size will be smaller & it can build all version.
If you use android-6.0/ cm-13.0 then obviously you can only build TWRP android-6.0 only, just edit the line 62, 63 for OmniROM or 72, 73 for CM accordingly. Building TWRP android-4.4 on cm-13.0 or on OmniROM android-6.0 will result in a build error ! Later base repo won't build TWRP older version !
Many newbies doesn't know that OmniROM/ CM repo are incremental updates & they create a separate cm11, cm12, cm12.1, cm13 each & sync individually to each of these folders.
Above syncing cm-13.0 & as you can see, it is also using source from cm-10.1, 10.2 & 11. Syncing all to the same ~/omni or ~/cm folder will do.
Sometimes on certain devices, OmniROM android-4.4 or Cyanogenmod cm-11.0 base repo just won't boot then you can try by editing this line to android-5.0 or cm-12.0 & updating it will only take a very short time if you use Part-Source.
Menu 2
Device tree
This script will create a barebone minimal device tree for building TWRP. Anything less will result in a build error. It will create five files which is just sufficient to build a fully working TWRP using prebuilt kernel. It will build kernels too, just update the correct kernel config to BoardConfig.mk & remove the remark # needed projects for building kernels. However, i don't see the needs to build the same kernel with every TWRP new build, it will take a longer time to build, most importantly, you are not building a ROM.
Code:
PRODUCT_MAKEFILES := \
$(LOCAL_DIR)/cm_[COLOR="blue"]device name that you have key-in[/COLOR].mk
AndroidProduct.mk
Code:
TARGET_ARCH := arm
TARGET_CPU_ABI := armeabi
TARGET_ARCH_VARIANT := armv7-a-neon
TARGET_CPU_VARIANT := [COLOR="blue"]cortex-a9[/COLOR] [COLOR="Red"]<= You only need to change this to suit your device[/COLOR]
BOARD_RECOVERYIMAGE_PARTITION_SIZE := [COLOR="Red"]0x105c0000[/COLOR] [COLOR="red"]<= You need to update this so that build will error out when the size exceed your recovery partition size[/COLOR]
BOARD_FLASH_BLOCK_SIZE := 131072
TARGET_PREBUILT_KERNEL := device/TD2/9300/kernel
BOARD_MKBOOTIMG_ARGS := --base 10000000 --pagesize 2048 --kernel_offset 00008000 --ramdisk_offset 01000000 --tags_offset 00000100
[COLOR="Blue"]#MTK common twrp flags[/COLOR] [COLOR="Red"]<= You only need to change the below flags to suit your device[/COLOR]
TW_NO_EXFAT := true
TWHAVE_SELINUX := true
TW_DISABLE_TTF := true [COLOR="red"]<= Will error out on TWRP android-6.0[/COLOR]
[COLOR="red"]#[/COLOR]TW_USE_TOOLBOX := true [COLOR="red"]<= You'll need extra projects for this flag, edit the script accordingly[/COLOR]
TW_NO_EXFAT_FUSE := true
TW_THEME := [URL="https://github.com/omnirom/android_bootable_recovery/blob/android-6.0/gui/Android.mk#l96-L100"]portrait_mdpi[/URL]
[COLOR="red"]#[/COLOR]RECOVERY_SDCARD_ON_DATA := true [COLOR="red"]<= For [URL="https://twrp.me/faq/datamedia.html"]data/media[/URL] device[/COLOR]
TW_USE_MODEL_HARDWARE_ID_FOR_DEVICE_ID := true
TARGET_USE_CUSTOM_LUN_FILE_PATH := "/sys/devices/platform/mt_usb/gadget/lun%d/file"
BoardConfig.mk
Code:
# Inherit device configuration
$(call inherit-product, device/[COLOR="blue"]TD2[/COLOR]/[COLOR="blue"]9300[/COLOR]/device_[COLOR="blue"]9300[/COLOR].mk)
## Device identifier. This must come after all inclusions
PRODUCT_DEVICE := [COLOR="blue"]9300[/COLOR]
PRODUCT_NAME := cm_[COLOR="blue"]9300[/COLOR]
PRODUCT_BRAND := [COLOR="blue"]TD2[/COLOR]
PRODUCT_MODEL := [COLOR="blue"]9300[/COLOR]
PRODUCT_MANUFACTURER := TD2
Code:
$(call inherit-product, build/target/product/[URL="https://github.com/CyanogenMod/android_build/blob/cm-11.0/target/product/full_base_telephony.mk"]full_base_telephony.mk[/URL])
# Time Zone data [COLOR="red"]<= This have been disable as some device will not boot, to enable it just remove the remark [B]#[/B] below[/COLOR]
[COLOR="red"]#[/COLOR]PRODUCT_COPY_FILES += \
[COLOR="Red"]#[/COLOR]bionic/libc/zoneinfo/tzdata:recovery/root/system/usr/share/zoneinfo/tzdata
PRODUCT_BUILD_PROP_OVERRIDES += \
PRODUCT_MODEL="i9300" \ [COLOR="Red"]<= This is where Menu 2 will get the ro.product.device & ro.product.model info[/COLOR]
TARGET_DEVICE="bird77_a_cu_ics2"
PRODUCT_NAME := full_[COLOR="Blue"]9300[/COLOR]
PRODUCT_DEVICE := [COLOR="blue"]9300[/COLOR]
device_(device-name).mk & cm.mk will be auto-created based on what you have key-in for the vendor & device name at Menu 2
For building recovery, you don't need to use full.mk, using it will result in need of extra projects on the Part-Source & it will also copy the extra fstab.goldfish & ueventd.goldfish.rc to the root of the ramdisk
Code:
# mount point fstype device [device2]
/boot emmc /dev/bootimg
/recovery emmc /dev/recovery
/system ext4 /dev/block/mmcblk0p3
/cache ext4 /dev/block/mmcblk0p4
/data ext4 /dev/block/mmcblk0p5
/emmc vfat /dev/block/mmcblk0p6 flags=display="Phone Storage";settingsstorage
/sdcard vfat /dev/block/mmcblk1p1 flags=display="SD Card";storage;removable
/sd-ext auto /dev/block/mmcblk1p2
/nvram emmc /dev/nvram flags=display="Nvram";backup=1
/uboot emmc /dev/uboot flags=display="Uboot";backup=1
#/boot emmc /dev/block/platform/mtk-msdc.0/by-name/boot flags=display="Boot";backup=1
#/recovery emmc /dev/block/platform/mtk-msdc.0/by-name/recovery flags=display="Recovery";backup=1
#/system ext4 /dev/block/platform/mtk-msdc.0/by-name/system flags=display="System";backup=1
#/cache ext4 /dev/block/platform/mtk-msdc.0/by-name/cache flags=display="Cache"
#/data ext4 /dev/block/platform/mtk-msdc.0/by-name/userdata flags=encryptable=/dev/block/platform/mtk-msdc.0/by-name/metadata
#/nvram emmc /dev/block/platform/mtk-msdc.0/by-name/nvram flags=display="Nvram";backup=1;flashimg=1
#/external_sd auto /dev/block/mmcblk1p1 flags=display="External SDcard";storage;wipeingui;removable;backup=0
#/usbotg auto /dev/block/sda1 flags=display="Usb-Otg";storage;removable;backup=0
#/boot mtd boot
#/recovery mtd recovery
#/cache yaffs2 cache
#/data yaffs2 userdata
#/misc mtd misc
#/system yaffs2 system
#/sdcard vfat /dev/block/mmcblk0p1
#/sd-ext ext4 /dev/block/mmcblk0p2
recovery.fstab - Edit or delete whatever that is not relevant to your device. Use osm0sis AIK to unpack your stock recovery.img & TWRP-ify the recovery.fstab... :good:
Code:
#
# Copyright (C) 2013 Intel Mobile Communications GmbH
#
# Sec Class: Intel Confidential (IC)
#
# Android fstab file.
#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
# The filesystem that contains the filesystem checker binary (typically /system) cannot
# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
#
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID068 /system ext4 defaults defaults
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID069 /data ext4 defaults defaults
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID070 /cache ext4 defaults defaults
/dev/block/mmcblk1p1 /sdcard vfat defaults defaults
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID076 /nvm_fs_partition ext4 defaults defaults
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID074 /misc emmc defaults defaults
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID071 /boot emmc defaults defaults
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID119 /recovery emmc defaults defaults
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID120 /recoverym emmc defaults defaults
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID001 /mobilevisor emmc defaults defaults
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID013 /splash_screen emmc defaults defaults
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID115 /mvconfig emmc defaults defaults
/dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID118 /secvm emmc defaults defaults
Most latest Android devices are using fstab version 2 AKA fstab 2 while TWRP is using fstab 1. Eg. Above is my Intel X3 stock recovery.fstab
Code:
# mount point fstype device [device2]
/boot emmc /dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID071
/recovery emmc /dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID119 flags=display=recovery;backup=1
/imei emmc /dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID022 flags=display=imei;backup=1
/mobilevisor emmc /dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID001 flags=display=mobilevisor;backup=1
/mvconfig emmc /dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID115 flags=display=mvconfig;backup=1
/secvm emmc /dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID118 flags=display=secvm;backup=1
/system ext4 /dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID068
/data ext4 /dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID069
/cache ext4 /dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID070
/nvm_fs_partition ext4 /dev/block/platform/soc0/e0000000.noc/by-name/ImcPartID076
/external_sd vfat /dev/block/mmcblk1p1 flags=display="Micro SDCard";storage;removable
/usbotg auto /dev/block/sda1 flags=display=USB-OTG;storage;removable
My TWRP-ify recovery.fstab. Typically, for ext4 partition, you don't need to specify flags=display= & backup=1, it will be taken care of by TWRP, for more info regarding fstab flags then refer to Main Thread for *RECOVERY.FSTAB*... :good:
RD osm0sis's unpackbootimg is able to extract --second <2ndbootloader-filename> & also --second_offset <address>
The repack arguments will be auto-updated to the BoardConfig.mk Thanks to RD osm0sis. Some TWRP flags ref taken from here... :good:
osm0sis's unpackbootimg also support --dt <filename> :good:
Some devices require additional info for factory update.zip then add it accordingly to the device tree, typically is your device_(device-name).mk. Look at other device tree here & here & here for reference. On CM base repo, you can also use mkvendor.sh... :good: However, you will need to manually edit certain files as no DEV has been updating it, currently it will result in a build error even when using Full-Source !
Do take note that even an extra space on some of the lines at BoardConfig.mk will result in a build error !
Menu 3
Below are the commands to build TWRP, thats it !
Code:
cd ~/omni
[COLOR="blue"]OR[/COLOR]
cd ~/cm
prebuilts/misc/linux-x86/ccache/ccache -M 25G
export USE_CCACHE=1
export LC_ALL=C
source build/envsetup.sh
lunch [COLOR="blue"]omni[/COLOR]_S939-eng [COLOR="blue"]<= S939 is the device name[/COLOR]
[COLOR="Blue"]OR[/COLOR]
lunch [COLOR="blue"]cm[/COLOR]_S939-eng
make -j4 recoveryimage
Menu 4
Below command generically will work on most Android devices. Updates : Has updated this menu to support this, just key-in /path-to-your-device-recovery-partition
Code:
adb push [COLOR="blue"]$OUT[/COLOR]/recovery.img /data/local/tmp
adb shell su -c "dd if=/data/local/tmp/recovery.img of=/[COLOR="blue"]path-to-your-device-recovery-partition[/COLOR]"
To use the $OUT path, you must first source it then lunch your device name, refer to previous Menu 3 for info.
Menu 5
Option 1 is make clean
Option 2 is wipe the whole repo base folder except the hidden .repo folder. As mention on the script GUI front-end, after that, use Menu 1 will have all the files extracted out.
Menu 6
This menu is using curl to create github repo.
It is for you to publish your device tree either for diagnostic & debugging when you ask for help. It is also for you to share a working build so that others can refer to it when they make a build of their own or git clone yours & build it themselves.
Preface & Credits
Many newbies make mistake by using other DEV's device tree which is normally meant for building ROMs, using it to build TWRP therefore will result in alot of build errors !
Above script can also be use to build TWRP for any Android devices that uses standard Android header, except for Menu 4 which is specifically for MTK devices only. Just edit the script to add support for your device... :good: Updated support for other devices
This project was actually started way back at 2013 & this is the main reason why TWRP doesn't build is bcos of the tedious, confusing & wrong Build Environment setup, it is all so different on so many different linux distros & OSes version, i went on to developed Easy Magic TWRP.... Now i use Intel device & this script did build a working TWRP for it too.... :laugh:
That's why i strongly recommends BBQLinux for beginners, Thanks to RD codeworkx, i can guarantee that any Build Error is not cause by wrong BE setup as its already built-in on BBQLinux... :good:
The other reason TWRP doesn't boot is bcos of wrong mkbootimg repack arguments, Thanks to RD osm0sis for his awesome unpackbootimg... :good:
Since many newbies are having problems with building TWRP & flooding the TWRP thread here
Dees_Troy said:
This guide isn't going to be a step-by-step, word-for-word type of guide. If you're not familiar with basic Linux commands and/or building in AOSP then you probably won't be able to do this.
Click to expand...
Click to collapse
Which is actually meant for intermediate users, i've offered to share this script when OP decided to open up a new thread here for TWRP flags.... :good:
Credits Updates
Hacker432 for testing & feedbacks on this script, now it uses the ATC folder so that it'll support other languages other than English & TWRP will boot now when build on cm-12.1 base repo... :good:
OP for giving this script a glamour name ATC aka AIO-TWRP-Compiler... :laugh: :highfive: :good:
My TWRP doesn't boot
Try unpack/ repack your stock 3e recovery.img with AIK, push it to your device & if it doesn't boot then obviously your device is not using standard Android header & so does this script will not build a bootable TWRP. Try google your device info on how they did it, Eg. Sony devices uses BOARD_CUSTOM_BOOTIMG_MK for repacking boot & recovery.img & update it accordingly to your BoardConfig.mk
Code:
adb shell cat /proc/last_kmsg
[COLOR="Blue"]OR[/COLOR]
adb shell cat /proc/last_kmsg > kmsg.txt
[U][COLOR="blue"]On Android-6.0 Marshmallow[/COLOR][/U]
adb shell cat /sys/fs/pstore/console-ramoops
[COLOR="blue"]OR[/COLOR]
adb shell cat /sys/fs/pstore/console-ramoops > kmsg.txt
Source
Extreme minimal, TWRP require this only one flag TW_THEME := to build or it will error out. You will also need other flags as well, refer to the OP. Some devices won't boot when certain TWRP flag is used or not used bcos its not compatible with your device kernel ! Most legacy device doesn't support TTF & TWRP won't boot so you have to build with TWRP android-5.1 with TW_DISABLE_TTF := true flag
Code:
[URL="https://github.com/TeamWin/android_device_kazam_thunder_q45/blob/cm-10.2/BoardConfig.mk#l49"]TW_NO_EXFAT := true[/URL] [COLOR="Red"]<= To disable exfat[/COLOR]
[URL="https://github.com/TeamWin/android_device_kazam_tornado_348/blob/android-4.4/BoardConfig.mk#l50"]TW_NO_EXFAT_FUSE := true[/URL] [COLOR="Red"]<= To disable exfat[/COLOR]
[URL="https://github.com/carliv/device_elephone_p6000/blob/cm-11.0/BoardConfig.mk#l110"]TW_USE_TOOLBOX := true[/URL] [COLOR="red"]<= Using this flag will use toolbox instead of busybox[/COLOR]
Above are some of the flags that can cause TWRP not to boot up. If you are using Part-Source then you need to add additional projects to support these flags as most of them are disabled on the script. Just remove the remarks # from the script for that particular projects. More detail info refer to above post #11 Part-Source.
Refer to the most bottom Bug Report on how to obtain recovery.log, without it nobody is able to help you.
Code:
[URL="https://github.com/omnirom/android_bootable_recovery/blob/android-6.0/minuitwrp/Android.mk#l122-l130"]TARGET_RECOVERY_PIXEL_FORMAT := ABGR_8888[/URL]
TARGET_RECOVERY_PIXEL_FORMAT := RGBX_8888
TARGET_RECOVERY_PIXEL_FORMAT := BGRA_8888
The other reason it doesn't boot is that it actually does boot up but the screen is blank ! Try adb shell & it should work on this scenario.
Try different pixel format one at a time, one of them should work.
Code:
[URL="https://github.com/omnirom/android_bootable_recovery/blob/android-6.0/minuitwrp/Android.mk#l114-l116"]TARGET_RECOVERY_FORCE_PIXEL_FORMAT := RGB_565[/URL]
[URL="https://github.com/omnirom/android_bootable_recovery/blob/android-6.0/minuitwrp/Android.mk#l79"]RECOVERY_GRAPHICS_FORCE_USE_LINELENGTH := true[/URL]
[URL="https://gerrit.omnirom.org/#/c/13948/"]TW_DISABLE_DOUBLE_BUFFERING := true[/URL]
When not setting any pixel format, the default is RGB565 & it should work on most Android devices. You can also try the above when non of them works.
Code:
[URL="https://github.com/omnirom/android_bootable_recovery/blob/android-6.0/minuitwrp/Android.mk#L14-L19"]TW_BOARD_CUSTOM_GRAPHICS[/URL]
If your existing device tree uses this & all the above doesn't work then drop by at TWRP IRC channel to get further help.
Source
Miscellaneous Tips
As mentioned many times, most of the time build error is bcos of wrong BE setup, use BBQLinux & you'll get over it. If you have already build on other distro then refer to here on how to use this script or migrate the source code .repo to BBQLinux.
Code:
[URL="https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/variables.h#l173"]TARGET_USE_CUSTOM_LUN_FILE_PATH[/URL]
[URL="https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/data.cpp#l828"]TW_BRIGHTNESS_PATH[/URL] [COLOR="blue"]<= If not define, TWRP will look for it [URL="https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/data.cpp#l840-l841"]here[/URL][/COLOR]
[URL="https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/data.cpp#l855"]TW_SECONDARY_BRIGHTNESS_PATH[/URL]
[URL="https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/data.cpp#l1076"]TW_MAX_BRIGHTNESS[/URL] [COLOR="blue"]<= If not define, TWRP will [URL="https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/data.cpp#l56-l58"]set it[/URL][/COLOR]
[URL="https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/data.cpp#l967"]TW_CUSTOM_BATTERY_PATH[/URL] [COLOR="Blue"]<= If not define, TWRP will use [URL="https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/data.cpp#l972"]this[/URL] or [URL="https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/data.cpp#l986"]this[/URL] [/COLOR]
[URL="https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/data.cpp#l937"]TW_CUSTOM_CPU_TEMP_PATH[/URL] [COLOR="blue"]<= if not define, TWRP will use [URL="https://github.com/omnirom/android_bootable_recovery/blob/android-5.1/data.cpp#l942"]this[/URL][/COLOR]
TWRP has everything specified to standard Android path unless when it doesn't work then you'll need to find that out yourself. Do take note that some device doesn't support certain feature such as CPU temperature, battery level, mount USB storage & etc then refer to the OP for flags to disable it.
Code:
adb shell su -c "ls -R" > [COLOR="Blue"]myAndroid.txt[/COLOR]
Above command will list out everything on your device.
Code:
adb shell su -c cat /sys/class/power_supply/battery/capacity
[COLOR="blue"]88[/COLOR]
Eg. Say the battery capacity doesn't work then look for that path at myAndroid.txt for something that says battery/capacity & specify it at BoardConfig.mk
Code:
adb shell cat /sys/class/thermal/thermal_zone0/temp
[COLOR="Blue"]27516[/COLOR]
If CPU temperature doesn't work then look for thermal/temp
Code:
adb shell
su
echo 0 > /sys/devices/platform/i2c-gpio.24/i2c-24/24-002c/backlight/lcd-backlight/brightness
echo 255 > /sys/devices/platform/i2c-gpio.24/i2c-24/24-002c/backlight/lcd-backlight/brightness
If brightness doesn't work, look for lcd-backlight/brightness, Eg. above command should be able to change the level of brightness if that is the correct path as indicated at myAndroid.txt.
Sync corruption
git & repo is like a Super Intelligent Source Code Auto-Resume Downloader when working together . . . :good:
You can stop it at any time, restart it back & it will auto-resume. cm repo & source code is located at ~/cm/.repo, omni at ~/omni/.repo it is a hidden folder & to view hidden folder via File Manager, you need to press Ctrl + h
Sometimes you have corruption then repo sync wouldn't work & normally you just need to delete manifests, manifests.git, manifests.xml with a repo init & repo sync then you'll be back to normal.
If still this doesn't solve the problem then delete everything EXCEPT the folder project-objects & projects, both of this is the actual source code folder.
After this a repo init then repo sync & everything will be back to normal, i guarantee, done this many times, no worries . . . :laugh:
Sometimes when you have severe data corruption, above technique will not work then manually cd ~/cm or ~/omni then repo init then repo sync & see what repo & git has to say then follow the on-screen instructions to remove the corrupted projects.
Scroll back up & see what the error was, remove the corrupted project then repo sync. In this case is rm -rf ~/cm/.repo/projects/prebuilts/clang/linux-x86/host/3.5.git
Subsequent sync show above error. rm -rf ~/cm/.repo/project-objects/CyanogenMod/android_external_icu.git
rm -rf ~/cm/.repo/projects/external/jemalloc.git
rm -rf ~/cm/.repo/projects/system/extras/su.git
rm -rf ~/cm/.repo/projects/external/libcxx.git
rm -rf ~/cm/.repo/projects/external/libcxxabi.git
rm -rf ~/cm/.repo/projects/external/libunwind.git
rm -rf ~/cm/.repo/project-objects/CyanogenMod/android_external_busybox.git
And finally all corrupted projects has been removed, subsequent repo sync & all files will be auto-extracted out.
Corrupted .repo folder
i've make a back up of my .repo folder using tar.gz compression years ago & when extracting out, normally will end with data corruptions except if you use lrzip... :good: You will need to manually remove all the text files such as hooks, pre-auto-gc & commit-msg which is supposed to be a symlink files.
After you force overwrite extraction, a repo init & repo sync will end with above message.
You will need to manually delete all the hooks.txt file found at .repo folder
You will need to manually delete all the commit-msg.txt file
You will need to manually delete all the pre-auto-gc.txt file. You might need to repo sync --force-sync many times to overwrite all the corrupted projects & after that, you won't be getting any of these error messages again.
Syncing work tree error - Doesn't check out all files
This operation must be run in a work tree
Run the below command will give you hint
Code:
repo --trace sync -l
Above hints the corrupted projects so remove it => rm -rf /home/yuweng/cm/.repo/projects/frameworks/ex.git
repo sync still it doesn't extract out all the files so you need to run repo --trace sync -l again. Delete the hinted project => rm -rf /home/yuweng/cm/.repo/projects/frameworks/webview.git
When all error has been fixed, a repo sync & all the files will be extracted out correctly
Source
Bug report
Zip & attach the ~/AIO-TWRP-Compiler/compile.log to your post when replying.
Refer to here on how to submit a proper TWRP bug report . . . :good:
How to obtain recovery log
adb pull /tmp/recovery.log -> Attach to your post
At TWRP -> BackUp -> After Backup go to Advanced -> Copy Log to SDCard
Typically you will find the recovery.log at
Typical Internal SdCard
/emmc/TWRP/BACKUPS/ [Your Device Name] / [Backup date] [ro.mediatek.version.release]
/data/media
/data/media/0
or
Typical External SdCard
/sdcard/TWRP/BACKUPS/ [Your Device Name] / [Backup date] [ro.mediatek.version.release]
Attach it to your post.
At TWRP console (Square button at button) -> You can view the log
If TWRP crash when executing certain menu/ function/ feature then you can use My Master Shifu _that gdb technique for debugging & submit the back trace to Teamwin so that they can fix it... :good:
Try IRC channel to get help directly, prepare all required info such as recovery.log, compile.log & android log, refer to here for the best timing . . .
TWRP FAQ
@yuweng the script has really been thought over for a long time and you also have put in tons of work in it. Thanks for it man!
Thanks bro... :highfive: The script initially includes BE setup for Ubuntu that includes setting up of Python, Java, Make, Git, build packages, adb rules & etc, now its half the size bcos we don't need to do all that on BBQLinux... It has went thru alot of revision, i lost track, one has PhilZ Touch on it, one revision will detect the device info such as graphics resolution, emmc or /data/media device & etc, you can actually do wonders with adb shell, automated alot of stuff for BoardConfig.mk, all in all, this script has about 4 years of work in it...
yuweng said:
Thanks bro... :highfive: The script initially includes BE setup for Ubuntu that includes setting up of Python, Java, Make, Git, build packages, adb rules & etc, now its half the size bcos we don't need to do all that on BBQLinux... It has went thru alot of revision, i lost track, one has PhilZ Touch on it, one revision will detect the device info such as graphics resolution, emmc or /data/media device & etc, you can actually do wonders with adb shell, automated alot of stuff for BoardConfig.mk, all in all, this script has about 4 years of work in it...
Click to expand...
Click to collapse
4 YEARS!!!! @Dees_Troy, @bigbiff, @_that this guy deserves a medal! And about the BE Setup, my good friend @thewisenerd had made an Android compiler which included a rather fancy dependencies check in a python program. I'll include it into AIO-TWRP-COMPILER as soon as I finish my school work for the week
Haha, they are all my Master Shifu's & they all have more experience than me on TWRP... :laugh: You are most welcome to add-in new features to it... :good:
yuweng said:
Haha, they are all my Master Shifu's & they all have more experience than me on TWRP... :laugh: You are most welcome to add-in new features to it... :good:
Click to expand...
Click to collapse
Experience?? They're encyclopedias on TWRP. But it's worthless if every humbug on the planet wants to compile it and doesn't even know what "ls -R " is supposed to do You're being a great help to everyone. I'll try and get them to try this when I can make it compatible for people who have already downloaded the source
Actually its quite easy but then again any wrong BE setup will result in build error that's why i strongly recommends BBQLinux for starters, its as easy as Ubuntu to setup, i can guarantee many will like the UI, Thanks to RD codeworkx.... :good:
Code:
mkdir ~/omni
cp -[COLOR="Blue"]R[/COLOR]f /path-to-your-existing-omnirom-folder/.repo ~/omni
[COLOR="blue"]OR[/COLOR]
mkdir ~/cm
cp -[COLOR="blue"]R[/COLOR]f /path-to-your-existing-cm-folder/.repo ~/cm
Remark or delete these lines & it'll work...
Updates - Migrating source code .repo to BBQLinux
So far my experience is that only lrzip is able to compress & extract source code .repo folder without data corruption... :good: Just open Ubuntu Nautilus File Manager & delete everything on your cm or omnirom except the hidden folder .repo
This hidden .repo folder is where the actual source code are, zipping it will be enough for migration, a repo init & repo sync will have all the files extracted out on BBQLinux ...
Code:
sudo apt-get install lrzip
cd /path-to-your-existing-[COLOR="Blue"]omnirom[/COLOR]-or-[COLOR="blue"]cm[/COLOR]-folder
lrztar -l .repo [COLOR="Blue"]<= Will take 10 to 20 minutes depending on your PC CPU, RAM & HDD[/COLOR]
[COLOR="blue"][U]To unzip it[/U][/COLOR]
copy [COLOR="Blue"].repo.tar.lrz[/COLOR] to [COLOR="Blue"]~/omni[/COLOR] or [COLOR="blue"]~/cm[/COLOR] folder accordingly
cd [COLOR="Blue"]~/omni[/COLOR] or [COLOR="blue"]~/cm[/COLOR]
lrzuntar .repo.tar.lrz
MSF Jarvis said:
Experience?? They're encyclopedias on TWRP. But it's worthless if every humbug on the planet wants to compile it and doesn't even know what "ls -R " is supposed to do[emoji14]You're being a great help to everyone. I'll try and get them to try this when I can make it compatible for people who have already downloaded the source
Click to expand...
Click to collapse
I don't know what it does but I compiled twrp(2.8.7.0 because twrp 3 doesn't want to work with my phone)In one month of work xD
yuweng said:
Actually its quite easy but then again any wrong BE setup will result in build error that's why i strongly recommends BBQLinux for starters, its as easy as Ubuntu to setup, i can guarantee many will like the UI, Thanks to RD codeworkx.... :good:
Code:
mkdir ~/omni
cp -rf /path-to-your-existing-omnirom-repo/.repo ~/omni
[COLOR="blue"]OR[/COLOR]
mkdir ~/cm
cp -rf /path-to-your-existing-cm-repo/.repo ~/cm
Remark or delete these lines & it'll work...
Click to expand...
Click to collapse
I use Ubuntu and I had several issues
Luckily I can compile without problems now
Thanks for your work
Inviato dal mio HUAWEI Y550-L03 utilizzando Tapatalk
AIO TWRP Compiler wiki
@yuweng, I have started writing down the wiki for this script at the Github repository. Would be grateful if you started writing the things you have mentioned here in that as well, and I'll proof-read it later on and also keep writing things myself
Devs seem pretty certain that Livedisplay is the cause of this bug now. See:
"The error is due to LOS livedisplay. Proper fix unknown.
Someone has posted a workaround in our telegram group - this workaround fixes PIS issue at cost of livedisplay."
https://forum.xda-developers.com/showpost.php?p=79854602&postcount=1568
We now have:
"the issue resides in LiveDisplay implementation
if you can live without some LiveDisplay options, flash the "fix" attached below"
https://forum.xda-developers.com/showpost.php?p=79885756&postcount=2029
At least one ROM removed Livedisplay in favour of another implementation:
https://forum.xda-developers.com/showpost.php?p=79614388&postcount=975
That was in May and as far as i know that fixed the issue there.
While Livedisplay may not account for ALL instances of this bug, it certainly appears to be at least a major factor. My own logs, (taken when both my OP3T and OP5 were hung on the 'Phone is Starting' message), include Livedisplay entries that are not present on a subsequent bootup.
Overall it doesn't look good for Livedisplay. You can see from the second link above that the .zip mentioned in the first link has been posted for use with the OP5/T.
What we know about the fix:
1) It makes edits to /vendor/etc/vintf/manifest.xml removing Livedisplay entries
2) Removes two files: /vendor/bin/hw/[email protected]_msm8998 and /vendor/etc/init/[email protected]_msm8998
(In the case of the OP3/T the 'oneplus_msm8998' would read 'oneplus3')
3) It removes a lot of Livedisplay functionality.
4) The fix as posted here should work on any LOS/Based ROM for both the OP3 and OP3T
Please read what @nvertigo67 had to say about the PIS bug:
nvertigo67 said:
In the logs I've seen, there is not only livedisplay hal crashing, but other hals as well. It seems to me that this relates to some boot timing differences over different boots, depending when hwservicemanager is started - if hardware service manager comes up to late quite some hals (among others also livedisplay) are constantly crashing. Perhaps late start of hwservicemanaher is a followup error from something even more different. Removing livedisplay changes the boot up sequence and it's timing, as using a third party launcher or uninstalling magisk does for others. configstore seems to play in here, too. But I don't completely umderstand, if crashing hwcservice is the cause fpr configstore to crash, or vice versa.
Click to expand...
Click to collapse
Ideally the bug would be squashed at it's source. i.e Livedisplay would be fixed by LOS. Otherwise it could be removed and replaced by something better on a ROM by ROM basis.
The flashable zip is attached as well as a screenshot showing what the Livedisplay settings now look like after it is applied: (crDroid/OP3T). 'Profiles' is removed but to me the calibration looks like 'Standard'.
Dirty flash your ROM again to undo the changes.
Many thanks to 2Tweak for adapting the script for use here, and to nvertigo67 as always for input and inspiration. Great work as always from both.
Something's wrong with your screenshots:
Display mode (and therefor colour temperature) has been removed from livedisplay in favour for aosp Nightlight. Color profile (where one can select advanced color spaces like srgb and dci-p3) is missing completely.
I'll attach shots from curtent livedisplay implementation and after applying your zip.
EDIT: the linecount computation needs some love. Currently it's cutting like this:
Code:
[email protected] /usr/local/src/los16/device/oneplus/oneplus3 $ linecount=$(sed -n '/<name>IPictureAdjustment<\/name>/=' configs/manifest.xml)
[email protected] /usr/local/src/los16/device/oneplus/oneplus3 $ echo $linecount
781
[email protected] /usr/local/src/los16/device/oneplus/oneplus3 $ sed "772","786"d configs/manifest.xml >/tmp/t1
[email protected] /usr/local/src/los16/device/oneplus/oneplus3 $ colordiff -c5 configs/manifest.xml /tmp/t1 *** configs/manifest.xml 2019-06-16 11:48:17.368090055 +0200
--- /tmp/t1 2019-07-17 19:37:09.170151287 +0200
***************
*** 767,791 ****
</hal>
<hal format="hidl">
<name>vendor.lineage.livedisplay</name>
<transport>hwbinder</transport>
<version>2.0</version>
- <interface>
- <name>IAdaptiveBacklight</name>
- <instance>default</instance>
- </interface>
- <interface>
- <name>IDisplayModes</name>
- <instance>default</instance>
- </interface>
- <interface>
- <name>IPictureAdjustment</name>
- <instance>default</instance>
- </interface>
- <interface>
- <name>ISunlightEnhancement</name>
- <instance>default</instance>
</interface>
</hal>
<hal format="hidl">
<name>vendor.lineage.power</name>
<transport>hwbinder</transport>
--- 767,776 ----
[email protected] /usr/local/src/los16/device/oneplus/oneplus3 $
I guess it should be deleted from "<hal format="hidl">" to the next "</hal>". The unaligned "</interface>" breaks some other hals. I havn't tested everything, but - at least - wifi is broken.
I'm too lazy to look up the exact sed patterns, but I would delete from "<name>vendor.lineage.livedisplay</name>" minis one line to the next occurance of "</hal>" after " <name>vendor.lineage.livedisplay</name>"
Sorry, I have assumed the livedisplay section of op5t and op3/t are identically.
nvertigo67 said:
Something's wrong with your screenshots:
Display mode (and therefor colour temperature) has been removed from livedisplay in favour for aosp Nightlight. Color profile (where one can select advanced color spaces like srgb and dci-p3) is missing completely.
I'll attach shots from curtent livedisplay implementation and after applying your zip.
Click to expand...
Click to collapse
The screenshots are from crDroid where they maybe aren't using the current LOS implementations.
My Wifi is disabled with the fix installed. Removing the fix restores it. Can't see how it could be affected by the zip though. How is yours?
Edit: You've seen it. I was expecting the same file versions on both the OP5/T and OP3/T.
Dirk said:
The screenshots are from crDroid where they maybe aren't using the current LOS implementations.
My Wifi is disabled with the fix installed. Removing the fix restores it. Can't see how it could be affected by the zip though. How is yours?
Edit: You've seen it.
Click to expand...
Click to collapse
Your posting and my edit have crossed. See my edit above
---------- Post added at 20:13 ---------- Previous post was at 20:10 ----------
The longer I look at this, I think tje sed on the manifest file is nice, but unnecessary if the hal and the rc file are removed.
nvertigo67 said:
The longer I look at this, I think tje sed on the manifest file is nice, but unnecessary if the hal and the rc file are removed.
Click to expand...
Click to collapse
This goes way beyond my level of understanding. That block of entries in the manifest.xml are very different on my crDroid version comapred to your LOS version:
Code:
<hal format="hidl">
<name>vendor.lineage.livedisplay</name>
<transport>hwbinder</transport>
<version>2.0</version>
<interface>
<name>IAdaptiveBacklight</name>
<instance>default</instance>
</interface>
<interface>
<name>IDisplayModes</name>
<instance>default</instance>
</interface>
<interface>
<name>IPictureAdjustment</name>
<instance>default</instance>
</interface>
<interface>
<name>ISunlightEnhancement</name>
<instance>default</instance>
</interface>
<fqname>@2.0::IAdaptiveBacklight/default</fqname>
<fqname>@2.0::IDisplayModes/default</fqname>
<fqname>@2.0::IPictureAdjustment/default</fqname>
<fqname>@2.0::ISunlightEnhancement/default</fqname>
If there are changes like that between ROMs, even on the same device, then specific versions of the fix would be needed for each ROM, and would stop working as soon as a ROM dev makes modifications to the base LOS implementation.
My mistake in thinking that the Livedisplay implementation would be consistent between ROMs.
If the edits to the manifest.xml aren't necessary, and only the two files need removing, that would make things much simpler.
Dirk said:
This goes way beyond my level of understanding. That block of entries in the manifest.xml are very different on my crDroid version comapred to your LOS version:
Code:
<hal format="hidl">
<name>vendor.lineage.livedisplay</name>
<transport>hwbinder</transport>
<version>2.0</version>
<interface>
<name>IAdaptiveBacklight</name>
<instance>default</instance>
</interface>
<interface>
<name>IDisplayModes</name>
<instance>default</instance>
</interface>
<interface>
<name>IPictureAdjustment</name>
<instance>default</instance>
</interface>
<interface>
<name>ISunlightEnhancement</name>
<instance>default</instance>
</interface>
<fqname>@2.0::IAdaptiveBacklight/default</fqname>
<fqname>@2.0::IDisplayModes/default</fqname>
<fqname>@2.0::IPictureAdjustment/default</fqname>
<fqname>@2.0::ISunlightEnhancement/default</fqname>
If there are changes like that between ROMs, even on the same device, then specific versions of the fix would be needed for each ROM, and would stop working as soon as a ROM dev makes modifications to the base LOS implementation.
My mistake in thinking that the Livedisplay files would be consistent between ROMs.
Click to expand...
Click to collapse
I've asumed the same. You need a more generic solution. This isn't trivial.
Trivial and Quick'n'dirty: leave the manifest alone (should work without touching the manifest).
nvertigo67 said:
I've asumed the same. You need a more generic solution. This isn't trivial.
Trivial and Quick'n'dirty: leave the manifest alone (should work without touching the manifest).
Click to expand...
Click to collapse
Yep. I wonder how essential the manifest edits are vs just deleting the two files.
If LOS releases an update that changes the manifest.xml contents, the fix would need updating. It would get messy across multiple builds of LOS and messier still with LOS/Based ROMs and various builds.
Like you said, generic/works in all cases would be best, but probably not possible unless there were a way to delete that whole 'Livedisplay' block in the manifest regardless of it's contents.
I'm just going to delete those files manually now and see what it does to Livedisplay.
BRB.
Edit: Restored Backup, removed the two files and booted straight into a PIS Hang. I guess the manifest edits are essential. Gonna have to rethink this whole thing.
Dirk said:
Yep. I wonder how essential the manifest edits are vs just deleting the two files.
If LOS releases an update that changes the manifest.xml contents, the fix would need updating. It would get messy across multiple builds of LOS and messier still with LOS/Based ROMs and various builds.
Like you said, generic/works in all cases would be best, but probably not possible unless there were a way to delete that whole 'Livedisplay' block in the manifest regardless of it's contents.
I'm just going to delete those files manually now and see what it does to Livedisplay.
BRB.
Edit: Restored Backup, removed the two files and booted straight into a PIS Hang. I guess the manifest edits are essential. Gonna have to rethink this whole thing.
Click to expand...
Click to collapse
+1
Removed the files and did the editing by hand; issue seems gone with wifi and other functionality still there.
So a smart sed or awk oneliner would probably solve it.
Unfortunately did not find a smart solution for that....
After a night with less than enough sleep, I belive I'm going crazy. I'm pretty sure something's wrong in my brain after looking too long at the same lines and I really need some help to unlock my brain again.
We agree that (for los16/oneplus3) that the block from line 768 to 788 needs to be deleted: https://github.com/nvertigo/android...blob/nlos-16.0/configs/manifest.xml#L768-L788
This should be easy with sed:
Code:
[email protected] /usr/local/src/los16/device/oneplus/oneplus3 $ sed -e '768,788d' /tmp/manifest.xml >/tmp/t2
I assume that the block (marked above in git) is deleted now, but look at this:
Code:
[email protected] /usr/local/src/los16/device/oneplus/oneplus3 $ colordiff -u /tmp/manifest.xml /tmp/t2
--- /tmp/manifest.xml 2019-07-18 09:27:39.296058200 +0200
+++ /tmp/t2 2019-07-18 09:49:34.846269326 +0200
@@ -766,27 +766,6 @@
</interface>
</hal>
<hal format="hidl">
- <name>vendor.lineage.livedisplay</name>
- <transport>hwbinder</transport>
- <version>2.0</version>
- <interface>
- <name>IAdaptiveBacklight</name>
- <instance>default</instance>
- </interface>
- <interface>
- <name>IDisplayModes</name>
- <instance>default</instance>
- </interface>
- <interface>
- <name>IPictureAdjustment</name>
- <instance>default</instance>
- </interface>
- <interface>
- <name>ISunlightEnhancement</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl">
<name>vendor.lineage.power</name>
<transport>hwbinder</transport>
<version>1.0</version>
[email protected] /usr/local/src/los16/device/oneplus/oneplus3 $
Ok, I thought, let's decrease start line and end line by one:
Code:
[email protected] /usr/local/src/los16/device/oneplus/oneplus3 $ sed -e '767,787d' /tmp/manifest.xml >/tmp/t2
[email protected] /usr/local/src/los16/device/oneplus/oneplus3 $ colordiff -u /tmp/manifest.xml /tmp/t2
--- /tmp/manifest.xml 2019-07-18 09:27:39.296058200 +0200
+++ /tmp/t2 2019-07-18 09:51:25.986269375 +0200
@@ -766,27 +766,6 @@
</interface>
</hal>
<hal format="hidl">
- <name>vendor.lineage.livedisplay</name>
- <transport>hwbinder</transport>
- <version>2.0</version>
- <interface>
- <name>IAdaptiveBacklight</name>
- <instance>default</instance>
- </interface>
- <interface>
- <name>IDisplayModes</name>
- <instance>default</instance>
- </interface>
- <interface>
- <name>IPictureAdjustment</name>
- <instance>default</instance>
- </interface>
- <interface>
- <name>ISunlightEnhancement</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl">
<name>vendor.lineage.power</name>
<transport>hwbinder</transport>
<version>1.0</version>
[email protected] /usr/local/src/los16/device/oneplus/oneplus3 $
Strange, isn't it? But I can make it even mote strange. Let's cut from line 768 to 787:
Code:
[email protected] /usr/local/src/los16/device/oneplus/oneplus3 $ colordiff -u /tmp/manifest.xml /tmp/t2
--- /tmp/manifest.xml 2019-07-18 09:27:39.296058200 +0200
+++ /tmp/t2 2019-07-18 09:54:39.826271669 +0200
@@ -765,26 +765,6 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl">
- <name>vendor.lineage.livedisplay</name>
- <transport>hwbinder</transport>
- <version>2.0</version>
- <interface>
- <name>IAdaptiveBacklight</name>
- <instance>default</instance>
- </interface>
- <interface>
- <name>IDisplayModes</name>
- <instance>default</instance>
- </interface>
- <interface>
- <name>IPictureAdjustment</name>
- <instance>default</instance>
- </interface>
- <interface>
- <name>ISunlightEnhancement</name>
- <instance>default</instance>
- </interface>
</hal>
<hal format="hidl">
<name>vendor.lineage.power</name>
[email protected] /usr/local/src/los16/device/oneplus/oneplus3 $
Code:
[email protected] /usr/local/src/los16/device/oneplus/oneplus3 $ sed -e '768,789d' /tmp/manifest.xml >/tmp/t2
[email protected] /usr/local/src/los16/device/oneplus/oneplus3 $ colordiff -u /tmp/manifest.xml /tmp/t2
--- /tmp/manifest.xml 2019-07-18 09:27:39.296058200 +0200
+++ /tmp/t2 2019-07-18 10:08:08.535812187 +0200
@@ -765,28 +765,6 @@
<instance>default</instance>
</interface>
</hal>
- <hal format="hidl">
- <name>vendor.lineage.livedisplay</name>
- <transport>hwbinder</transport>
- <version>2.0</version>
- <interface>
- <name>IAdaptiveBacklight</name>
- <instance>default</instance>
- </interface>
- <interface>
- <name>IDisplayModes</name>
- <instance>default</instance>
- </interface>
- <interface>
- <name>IPictureAdjustment</name>
- <instance>default</instance>
- </interface>
- <interface>
- <name>ISunlightEnhancement</name>
- <instance>default</instance>
- </interface>
- </hal>
- <hal format="hidl">
<name>vendor.lineage.power</name>
<transport>hwbinder</transport>
<version>1.0</version>
[email protected] /usr/local/src/los16/device/oneplus/oneplus3 $
As you can see, cutting from 768 to 787 works as well as 768 to 789, but as soon as I try to cut from 768 to 788 it gets strange.
I've compiled two different sed versions (4.5 and 4.7) and compiled a busybox with sed: all three seds show the same behaviour.
Please help me unwinding this.
EDIT: some hours of sleep helps: I should finally learn to read diffs. It's as expected and working, of course...
2Tweak said:
Removed the files and did the editing by hand; issue seems gone with wifi and other functionality still there.
So a smart sed or awk oneliner would probably solve it.
Unfortunately did not find a smart solution for that....
Click to expand...
Click to collapse
I dare say the modifications would work as expected if they could be applied consistantly, in a manner that doesn't break unrelated parts of the OS. I'm given pause to even use it on my OP5 knowing that the goalpoasts could shift any time.
Thanks for taking a look. :good:
This one works for now. It's not generic, but it works at least...
nvertigo67 said:
This one works for now. It's not generic, but it works at least...
Click to expand...
Click to collapse
Good work @nvertigo67 :good:
I copied it into my cleanup script which I run after install of new build this way:
Code:
echo -n "Repair Phone Is Starting error......"
rm -f '/system/vendor/bin/hw/[email protected]'
rm -f '/system/vendor/etc/init/[email protected]ice.oneplus3.rc'
existlinecount=$(grep -c 'livedisplay' /system/vendor/etc/vintf/manifest.xml)
if [ "$existlinecount" -gt 0 ]; then
linecount=$(sed -n '/<name>IPictureAdjustment<\/name>/=' /system/vendor/etc/vintf/manifest.xml)
startlinecount=$(expr "$linecount" - 13)
endlinecount=$(expr "$linecount" + 11)
sed -i "$startlinecount","$endlinecount"d /system/vendor/etc/vintf/manifest.xml
fi
echo " done!"
Is working nicely.
Thanks for your effort :good:
While looking through this, I wonder why the livedisplay service is deleted, but the hal stays in place:
Deleted:
Code:
/system/vendor/bin/hw/[email protected]
/system/vendor/etc/init/[email protected]
Modified:
Code:
/system/vendor/etc/vintf/manifest.xml
Untouched:
Code:
out/target/product/oneplus3/system/etc/permissions/org.lineageos.livedisplay.xml
out/target/product/oneplus3/system/etc/init/lineage-livedisplay.rc
out/target/product/oneplus3/system/lib64/[email protected]
Is this done by purpose? Were those three files just forgotten? Is the hal still in use, though the service is disabled? Is the hal necessary to avoid LineageParts from crashing? Why do we still set the permission for the livedisplay's sysfs nodes (i.e. srgb and dci-p3) though we can't access them anymore? Why do we still propagate the featute "org.lineageos.livedisplay"?
nvertigo67 said:
Is this done by purpose? Were those three files just forgotten? Is the hal still in use, though the service is disabled? Is the hal necessary to avoid LineageParts from crashing? Why do we still set the permission for the livedisplay's sysfs nodes (i.e. srgb and dci-p3) though we can't access them anymore? Why do we still propagate the featute "org.lineageos.livedisplay"?
Click to expand...
Click to collapse
The answer really could be anything couldn't it? Maybe they knew exactly what parts were causing the issue and needed to be removed. Or perhaps the remaining parts were just necessary for stability. Or maybe they just aren't important now that the rest is gimped, so are just remnants?
I think what the thread needs if nothing else, is a simple guide so that people can manually apply the 'fix' if they wish. (As 2Tweak has done). It's perhaps not for the novice but i think most can see their way through it.
It would go something like:
This fix will cripple Livedisplay. Proceed with caution!
1) Delete '/system/vendor/bin/hw/[email protected]' and '/system/vendor/etc/init/[email protected]'
2) Edit '/system/vendor/etc/vintf/manifest.xml' to remove the block of text that deals with Livedisplay.
3) To undo your changes flash your ROM again/or restore Nandroid.
#2 needs some finesse. Perhaps what you wrote before, "it should be deleted from "<hal format="hidl">" to the next "</hal>".
I would delete from "<name>vendor.lineage.livedisplay</name>" minus one line to the next occurance of "</hal>" after " <name>vendor.lineage.livedisplay</name>"
It looks good to me. Most people will get it. It's the whole 'Livedisplay' block, right?
Dirk said:
The answer really could be anything couldn't it? Maybe they knew exactly what parts were causing the issue and needed to be removed. Or perhaps the remaining parts were just necessary for stability. Or maybe they just aren't important now that the rest is gimped, so are just remnants?
Click to expand...
Click to collapse
Not really. I'm still thinking of a generic solution. It would be much easier to do something like "rm $(find /system/ -name \*livedisplay\*" or "rm $(find /system/ -name \*livedisplay\*service\*)", then having lists of files for different devices. To decide that, I need to understand.
Apart from a generic solution, I would like to have answers to these questions to understand the problem. I would like to fix the issue in livedisplay (if livedisplay is actually the problem). And the more I understand, the more probable it could be fixed.
Generally I don't like publishing fixes, workarounds or whatever without understanding it.
BTW: I have an idea how to get the livedisplay's manifest block, without relying on fixed line numbers. I'll dig into this weekend and test with the untouched files.
nvertigo67 said:
While looking through this, I wonder why the livedisplay service is deleted, but the hal stays in place:
Deleted:
Code:
/system/vendor/bin/hw/[email protected]
/system/vendor/etc/init/[email protected]
Modified:
Code:
/system/vendor/etc/vintf/manifest.xml
Untouched:
Code:
out/target/product/oneplus3/system/etc/permissions/org.lineageos.livedisplay.xml
out/target/product/oneplus3/system/etc/init/lineage-livedisplay.rc
out/target/product/oneplus3/system/lib64/[email protected]
Is this done by purpose? Were those three files just forgotten? Is the hal still in use, though the service is disabled? Is the hal necessary to avoid LineageParts from crashing? Why do we still set the permission for the livedisplay's sysfs nodes (i.e. srgb and dci-p3) though we can't access them anymore? Why do we still propagate the featute "org.lineageos.livedisplay"?
Click to expand...
Click to collapse
Just tried it and removed the other files also. When clicking on livedisplay in settings, the settingsmenu is crashing because of the missing livedisplay. Further everything seems to work.
This is a behavior I noticed before in LOS and which is different and less "tweakproof" then for example NOS, Omni and some other ROMs. Other ROMs seems to test availability of functionality / apk and decide to enclose it in the menu. In LOS there seems to be no testing, settings menu seems to be fixed.
When I for example remove SettingsIntelligence in LOS it takes ages before settings menu is showing up, in other ROMs this is not an issue at all.
For the XML it could be an option to search for the first <hal format="hidl"> above and the first </hal> beneath vendor.lineage.livedisplay and delete that part. How to do that is something I have to find out with sed/awk.
What all files are doing I have no idea, but it seems the man who found this solution knowed what he was doing. ..
2Tweak said:
What all files are doing I have no idea, but it seems the man who found this solution knowed what he was doing. ..
Click to expand...
Click to collapse
That or a whole lot of trial and error! I wonder if he knew the root cause or just spent a lot of time editing and restarting.
Thanks for your insights and testing. Hopefully we'll narrow it down to which is the critical part that needs fixing.
What am I doing wrong?
Get the whole file as output....
The idea is to make the script independent of line numbers and delete the block from <hal> to </hal>.
Code:
[#!/sbin/sh
#
# Script by 2Tweak
# Last modified 20-07-2019
echo -n "Repair Phone Is Starting error......"
rm -f '/system/vendor/bin/hw/[email protected]'
rm -f '/system/vendor/etc/init/[email protected]'
fname="/system/vendor/etc/vintf/manifest.xml"
testname="/data/local/tmp/test.xml"
found=0
startstop=0
tstr=""
nstr=""
touch $testname
while IFS= read -r line
do
echo "$line"
if [[ "$line" == *'<hal'* ]]; then
startstop=1
elif [[ "$line" == *'</hal'* ]]; then
startstop=2
elif [[ "$line" == *'livedisplay'* ]]; then
found=1
fi
if [ $startstop -eq 1 ]; then
tstr .= $line
elif [ $startstop -eq 2 ]; then
tstr .= $line
if [ $found -eq 0 ]; then
nstr .= $line
else
found=0
fi
tstr=""
startstop=0
else
nstr .= $line
fi
done <"$fname"
echo $nstr >> $testname
echo " done!"
sleep 0.3
2Tweak said:
What am I doing wrong?
Get the whole file as output....
The idea is to make the script independent of line numbers and delete the block from <hal> to </hal>.
Code:
#!/sbin/sh
#
# Script by 2Tweak
# Last modified 19-07-2019
echo -n "Repair Phone Is Starting error......"
rm -f '/system/vendor/bin/hw/[email protected]'
rm -f '/system/vendor/etc/init/[email protected]'
fname="/system/vendor/etc/vintf/manifest.xml"
testname="/data/local/tmp/test.xml"
found=0
startstop=0
tmpstring=""
newstring=""
touch $testname
while IFS= read -r line
do
if [ "$line" == *'<hal'* ]; then
startstop=1
elif [ "$line" == *'</hal'* ]; then
startstop=2
elif [ "$line" == *'livedisplay'* ]; then
found=1
fi
if [ "$startstop" == "1" ]; then
tstr .= $line
elif [ "$startstop" == "2" ]; then
tstr .= $line
if [ "$found" == "0" ]; then
echo "$tstr" >> $testname
else
found=0
fi
tstr=""
startstop=0
else
echo "$line" >> $testname
fi
done <"$fname"
echo " done!"
sleep 0.3
Click to expand...
Click to collapse
Sadly, I'm lower on time this we then I've thought. From a first short look I would guess "==" is bash syntax but not posix sh. Also I'm not sure how the patterns are expanded (i.e. *'<hal'*). The easiest way is setting -x for tje shell, to see, what happens (imsert "set -x" after the hash bang).
My approach is more similar to the original zip: get the livedisplay line:
Code:
linecount=$(sed -n '/<name>vendor.lineage.livedisplay<\/name>/=' /vendor/etc/vintf/manifest.xml)
linecont decreased by 1 is the absolute linenumber of the livedisplay's block (<hal format="hidl">). Now we can get the telative linenumber of the first "</hal>" after $linenumber. wc -l gives the linenumer of the file. linenumber of the file minus $linecount are the lines_to_search. Then we can
Code:
relative_end = tail -n $lines_to_search manifest.xml | grep -n -m1 '</hal>' | cut -d':' -f1
Now we can compute startlinecount ($linecount minus 1) and endlinecount ($linecount plus relative_end).
At the moment I'm stuck with the filenames: generating the backup filename dynamically depending on what path/file is found; and generating the regular filenames dynamically from the backup filename on restore...