[Q] building an image from source for SM-N900P - Galaxy Note 3 Q&A, Help & Troubleshooting

I downloaded the source from opensource.samsung.com, and seem to be able to get a zImage. But I am not sure if I am doing everything correctly. Here have a couple of questions as follows:
Question 1- I don't see a system.img and / or a ramdisk in .../out/target/product/generic/ folder. Shouldn't I see a system.img and or a ramdisk.img there? I know I can get a ramdisk from a stock firmware. I like to know why I see some tutorials where the person has their own ram disk generated. Further is initramfs and ramdisk.img the same file? I am sure I'll find this out very soon, but if you can clear it up for me, I would certainly appreciate it.
Question 2- Also when I issue the command:
Code:
make VARIANT_DEFCONFIG=msm8974_sec_hlte_spr_defconfig msm8974_sec_defconfig SELINUX_DEFCONFIG=selinux_defconfig modules
I get the following error ( Error 1) :
The present kernel configuration has modules disabled.
Type 'make config' and enable loadable module support.
Then build a kernel with module support enabled.
Click to expand...
Click to collapse
I just dread going through make config so I use this command:
Code:
make VARIANT_DEFCONFIG=msm8974_sec_hlte_spr_defconfig msm8974_sec_defconfig SELINUX_DEFCONFIG=selinux_defconfig menuconfig
But it seems like the changes I make are not saved since I get the same error l labeled as error 1 above. I am sure I saved my config when I exit the menuconfig option. Does anyone know what I am doing wrong. Is there some way to quickly activate the loadable modules option?

Related

[TOOL] KernelModCorner - Extract and modify ramdisk - Rebuild kernel

This script is built from the knowledge gathered from:
http://forum.xda-developers.com/showthread.php?t=1332629
http://nookdevs.com/NookColor:_Build_the_Original_Kernel
http://nookdevs.com/User_talk:Warewolf
This script will let you extract the ramdisk off of the working kernel and will create a directory with the ramdisk for you to edit to your heart's content. The script will then download dalingrin's kernel source and move back to a known working commit (if it hasn't done this already.) The script will then compile said kernel and merge the new ramdisk to the kernel. The script will give you the option of backing up your current kernel and then pushing the new kernel into your touchpad.
Warning: I am not responsible for any damage that come to your touchpad.
Requirements:
It assumes you have all the required programs to compile the kernel. Maybe v2 will check for this and install the required items.
You must have adb somewhere in your user's PATH.
You must have mkimage in your path. Later versions may do thi for you.
How to use:
Place the script in a folder with a known working boot.img from the Touchpad's CM7.
Open a terminal window and browse to that folder.
Give the script execute permissions:
Code:
$ chmod +x KernelModCorner
Run the script:
Code:
$ ./KernelModCorner
This command bring up the following menu:
Code:
What do you want to do?
1: Extract from boot.img (Warning: This will delete any previously extracted ramdisk.)
2: Recompile kernel and merge with new ramdisk
3: Backup current uImage and transfer new one.
4: Clean up all temporary files and ramdisk (Note: This does not include the kernel sources.)
5: Restore backup.
6: Exit
You can probably figure out which options do what...
I just used it successfully to compile the following kernel (which I also started trying to overclock the GPU in... not sure if it is overclocked at the moment as most adreno's in the past have had their GPU clock locked... test it if you'd like and let me know.)
Great job on this invaluable tool
Thanks
I would suggest posting which kernel/CM release this script is intended to work with
since it is highly version specific.
The ramdisk offset being used will only work with one version. Also, there could be a mismatch between the git commit being used and any newer ramdisk/system.
To make the script less version specific, you could use uimage-extract available in the tools dir of the moboot source (see http://code.google.com/p/moboot/source/browse/#git%2Ftools). To compile, add "-lz".

[EXPERIMENTAL/TOOLS/GUIDE/ADV.] Toolchain gcc 4.6.3 Cygwin/Linux/OSX; kernel builds

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.

[B928] OC kernel 0.1 [one-hit wonder]

This will not be worked on any longer thanks to Huawei's incompetence. I'm glad my main phone isn't by them. I leave my 0.2 diff attached (which did make my phone faster FWIW - and has fsync() control. Not of use to me, but people who use a modified libsqlite would like it...). Feel free to apply it and see if you can somehow fix dhd.ko loading.
Hi,
Not one for names, so this shall be known as "OC kernel" This is built from the ICS U8800pro source that Huawei put out.
Install at your own risk; I take no responsibilty for any damage that may occur through the usage of this kernel.
Features:
ADB as root
Overclocking enabled (thanks to genokolar)
Undervolting interface added (from genokolar, who took it from a SE kernel modder somewhere) - I think SetXperia can use it
SIO I/O scheduler added
SmartassV2 cpufreq scheduler (AnDyX mod) - although I think ondemand does a bit better IMO
sysfs entry to turn off keypad lights (I wrote an applet for this some time back, I'll dig it out later)
Logcat is always enabled now as the ServiceMenu toggle doesn't work anymore
Minimum display backlight is set to 15, but I think Android needs a framework change to use it. You could try RootDim
Kernel actually builds (and Bluetooth works)
ZRAM (+ swap) support. ZRAM is optimized for Android (taken from Siyah kernel). I'll write up the instructions on enabling this later
CIFS as module
Extras:
Change schedulers and phone speed:
Use a tool like No Frills CPU or SetCPU.
Turn off button lights:
Install the ButtonLight widget and add it to your main screen. I've published the source before in another thread; seek it out if you're after its (bad) code.
It's buggy the first few times you run it, but works fine after that.
Dim screen to 14:
The minimum backlight level is now set to 15. RootDim from the Play Store lets you set it to that.
Mount Windows shares:
Grab CifsMounter and point it to the cifs.ko in /system/lib/modules. You may also need to insmod nls_utf8.ko and md4.ko.
Enable ZRAM (taken from Siyah kernel):
(Note I've not used ZRAM so I have nothing to say on its stability, good or bad)
Grab a BusyBox binary from somewhere
Run the following commands:
Code:
echo 90 > /proc/sys/vm/swappiness #You must set the swappiness high to ensure that the compressed RAM is accessed first!
echo $SIZE > /sys/devices/virtual/block/zram0/disksize #Set size to whatever you wish. 100MB is 104857600 = 100 * 1024 * 1024
busybox mkswap /dev/block/zram0
busybox swapon /dev/block/zram0
Dump the lines in install-recovery.sh if you want to be ZRAMMed every time you boot the phone (although in that case, make sure you have
Code:
busybox swapoff /dev/block/zram0 > /dev/null 2>&1 #Use > /dev/null 2>&1 for every busybox command in install-recovery.sh as it will discard any messages outputted
echo 1 > /sys/devices/virtual/block/zram0/reset
before the lines above)
Install:
Flash the attached ZIP in CWM recovery. You should backup your original boot.img and /system/lib/modules first
Source:
Take http://www.huaweidevice.com/worldwi...=toDownloadFile&flay=software&softid=NDY3NTU= and apply attached diff
at last..xaaxxaa!!but why with modules too???whats their use?
pikachukaki said:
at last..xaaxxaa!!but why with modules too???whats their use?
Click to expand...
Click to collapse
'cause I add a new module - cifs (used by CifsMounter if you want to mount Windows shares) - and because the modules that are originally in /system/lib/modules need to be replaced so that they can load with this kernel (I don't know what those modules do, but I'd rather play it safe)
qwerty12 said:
'cause I add a new module - cifs (used by CifsMounter if you want to mount Windows shares) - and because the modules that are originally in /system/lib/modules need to be replaced so that they can load with this kernel (I don't know what those modules do, but I'd rather play it safe)
Click to expand...
Click to collapse
Boot normally change io to sio and smartassv2...1500mhz lets check..good work..i envy you and i want your guide on compiling...xaaxax im off to bed!!
fps is locked!!xaaxax
pikachukaki said:
Boot normally change io to sio and smartassv2...1500mhz lets check..good work..i envy you and i want your guide on compiling...xaaxax im off to bed!!
fps is locked!!xaaxax
Click to expand...
Click to collapse
I'll write it up sometime - but bear in mind I'm not an expert at this
Regarding FPS: do the install-recovery.sh trick
Only thing I modify in initramfs is the ro.secure setting so that ADB can be ran as root
qwerty12 said:
I'll write it up sometime - but bear in mind I'm not an expert at this
Regarding FPS: do the install-recovery.sh trick
Only thing I modify in initramfs is the ro.secure setting so that ADB can be ran as root
Click to expand...
Click to collapse
You did a great job i couldnt even compile the kernel without changes!!you did great!!
the difference is obvious !!
Sent from my U8800Pro using xda premium
Pika When U add This Kernet To ur ROM?
As expected from qwerty12!
Great job!
I'll also request a guide on how to build the kernel like pika asked.
Hope you continue to improve the kernel! A thanks is simply not enough to thank you for your work, but thanks again
husen4u said:
Pika When U add This Kernet To ur ROM?
Click to expand...
Click to collapse
I wont!just d/w it and flash it!simple!
Sent from my U8800Pro using xda premium
Now what you suggest oc ics or kalo gb?
Sent from my U8800pro using xda app-developers app
husen4u said:
Now what you suggest oc ics or kalo gb?
Sent from my U8800pro using xda app-developers app
Click to expand...
Click to collapse
From now on i wont ever go back to GB ever again! if our luck changes and someone release cm9 i will forget what gb is!! there are some small bugs but the rom is usable for everyday!!
Moihack said:
As expected from qwerty12!
Great job!
Click to expand...
Click to collapse
Thank you
I'll also request a guide on how to build the kernel like pika asked.
Click to expand...
Click to collapse
Certainly, sir.
Hope you continue to improve the kernel! A thanks is simply not enough to thank you for your work, but thanks again
Click to expand...
Click to collapse
Unfortunately I won't be working on this anymore unless Huawei get back to my request for the source to the the dhd.ko module (which they may not have to comply with because the license for the module states "Unless you and Broadcom execute a separate written software license agreement governing use of this software" so the U8800pro version may not be under GPL). I made (well, found on the Internet) more optimizations but the Wi-Fi refuses to turn on because the dhd.ko module refuses to load. Only way I can get something working is to build the source that Huawei give or attempt to force other versions of the bcm source to load, but it's unlikely that would work.
--
Anyway, a small guide.
I used an x86_64 laptop running (X)ubuntu 12.04.1 to follow these steps. This page was a great resource.
Prerequisites:
A computer running GNU/Linux (a Mac should work in theory - the same toolchain we use is built for it, too, but I have no idea how OS X works)
git installed (apt-get install --no-install-recommends git-core is enough under Ubuntu)
sudo apt-get install flex bison gperf build-essential libncurses5-dev zlib1g-dev ia32-libs lib32z1-dev lib32ncurses5-dev gcc-multilib g++-multilib abootimg
Getting ADB working
One of the best things to do is getting ADB set up, as you then have easy communication with the device. It's not essential but you'll just end up wasting time transferring files through other, longer means.
Grab the Linux platform tools ZIP from here: http://www.hariadi.org/android/manually-download-of-android-sdk-tools-and-sdk-platform-tools/. Extract the adb binary from the zip file, preferably to somewhere in your $PATH. chmod 755 it. chown, if necessary.
Next, open http://aur.archlinux.org/packages/an/android-udev/android-udev.tar.gz and, doing all this as root (sudo in Terminal etc.), place 51-android.rules in /lib/udev/rules.d/ (not the best place - but it works), chmod 644 it and chown root:root it.
Next, execute /usr/sbin/groupadd adbusers, followed by gpasswd -a USERNAME adbusers, USERNAME being the user you normally log on with.
Restart (while you can force Linux to see the new group through the, well, newgrp command udev will not "see" the new rule, despite how much you try with udevadm).
That should be ADB set up (give it a test, remembering to enable USB debugging mode on the phone first!).
On to preparing your workarea.
--
Create a new folder in your home folder and cd to it. This folder will house the prebuilt folder of toolchains and other stuff, and the kernel source in a folder of its own.
In this folder, execute git clone --depth 1 https://android.googlesource.com/platform/prebuilt.git and move onto the next step, since the download takes a while. That command grabs the prebuilt toolchain from Google using Git, but doesn't obtain a deep history for each file to make the download quicker.
Open http://www.huaweidevice.com/worldwi...=toDownloadFile&flay=software&softid=NDY3NTU= and save the source to your Downloads directory. After git has finished running, still in the folder with the "prebuilt" folder, execute tar jxf ~/Downloads/HUAWEI_U8800pro<tab - as in actually press tab> and you should have a kernel folder alongside the prebuilt one.
Building the kernel
cd to this new kernel folder.
First things first: make sure that Bluetooth is properly enabled by editing the Makefile. Find the line #ifeq ($(ENABLE_BTLA_VER30),true) and comment out every line in that section except for KBUILD_CFLAGS += -DHUAWEI_BT_BTLA_VER30 so you end up with this:
Code:
#/* < DTS2012020604357 zhangyun 20120206 begin */
# Add Huawei Marco for different BT chip
#ifeq ($(ENABLE_BTLA_VER30),true)
KBUILD_CFLAGS += -DHUAWEI_BT_BTLA_VER30
#endif
#ifeq ($(ENABLE_BLUEZ_VER30),true)
#KBUILD_CFLAGS += -DHUAWEI_BT_BLUEZ_VER30
#endif
#/* DTS2012020604357 zhangyun 20120206 end > */
Commenting out the offending code leaves you with a kernel that builds but a Bluetooth module that won't start up - the same also applies if you try to build with the other define.
You can also make things easier for yourself by replacing the following
Code:
ARCH ?= $(SUBARCH)
CROSS_COMPILE ?= $(CONFIG_CROSS_COMPILE:"%"=%)
with
Code:
ARCH ?= arm
CROSS_COMPILE ?= ../prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
else you will have to put "ARCH=arm CROSS_COMPILE=../prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-" after "make" each time. Remember this as I'll be assuming that you went for the option to edit the Makefile. I also assume that the prebuilt folder is above the kernel one. Adjust CROSS_COMPILE if necessary.
The ARCH variable is self-explanatory, but the CROSS_COMPILE variable (and the toolchain that it's pointing to) need to be set because the standard GNU development tools that apt installs don't produce output that an ARM processor can understand. So you cross-compile: the tools are for the X86 architecture but produce ARM output. 4.4.3 is chosen because the stock kernel is compiled with GCC 4.4.3 (if you run "adb shell cat /proc/version" you'll see). The arm-eabi-4.4.3 folder is chosen over arm-linux-androideabi-4.4.x because it specifies that magic "3" (I know, bad way to decide but it works), and over i686-android-linux-4.4.3 because we don't want to produce code for the PC.
Get the current configuration in use by the stock kernel (as that's a good point to start from - a known working configuration): http://wiki.cyanogenmod.com/wiki/Building_Kernel_from_source#Configure_the_Build
I'd also recommend placing a copy of .config as arch/arm/configs/<your funky name here> so that if .config gets deleted (make clean etc.) you can run make <the name you gave to the file in arch/arm/configs> and have .config come back again.
(cp arch/arm/configs/<the name you gave to the file> .config if you didn't modify the Makefile to specify the ARM arch.)
Run make oldconfig (not always necessary - generally it's invoked if you've applied a patch that introduces a new config option and the option then needs to go into your .config. Run make menuconfig afterwards and customize away.
When you're done, run make -jX - X as in the number of cores you have + 1. So, in my case, with a quad-core processor and HyperThreading enabled on all of them, "make -j9" works for me. If the compile went OK, you'll be left with a message saying that arch/arm/boot/zImage is ready. If not, run "make" without the -jX argument and make should stop where the error occurs. Have fun fixing the error!
Assuming that you have a new, shiny zImage, it's now time to put it into your boot.img.
Updating your boot.img:
Google have tools for this purpose but I've never used them so I don't know how they work. abootimg works fine for this, however.
Pull the current boot.img off your phone: adb pull /.cust_backup/image/boot.img.. I'd recommend creating a backup somewhere.
Create a new directory to store the boot.img in on your computer and run abootimg -x boot.img (if you had fun enabling every option in the kernel, you'll see why I'm telling you to use the -x option first rather than directly use the -u option). Now run abootimg -u boot.img -k <path to your newly built zImage>.
If this succeeds, yay! If not and you're told it's too big for the boot image, then don't worry. Take the size it's saying that the zImage is and convert that number into hex. Edit bootimg.cfg and change the value of the bootsize setting into the number you just converted into hex. We'll now repack again, but this time running abootimg -u boot.img -f bootimg.cfg -k <path to your newly built zImage>. This should work.
Sending the boot.img to the phone
If your ADB is already running as root, you can do the following to upload the new bootimg:
Code:
adb shell mount -o remount,rw /.cust_backup
adb push boot.img /.cust_backup/image/
adb reboot
If not, just reboot into pink screen mode and copy and paste.
Check System Settings and the version number should've changed. Congratulations!
Extras
Installing the modules:
OK, so you decided to build parts of the kernel as a module and you want to actually, y'know, have the modules present on the device. After building the kernel, execute:
make INSTALL_MOD_STRIP=1 modules_install INSTALL_MOD_PATH=<any folder name here>
If you look in that folder, you'll find the modules neatly wrapped up in folders, along with other text files. These text files are useless on a stock ROM because there's no modprobe - you need BusyBox for that. And since we don't want to have them seperated in folders (this is how the stock kernel does it), the files would be wrong, anyway. If you want to use modprobe and have BusyBox installed, you can run depmod on the phone after transferring the modules.
To get the modules into one folder make the directory "modules" in a folder higher-up to where the modules are stored, and then run for i in `find . | grep ko`; do mv "$i" ../modules/; done to move them into that folder.
At this point, I'd just recommend using my OC_Kernel.zip and replacing the modules in that. Or you can adb push them over to the /system/lib/modules folder (after issuing an "adb remount" - assuming that ADB is running as root in the first place).
Making ADB run as root:
As root on your computer, (we want to preserve permissions) use abootimg to split the boot image and extract the contents of the initrd:
abootimg -x boot.img && mkdir newramdisk && cd newramdisk && zcat ../initrd.img | cpio -i --no-absolute-filenames (--no-absolute-filenames is important! I trashed a Ubuntu install by leaving it out - the initrd contains ARM binaries of core Linux programs and if the initrd.img contains an absolute path of "/" then these files will get placed in /)
Make any changes you desire to the initrd. To have adb run as root, just edit /default.prop and set ro.secure to 0. Make sure that the editor you used didn't leave any backup files.
When you're done, run find . -print | cpio -o -H newc | gzip -n -9 > ../initrd.img and this will put the modified initrd folder back into initrd.img.
After that run cd .. ; abootimg -u boot.img -r initrd.img to actually put the initrd.img back into the boot.img.
If you run into a space error, you can do one of three things:
if you only made a single change (like enabling ADB), check to see that there is no backup file (default.prop~) littered about
you can remove the lengthy comments and copyright notices from the files to make space
you can use the trick we used earlier with abootimg to increase the size number in bootimg.cfg for the initrd
Overclocking:
Just look at the acpuclock C file (and possibly relevant cpufreq changes - but I can't remember) in my "OC kernel" diff. Make sure that the option in the kernel config is selected to limit the speeds to the U8800pro's native 1GHz, otherwise the phone will boot at 2GHz!
Rebuilding the Wi-Fi module:
I hope to be able to write this one since it's apparently needed in some cases, but it depends on if Huawei come through
any idea about this error?
drivers/mfd/pmic8058.c:327: error: rtc_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:327: error: rtc_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:241: error: othc0_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:241: error: othc0_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:250: error: othc1_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:250: error: othc1_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:261: error: othc2_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:261: error: othc2_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:183: error: misc_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:183: error: misc_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:210: error: thermal_alarm_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:210: error: thermal_alarm_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:270: error: batt_alarm_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:270: error: batt_alarm_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:152: error: pm8058_charger_resources causes a section type conflict
drivers/mfd/pmic8058.c:152: error: pm8058_charger_resources causes a section type conflict
matteof93 said:
any idea about this error?
drivers/mfd/pmic8058.c:327: error: rtc_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:327: error: rtc_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:241: error: othc0_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:241: error: othc0_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:250: error: othc1_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:250: error: othc1_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:261: error: othc2_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:261: error: othc2_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:183: error: misc_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:183: error: misc_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:210: error: thermal_alarm_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:210: error: thermal_alarm_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:270: error: batt_alarm_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:270: error: batt_alarm_cell_resources causes a section type conflict
drivers/mfd/pmic8058.c:152: error: pm8058_charger_resources causes a section type conflict
drivers/mfd/pmic8058.c:152: error: pm8058_charger_resources causes a section type conflict
Click to expand...
Click to collapse
Honestly, I have no idea. What toolchain are you using and where was your .config obtained from? Even when the Bluetooth thing was giving me errors, I never once saw that
same toolchain you have used. i have tried with ubuntu 12.04 x64 and ubuntu 10.04 x86 but same problem.....i have obtained my config from my phone using adb command
matteof93 said:
same toolchain you have used. i have tried with ubuntu 12.04 x64 and ubuntu 10.04 x86 but same problem.....i have obtained my config from my phone using adb command
Click to expand...
Click to collapse
I don't know why the same toolchain works on my laptop but not yours :\
Someone with a similar problem (same?) solved it by using an older toolchain: http://forum.xda-developers.com/showpost.php?p=27294383&postcount=7157
thanks thanks thanks.....i saw that post this morning but i did not noticed the post with the solution
UPDATE: NOW KERNEL COMPILED CORRECTLY....this means that tomorrow i know what to do
ZRAM (+ swap) support. ZRAM is optimized for Android (taken from Siyah kernel). I'll write up the instructions on enabling this later
qwerty your owning us some instructions!!xaaxxa
pikachukaki said:
qwerty your owning us some instructions!!xaaxxa
Click to expand...
Click to collapse
Done, check the first post
I also won't be working on this. My email (which does clearly state what I want, even if it's long-winded):
Dear Sir/Madam,
I recently built a kernel for my U8800pro from your sources and it
works fine, except that the Wi-Fi will not start because the dhd.ko
module that comes with the B928 firmware refuses to load into my
modified kernel. After looking around, the bcm4329 source is what I
need to build (usually distributed outside of the kernel); however, it
seems that the U8800pro uses a customized version. After looking at
the strings of the dhd.ko on the B928 firmware, I have seen many
strings that are present in that dhd.ko binary do not appear in:
* bcm_4.218.248.6_7x25_wifi_driver.tar from the Huawei Device website,
despite it having the same version number
* the bcm4329 source in the Qualcomm CodeAurora Git repository
* the bcm4329 source on the NyVIDIA Tegra Git repository
Furthermore, the strings also do not appear in the ICS kernel nor the
Gingerbread one. I can only conclude that Huawei have their own
specialized version of the bcm4329 4.218.248.6 source for the U8800pro
that is distributed outside the kernel. I understand that Qualcomm
allow the option to let the vendor arrange to have the code
distributed under a different license provided that the vendor makes
an agreement beforehand with Qualcomm. Otherwise it becomes GPLed by
default. If Huawei chose to make an agreement, then I have no right to
ask. However, I believe it is still licensed under the GPL for two
reasons:
* Running modinfo on the dhd.ko from the B928 firmware says this:
"license: GPL v2
* Both bcm_4.218.248.6_7x25_wifi_driver.tar.gz and
[S7][SoftWare]S7_Broadcom_BCM4329_4.218.205.0_Open_Source are under
the GPL
I would like to request the source code, please, of the bcm4329
4.218.248.6 source that is modified for the U8800pro if the code is
under the GPL
Best regards
Click to expand...
Click to collapse
was met with the following generic response:
Dear Customer,
Thank you for contacting Huawei device.
This is our website link http://www.huaweidevice.com/worldwide/searchResult.
do?method=execute&searchString=U8800pro where you can download the secure
code for U8800pro to you.
Once again thank you for contacting Huawei device.
Best Regards.
Huawei Device Customer Care Team.
Click to expand...
Click to collapse
Since my U8800pro is not my main phone anymore, I do not have the energy to fight. Nor do I want to work on Huawei's kernel, where you have to be careful about what you change or the Wi-Fi module won't load (and Huawei won't give you the source - which they should do since I'm sure it's under GPL). matteof93 will most likely produce something better or when everyone starts producing their own kernels and make enough improvements to be hit with the same issue as I, they'll start to get more emails and listen
@qwerty at the last command it said that device is busy...also is there any way that you can make it for init.d so it will be easier??thx!!

[GUIDE] How to make GSIs overlay file for your phone

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.

[GUIDE] Porting Kernel Source to Snapdragon Device

Some OEMs violating GPL licenses and won't publish linux kernel sources for their Android devices.
On this post I’ll explain how to port kernel source to any android device.
Maybe you can port kernel sources to other SoCs with similiar ways but I've explained qcom way.
What do we need ?
A Computer which has Linux or Mac installation.
Device to test.
Let’s Start, Shall we ?
First of all we need to take dmesg of stock kernel using adb shell dmesg > dmesg.txt command. (I recommend you to take it while device is booting)
You got dmesg ? Nice. Open it with any text editor and search for “hardware” or “machine” and note the result to somewhere. By doing this we’ll get the name of device-tree-blobs.
Download android image kitchen and extract it to somewhere.
Now hold and move your device’s stock boot.img to unpackimg.(bat/sh)
Now your stock kernel got extracted to split_img/boot.img-zImage. After this line I will referance this file as “stock kernel”
Fetch split-appended-dtb using git clone https://github.com/MacTavishAO/split-appended-dtb-mac command. We’ll use this tool to extract dtb from stock kernel.
Copy stock kernel to split-appended-dtb-mac folder.
Now we will extract dtb(device-tree-blobs) from stock kernel. If you are on Linux use ./split-appended-dtb boot.img-zImage command for Mac use ./split-appended-dtb-mac boot.img-zImage command.
Now we have bunch of files named dtbdump_xx.dtb. We have to find out which one our device uses. Use grep -r <machine name that we found at step 2> . to find out which dtb our device using. (Write different parts of machine name to find out)
Install dtc using apt install device-tree-compiler command.
Let’s say it turns out dtbdump_21.dtb is the right one. We have to decompile dtb file to dts using dtc -I dtb -O dts -o extracted.dts dtbdump_21.dtb command.
Now we have to extract defconfig from stock kernel.
Use wget https://github.com/torvalds/linux/raw/master/scripts/extract-ikconfig && chmod a+x extract-ikconfig command to download necessary tool.
Use ./extract-ikconfig boot.img-zImage > extracted_defconfig to get defconfig from stock kernel.
Now we got what we need, we need to download kernel source to start porting to our device.
After this point I’ll start to explain as porting to Qualcomm device but almost same on other system-on-chips.
Go to Settings -> About Phone -> and note “Kernel version”
We need to download soc manufacturer’s sources. From here find msm-X.X that matching with your phone and copy link of it.
And from here find tag matching your chipset and write it down somewhere.
Use git clone <sources from 2 steps up> -b <tag>
Now enter to msm-X.X folder.
Copy extracted_defconfig to arch/<your device's architecture>/configs/ folder.
If your device is arm64 copy extracted.dts to arch/arm64/boot/dts/qcom/ if this directory doesn’t exist copy to arch/arm/boot/dts/qcom/ folder. (If you have 3.x qcom device skip the arm64 part and copy it directly into arm)
Open “Makefile” file in arch/arm(64)/boot/dts/qcom/ and add extracted.dts to the line matching with your chipset.
It’s time to import drivers. After this step I cannot help you because every devices’ hardware isn’t same but I can give some tactics.
To get driver names you can read dts file or install any device info app from Google Play Store etc.
Search these names and GitHub you can find files and commits which will help you to add drivers.
You did all of these without my help ? Excellent! Now it’s time to build kernel. I suggest you to use @natchanchance 's kernel compilation guide.
After compiling kernel. Copy compiled kernel to split_img folder which mentioned at early of this tutorial. rename it to boot.img-zImage and double click repackimg.(bat.sh) and you have new file named image-new.img.
Boot it using fastboot boot image-new.img command and if everything is working you can use fastboot flash boot image-new.img to use it permanently.
Leave a comment here about your questions. I'll try to reply all of them.
Planned to make a guide video about it but I don't have much time. Keep checking this thread may I post soon.
Reserved
Reserved.
Reserved
Thanks Dude!
This is very useful guide especially fir those who want to port the kernel source.
Thanks man. I am following your guide.
Thanks ?
While looking for matching dtbdump file I got a match in all four files for PMI8996, which file should I use?
"We have to decompile dtb file to dts using dtc" stuck at this step.
Any help on which "App" to use to find driver names..
Thanks
CPUZ / AIDA64
ataberkozen said:
It’s time to import drivers. After this step I cannot help you because every devices’ hardware isn’t same but I can give some tactics.
To get driver names you can read dts file or install any device info app from Google Play Store etc.
Search these names and GitHub you can find files and commits which will help you to add drivers.
Click to expand...
Click to collapse
I've found another way to find hardware info using hwinfo tool inside termux. The trick is to use it with root permissions.
Install hwinfo in termux:
Code:
apt-get install hwinfo
Run it with root permission tee into a text file:
Code:
su -c $(which hwinfo) | tee hwinfo.txt

Categories

Resources