--------------------------Solution--------------------------
Thanks to @sdr4wkcab
Notice:You should replace paths with your own.
1.Open /device/samsung/ks01lte/BoardConfig.mk
2.Change
BOARD_PROVIDES_LIBRIL := ture
to
BOARD_PROVIDES_LIBRIL := false
3.Extract libril.so from stock ROM.
4.Add these lines to /device/samsung/ks01lte/Android.mk
Code:
$(shell mkdir -p $(OUT)/obj/lib)
$(shell cp -f ~/cm12.1/others/libril.so $(OUT)/obj/lib/)
5.Put libril.so in a folder "others" right in the root directory of the source file.
Rom then can be built normally.
______________________________________
Hi!
I want to compile CM12.1 myself.
Butttttt
Code:
Import includes file: /home/builder/cm12.1/out/target/product/ks01lte/obj/EXECUTABLES/rfc_intermediates/import_includes
make: *** No rule to make target “/home/builder/cm12.1/out/target/product/ks01lte/obj/EXECUTABLES/rild_intermediates/import_includes” Needed by “/home/builder/cm12.1/out/target/product/ks01lte/obj/SHARED_LIBRARIES/libril_intermediates/export_includes”. Stop.
make: *** Waiting for unfinished jobs...
Export includes file: external/bluetooth/bluedroid/test/rfcommtest/Android.mk -- /home/builder/cm/out/target/product/ks01lte/obj/EXECUTABLES/rfc_intermediates/export_includes
#### make failed to build some targets (02:48 (mm:ss)) ####
This is what I always encounter 2min after brunch. I have re-sync for many times, but it won't help.
Any way to solve this ? Thanks in advance!!
Same here building for Note 4. Any ideas guys?
Well, ROM built with SIM card not recognized.
Try setting BOARD_PROVIDES_LIBRIL := false in the BoardConfig.mk and copying the librild.so by hand from your backup.
sdr4wkcab said:
Try setting BOARD_PROVIDES_LIBRIL := false in the BoardConfig.mk and copying the librild.so by hand from your backup.
Click to expand...
Click to collapse
Thanks! It finally works!
Just remember that RIL (Radio Interface Library) is something Android needs in order to communicate with the phone's modem (i.e. make calls, send msm, change SIM-settings, etc.). If you don't have this in the correct way on your ROM you will have instead of a GSG5 mobile phone a very small non-SIM-capable tablet in the end, running CM
If you are suspicous about using a binary blob like this in your own distribution, rejoice, for your suspicion was justified: RILd is shamelessly backdoored (just google for "Replicant Samsung Galaxy backdoor"). Luckily the Replicant developers managed to initiate an open-source replacement for Samsung's RIL, which heavily needs contributors..
sdr4wkcab said:
Just remember that RIL (Radio Interface Library) is something Android needs in order to communicate with the phone's modem (i.e. make calls, send msm, change SIM-settings, etc.). If you don't have this in the correct way on your ROM you will have instead of a GSG5 mobile phone a very small non-SIM-capable tablet in the end, running CM
If you are suspicous about using a binary blob like this in your own distribution, rejoice, for your suspicion was justified: RILd is shamelessly backdoored (just google for "Replicant Samsung Galaxy backdoor"). Luckily the Replicant developers managed to initiate an open-source replacement for Samsung's RIL, which heavily needs contributors..
Click to expand...
Click to collapse
Thanks for that info.
I have very little skills of coding or debugging on these stuffs.... It can take me a long to look for practical and useful guide or tutorial, or even finally know about the source code.
The Rom I built works normally now, "apparently", with overheat along and occasional sudden freeze. I did sync the source code from cm's github, but the the only maintainer of my device on CyanogenMod seems to stop maintaining this device (ks01lte) :crying: So there must be much to improve.
I'm trying to build kernel from Note 3's source code, which is almost identical to my device except for few things like memory size. But failed today. Will investigate more.
Related
I'm trying to build busybox from sources.
I use last NDK as toolchain.
I started building it from original sources checked out from official busybox's git. Some small fixes with includes/declarations and stuff. Didn't finish fixing these problems.
And found out that cyanogenmod already has it with fixes I made for my build, but wrapped in __BIONIC__ define.
I decided to build it from cyanogenmod git (http://github.com/cyanogen/android_external_busybox) cause it looks like it already solved all that small build problems.
But I can't invoke make properly.
It has Android.mk, If I invoke usual
Code:
make ARCH=arm CROSS_COMPILE="arm-eabi-" CFLAGS="-I/home/astar/android/android-ndk-r4/build/platforms/android-8/arch-arm/usr/include"
it doesn't use Android.mk makefile and fails with those small problems.
But if I invoke it with -f Android.mk It fails with error
Code:
$ make ARCH=arm CROSS_COMPILE="arm-eabi-" CFLAGS="-I/home/astar/android/android-ndk-r4/build/platforms/android-8/arch-arm/usr/include" -f Android.mk
cat: /busybox-full.sources: No such file or directory
make: *** CC=cc: No such file or directory. Stop.
cat: /busybox-full.links: No such file or directory
cat: /busybox-minimal.sources: No such file or directory
make: *** CC=cc: No such file or directory. Stop.
looking inside Android.mk i think, that it fails with setting LOCAL_PATH. Setting it manually inside Android.mk doesn't help.
Can anyone point me to proper guide/howto?
How do You build busybox?
I have really little knowledge about building parts of Android system, but I think that you can't build it using makefile directly. When you are building Android system, then building process begins with some initialization, macros are defined, etc. and then makefiles of subprojects are called. This is why you get errors - you run makefile of busybox directly, but building process isn't initialized properly.
On the other hand NDK does this initialization when you are building native application, but you don't use NDK properly. NDK apps aren't build using regular make command.
There's three build systems for android:
SDK - Java
NDK - C/C++
android-sources - unixy stuff
You might need the android-sources rather than NDK to build busybox. To do that you'll need to download the sources then source the build/envsetup.sh then run "mm" in the directory that has your Android.mk
I have some instructions here (for dropbear, not busybox, but should be similar):
http://teslacoilsw.com/dropbear
Check the Building section.
[email protected] said:
I have some instructions here (for dropbear, not busybox, but should be similar):
http://teslacoilsw.com/dropbear
Check the Building section.
Click to expand...
Click to collapse
Thank you very much. It is the magic I was looking for (crap, I spent 10 hours trying to find out how to do it):
Code:
export TOP=/path/to/android-sources
source "$TOP/build/envsetup.sh"
mm
I managed to build AOSP with java 1.6. Check this patch if you're interested in.
I tried to build cm's busybox with AOSP but it fails (I expected that). Currently I'm getting cm sources. Hope that it'll be ok.
Do you know if I have to build whole tree before external utils (=busybox)? Cause when I tried to do it before aosp build it failed with make dependencies.
The following contains binaries, and instructions for use of an experimental newer toolchain than those included in the android pre-built package.
This is provided to allow existing linux kernel developers experiment with the updated version of GCC (besides the complicated building instructions the code just has a small patch for a known issue with android and 4.6.* otherwise is directly from GNU (see build information below)
The packages I'm also providing to help developers current on windows (With cygwin but no other virtual environment) to start exploring android Linux kernel development for their devices. (In addition to a OSX toolchain for more advanced mac users)
due to the slight differences between kernels on different devices this How To is intended to be used for advanced users who can adjust for the differences required for the devices specific kernel.
I may add additional guides to this thread if I find a need for them.
[size=+1]Binary Toolchains[/size]
I have two versions of a GCC-4.6.3 toolchain
1) For x86 linux: toolchain-4.6.3.tar.bz2 (Sha1: c8c57aba6ad92e9acddf29ba8620ba880be09a81)
2) For Cygwin (windows): toolchain-4.6.3.cygwin.tar.bz2 (Sha1: 6947e1c1ba95195019f542eb8ba0708667b63eca)
3) For OSX (mac/darwin): toolchain-4.6.3.darwin.tar.bz2 (Sha1: 9a977f0672863fdd9501383a6ad1e30723281f68)
[size=-1]> The linux version was built via this script: http://pastebin.com/b2dZ8YtG (or in the included toolchain_notes.txt)
> The cygwin/darwin version uses the same source however has a slightly modified script (see the included toolchain_notes.txt for the updated script)[/size]
[size=+1]System Requirements[/size]
Note I have a 64bit debian linux box, and a 64bit version of WIndows7 Pro running cygwin, while I believe these binaries ought to be compatible with all x86 linux and cygwin installs these have not been tested by a wide number of people yet.
> Linux users: If you have a working android build environment likely no additional requirements are needed. In addition you must build any kernel/android utilities from a case sensitive filesystem or disk image.
> OSx users: the cygwin packages will give you an idea of what is required, please also see the README in the tar.bz2 about manually installing elf.h
> Cygwin users: as its unlikely you have compiled a kernel with cygwin up to this point you may wish to ensure the following packages are installed (as well as any cygwin recommends to be used with them):
vim
vim-common
make
cmake
lzop
gcc
gcc-core
gcc-g++
wget
git
git-compleation
libncurses-devel
python
Cygwin users must also set their NTFS file partition to allow case sensitive files:
To do this open regedit and change:
HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\kernel\obcaseinsensitive
to 0
after this reboot and the NTFS kernel will allow cygwin to use case sensitive files (ie 'AbC' and 'aBc' as two different files)
[size=+1]Advanced Kernel Building Guide[/size]
Since may devices are slightly different this can only be a high level kernel building guide
Please ask for any specific directions from the current kernel maintainer.
To most people who have built kernels before this will look familiar, the most important part is preparing your local environment to use the new toolchain,
1) If you have not already download the tar.bz2 above, (pick the one for the computer you are preparing to build kernels on)
2) extract the file (for the sake of this guide I will assume it is extracted into a ~/android directory)
ie on cygwin you might:
mkdir -p ~/android
cd ~/android
tar -xjvf toolchain-4.6.3.cygwin.tar.bz2
Note: steps one and two are just properly installing the toolchain, you will not need
to repeat them to build a different kernel.
2.b) OSX Only: check elf.h
open ~/android/toolchain-4.6.3/README in a text editor and check if elf.h is installed, otherwise manually install it as per the readme
3) fetch your kernel source into the ~/android directory and change into the
source codes root directory
(this can be via a git repo or tarball)
example if you wanted my ACER a100/a500 source you might run:
git clone git://github.com/ezterry/AcerTabKernel.git
cd AcerTabKernel
change this to match the source you are fetching
4) In the root directory of the kernel source (~/android/AcerTabKernel in the about a100/a500 example) update the environment for the cross compiler
add the toolchain to your path:
export PATH=$HOME/android/toolchain-4.6.3/bin:$PATH
set the cross compile:
export ARCH=arm
export CROSS_COMPILE=arm-linux-androideabi-
export KERNEL_DIR=`pwd`
(this will need to be done once for each terminal you use to run any of the following make commands)
5) Grab your configuration
From the device:
adb pull /proc/config.gz
gzip -dc config.gz > .config
or from a prepared configuration if it's included in your code base by running
make _defconfig
example for the a100/a500 code base is 'make vangogh_defconfig' for the a100 and 'make picasso_defconfig' for the a500
6) Customize configuration
just run menuconfig and use the UI to update settings
make menuconfig
7) building the kernel (zImage)
This is normal at this point with 'make -j'
so for a quad core CPU you can run
make -j5
(note: the wrong number in the -j argument will not harm the build but may slow down the building process by either using too few threads or needing to keep track of too many)
8) If it worked you will now have the kernel in arch/arm/boot/zImage
this can be injected into the boot.img (as the kernel, using an existing ramdisk) as is
If it failed for your kernel your kernel source may need one of the common patches
9) Building modules
the following will prepare the modules in subdirectory mod:
make modules
rm -rf mod
mkdir mod
cp `find ./ | grep .ko$` modules.order mod/
After these commands [if no errors] you can simply copy the contents of mod/ to /system/lib/modules on your device, note it is recommended usually to remove the existing contents of /system/lib/modules unless there is a closed source module required from the previous build despite the new kernel.
[size=+1]Common Patches Required[/size]
If your kernel has not been built for the new toolchain or on cygwin before you may require some of these common patchs: (I've thus far only tested this on my Acer A100/A500 source)
wireless/bcm4329 for GCC-4.6.3:
https://github.com/ezterry/AcerTabKernel/commit/123f32e27e2c74f1c1789ae5d6d5a1c04e1e264c
linux kernel module patch for cygwin (broken elf.h):
https://github.com/ezterry/AcerTabKernel/commit/220db49593cf6b9f3b556e2f4b75b2f6d3ff556c
Error compiling security/smc/bridge_pub2sec.S (I required the cygwin elf patch and this patch to build the Franco galaxy nexus kernel)
0001-Fix-build-error-with-4.6.3-toolchain-smc-0.patch
(use 'git am 0001-Fix-build-error-with-4.6.3-toolchain-smc-0.patch' to apply)
OSX stat patches (fixes errors between GNU and BSD stat):
https://github.com/ezterry/AcerTabKernel/commit/0c49df3cc1a05a0ccd98201511cdc0534aaeb35a
Errors loading newly built modules (modules appear to build cleanly but wont install):
simply add -fno-pic to CFLAGS_MODULE
https://github.com/ezterry/AcerTabKernel/commit/c5ed0fcb014d36936a86ad253f15af43de2f644a
(I can add others here if highlighted to me, and as I find them)
[size=+1]Other Toolchain uses[/size]
The linux toolchain can be used to build android components, however this requires various manipulation to the android /build git repository as currently various other toolchains have hard coded paths into the prebuilt repo. If you intend to incorporate this into your build it may be best to inject the toolchain into your prebuilt repo rather than expect your users to download the links above, ensure to keep the compile notes as it explains how to get the source code to the toolchains)
On cygwin/osx it may also be possible to build android applications however I've not yet tested this as the scripts to make a proper build are complex when attempted outside the android build tree.
Excellent!!! thanks Man!!! Has been looking for one of these
Added in the OSX version of the toolchain (and some related patches)
Also if you are having problems with your modules built with this toolchain a CFLAG fixes it. (see note in common patches)
FINALLY!!! Great Instructions followed them to the T and BAM got my kernel compiled!!!
wow your toolchain is so small, many thanks, just compiled a kernel for my LG P500 gonna test it, thanks again
Bookmarked for testing when I wake up...
I can almost put: "Building under Windows is not currently supported." (quote from google), unofficially at least, out of my mind...
I have been spoiled by Windows for far too long I fear, my attempt for this last week at getting Linux setup and building CM9 has been nothing but a complete FAILURE, too many single line entrys for different distributions/package combo's, commands I dont know and cant find because of wildcard portions of them and lack of understanding, and not enough scripts like the wonderful Compile CM9 script someone put up (cant run it because all the pre-req's arent setup).
Good god Ill be jumping for joy if this works tomorrow on WinBlows!
EDIT: never mind, problem solved, what I need to know now won't be solved here
I wish i knew how to go about doing this..
Thanks
Thanks For ........... i Really need It .........
Hammerfest said:
Bookmarked for testing when I wake up...
I can almost put: "Building under Windows is not currently supported." (quote from google), unofficially at least, out of my mind...
I have been spoiled by Windows for far too long I fear, my attempt for this last week at getting Linux setup and building CM9 has been nothing but a complete FAILURE, too many single line entrys for different distributions/package combo's, commands I dont know and cant find because of wildcard portions of them and lack of understanding, and not enough scripts like the wonderful Compile CM9 script someone put up (cant run it because all the pre-req's arent setup).
Good god Ill be jumping for joy if this works tomorrow on WinBlows!
Click to expand...
Click to collapse
If you succeed tell me how to do it in a more familiar way
I get errors regading the processor not being supported?
brfield said:
I get errors regading the processor not being supported?
Click to expand...
Click to collapse
Sorry I can't support devs that have not learned cut copy and paste.
You probably forgot to export some of the environment variables or are just trying to run a arm binary on your PC and or a x86 binary on your arm device.
But why am I guessing? Why don't we know what you tried to run and what the actual text of the error was.. what type of kernel you tried to build, what you are running?
These packages are for developers if you feel like using them its time to learn to how to trouble shoot a problem and write a ticket to explain said problem clearly to others with at least some information to give us a chance to understand.
Sent from my Galaxy Nexus using Tapatalk 2
Great guide. Have the bcm4329 wireless module, so followed the tips and everything compiled and works!
Thanks!
one question,how to compiled android kernel with -O3 optimization?
jxxhwy said:
one question,how to compiled android kernel with -O3 optimization?
Click to expand...
Click to collapse
Um, in general its recommended you don't:
-O3 is not recommended for the kernel as many low level parts require the assembly code generated to remain as is and not be optimized as will be by some of the options -O3 enables thus likely reducing the stability of your kernel.
---
That said the menuconfig has an option to optimize for size (-Os) if enabled else -O2
For other optimization (including tuning for your cpu) you can add them to the CFLAGS_KERNEL/CFLAGS_MODULE in the make file.)
For -O3 like functionality you could add the increment to the line:
-finline-functions, -funswitch-loops, -fpredictive-commoning, -fgcse-after-reload, -ftreel-vectorize, -ftree-partial-pre and -fipa-cp-clone
-Ofast is -O3 with -ffast-math as well
If you do build with all the -O3 or-Ofast options ensure you test the kernel for stability and run some benchmarks. (as it may not actually be faster depending on the cache misses)
The first option I'd start pruning was the one mentioned in my reference below -fgcse-after-reload.
If you really insist on -O3 rather than just adding the optimization you want that are not in O2,it can be added also in the Makefile where the configure flag is checked and its added to KBUILD_CFLAGS
Obviously all and any of this is at your own risk, anything that breaks you have to find a way to fix it.
Reference:
Gcc optimize options:
http://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
Talk of O3 and the kernel (not android specific)
http://unix.stackexchange.com/questions/1597/compiling-gnu-linux-with-o3-optimization
ezterry,thank you very much!
I want to build cm9 kernel using toolchain 4.6.3.
How to replace the default GCC 4.4.3 to 4.6.3 version?
BTW,I use the way -- make bootimage
jxxhwy said:
ezterry,thank you very much!
I want to build cm9 kernel using toolchain 4.6.3.
How to replace the default GCC 4.4.3 to 4.6.3 version?
BTW,I use the way -- make bootimage
Click to expand...
Click to collapse
If you are asking in a cm9 build tree.. its a pain, best is to update the cm kernel makefile to point the build chain temporarily.
If you mean just to compile by hand as described in the op
Once the kernel is compiled find an anykernel update.zip or manually use mkbootimg or fastboot to merge it with the ram disk. Cm9 targets mkbootimg and unpackbootimg (if I'm not mistaken) will build the applications to unpack your current (or the default cm9) boot image and re-create them with your custom kernel built from hand.
Now,I runing script file:
#Let's make sure the environment is clean and ready to compile the kernel
echo "Cleaning house!!"
make mrproper
echo "House cleaned, lets build a kernel!!!"
#
# Lets set the kernel defconfig
echo "defconfig = cyanogenmod_iprj_defconfig"
make ARCH=arm cyanogenmod_iprj_defconfig
#
# Let's build a kernel
echo "Now compiling kernel, go get a soda! "
ARCH=arm CROSS_COMPILE=~/Android/sourcecm9/cm9/toolchain-4.6.3/bin/arm-linux-androideabi- make zImage -j4
#
if [ -f arch/arm/boot/zImage ]; then
echo "Plague has been compiled!!! You can find it in arch/arm/boot/zImage"
else
echo "Kernel did not compile, please check for errors!!"
fi
but,I got some error output:
/home/xxx/cm9/toolchain-4.6.3/bin/arm-linux-androideabi-ld: cannot find usr/initramfs_data.o: No such file or directory
thanks again!!!
I think that means there is an issue with your config..
Most android kernels require initramfs, but don't specify a file, as its provided by the bootloader.. However in your case it is trying to embed it into the kernel.
Sent from my A500 using Tapatalk 2
ezterry said:
I think that means there is an issue with your config..
Most android kernels require initramfs, but don't specify a file, as its provided by the bootloader.. However in your case it is trying to embed it into the kernel.
Sent from my A500 using Tapatalk 2
Click to expand...
Click to collapse
issue has been resolved by myslef.Thanks for your time.
hi all
we have included this device in open devices project
you can check news about project on
http://developer.sonymobile.com/know.../open-devices/
feel free to fork, build, fix and push back
Br
J
Wohooo! Finally! [emoji106] [emoji2] [emoji3]
Excellent! An AOSP ROM is the only thing I can think is missing from an otherwise perfect device.
GCC here we come..
Andoroid L (5.0) code, binaries and guides are published
No working camera or modem, looks like we've still got awhile guys...
great news,thankss
nice
I'm syncing it now. I'm going to do a blind build (not changing anything just going with what's already there) because I have yet to unlock my bootloader and won't until they can figure out a way so at least the camera and noise cancellation don't get messed up when unlocking (if I go back to a sony stock rom I know it won't matter on AOSP)
graffixnyc said:
I'm syncing it now.
Click to expand...
Click to collapse
Preparing to build as well. Like you, I haven't BL unlocked and won't until the DRM issues are resolved.
jerpelea said:
Andoroid L (5.0) code, binaries and guides are published
Click to expand...
Click to collapse
Your work is really appreciated. FYI, I convinced a friend to buy a Z3C in large part due to your AOSP commitment. [emoji106]
Guessing we'll need to reverse engineer the camera and modem binaries? Is that right?
illogic6 said:
Guessing we'll need to reverse engineer the camera and modem binaries? Is that right?
Click to expand...
Click to collapse
no
Reverse Engeneering
In other words - SONY will deliver the required drivers or better all required driver will be there in a while...
I get compile error:
Code:
external/bluetooth/bluedroid/main/../btif/co/bta_av_co.c: In function 'bta_av_audio_sink_getconfig':
external/bluetooth/bluedroid/main/../btif/co/bta_av_co.c:557:52: error: 'p_sink' undeclared (first use in this function)
if (bta_av_co_audio_sink_has_scmst(p_sink))
^
external/bluetooth/bluedroid/main/../btif/co/bta_av_co.c:557:52: note: each undeclared identifier is reported only once for each function it appears in
make: *** [out/target/product/aries/obj/SHARED_LIBRARIES/bluetooth.default_intermediates/../btif/co/bta_av_co.o] Error 1
make: *** Waiting for unfinished jobs....
help appreciated
m0d said:
I get compile error:
Code:
external/bluetooth/bluedroid/main/../btif/co/bta_av_co.c: In function 'bta_av_audio_sink_getconfig':
external/bluetooth/bluedroid/main/../btif/co/bta_av_co.c:557:52: error: 'p_sink' undeclared (first use in this function)
if (bta_av_co_audio_sink_has_scmst(p_sink))
^
external/bluetooth/bluedroid/main/../btif/co/bta_av_co.c:557:52: note: each undeclared identifier is reported only once for each function it appears in
make: *** [out/target/product/aries/obj/SHARED_LIBRARIES/bluetooth.default_intermediates/../btif/co/bta_av_co.o] Error 1
make: *** Waiting for unfinished jobs....
help appreciated
Click to expand...
Click to collapse
just re sync your tree and fix is there
That inform you in: <insert the cpu thread number of your computer> ??? Please
I got a build to finish. I'll post the boot and system img for someone to try.. I'm not going to go through the trouble yet to make a flashable zip until we at least know it boots. I'll upload the images now
Posted the images: http://forum.xda-developers.com/z3-compact/development/img-aosp-5-0-boot-imgs-t2940499
So @NisseGurra flashed the build I made yesterday here is what he found to be broken:
no wifi, no network, some reboots, no usb storage, no external sd, no sound or camera
But its very snappy, looking forward to a functional aosp
Thank you for the guides,
I was able to compile AOSP for D5803 successfully.
A couple of issues,
First,
Has the Cherry-Pick for external/libnfc-nci/ that is provided in the guide been merged?
As I get the following error,
Code:
/external/libnfc-nci $ git cherry-pick 83cf98d0a5018e023eb9cc8b4e394957f9a6989f
fatal: bad object 83cf98d0a5018e023eb9cc8b4e394957f9a6989f
(Updated on blog to correspond with Shinano Issue.)
Second,
I get the following error when I try to output zipped package,
Code:
[B]No private recovery resources for TARGET_DEVICE aries
No recovery.fstab for TARGET_DEVICE aries[/B]
make: *** no rule to make target `otapackage'. stop.
Does this have anything to do with: TARGET_BOOTLOADER_BOARD_NAME := D5803
or that it is called aosp_d5803 (aosp_d5803.mk)
UPDATE: otatools seems to work, [" . build/envsetup.sh && time lunch aosp_d5803-userdebug && make otatools "].
But I can not find the output / output directory for package
Oh,
Is there supposed to be a userdata.img too?
Looking around a different sources mention it, however there is no userdata.img when I compiled it.
Thank you for your time
So, I just built a CM11 for my XT1022 based on @JackpotClavin trees. I found a difficulty in setting up RIL (although Bluetooth was working fine).
I thought maybe, the vendor blobs were a mismatch and they need to be replaced by the stock KK4.4.4 ones.
I found a proprietary-blobs.txt in the vendor directory( again thanks to @JackpotClavin) but the problem was the files list was huge and it would be insane to manually fetch those files
Hence, I wrote a small python script to fetch the vendor blobs from my phone recursively.
The only changes you need to make on the script is to change the paths of proprietary-blobs.txt (path_list variable) and the *croot* path (croot_path variable).
I hope in this way, I am a little helpful to my fellow members in this community
The code:
Code:
#!/usr/bin/python3
#don't forget to put the / at the beginning and the end
path_list="<modify-the-path-to-proprietary-blobs.txt>"
croot_path="<specify croot_path"
try:
f=open(path_list,"r")
except(FileNotFoundError):
print("Invalid file path")
sys.exit(1)
finally:
count=0
a=f.readlines()
for x in a:
count=count+1
b=os.system("adb pull "+a[0].replace("\n","")+" "+croot_path+os.path.split(x)[0].replace("\n",""))
print(b)
print("Job done!")
print("Total files to retreive: "+len(a))
print("No. of retreived files: "+count)
print("Goodbye!")
sys.exit(0)
Hello, when you using phh's GSIs, you may found bugs on auto brightness, battery usage data, etc (e.g: Xiaomi, Huawei, etc.). For this, you can make an overlay files for your mobiles.
Requirements:
framework-res.apk on your stock rom. (It may on /system/framework/framework-res.apk)
apktool (to extract framework-res.apk)
git (to clone repo)
Linux (to build overlay files)
Steps:
1. Fork phhusson/vendor_hardware_overlay on GitHub.
2. Clone Repository which you forked, and make a new branch for your works.
3. Copy a device which similar for your device, and rename it to your own device.
4. Edit <Your device>/Android.mk (Just modify the contents of the brackets, same as below)
Code:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_PACKAGE_NAME := treble-overlay-[Manufacturer of your device]-[Name of your device]
LOCAL_MODULE_PATH := $(TARGET_OUT)/overlay
LOCAL_IS_RUNTIME_RESOURCE_OVERLAY := true
LOCAL_PRIVATE_PLATFORM_APIS := true
include $(BUILD_PACKAGE)
5. Edit <Your device>/AndroidManifest.xml
Code:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="me.phh.treble.overlay.[Manufacturer of your device].[Name of your device]"
android:versionCode="1"
android:versionName="1.0">
<overlay android:targetPackage="android"
android:requiredSystemPropertyName="ro.vendor.build.fingerprint"
android:requiredSystemPropertyValue="+[write as similar format]*"
android:priority="[Take next number of last used]"
android:isStatic="true" />
</manifest>
If you don't know how to take androidriority, you can execute this commands to list priority which used already:
Code:
cd [Path of repository]
find -name AndroidManifest.xml |while read manifest;do packagename="$(xmlstarlet sel -t -m '//manifest' -v @package -n $manifest)";priority="$(xmlstarlet sel -t -m '//overlay' -v @android:priority -n $manifest)";echo -e "$priority\t$packagename";done|more
(the single line command split here, just for viewing or making a shell script):
Code:
find -name AndroidManifest.xml |while read manifest;do
packagename="$(xmlstarlet sel -t -m '//manifest' -v @package -n $manifest)";
priority="$(xmlstarlet sel -t -m '//overlay' -v @android:priority -n $manifest)";
echo -e "$priority\t$packagename";
done
It will print a list for you (unsorted), and you just take an unused priority.
You can find device fingerprint on /vendor/build.prop, or execute following commands (on your device or adb shell):
Code:
getprop ro.vendor.build.fingerprint
If you can't find ro.vendor.build.fingerprint, you can find ro.vendor.product.name or ro.product.vendor.device, then change android:requiredSystemPropertyName and android:requiredSystemPropertyValue what you found.
Huawei seems to use ro.hw.oemName to detect phone, and others manufacturer maybe have their own detection, too. But it should be unique for other phones with same manufacturer.
(It's NOT recommended unless your device don't have ro.vendor.build.fingerprint.)
6. Extract framework-res.apk with apktool on another side. (to avoid commited by mistake)
7. Replace <Your device>/res/xml/power_profile.xml to which power_profile.xml for your device.
It will on <Extracted framework-res.apk>/res/xml/power_profile.xml.
Or you can find whoever's device tree, it may have this file, too.
8. Edit <Your device>/res/values/config.xml
Find each key on following files what for your device:
Code:
[Extracted framework-res.apk]/res/values/arrays.xml
[Extracted framework-res.apk]/res/values/bools.xml
[Extracted framework-res.apk]/res/values/fractions.xml
[Extracted framework-res.apk]/res/values/integers.xml
And then replace values into <Your device>/res/values/config.xml
9. Add your device into <Path of repository>/overlay.mk
Just write like other lines.
10. Build overlays
Just execute following commands:
Code:
chmod u+x [Path of repository]/build/build.sh
[Path of repository]/build/build.sh
If You get this, Do what it said:
Code:
Please install aapt (apt install aapt should do)
Or if you get this:
Code:
OpenJDK Server VM warning: You have loaded library /root/overlay/vendor_hardware_overlay/build/signapk/libconscrypt_openjdk_jni.so which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
Exception in thread "main" java.lang.UnsatisfiedLinkError: org.conscrypt.NativeCrypto.get_cipher_names(Ljava/lang/String;)[Ljava/lang/String;
at org.conscrypt.NativeCrypto.get_cipher_names(Native Method)
at org.conscrypt.NativeCrypto.<clinit>(NativeCrypto.java:764)
at org.conscrypt.OpenSSLProvider.<init>(OpenSSLProvider.java:56)
at org.conscrypt.OpenSSLProvider.<init>(OpenSSLProvider.java:49)
at com.android.signapk.SignApk.main(SignApk.java:942)
I have no solution, either. Try to build on another computer.
11. Test overlay with tests.sh and yourself
For general checks (symtax, etc.), just execute following command:
Code:
chmod u+x [Path of repository]/tests/tests.sh
[Path of repository]/tests/tests.sh
You should fix errors what reported for your device, and then restart from step 10.
If it reported errors but not for your device, just ignore it.
When check passed, you can find overlay file on <Path of repository>/build/treble-overlay-<Manufacturer of your device>-<Name of your device>.apk, just copy it into your phone's /system/overlay/, and set permission to rw-r--r-- / 0644.
And then reboot your phone to test your overlay.
12. If it works for your device, don't forget to perform a pull request for phhusson/vendor_hardware_overlay, to support his awesome works.
Thanks for the guide @minadzuki
but i'm getting this error after step 10:
(core dumped) aapt package -f -F ${name}-unsigned.apk -M $path/AndroidManifest.xml -S $path/res -I android.jar
even when i try to build for existing devices I got the same error
king1990 said:
Thanks for the guide @minadzuki
but i'm getting this error after step 10:
(core dumped) aapt package -f -F ${name}-unsigned.apk -M $path/AndroidManifest.xml -S $path/res -I android.jar
even when i try to build for existing devices I got the same error
Click to expand...
Click to collapse
Oh...I forgot this, sorry.
Because I haven't encountered this error, so I don't have a way to solve it, either. (I tried to built it on three remote servers only)
And...is it cause segment fault?
Or you can try to install google-android-build-tools instead of aapt. (because I can't find aapt on archlinux but found this)
Very nice guide, thanks!
I'll link it as part of a "how to contribute"
For aapt, there is an aapt included in the git. If it doesn't work for you (like @king1990's segfault), know that the one included in the git has the lowest priority. It will pick up aapt from the system first.
(but then you'll need to have a system-wide aapt).
Or if you have an Android SDK somewhere, you can set your PATH to include it.
Edit: I just realized that what I just described might actually be the issue. If there is a system-wide aapt, it will use the libc++ in the git, which would explain the crash.
I fixed this case in my current git.
If there is a system-wide aapt it will use it.
If for some reason, system-wide aapt isn't suitable, you can run build.sh with --local-aapt to force the use of the in-git aapt (i.e. it will have higher priority than system's so no conflict should happen)
king1990 said:
Thanks for the guide @minadzuki
but i'm getting this error after step 10:
(core dumped) aapt package -f -F ${name}-unsigned.apk -M $path/AndroidManifest.xml -S $path/res -I android.jar
even when i try to build for existing devices I got the same error
Click to expand...
Click to collapse
Could you check again with latest git?
If it still doesn't work, can you try to call build.sh --local-aapt ?
@phhusson Thanks now it working fine and building without faults
I have few questions regarding the AndroidManifest.xml :
1- for android:requiredSystemPropertyValue how do I know which name to use ? is it trial and error ?
2- for androidriority does matter which number I choose ?
3- some vendors have this overlay (framework-res__auto_generated_rro.apk) under "vendor/overlay". Does is affect the device overlay in system/overlay ?
4- to install the overlay is it just as @minadzuki says ?
and thanks again for your great work
king1990 said:
@phhusson Thanks now it working fine and building without faults
I have few questions regarding the AndroidManifest.xml :
1- for android:requiredSystemPropertyValue how do I know which name to use ? is it trial and error ?
2- for androidriority does matter which number I choose ?
3- some vendors have this overlay (framework-res__auto_generated_rro.apk) under "vendor/overlay". Does is affect the device overlay in system/overlay ?
4- to install the overlay is it just as @minadzuki says ?
and thanks again for your great work
Click to expand...
Click to collapse
1. For example, Xiaomi Mi 6X has this fingerprint:
xiaomi/wayne/wayne:8.1.0/OPM1.171019.011/8.7.12:user/release-keys/
So you can take xiaomi/wayne to use, and android:requiredSystemPropertyValue will be: +xiaomi/wayne*
2. it will affect to build images, or affect the detection on System. If you got this:
Code:
F: .xxx/AndroidManifest.xml: priority xx conflicts with another manifest
You just take next number and try again, until now priority 53 has been taken (without pull request), you can take priority since 54.
3. Sorry, I don't know for this.
4. Yes, just simply copy and permission change.
king1990 said:
@phhusson Thanks now it working fine and building without faults
Click to expand...
Click to collapse
Cool
3- some vendors have this overlay (framework-res__auto_generated_rro.apk) under "vendor/overlay". Does is affect the device overlay in system/overlay ?
Click to expand...
Click to collapse
overlays in /system/overlay and /vendor/overlay are the same thing, and on my GSI both are loaded, so yes it affects it.
But if your vendor has a framework-res__auto_generated_rro.apk, you probably don't need an overlay file for your phone, because it's already there.
(Please note that /system/overlay doesn't exist in AOSP, that's a change specific to my ROM, and custom ROMs based on it. AOSP only has /vendor/overlay)
@minadzuki Thanks for answering my questions. @phhusson its clear now , I don't know if this is related to your treble approach or not but some GSI ROMs refuse to go the minimum value in the brightness curve no mater what value I set in the curve, it never achieved.
is this treble or ROM related ?
king1990 said:
@minadzuki Thanks for answering my questions. @phhusson its clear now , I don't know if this is related to your treble approach or not but some GSI ROMs refuse to go the minimum value in the brightness curve no mater what value I set in the curve, it never achieved.
is this treble or ROM related ?
Click to expand...
Click to collapse
Brightness is a bit complex on Android Pie... (well it already was before, but it got even worse)
Do you have a link to your current overlay, so I can take a look at which code path you'd go to?
What's the lowest backlight value you get in /sys/class/backlight/panel0-backlight/brightness or /sys/class/leds/lcd-backlight/brightness?
Also what's your device? Does it have extended brightness range? (what's the value of getprop persist.sys.qcom-brightness // is it a samsung device?)
phhusson said:
Brightness is a bit complex on Android Pie... (well it already was before, but it got even worse)
Do you have a link to your current overlay, so I can take a look at which code path you'd go to?
What's the lowest backlight value you get in /sys/class/backlight/panel0-backlight/brightness or /sys/class/leds/lcd-backlight/brightness?
Also what's your device? Does it have extended brightness range? (what's the value of getprop persist.sys.qcom-brightness // is it a samsung device?)
Click to expand...
Click to collapse
for overlay this the extracted files from the overlay apk (my device is Axon7)
The lowest backlight is 10 (once manually edit it to 1 it goes to really dim brightness)
what I don't understand that I already built two GSI ROMs one is DU13 & other Liquid pie both report the same backlight light value at 10 at minimum value but in DU its very dim and in liquid its still bright ?!
The command did not give back any information so I assume we don't extended brightness range.
Thanks
Edit : it was overlay problem , fixed after modifying it
I tried to create an overlay for my Honor View 10 (Berkeley)
Is there a list of recommended settings to copy over from the stock ROM? I started with copying everything listed in tests/knownKeys and it seems to work
There's a power_profile.xml in the framework-res.apk I dumped from my stock ROM but the battery capacity is set to 1000 instead of 3750. Is that right?
There's also a power_profile_test.xml in there with a much more sane value of 3000 mAh. Should I use this one instead?
Copperhead100 said:
I tried to create an overlay for my Honor View 10 (Berkeley)
Is there a list of recommended settings to copy over from the stock ROM? I started with copying everything listed in tests/knownKeys and it seems to work
There's a power_profile.xml in the framework-res.apk I dumped from my stock ROM but the battery capacity is set to 1000 instead of 3750. Is that right?
There's also a power_profile_test.xml in there with a much more sane value of 3000 mAh. Should I use this one instead?
Click to expand...
Click to collapse
I don't have any Huawei phones, sorry.
Maybe you can referrer /Huawei/kirin970/CLT or /Huawei/kirin970/EML, Honor V10 maybe have its OEM name and called "BKL"
Copperhead100 said:
I tried to create an overlay for my Honor View 10 (Berkeley)
Is there a list of recommended settings to copy over from the stock ROM? I started with copying everything listed in tests/knownKeys and it seems to work
There's a power_profile.xml in the framework-res.apk I dumped from my stock ROM but the battery capacity is set to 1000 instead of 3750. Is that right?
There's also a power_profile_test.xml in there with a much more sane value of 3000 mAh. Should I use this one instead?
Click to expand...
Click to collapse
On Huawei, you'll find real power_profile.xml somewhere in /odm or /product. I'd say /product/etc/power_profile.xml
phhusson said:
On Huawei, you'll find real power_profile.xml somewhere in /odm or /product. I'd say /product/etc/power_profile.xml
Click to expand...
Click to collapse
Thanks. It's actually /product/etc/xml/power_profile.xml
There's a new pull request incoming
is it possible to create an overlay in Widows usingGIT for Windows?
JEANRIVERA said:
is it possible to create an overlay in Widows usingGIT for Windows?
Click to expand...
Click to collapse
Yes, you can write source code everywhere (don't forget to replace CRLF to LF), but maybe you should build it on Linux, or you have a way to build it on Windows (e.g.: WSL, Mingw, etc.)
@minadzuki I can't find a config.xml in my framework-res.apk, am I missing something? or that gets created somehow in the process?
another question
on step 5 you say to edit AndroidManifext.xml, does that means delete everything in it and copy paste what you put on the code box? or just add that at the end of the xml file?
JEANRIVERA said:
@minadzuki I can't find a config.xml in my framework-res.apk, am I missing something? or that gets created somehow in the process?
another question
on step 5 you say to edit AndroidManifext.xml, does that means delete everything in it and copy paste what you put on the code box? or just add that at the end of the xml file?
Click to expand...
Click to collapse
framework-res.apk doesn't contain config.xml, it split into several files: arrays.xml, bools.xml, fraction.xml, integers.xml. just create config.xml or copy from other devices and find values on these files (to replace it).
and step 5, just replace values which for your device, like what other devices wrote.
minadzuki said:
framework-res.apk doesn't contain config.xml, it split into several files: arrays.xml, bools.xml, fraction.xml, integers.xml. just create config.xml or copy from other devices and find values on these files (to replace it).
and step 5, just replace values which for your device, like what other devices wrote.
Click to expand...
Click to collapse
thanks for the response but I am really lost here those 4 xml has way to much data in it, should I just copy everything to config.xml?
to be honest what I am trying to fix are 2 things the battery stats not showing and the auto brightness and brightness slider and if the led light is fixable by an overlay that too, I can provide you all the files needed could you build it for me please? my device is an HTC U12+
JEANRIVERA said:
thanks for the response but I am really lost here those 4 xml has way to much data in it, should I just copy everything to config.xml?
to be honest what I am trying to fix are 2 things the battery stats not showing and the auto brightness and brightness slider and if the led light is fixable by an overlay that too, I can provide you all the files needed could you build it for me please? my device is an HTC U12+
Click to expand...
Click to collapse
you can check like this:
https://github.com/phhusson/vendor_hardware_overlay/blob/master/Xiaomi/Mi8/res/values/config.xml
then take values from those 4 xmls.