shakalaca / android_device_asus_Z017

14 stars 7 forks source link

Issue with hardware/qcom/display-caf #5

Open aswindivakar opened 7 years ago

aswindivakar commented 7 years ago

Can you please add a repository of your hardware/qcom/display-caf folder.Iam getting 12 errors in that section.

aik commented 7 years ago

any progress here?

aswindivakar commented 7 years ago

No progress :(

aik commented 7 years ago

I cloned Shakalaca's kernel and checked out android-7.0 branch, run "brunch Z017", this produced lineage-14.1-20170615-UNOFFICIAL-Z017.zip which did boot up but it did not have wifi.

aswindivakar commented 7 years ago

How did you fix display-caf errors?

Planet-X commented 7 years ago

I managed to build the rom, wifi working! I didn't encounter the display-caf error at all. Maybe your sources are messed up. Did you use the newly added local_manifest files?

To solve the wifi problem: kernel module signing is to blame here. I found two solutions:

  1. (dirty, easy): Disable signature enforcement: edit the file [path to source]/kernel/asus/Z017/arch/arm64/configs/ze552kl-userdebug_defconfig and change CONFIG_MODULE_SIG_FORCE=y to CONFIG_MODULE_SIG_FORCE=n. This disables a security feature, so it's not recommended!
  2. (secure, harder) Leave signature enforcement on. Write a script that signs all modules in [path to source]/out/target/product/Z017/system/lib/modules/ as soon as they are created and run it in parallel to the compilation process.

Even the second solution is somewhat dirty. If anyone knows how to properly fix this I'd be grateful to know!

aik commented 7 years ago

The Shakalaca's android-7.0 branch in his kernel tree has include/uapi/linux/msm_mdp_ext.h which has mdp_destination_scaler_data defined (and other missing symbols from that display-caf) and after I switched to that branch, it just compiled. Almost - before switching kernels, I also had to add "LOCAL_C_INCLUDES += hardware/qcom/fm/fm_hci" to hardware/qcom/fm/helium/Android.mk

aik commented 7 years ago

Is there any way to avoid compiling the whole thing every time? I'll change the config but "brunch Z017" will rebuild it all.

aik commented 7 years ago

Planet-X, which kernel did you use exactly (url please)? And what vendor files you use? Extracted from the phone or from Shakalaca's git or from the image he built? My zip image size is 40mb less than his so I assume something is missing in my image but what...

Planet-X commented 7 years ago

I'm using shakalaca's provided kernel, branch android-7.0 from here: https://github.com/shakalaca/android_kernel_asus_ze520kl/tree/android-7.0 I'm using his vendor git repository. My zip file only has 612 MB, everything working well though. (Even with added substratum support!)

aik commented 7 years ago

Planet-X, still, do you know if there is any way to avoid compiling the whole thing every time? :) And any luck with the battery life?

Planet-X commented 7 years ago

Forgot to answer this one, sorry :) You can speed up the compilation of incremental builds by using ccache: https://source.android.com/source/initializing#setting-up-ccache
It boils down to executing "export USE_CCACHE=1" and "prebuilts/misc/linux-x86/ccache/ccache -M 50G" just before brunch, in your source directory. With ccache I only have to recompile around 2300 objects on average - of course depending on any made changes.

Battery life looks great so far - one charge lasts for about two days. I'm not a heavy mobile user though...

aik commented 7 years ago

ah, so this is the best I can get (I am doing this already, hoped there is something better though). ok. thanks.

Planet-X commented 7 years ago

Other than that compiling from an ssd drive greatly decreased the compilation time for me: at least five times faster!

aik commented 7 years ago

Well, I was hoping that I change a kernel config option, run "brunch Z017" and it would only compile kernel and build the image but it seems to compile other stuff unrelated to the kernel

aik commented 7 years ago

Ok, got my image with wifi working, cool. Since device/asus/Z017/BoardConfig.mk allows specifying pre-built kernel, I guess we could just build the kernel separately and sign all the modules; and use that when building the main firmware image. Tried that? I also wonder if there is a better kernel somewhere, like https://github.com/LineageOS/android_kernel_bq_msm8937.git (this one won't do it as it is missing symbols necessary for display-caf)

aik commented 7 years ago

2 days on a single charge?! How? Mine lasts 20hours top and I do not use it much....

aik commented 7 years ago

Planet-X, my phone does not detect headphone in the fm radio, says "Please plug in a headset to use FM radio", seen that?

shakalaca commented 7 years ago

@aik You can issue 'make -j8 $ANDROID_PRODUCT_OUT/kernel' to build the kernel only :)

shakalaca commented 7 years ago

and thanks @Planet-X 's tip, I'm also using some kind of 'dirty' work to build the kernel module with working signature (vendor/cm)

diff --git a/build/tasks/kernel.mk b/build/tasks/kernel.mk
index 70e5cd1..a1007a1 100644
--- a/build/tasks/kernel.mk
+++ b/build/tasks/kernel.mk
@@ -247,8 +247,7 @@ define mv-modules
     if [ "$$mdpath" != "" ];then\
         mpath=`dirname $$mdpath`;\
         ko=`find $$mpath/kernel -type f -name *.ko`;\
-        for i in $$ko; do $(KERNEL_TOOLCHAIN_PATH)strip --strip-unneeded $$i;\
-        mv $$i $(KERNEL_MODULES_OUT)/; done;\
+        for i in $$ko; do mv $$i $(KERNEL_MODULES_OUT)/; done;\
     fi
 endef

and define CONFIG_MODULE_SIG_ALL=y in kernel configuration file

shakalaca commented 7 years ago

@AswinDivakar It came with LineageOS repo and I never touch that folder (that's why I put libsdm* in vendor/asus/Z017 ..)

aswindivakar commented 7 years ago

@aik Trying to build with android-7.0 branch thanks :)

aswindivakar commented 7 years ago

@shakalaca Ok, maybe checking out to android-7.0 branch will fix my issue.Building in progress :)

aik commented 7 years ago

@shakalaca can you please update your vendor folder on github? somehow your images are 60mb bigger than mine, something might be missing, thanks. btw where did your kernel come from? here - https://www.asus.com/in/support/Download/39/1/0/29/n9bGgSfGVSrBMnRw/32/ ?

aik commented 7 years ago

I also had to disable: BOARD_USES_LEGACY_ALSA_AUDIO := false , otherwise would not compile. Was it just me or others had to do the same?

Planet-X commented 7 years ago

@aik I got this battery life by disabling almost anything running in the background and installing "Naptime" by Francisco Franco. Screenshot as proof: screenshot

I didn't have to disable legacy audio on my build. Have you cloned https://github.com/shakalaca/android_hardware_qcom_audio-caf_msm8937_asus to "hardware/qcom/audio-caf/msm8937/legacy" ? FM also works well on my phone. Are you using this manifest file: https://github.com/shakalaca/android_device_asus_Z017/blob/cm-14.1/local_manifests/qcom_fm.xml ?

aik commented 7 years ago

@Planet-X I did not checkout that legacy library, trying now; and that xml - it has always been in the repo, do I need to do anything extra? I have been having this problem pretty much all the time, my images or shakalacas - does not matter, it works first time after flashing and then it does not.

Planet-X commented 7 years ago

@shakalaca Your solution to signing seems far less dirty than mine. Just for completion, my script currently looks like this:

#!/bin/bash
SOURCEPATH="[path to lineage source root, not ending with slash]"        #Set source path here!
#Clear old modules:
rm $SOURCEPATH/out/target/product/Z017/system/lib/modules/*

#Wait for the build process to generate the modules
echo "Waiting for finished modules..."
while [  "$(ls $SOURCEPATH/out/target/product/Z017/system/lib/modules/ | grep wlan.ko)" == "" ]; do
       sleep 3
done
sleep 3
echo "Signing modules..."
cd $SOURCEPATH/out/target/product/Z017/obj/KERNEL_OBJ       #In this directory the signing keys are stored
MODULES=$SOURCEPATH/out/target/product/Z017/system/lib/modules/*       #Store all module file paths in array MODULES
for m in $MODULES            #Sign all modules
do
  perl $SOURCEPATH/kernel/asus/Z017/scripts/sign-file sha512  ./signing_key.priv  ./signing_key.x509  $m
done

It's as cheap as it gets, but I'll stick to it for now as it doesn't involve tampering with cm sources.

Planet-X commented 7 years ago

@aik With the files from the local_manifests folder you can pretty much set up the repo command to check out any additionally needed repositories for you. The files in your device's local_manifests folder should be copied to "[lineage source dir]/.repo/local_manifests". The next time you execute "repo sync" it will also download necessary Zenfone 3 sources to their corresponding directories. This currently includes kernel, device tree, audio-caf and qcom-fm. Only vendor has to be checked out manually.

aik commented 7 years ago

@Planet-X sounds lovely, I assume @shakalaca 's repo is missing them and you have these manifests ready? Care to share? :)

Planet-X commented 7 years ago

@aik The manifests are in @shakalaca 's repository here: https://github.com/shakalaca/android_device_asus_Z017/tree/cm-14.1/local_manifests

aik commented 7 years ago

@Planet-X this did not pull neither kernel nor that legacy audio stuff, weird :-/

Planet-X commented 7 years ago

@aik This should definitely work - At least I'm using it without any troubles. Maybe running 'repo forall -vc "git reset --hard"' can resolve this. !This will reset any changes done to source files managed by repo! The files should then be pulled, assuming the manifests are placed correctly. Of course you could also stick to manually pulling the files just as described in the manifest files.

aik commented 7 years ago

What is reponsible for adb? I took perf config, flashed - now the laptop does not detect the phone via adb or anyhow else.

aik commented 7 years ago

Headphones are still a problem - the phone does recognise them right after I flash new firmware + wipe dalvik+cache and after a while the phone stops seeing them.

aik commented 7 years ago

Did anyone need this?

diff --git a/arch/arm/boot/dts/qcom/msm8953-audio.dtsi b/arch/arm/boot/dts/qcom/msm8953-audio.dtsi index b032a17..94385aa 100644 --- a/arch/arm/boot/dts/qcom/msm8953-audio.dtsi +++ b/arch/arm/boot/dts/qcom/msm8953-audio.dtsi @@ -11,9 +11,7 @@

-/*

include "msm8953-wsa881x.dtsi"

-*/

aswindivakar commented 7 years ago

Now I am having this issue when i changed my Source location anyone knows how to fix this?

-bash: make: command not found Device Z017 not found. Attempting to retrieve device repository from lineageos Github (http://github.com/LineageOS) . Repository for Z017 not found in the LineageOS Github repository list. If this is in error, you may need to manuall y add it to your local_manifests/roomservice.xml. -bash: make: command not found -bash: make: command not found Don't have a product spec for: 'lineage_Z017' Do you have the right repo manifest?

shakalaca commented 7 years ago

@aik nop, maybe I should restart a clean repo to see what's missing ? :)

aswindivakar commented 7 years ago

@shakalaca @Planet-X Where exactly I need to add?(I need path to the file)

CONFIG_MODULE_SIG_ALL=y

Planet-X commented 7 years ago

@AswinDivakar You have to add it to the kernel configuration located here: [path to source]/kernel/asus/Z017/arch/arm64/configs/ze552kl-userdebug_defconfig

aswindivakar commented 7 years ago

@Planet-X Thank You :)

aswindivakar commented 7 years ago

@Planet-X How did you managed to get such a great Battery Life.I can only get approximately 3 hrs Screen on time with 65% battery (First boot-Installing apps,syncing,setting up things)

Planet-X commented 7 years ago

@AswinDivakar My battery life wasn't as good on first boot either. Installing apps and setting up the device consumes far more battery than day to day usage. The only things I did to gain more battery life were:

  1. I installed Naptime by Francisco Franco.
  2. I went through every app in lineage's privacy guard and disabled all unnecessary "Keep awake" and "Run in background" permissions.

My phone is a ZE552KL so its battery is 400 mAh bigger than the ZE520KL's.

aswindivakar commented 7 years ago

Ok.I thought your device is ZE520KL.Anyway thank you :)

aswindivakar commented 7 years ago

Does anyone know how to fix this?

[ 13% 1155/8810] target R.java/Manifest.java.../APPS/ZenfoneDoze_intermediates/src/R.stamp) FAILED: /bin/bash -c "(rm -rf /home/aswin/android/rr/out/target/common/obj/APPS/ZenfoneDoze_intermediates/src/R.stamp && mkdir -p /home/aswin/android/rr/out/target/common/obj/APPS/ZenfoneDoze_intermediates/src/ ) && (mkdir -p /home/aswin/android/rr/out/target/common/obj/APPS/ZenfoneDoze_intermediates/src ) && (mkdir -p /home/aswin/android/rr/out/target/common/obj/APPS/ZenfoneDoze_intermediates/ ) && (/home/aswin/android/rr/out/host/linux-x86/bin/aapt package --auto-add-overlay --auto-add-overlay -z --extra-packages android.support.v14.preference:android.support.v7.appcompat:android.support.v7.preference:android.support.v7.recyclerview:com.android.settingslib --pseudo-localize -m -J /home/aswin/android/rr/out/target/common/obj/APPS/ZenfoneDoze_intermediates/src -M device/asus/Z017/doze/AndroidManifest.xml -P /home/aswin/android/rr/out/target/common/obj/APPS/ZenfoneDoze_intermediates/public_resources.xml -S device/asus/Z017/doze/res -S device/asus/Z017/doze/../../../../packages/resources/devicesettings/res -S frameworks/support/v14/preference/res -S frameworks/support/v7/appcompat/res -S frameworks/support/v7/preference/res -S frameworks/support/v7/recyclerview/res -S frameworks/base/packages/SettingsLib/res -I /home/aswin/android/rr/out/target/common/obj/APPS/framework-res_intermediates/package-export.apk -I /home/aswin/android/rr/out/target/common/obj/APPS/org.cyanogenmod.platform-res_intermediates/package-export.apk -G /home/aswin/android/rr/out/target/common/obj/APPS/ZenfoneDoze_intermediates/proguard_options --min-sdk-version 25 --target-sdk-version 25 --version-code 25 --version-name 7.1.2 --skip-symbols-without-default-localization ) && (for GENERATED_MANIFEST_FILE in `find /home/aswin/android/rr/out/target/common/obj/APPS/ZenfoneDoze_intermediates/src -name Manifest.java 2> /dev/null`; do dir=`awk '/package/{gsub(/\./,\"/\",\$2);gsub(/;/,\"\",\$2);print \$2;exit}' \$GENERATED_MANIFEST_FILE`; mkdir -p /home/aswin/android/rr/out/target/common/R/\$dir; /home/aswin/android/rr/out/host/linux-x86/bin/acp -fp \$GENERATED_MANIFEST_FILE /home/aswin/android/rr/out/target/common/R/\$dir; done ) && (for GENERATED_R_FILE in `find /home/aswin/android/rr/out/target/common/obj/APPS/ZenfoneDoze_intermediates/src -name R.java 2> /dev/null`; do dir=`awk '/package/{gsub(/\./,\"/\",\$2);gsub(/;/,\"\",\$2);print \$2;exit}' \$GENERATED_R_FILE`; mkdir -p /home/aswin/android/rr/out/target/common/R/\$dir; /home/aswin/android/rr/out/host/linux-x86/bin/acp -fp \$GENERATED_R_FILE /home/aswin/android/rr/out/target/common/R/\$dir || exit 31; /home/aswin/android/rr/out/host/linux-x86/bin/acp -fp \$GENERATED_R_FILE /home/aswin/android/rr/out/target/common/obj/APPS/ZenfoneDoze_intermediates/src/R.stamp || exit 32; done ) && (touch /home/aswin/android/rr/out/target/common/obj/APPS/ZenfoneDoze_intermediates/src/R.stamp )" ERROR: resource directory 'device/asus/Z017/doze/../../../../packages/resources/devicesettings/res' does not exist

Planet-X commented 7 years ago

@AswinDivakar Yes, I also encountered this error. The solution is to add this line <project name="LineageOS/android_packages_resources_devicesettings" path="packages/resources/devicesettings" remote="github"/> to one of your local_manifest files and do a repo sync. Optionally you can manually pull the files from https://github.com/LineageOS/android_packages_resources_devicesettings and put them into "[path to source]/packages/resources/devicesettings"

aik commented 7 years ago

@AswinDivakar /home/androidbuild/android/system/kernel/asus/Z017/arch/arm64/configs/ze552kl-userdebug_defconfig

aik commented 7 years ago

I wonder if it is possible to underclock cpu or do something similar permanently?

aik commented 7 years ago

@shakalaca git diff should tell ya what is missing :-) I noticed new kernel on the asus website, ported somehow and this is why adb was not working. The msm8953-audio.dtsi problem appears on both your and newer kernel though.

aswindivakar commented 7 years ago

@Planet-X Let me check it :)

aswindivakar commented 7 years ago

How to change button configuration in our build, in my RR build recent hardware key is not working onscreen key works well.Anyone knows how to fix this? @Planet-X @aik @shakalaca