[HOWTO] Building from sources [Kernel only for now] - Nexus 4 Android Development

Hello everyone.
This guide will help you in building a kernel from source for your Nexus 4
Later, when 4.2 hits AOSP, i'll add a guide for building that too
You will need a computer running Linux / OSX to build the kernel, natively, or via a VM.
This guide assumes you’re running any Linux distro.
Getting a toolchain:
You need a toolchain to build the kernel.
The preferred one is Google’s toolchain, the same they use to build AOSP.
In a terminal, type:
Code:
git clone [url]https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/[/url]
export PATH=$PATH:$(pwd)/arm-linux-androideabi-4.6/bin
export CROSS_COMPILE=arm-linux-androideabi-
TIp: paste the export statements in your ~/.bashrc to have them exported each login.
Getting the kernel source:
The kernel source for Nexus devices is available from Google’s servers.
Nexus 4 : https://android.googlesource.com/kernel/msm
Github Mirror: https://github.com/android/kernel_msm
Open the terminal, and type the below commands to get the kernel source on your computer.
Code:
mkdir -p android/kernel
cd android/kernel
For Nexus 4, we get the msm kernel sources.
Code:
git clone [url]https://android.googlesource.com/kernel/msm[/url]
Next, we change our directory to the newly fetched source.
Type
Code:
cd msm
Figuring out what to build:
Now, we need to figure out which revision to build.
You need to be exactly sure about this, otherwise there are chances that the compiled kernel won’t work.
The commit to build upon can be found by a few ways.
To get the kernel sources matching the device tree, type the below in the device tree.
Code:
git log kernel
Next, type the below in the kernel tree
Code:
git checkout <commit>
The commit of the version running of the current review units is 7a47627, which is same as branch android-msm-mako-3.4-jb-mr1-fr .
Compiling:
Name of defconfig: mako_defconfig
cd to the directory of the kernel source, then type the below in a terminal.
Code:
export ARCH=arm
export SUBARCH=arm
Code:
make <name_of_defconfig>
make
The kernel image will be ready at arch/arm/boot/zImage
To flash it, you need to make it into a boot.img, more on that later, when we have more sources.

1) what is the branch "android-msm-mako-3.4-jb-mr1-fr" for?
2) what does mr1 mean? sounds like milestone/alpha/beta. Maybe it's not final? Last commit is 2 weeks ago.
3) great guide

m11kkaa said:
1) what is the branch "android-msm-mako-3.4-jb-mr1-fr" for?
2) what does mr1 mean? sounds like milestone/alpha/beta. Maybe it's not final? Last commit is 2 weeks ago.
3) great guide
Click to expand...
Click to collapse
mr1 could stand for "Milestone Release 1", it might not be final.
That being said, you should never checkout a branch directly for compiling a kernel, but the commit directly.

cdesai said:
...You need a toolchain to build the kernel. The preferred one is Google’s toolchain, the same they use to build AOSP.
Click to expand...
Click to collapse
Could you also use linaro to compile the kernel? I believe it's a toolchain anyway, but I'm not too sure on it's benefits or compatibility...

nice didn't realize kernel source was already available- can't wait to test this zImage and start testing changes noticed they left out kernel compression makes for a big zimage

randomblame said:
nice didn't realize kernel source was already available- can't wait to test this zImage and start testing changes noticed they left out kernel compression makes for a big zimage
Click to expand...
Click to collapse
Are you planning on developing for the N4?
Loved your work on the DHD

espionage724 said:
Could you also use linaro to compile the kernel? I believe it's a toolchain anyway, but I'm not too sure on it's benefits or compatibility...
Click to expand...
Click to collapse
Linaro isn't a toolchain, but they do make toolchains.
Yes, you can use it to compile the kernel, though it may not compile at all with it, or not work well - your mileage may vary.
randomblame said:
nice didn't realize kernel source was already available- can't wait to test this zImage and start testing changes noticed they left out kernel compression makes for a big zimage
Click to expand...
Click to collapse
Nope, LZO compression is enabled by default

cdesai said:
Linaro isn't a toolchain, but they do make toolchains.
Yes, you can use it to compile the kernel, though it may not compile at all with it, or not work well - your mileage may vary.
Click to expand...
Click to collapse
Linaro has proven to increase android performance up 30 - 100% not sure if that is with -O3 optimizations or not. That is all I use on my kernels
Sucks this phone is not coming to Sprint, might be time to change carriers...
randomblame said:
nice didn't realize kernel source was already available- can't wait to test this zImage and start testing changes noticed they left out kernel compression makes for a big zimage
Click to expand...
Click to collapse
-mvectorize-with-neon-quad ---> I use this in my makefile for cflags and drops the zImage size from 5.0mb to 4.4mb.

cdesai said:
Linaro isn't a toolchain, but they do make toolchains.
Yes, you can use it to compile the kernel, though it may not compile at all with it, or not work well - your mileage may vary.
Nope, LZO compression is enabled by default
Click to expand...
Click to collapse
ah I didn't see it - 6+mb still pretty big from what I'm used to at least
I'm going through the mind numbing process of bringing in mainline patches and squashing them all together. I'm up to 3.4.1 ... woot where's the hang me emoticon lol
*finally got smart and cloned mainline and reset the head back to each sublevel and merged into my local n4 source
got it all the way up to date with mainline 3.4.18

Thanks cdesai. I didn't think anything was out yet!!

randomblame said:
ah I didn't see it - 6+mb still pretty big from what I'm used to at least
I'm going through the mind numbing process of bringing in mainline patches and squashing them all together. I'm up to 3.4.1 ... woot where's the hang me emoticon lol
*finally got smart and cloned mainline and reset the head back to each sublevel and merged into my local n4 source
got it all the way up to date with mainline 3.4.18
Click to expand...
Click to collapse
Yea, it's big, but partitions on new devices are big as well.
y u no use git to merge
Just add korg as a remote, fetch, merge.
Each version is tagged, so you can do that incrementally too.
Also, kernel.org hosts patches as well, if you prefer that way.
snowman77 said:
Thanks cdesai. I didn't think anything was out yet!!
Click to expand...
Click to collapse
Google <3

I got it straightened out so it's up to date with mainline and I think I've got overclocking up to 1.89ghz ready lots of more fun to be had but damn I'm just teasing myself till tuesday/whenever the thing comes in the mail. hard to test anything without hardware.

I may need a tip. I have followed your guide - which I find great and simple - but I'm having a problem with the arm binaries when I launch the make command after checking out the remotes/origin/android-msm-mako-3.4-jb-mr1-fr and executed make mako_defconfig:
Code:
/bin/sh: 1: arm-linux-androideabi-ld: not found
I have cloned the toolchain and msm repos, and added to the PATH environment var the location of the bin directory. I can reach arm-linux-androideabi-ld from the command line, but no luck executing it:
Code:
[email protected]:~/android/kernel/msm$ /home/echedey/android/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-ld
bash: /home/echedey/android/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-ld: No such file or directory
And it is there with execution rights:
Code:
[email protected]:~/android/kernel/msm$ ll /home/echedey/android/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-ld
-rwxrwxr-x 1 echedey echedey 3145332 Nov 10 16:32 /home/echedey/android/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-ld*
My repos are in these paths:
Code:
/home/echedey/android/arm-linux-androideabi-4.6
/home/echedey/android/kernel
And my $PATH is:
Code:
/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/echedey/android/arm-linux-androideabi-4.6/bi
Am I missing anything?

josjator said:
I may need a tip. I have followed your guide - which I find great and simple - but I'm having a problem with the arm binaries when I launch the make command after checking out the remotes/origin/android-msm-mako-3.4-jb-mr1-fr and executed make mako_defconfig:
Code:
/bin/sh: 1: arm-linux-androideabi-ld: not found
I have cloned the toolchain and msm repos, and added to the PATH environment var the location of the bin directory. I can reach arm-linux-androideabi-ld from the command line, but no luck executing it:
Code:
[email protected]:~/android/kernel/msm$ /home/echedey/android/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-ld
bash: /home/echedey/android/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-ld: No such file or directory
And it is there with execution rights:
Code:
[email protected]:~/android/kernel/msm$ ll /home/echedey/android/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-ld
-rwxrwxr-x 1 echedey echedey 3145332 Nov 10 16:32 /home/echedey/android/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-ld*
My repos are in these paths:
Code:
/home/echedey/android/arm-linux-androideabi-4.6
/home/echedey/android/kernel
And my $PATH is:
Code:
/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/echedey/android/arm-linux-androideabi-4.6/bi
Am I missing anything?
Click to expand...
Click to collapse
You path has a "n" missing from bin at the end.
You could type arm- and try to use tab-completion to see if it's accessible, then the same thing with full path (~/android/arm-linux-androideabi-4.6)

cdesai said:
You path has a "n" missing from bin at the end.
You could type arm- and try to use tab-completion to see if it's accessible, then the same thing with full path (~/android/arm-linux-androideabi-4.6)
Click to expand...
Click to collapse
Sorry, the missing 'n' came from the c&p. I can actually see the file by tabing it from any path but after the auto completing it tells this weird thing:
Code:
[email protected]:~$ arm-linux-androideabi-ld
bash: /home/echedey/android/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-ld: No such file or directory
I'm a experienced *nix user but I don't get this. The repos are correctly cloned and all files under bin has exec rights. I'm running ubuntu 12.10. Maybe a problem with the shell? I should try any other environment, but that would be like killing flies with missiles. Thanks for your help.

Do you definitely have the appropriate executable at
'/home/echedey/android/arm-linux-androideabi-4.6/bin/arm-linux-androideabi-ld'?
Can you do an ls -lF of that directory?
Perhaps the arm-linux-androideabi-ld file there is actually just a symlink which has lost its target.

@josjator Yeah, seems I have the same problem as you. I'm also using Ubuntu 12.10 with a bash shell. I think it may be a recursive make/shell issue thing (sorry, I'm not too hot on make files). Will keep plugging away to see if I can resolve the problem.

The device trees have hit AOSP
https://android.googlesource.com/device/lge/mako/

dsana123 said:
@josjator Yeah, seems I have the same problem as you. I'm also using Ubuntu 12.10 with a bash shell. I think it may be a recursive make/shell issue thing (sorry, I'm not too hot on make files). Will keep plugging away to see if I can resolve the problem.
Click to expand...
Click to collapse
@josjator: Using the 4.7 toolchain sorted me out (at least it's building now and past the initial problem).
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7
Click to expand...
Click to collapse
The objdump and ld binaries are much happier now.
BTW, I did download the 4.6 toolchain again (just in case there was some problem in the initial git clone), but I still encountered objdump and ld problems.

Works like a champ on Ubuntu 12.10 exactly as outlined in the OP. Thanks!
Code:
[email protected]:~/Documents/AOSP/kernel/msm$ ls -l arch/arm/boot/zImage
-rwxrwxr-x 1 android android 6314888 Nov 16 23:45 arch/arm/boot/zImage
[email protected]:~/Documents/AOSP/kernel/msm$ uname -a
Linux ubuntu 3.5.0-17-generic #28-Ubuntu SMP Tue Oct 9 19:31:23 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
[email protected]:~/Documents/AOSP/kernel/msm$ arm-linux-androideabi-gcc -v
[...]
gcc version 4.6.x-google 20120106 (prerelease) (GCC)

Related

DroidX source posted! tun.ko should be possible now

Sources are here:
opensource.motorola.com/sf/frs/do/viewRelease/projects.droidx/frs.droidx_source.shado_x3_1_13_5_10
Hopefully I'll get some time to work on tun.ko for openvpn or vpnc.
But if someone beats me to it, please post it here.
Jeb
Downloading the source and pre-req's now. Will work on the tun.ko when I get back from dinner if no one else has it done.
Droid X source code! What!? Does this mean a bright future could be ahead for us?
XDA App = Pwnage
jebc4 said:
Sources are here:
opensource.motorola.com/sf/frs/do/viewRelease/projects.droidx/frs.droidx_source.shado_x3_1_13_5_10
Hopefully I'll get some time to work on tun.ko for openvpn or vpnc.
But if someone beats me to it, please post it here.
Jeb
Click to expand...
Click to collapse
What exactly is this?
drew630 said:
Downloading the source and pre-req's now. Will work on the tun.ko when I get back from dinner if no one else has it done.
Click to expand...
Click to collapse
Good luck to you and all for any work on this sweet phone. You rock!
Sent from my DROIDX using XDA App
Hi Drew,
Did you have any luck with tun.ko?
Thanks & all the best!
You can click in the bottom right of that that link and download all the files in one zip. SHADO_X3_1.13.5.10.zip is around 275MB.
I have unzipped that, then untarred all the individual archives.
According to the README, you need some files from source.android.com, but their link doesn't work, so that will take some more digging. (maybe I missed something...)
It appears to be the complete build process. I was just hoping to jump in and get a tun.ko modules compiled, but I still can't find the kernel config (I was just quickly looking around).
Anyway, bottom line is that I will have to get up to speed on the android build process, not just the cross compiled kernel process. This will take me some more time.
If anyone gets one before me, please post.
Thanks, Jeb
Anyone had any luck yet?
Sent from my DROIDX using XDA App
hmmm... I think that you should be able to compile the kernel with the default config options, but just enable the tun/tap module... I don't think that the module would really depend too heavily on any of the other config options?
I have compiled the module multiple times with multiple config files but none work. I get a exec failed error which is presumably because i compiled for the wrong architecture.
I have tried all the omap3 configs i found and the defconfig with no luck. I am away today but will look at it again tomorrow.
Sent from my DROIDX using XDA App
I'm no droid expert but it looks like according to the droid readme file you want ARM arch, but the compiler that youo should be using is arm-eabi-gcc (comes from the prebuilt tools from android) - in the Makefile set CROSS_COMPILE to /path/to/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi- (or whatever the path to the file is on your build environment)
All the best,
Okay, after a bunch of hours I finally got it compiled
The 'exec format error' that you were probably seeing is not because it was compiled for the wrong architecture. I originally compiled the kernel modules with the default .config file that 'make menuconfig' generated.
When I tried to load it, I got the 'exec format error'. 'dmesg' showed:
<3>[46706.378570] tun: version magic '2.6.29 mod_unload modversions ARMv5 ' should be '2.6.29 preempt mod_unload ARMv7 '
So, that gave me a big hint - after a few hours of customizing I finally got the .config file to a version that will properly compile and load the openvpn module.
I'm attaching the .config file (config.zip) and tun.ko file (tun.ko.zip)
*NOTE* - I have not tested the kernel module yet, so I have no idea if it works. Even if it does work, the .config file is the default one that I manipulated so that the tun module would compile. You probably don't want to use the .config file as it may not match all of the hardware and configs of the droid x. If someone has the actual droid x .config file used by motorola then that would be very helpful.
*update* - the attacked files *do not work*. The working version is available at http://forum.xda-developers.com/showthread.php?p=7417520
Hmm... it looks like tun.ko does compile and install, but is not working properly
# lsmod
tun 11392 0 - Live 0xbf00c000
sec 4808 0 - Live 0xbf000000
# cat /dev/net/tun
/dev/net/tun: No such device
#
The response should be 'cat: /dev/net/tun: File descriptor in bad state'
If we only had the .config file from motorola this would be a lot easier.
mab2 said:
Hmm... it looks like tun.ko does compile and install, but is not working properly
# lsmod
tun 11392 0 - Live 0xbf00c000
sec 4808 0 - Live 0xbf000000
# cat /dev/net/tun
/dev/net/tun: No such device
#
The response should be 'cat: /dev/net/tun: File descriptor in bad state'
If we only had the .config file from motorola this would be a lot easier.
Click to expand...
Click to collapse
I'll post on Motodev board for the running .config (they should have left it in the running kernel at /prog/config.gz ...)
Anyway, thanks trying -- could you post any tips on getting a dev env setup?
I've been using linux for years, but this is my first android setup.
jebc4 said:
I'll post on Motodev board for the running .config (they should have left it in the running kernel at /prog/config.gz ...)
Anyway, thanks trying -- could you post any tips on getting a dev env setup?
I've been using linux for years, but this is my first android setup.
Click to expand...
Click to collapse
I'm in the same boat as you - android newbie, linux veteran.
I started out by getting the whole android environment - http://source.android.com/source/download.html - and ran 'repo init -u git://android.git.kernel.org/platform/manifest.git' - all of that was just so I could get the prebuilt directory with the arm-eabi- files that will be used below.
Then I just downloaded the entire project from opensource.motorola.com - extracted it all, went into the kernel directory and hacked away at the .config file from there.
To compile the kernel I ran:
CROSS_COMPILE=/home/MY_USERNAME/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi- make -j 4 kernel
CROSS_COMPILE=/home/MY_USERNAME/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi- make modules
I spent a few hours with it - playing around with environment variables and modifying some Makefiles so I may have left out a small thing or two
It looks like running 'make mapphone_defconfig' created a functioning .config file and I used that to generate tun.ko.
I've posted the files at http://forum.xda-developers.com/showthread.php?p=7417520
Attachments removed as per OP's request.
mab2 said:
I'm no droid expert but it looks like according to the droid readme file you want ARM arch, but the compiler that youo should be using is arm-eabi-gcc (comes from the prebuilt tools from android) - in the Makefile set CROSS_COMPILE to /path/to/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi- (or whatever the path to the file is on your build environment)
All the best,
Click to expand...
Click to collapse
Thanks but I already got that, been compiling kernels for other Android devices for a while...
drew630 said:
Thanks but I already got that, been compiling kernels for other Android devices for a while...
Click to expand...
Click to collapse
didn't know that - no harm intended
All the best,
mab2 said:
Okay, after a bunch of hours I finally got it compiled
The 'exec format error' that you were probably seeing is not because it was compiled for the wrong architecture. I originally compiled the kernel modules with the default .config file that 'make menuconfig' generated.
When I tried to load it, I got the 'exec format error'. 'dmesg' showed:
<3>[46706.378570] tun: version magic '2.6.29 mod_unload modversions ARMv5 ' should be '2.6.29 preempt mod_unload ARMv7 '
So, that gave me a big hint - after a few hours of customizing I finally got the .config file to a version that will properly compile and load the openvpn module.
I'm attaching the .config file (config.zip) and tun.ko file (tun.ko.zip)
*NOTE* - I have not tested the kernel module yet, so I have no idea if it works. Even if it does work, the .config file is the default one that I manipulated so that the tun module would compile. You probably don't want to use the .config file as it may not match all of the hardware and configs of the droid x. If someone has the actual droid x .config file used by motorola then that would be very helpful.
*update* - the attacked files *do not work*. The working version is available at http://forum.xda-developers.com/showthread.php?p=7417520
Click to expand...
Click to collapse
i'm having a similar issue, how did you fix this ARMvX Version problem when compiling a module? Thanks in advance!

[Q] [KERNEL] ARMv6 vs ARMv7 cross-compile question / tun.ko for LG Revo

hello all -- ive mostly been a lurker (been too busy), but i finally found some time to try and get the ipsec vpn working on my stock-but-rooted LG Revo. despite some ardent googling, i couldn't find a working tun.ko that would work with vpc/VPN Connections. so i decided to compile my own.
i figure since there's certainly nothing in the LG Revo boards here specific to compiling tun.ko for the LG Revo, i'd start this thread and document my steps along the way. i figure other board users can use for reference etc. hope it's ok mods/admins!
the short version/TL;DR:
i have compiled my own tun.ko for my stock/rooted LG Revolution. i have the correct kernel version (etc) but am stuck because i dont seem to be able to compile ARMv7, only ARMv6. this is the error i receive when i try to insmod:
Code:
tun: version magic '2.6.32.9-perf preempt mod_unload ARMv6 ' should be '2.6.32.9-perf preempt mod_unload ARMv7 '
basically i need to compile it for ARMv7 not ARMv6. i don't know how.
the long version, aka the steps i took:
starting in a nice clean folder, download the linux kernel src specific to the version of the kernel on my rooted stock LG Revo. i obtained this earlier (you can check via Settings -> About Phone -> Kernel version. if you have a stock (rooted or not) LG Revolution it will be: 2.6.32.9-perf.
Code:
$ mkdir -p $HOME/tmp/lgrevosrc
$ export LGREVOSRC=$HOME/tmp/lgrevosrc
$ cd $LGREVOSRC
$ wget -q http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.32.9.tar.bz2
$ wget -q http://dl.google.com/android/android-sdk_r10-linux_x86.tgz
$ wget -q http://dl.google.com/android/ndk/android-ndk-r5b-linux-x86.tar.bz2
$ tar xjf linux-2.6.32.9.tar.bz2
$ tar xzf android-sdk_r10-linux_x86.tgz
$ tar xjf android-ndk-r5b-linux-x86.tar.bz2
earlier, i copied the config file for the kernel specific to my LG Revo by using Root Explorer and copying the /proc/config.gz file. i now copy this into my linux kernel src tree, being sure to gzunzip it first and to copy it to the src folder as ".config", not "config".
Code:
$ cd $LGREVOSRC/linux-2.6.32.9
$ gzip -d ~rickt/tmp/from_my_lgrevo/config.gz
$ cp ~rickt/tmp/from_my_lgrevo/config .config
now we have to edit the .config file and add the tun module so it will be compiled. i added the following line to the .config file:
Code:
CONFIG_TUN=m
now, we compile the modules, being sure to set the environment variables for the architecture we NEED, not the one we're compiling on:
Code:
$ export ARCH=arm
$ export CROSS_COMPILE=arm-eabi-
$ export PATH=$PATH:$LGREVOSRC/android-ndk-r5b/toolchains/arm-eabi-4.4.0/prebuilt/linux-x86/bin
$ make modules
HOSTCC scripts/basic/fixdep
HOSTCC scripts/basic/docproc
HOSTCC scripts/basic/hash
HOSTCC scripts/kconfig/conf.o
< snipped, for brevity >
LD [M] net/sched/cls_flow.ko
CC net/sched/sch_dsmark.mod.o
LD [M] net/sched/sch_dsmark.ko
$
let make sure the tun.ko module was compiled, and we'll see what type of arch it was compiled for:
Code:
$ find . -name tun.ko
./drivers/net/tun.ko
$ ls -l ./drivers/net/tun.ko
-rw-r--r-- 1 root root 190705 Aug 19 06:35 ./drivers/net/tun.ko
$ file ./drivers/net/tun.ko
./drivers/net/tun.ko: ELF 32-bit LSB relocatable, ARM, version 1 (SYSV), not stripped
$ strings ./drivers/net/tun.ko | grep -i arm
vermagic=2.6.32.9-perf preempt mod_unload ARMv6
BOOM! note the ARMv6. this is important, because when i try to insert the module into the kernel on my android (after copying it over, obviously) i get:
Code:
# insmod tun.ko
insmod: init_module 'tun.ko' failed (Exec format error)
ok, so i start nosing around in the logs to see what i can see, and i see:
Code:
<3>[122130.240509] tun: version magic '2.6.32.9-perf preempt mod_unload ARMv6 ' should be '2.6.32.9-perf preempt mod_unload ARMv7 '
so... i guess this was a long and drawn-out way of saying that i have a great desire to have a tun.ko for our beloved LG Revolution, but i'm not sure how to have gcc on a linux box cross-compile for ARMv7, not ARMv6.
anyone? bueller?
I work quite a bit with cross-compilers in my day job, but I haven't tried to use any of the pre-packaged ones in the Android SDK(s).. however, until I have time to play with them, the ARMv6 versus 7 probably relates to these 2 variables:
$ export ARCH=arm
$ export CROSS_COMPILE=arm-eabi-
Also, gcc has -march and -mtune params that can sometimes be used to select specific CPUs and/or sub-architectures within a main CPU family.. if someone (e.g. LG) gave out an SDK for the Revo specifically, their gcc would probably already be "spec'ed" to march and mtune for the specific CPU..so maybe the generic Android ARM gcc cross-compiler defaults to ARMv6.
I may have time to poke into this later, but it probably won't be today..
- Phil
I've been informed that GCC cannot output ARMv7. I think licensed developer tools are needed. Can anyone confirm this?
RMT.
GCC4.3 added ARMv7 support. This discussion seems to confirm the various details:
I think in GCC 4.3 is where you get ARMv7 architecture support, (see
http://gcc.gnu.org/gcc-4.3/changes.html), which is EABI and at GCC 4.4
you have "EABI-compatible profiling interface for EABI targets." (again see
http://gcc.gnu.org/gcc-4.4/changes.html).
So I've chosen to work on 4.4 just to be sure, and it also supports Cortex-A9, as
well as VFPv3 (yeah!).
Click to expand...
Click to collapse
Full discussion here:
http://freebsd.1045724.n5.nabble.com/ARMv7-EABI-Cross-Compiler-tp4201510p4201523.html
Depending on who is providing the cross-compiler you are trying to use, they may either be using something prior to gcc4.3, or, they are providing a compiler which has not been enabled with the ARMv7 target. You could try using Kegel's cross-tool with a recent gcc (4.4 or 4.5) to build your own ARMv7 cross-compiler, but not sure how deep you want to go with this!
- Phil
I haven't been able to get a working tun.ko for this either. I've having trouble compiling my own. Could you post the adapter you're working with?
I just saw a verizon update come down, but kernel is 2.6.32.9-perf [email protected] #1.
Bumping this ol' thread hoping that progress has been made or someone knows about a thread I missed. Trying (hoping) to get OpenVPN going with my Revo so I'm hoping there's a tun.ko available.
I successfully compiled a tun.ko for mine using the "crossdev" package on gentoo. Just setting ARCH=arm CROSS_COMPILE=arm-eabi- did the trick for me.
I believe older verions of gcc were not yet capable of producing ARMv7.
gcc 4.5.3 certainly is. I would try upgrading to that if possible and that ought to work.
I'd be happy to share my tun.ko with anyone that wants it as well...
Slightly unrelated, I also found that loading the module (insmod tun.ko) did not cause the /dev/net/tun node to be created for some reason...
a simple
Code:
mkdir /dev/net
mknod /dev/net/tun c 10 200
as root, and AFTER loading the module resolves that problem, at least until the next reboot. I haven't figured out how to get it to run a script at boot yet to automate it.
If anyone wants the tun.ko let me know and I'll upload it somewhere.
Bait-Fish said:
Bumping this ol' thread hoping that progress has been made or someone knows about a thread I missed. Trying (hoping) to get OpenVPN going with my Revo so I'm hoping there's a tun.ko available.
Click to expand...
Click to collapse
Blitz includes tun.ko
Sent from my VS910 4G using xda premium
nasaiya said:
I'd be happy to share my tun.ko with anyone that wants it as well...
Click to expand...
Click to collapse
Thanks you very much for the offer. I am a total noob as far as compiling goes!
mtmichaelson said:
Blitz includes tun.ko
Click to expand...
Click to collapse
Damn sweet! I never needed it before so that went right over my head previously. Can I simply extract it or would I have to be on BK? (which I'm not)
Sent from my VS910 4G using Tapatalk
I believe you need to install ClockWorkMod to flash blitz onto your phone. You can backup first and try it out safely with CWM. Just follow the instructions in the thread it's easy.
Here's my tun.ko for anyone that wants it. I found "openvpn installer" and "openvpn settings" apps perfect for my needs (only issue is I still have to manually add the device node -- even with blitzkrieg, but it's no big deal)
http://www.box.com/s/a50pnexofiej4in7s5h7
Bait-Fish said:
Thanks you very much for the offer. I am a total noob as far as compiling goes!
Damn sweet! I never needed it before so that went right over my head previously. Can I simply extract it or would I have to be on BK? (which I'm not)
Sent from my VS910 4G using Tapatalk
Click to expand...
Click to collapse
You could try pulling it from the blitz zip and dropping it in your /system/lib/modules and see if it works!
Sent from my VS910 4G using xda premium
Cool, thanks. I'll attempt the 'easy' way first.
Sent from my VS910 4G using Tapatalk

[ABANDONED]FIXED/MODIFIED][KERNEL][16 JULY] franco.Kernel | 2.6.35.10

So I compiled franco's kernel with his sources at github with incoming call fix from CM with other improvements. All Credit goes to franciscofranco who was so kind to compile this kernel even-though he has other devices, and also other developers for all these patches included in the kernel.
I decide what I want not you. No means no, if you ask me to add *insert feature here* IF I consider it useless etc etc
Also one thing to note that it doesn't have :
* (Since franco didnt release his sources for it)
Doubled busses frequencies - system will go faster but you'll possible lose some overclocking capabilities. Busses frequency OC > cpu OC.
* Your megaduper governors (people failed to realise that tuned stock governors(or they can tune them themselves) have almost same performance with smartass etc)
Click to expand...
Click to collapse
Changelog - other changes are in my source
#12 http://www.mediafire.com/?vdm3xs1hdjuh7ju
- revert "conservative from 3.2 kernel", use .38 kernel version instead (works correctly now)
- revert back to .35 cpuidle
- use latest linaro toolchain for fun and testing
Click to expand...
Click to collapse
Sources:https://bitbucket.org/cresqo/2.6.35.10-p500
Cresqo said:
So I compiled franco's kernel with his sources at github with incoming call fix from CM. Also one thing to note that it doesn't have :
If all goes well I'll update the kernel with camera flicker bug fix, 652, 672, 691, 710 cpu frequencies, recent LCD patch and maybe the bluetooth sleep bug fix
So here's the link: http://www.mediafire.com/?zi2k8yp7ilvpibc
I need tests on this. (camera and incoming calls)
Also white noise is back as expected.
Click to expand...
Click to collapse
Well done!
Sent from my LG-P500 using xda premium
Just updated the kernel with latest linaro toolchain and other things
Great job!
Why not move it to the Development section if you are planning on improving this kernel?
Sent from my LG-P500 using xda premium
RockR172 said:
Great job!
Why not move it to the Development section if you are planning on improving this kernel?
Sent from my LG-P500 using xda premium
Click to expand...
Click to collapse
Well once I figure out how the heck do I use git (need help here)
Btw, this kernel with fix feels a bit faster than franco #3, but I don't think is nowhere near the speed of #4
nice, but why not compiled franco's kernel #4 ? why #3 ?
Edit: did u added Added tun.ko and cifs.ko ?
GonDr said:
nice, but why not compiled franco's kernel #4 ? why #3 ?
Edit: did u added Added tun.ko and cifs.ko ?
Click to expand...
Click to collapse
There are no sources for #4...
Sent from my LG-P500 using xda premium
Cresqo said:
Well once I figure out how the heck do I use git (need help here)
Btw, this kernel with fix feels a bit faster than franco #3, but I don't think is nowhere near the speed of #4
Click to expand...
Click to collapse
What kind of help do you need?
GonDr said:
nice, but why not compiled franco's kernel #4 ? why #3 ?
Edit: did u added Added tun.ko and cifs.ko ?
Click to expand...
Click to collapse
Added I guess, idk if working
DJNoXD said:
What kind of help do you need?
Click to expand...
Click to collapse
It sounds like a noob question, but how do you add alot of files as once and commit them, do I have to manually do it or do I need to use a git GUI like git-cola?
Cresqo said:
It sounds like a noob question, but how do you add alot of files as once and commit them, do I have to manually do it or do I need to use a git GUI like git-cola?
Click to expand...
Click to collapse
I did not find a gui (for linux) that I like. Therefor I only use the console git.
Adding all filles at once:
Code:
git add .
Commit all changed / modified / added files at onces:
Code:
git commit -a
Commit all changed / modified / added files at onces and set commit message (no editor opens).
Code:
git commit -a -m "my commit message"
Cresqo said:
So I compiled franco's kernel with his sources at github with incoming call fix from CM with other improvements. All Credit goes to franciscofranco who was so kind to compile this kernel even-though he has other devices. Also one thing to note that it doesn't have :
Click to expand...
Click to collapse
Dear Cresqo,
Please go thru following link it may be helpful to extract .config file from Franco kernel #4
Link:
http://droid-force.com/archive/index.php/thread-184.html
This what the thread says:
There is a simpler way to get the basic .config file, and this is to get it from a running kernel built by someone else. You can extract the .config from a running kernel with these commands:
Code:
cd ~/android/kernel/bravo_2.6.35_gb-mr
adb pull /proc/config.gz
zcat config.gz > .config
Now we can open menuconfig and add anything we need in addition.
Note: I think "bravo_2.6.35_gb-mr" is the working folder \ Home directory on PC
Cresqo said:
compiled with latest GCC 4.7.1 Linaro toolchain
Click to expand...
Click to collapse
Do you notice any advantages compiling kernel by using linaro toolchain?
Kanad said:
Dear Cresqo,
Please go thru following link it may be helpful to extract .config file from Franco kernel #4
Link:
http://droid-force.com/archive/index.php/thread-184.html
This what the thread says:
There is a simpler way to get the basic .config file, and this is to get it from a running kernel built by someone else. You can extract the .config from a running kernel with these commands:
Code:
cd ~/android/kernel/bravo_2.6.35_gb-mr
adb pull /proc/config.gz
zcat config.gz > .config
Now we can open menuconfig and add anything we need in addition.
Note: I think "bravo_2.6.35_gb-mr" is the working folder \ Home directory on PC
Click to expand...
Click to collapse
Honestly I don't think it will work and my .config is quite OK actually...so the only way is to ask Franco for it since he didn't enable the option for the config to be in config.gz
DJNoXD said:
Do you notice any advantages compiling kernel by using linaro toolchain?
Click to expand...
Click to collapse
Hmm, tough question, maybe a little smooth, maybe, but i'll revert as soon as there is any bug associated with it (didn't encounter static sound bug so far, perhaps it's due to compiling the ROM with linaro toolchain)
Btw i'm uploading my sources to bitbucket(though all changes are not visible as i've already modified the files and i'm lazy and don't have that much time to do it again...)
Cresqo said:
Btw i'm uploading my sources to bitbucket(though all changes are not visible as i've already modified the files and i'm lazy and don't have that much time to do it again...)
Click to expand...
Click to collapse
I'm curious about to see your sources.
DJNoXD said:
I'm curious about to see your sources.
Click to expand...
Click to collapse
My sources: https://bitbucket.org/cresqo/2.6.35.10-p500
Though the commits are wrong(was messed up with an earlier source from last time)
Cresqo said:
My sources: https://bitbucket.org/cresqo/2.6.35.10-p500
Though the commits are wrong(was messed up with an earlier source from last time)
Click to expand...
Click to collapse
Is your repo private?
DJNoXD said:
Is your repo private?
Click to expand...
Click to collapse
Oops sorry didn't know I enabled the option, just disabled it.
You have added lots of temp files, which (I think) you don't wont to upload (e.g. all *.o files).
Add a gitignore file to your repo and those files will be ignored.
DJNoXD said:
You have added lots of temp files, which (I think) you don't wont to upload (e.g. all *.o files).
Add a gitignore file to your repo and those files will be ignored.
Click to expand...
Click to collapse
Eh...gitignore file is gone...will recommit it again
Sorry Cresqo, i haven't repplied your PM cause i had exams... now two biggest exams now is gone! I've finished it! Now I can do everythings i want: learn C, C++, play badminton , play games, compile ROM or kernel ...
Love Tyn!

CM12 - building, optimising, fixing, having fun

Hi all o/
To celebrate two weeks of my successful CM12 building and hacking, I'm starting this thread. Its purpose is to discuss general CM12 building steps for beginners like myself, bugs and fixes, applying @JustArchi's optimisation flags, solving the resulting build failures.... and all the other CM12/S4Mini-related questions that don't belong to F4k's [ROM] thread but end up there (I was guilty of that).
First of all, my thanks go to:
@arco68 for making it possible to build ROMs for our S4mini
CyanogenMod team for the ROM itself
@F4k for his kernel and all the other excellent contributions to this forum
@JustArchi for finding what he found
In this first post I will outline the steps needed to build a vanilla unofficial CM12 for serranoltexx. serranoltexx is the only device I have so this is what I'll introduce. I suspect building serrano3gxx is just as simple (just replace the device name in all the relevant steps). I don't know what to do to build for i9192, if you do please contribute
Building your own CM12 ROM
Main article: http://wiki.cyanogenmod.org/w/Build_for_serranoltexx
The article above tells you how to build CM11, but CM12 builds just as well with minor modifications I'll outline here. To follow those steps you need a Linux installation. I will write how you can make an example Lubuntu-based virtual machine on your Windows box in a post below.
Modifications to the build steps:
"Install the SDK" -- you can skip that, because in the end we will not use any SDK tools.
"Install the Build Packages" - replace jdk6 with jdk7 everywhere, as Java 7 is needed to build Lollipop.
"Create the directories" - I will assume you've followed those steps and everything is under ~/android/system/
"Initialize the CyanogenMod source repository" replace "cm-11.0" with "cm-12.0" of course
"Extract proprietary blobs" we will do this completely differently. If you try to use extract-files.sh, the script will fail, and when I finally fixed the script my camera didn't work...
So, do this instead (credit to @F4k and @kyrillos13 for answering my question on page 90 of F4k's ROM thread)
* Go to https://github.com/TheMuppets/proprietary_vendor_samsung
* Switch branch to cm-12.0
* Use the "Download ZIP" button to get the copy of the entire thing. The zip is big (500 MB? ish) and 95% of it useless for us, so if you're trying to save some bandwidth you can try to do this trick to get only the "serrano-common" folder. If you do, make a post here with exact steps for others
* Copy the "serrano-common" folder to ~/android/system/vendor/samsung/ (to clarify, final directory structure should include ~/android/system/vendor/samsung/serrano-common/proprietary/app/ folder among others)
"Turn on caching to speed up build" - sounds like a good idea but we're going to be playing with compiler options, which diminishes its usefulness. It also uses a lot of disk space. Only follow it if you want your daily increments to build fast, and you don't expect to be doing global changes such as optimisation flag changes often. I didn't do this step.
This concludes my first post in this thread. I personally have never had problems with building after this part (except when I had not enough space or memory) and the resulting vanilla builds always worked for me fine. Feel encouraged!
Next post: some tricks and useful commands
A random selection of interesting things:
What recovery is good for applying my builds
Well they're all good, and they all work I bet. What I use is Phil's Touch and I'm on version 6.48.4 and it's worked perfectly.
How do I dirty flash my build on top of another CM12 build
I keep doing that since early F4k's builds and have no problems (yet!!). The trick is to only keep /data, while wiping everything else:
* Copy your newly build .zip file to your sdcard (you'll want to have a large enough sd card, I think)
* (if you want to) copy F4k's kernel and/or gapps too.
* Reboot your phone, go to recovery
* Backup your current phone. Seriously, never miss that step.
* Format /system (in Phil's Touch that's under "mounts and storage")
* Format /cache (as above)
* Select "install zip from sd card" and choose your ROM
* (if you want to) repeat "install zip from sd card" for F4k's kernel and/or gapps.
* Reboot your phone. It will take ~5 minutes or so for ART to re-compile all your apps
Soo my build didn't work. Wat do??
* Reboot to Recovery
* What I do is another backup. This gives me a nice archive containing my broken build, which I can later investigate
* Use recovery to restore the backup you've made before applying your build
* Reboot. You're back on a build that worked. Phew~
* (if you want to investigate) copy both backups (one that works and one that doesn't) to your PC. Uncompress the contents of /system for both, see if they obviously differ (such as one having binary blobs and one not lol).
Use F4k's kernel if you want to
Up to you, but here it is: https://s.basketbuild.com/devs/F4k/kernel_f4k-lp
I use it and as a result, I don't bother to optimise/improve CM12 kernel. I also don't care if I ever mis-compile CM12 kernel (not that it ever happens).
Gapps location
I use "mini" from here: https://s.basketbuild.com/devs/TKruzze/Android 5.0.1 GApps and all I can say is that it worked for me so far.
I made some changes and I forgot what I did
Command "repo status" will give you a list of all the files you've modified across all the git repositories.
I made some changes to a file and I forgot how it looked before
Go to that file's directory (or at least its git repository, but it's somewhat hard to figure out what is the repository structure in your workspace) and issue "git diff" command. It will produce a diff file with all your changes.
I made some changes to a file and I want to undo that
Go to that file's directory and issue "git checkout [filename]" command. It will drop your changes and replace the file with original.
My build finished and I want to make a new, fresh, one
You want to say "make clean" before you do "brunch serranoltexx" again.
Coming up: Basic JustArchi-inspired optimisations
Main article: http://forum.xda-developers.com/showthread.php?t=2754997
In the mid of 2014, @JustArchi recognised that all of Android has always been built with -Os option - meaning that the binaries are optimised for small size and not for execution speed. -Os is sometimes necessary (as it was on very early Android devices), but the "usual" build optimisation has always been -O2 meaning optimise for speed. Or -O3, which runs even more optimisations for speed (which might or might not help relative to O2 and will always make compilation slower).
Applying those optimisations has never been easier, because Lollipop is already built with GCC 4.8 (which was very highly recommended, but not in default toolchain, before). So all we need to do is activate -O3 by modifying some makefiles.
Does it do anything
In 0xbenchmark, several graphics-related tests (draw-arc, draw-circle) are up to six times faster. Does it matter? Dunno! But it's fun to see such a thing anyway!
What is THE most important file to modify?
Here: ~/android/system/build/core/combo/TARGET_linux-arm.mk
Line 70 defines "TARGET_arm_CFLAGS", this is the base compiler flags for *kernel* and starts with -O2. You can change that -O2 to -O3 if you want, but if you use F4k's kernel then it will do nothing in practice.
Line 77 defines TARGET_thumb_CFLAGS, this is the base compiler flags for android binaries. It clearly has -Os staring you in the face. Aha!! Change that to -O3 (or -O2) and you've just applied 90% of all compiler optimisations you can make. Build again. Your zip will be larger, this means it worked.
So I did that and it didn't finish building
Heh you're right, I lied. Unfortunately GCC is not as perfect as we'd wish and it will produce new errors or warnings with -O3 flag. Some of them make sense, some baffle me... Here's a list of what I had to change:
Error building android/system/frameworks//media/libstagefright/codecs/amrwbenc/src/isp_az.c, compiler detects array index out of bounds
It doesn't make any sense if you ask me (and I stared at the code a lot). There are two arrays f1 and f2. f1 has size [NC16k + 1] and f2 has size [NC16k], and if f1 is big enough then f2 should be big enough, but GCC disagrees.
For an off chance that GCC is right, I made f2 bigger [NC16k + 1]. Since nobody does sizeof(f2) it causes no change in logic, it marely allocates one extra (unused) word on stack. Made GCC happy.
[edit] this fix is unnecessary on gcc 4.8.5; see "Using SaberMod toolchain to build your CM12" on page 3 for how to use updated gcc[/edit]
Error building android/system/frameworks/av/media/libstagefright/codecs/m4v_h263/dec/src/deringing_[chroma|luma].cpp, cryptic "assuming when assuming" message
Another weird one. It *seems* to me that GCC unrolled a loop, and then looked at the unrolled loop index condition and concluded it's dumb after the unrolling, and complains. Modify:
android/system/frameworks/media/libstagefright/codecs/m4v_h263/dec/Android.mk
Find line: Local_CFLAGS += -Werror
Replace with: Local_CFLAGS += -Werror -Wno-error=strict-overflow
Error linking libhwcomposer, symbols "configRotator", "configMdp" and "updateSource" not found
Those three functions are defined with |inline| in the cpp files, while a compiler option tells gcc that inline implies static (dunno why it works with -Os, it really should never work). Open:
~/android/system/hardware/qcom/display-caf/msm8960/libhwcomposer/hwc_utils.cpp
Line 1238, remove "inline"
Line 1309, remove "inline"
Line 1335, remove "inline"
That is all, should build now!
Anything else uses -Os?
Yes, there's a bunch of Android.mk files that locally override the -O3 flag we just set with -Os (or -O2). You can make a global search, but here's a list of some important ones:
* every makefile under external/chromium_org/. This is the built-in web browser and unfortunately every single makefile does the override, and there's over9000 of them. If you want to change them all, you probably want to write a script of some sort. If you do, share one here lol.
* third_party/android_crazy_linker/src/Android.mk, adds -Os to LOCAL_CFLAGS. I do not know what crazy linker is, but if you want that to be bigger and faster, change that to -O3.
* third_party/zlib/zlib.target.linux-arm.mk, adds -Os to MY_CFLAGS_Release. Zlib sounds like something that should be fast, change that to -O3.
* modules/audio_processing/ lots of .mk files use -Os. How weird. You're only interested in *.target.linux-arm.mk, other targets do not apply to us.
* external/... some of the Android.mk files there use -Os. Some seem to matter.
Phew ~ next up: some more interesting optimisations that worked for me.
Compile for cortex-a15 target
The CPU in our S4mini is called Krait. It's neither Cortex-A9 nor Cortex-A15, but it's supposed to be similar to A15. However, the CM12 build system does not have an appropriate entry for Krait and defaults to generic A7+Neon, a choice that is not VERY bad but presumably not optimal either.
Go to file: ~/android/system/build/core/combo/arch/arm/armv7-a-neon.mk
Find the line that detects a15-compatible architectures (cortex-a15 and denver):
ifneq (,$(filter cortex-a15 denver,$(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)))
add krait to the list:
ifneq (,$(filter krait cortex-a15 denver,$(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)))
Activate neon vector extensions
[edit] see "Activate neon vector extensions, for real this time" on page 3 for a working, but hacky, solution[/edit]
Activate linker optimisations
In the in file: build/core/combo/select.mk there's room for some linker parameters.
Find the line that says:
$(combo_var_prefix)GLOBAL_LDFLAGS :=
and change it to:
$(combo_var_prefix)GLOBAL_LDFLAGS := -Wl,-O1
(that's: dash whiskey lima comma dash oscar one, no spaces, in case it's not readable)
I do not know what kind of optimisations linker makes, but this parameter asks it to make them.
Thanks a lot for this helpful and informative how-to. This is really appreciated if one likes to build the rom on his own.
Regards!
where can i download YOUR build of cm12?
well done!
This is a great write up. Anybody contributing for necessary mods required for duos will value add
I'm glad you guys like it I'll post some more tomorrow.
Howdareme said:
where can i download YOUR build of cm12?
Click to expand...
Click to collapse
Mine? I don't upload them anywhere because I don't see much point, making a near-identical copy of F4k's rom. Plus I am very lazy ;ppp
Now, to say something useful: if you're building any time soon, you might want to include this patch: http://review.cyanogenmod.org/#/c/82572/
It seems like there's a serious resource leak any time you switch your screen off.
Thanks for sharing this wonderful information!
sysKin said:
* Go to https://github.com/TheMuppets/proprietary_vendor_samsung
* Switch branch to cm-12.0
* Use the "Download ZIP" button to get the copy of the entire thing.
Click to expand...
Click to collapse
You might wanna consider adding that repo to a local manifest instead. See also @k2wls excellent guide: How to make your own CM-11.0 for your S4 mini
you can save the 500mb download by just adding this to .repo/local_manifests/roomservice.xml
Code:
<project name="TheMuppets/proprietary_vendor_samsung" path="vendor/samsung" remote="github" />
although perhaps we should be using arco's repo instead of the muppets?
https://github.com/arco/proprietary_vendor_samsung
also we should make a list of recommend patches from gerrit.
arco doesn't seem to be doing anything s4mini-specific at the moment, tonnes of work on bluetooth it seems:
http://review.cyanogenmod.org/#/q/owner:"Arne+Coucheron"+branch:"cm-12.0",n,z
sej7278 said:
you can save the 500mb download by just adding this to .repo/local_manifests/roomservice.xml
Code:
<project name="TheMuppets/proprietary_vendor_samsung" path="vendor/samsung" remote="github" />
although perhaps we should be using arco's repo instead of the muppets?
https://github.com/arco/proprietary_vendor_samsung
Click to expand...
Click to collapse
Wooo thanks, this is exactly the kind of knowledge I'm hoping we can put in one place, and I'm a noob when it comes to android build system (and |repo| script).
also we should make a list of recommend patches from gerrit.
Click to expand...
Click to collapse
Yup!
sysKin said:
Wooo thanks, this is exactly the kind of knowledge I'm hoping we can put in one place, and I'm a noob when it comes to android build system (and |repo| script).
Click to expand...
Click to collapse
well it won't actually save you a 500mb download, it'll just download it using repo, but at least it'll keep it up-to-date this way (as i recall there is a way to just checkout the directories you want, but i can't remember it, think you have to list every directory you don't want and remove it).
you can also add revision="cm-12.0" to the end of the tag, but cm-12.0 is the default now anyway.
i'd say USE_CCACHE=1 is worth doing, unless you're making major changes for every build, it defaults to only using 1Gb these days.
also if like me you've already checked out the cm-11.0 branch, you can switch to cm12 using:
Code:
repo init -b cm-12.0
repo sync -j16
built ok after a second repo sync (think i was in the middle of a merge window) and it turns out you don't need to get the prebuilts anymore, the terminal app is part of the source now.
oh and the screen off memory leak patch has been merged now.
it did take my 3.2ghz core-i5 with ccache on an ssd and 12gb ram about 2.5 hours to build, so a lot longer than cm7/9/10 (30-45mins) and a bit longer than cm11 (1.5-2 hours)
edit: actually a warm ccache only saved 5-10mins it seems, much more java than c/c++ in android these days i guess.
stop "settings > device > buttons" from crashing: http://review.cyanogenmod.org/#/c/83030/ (merged)
still looking for how to:
1. enable editting quick settings tiles
2. unmount usb mass storage,
3. take a screenshot from reboot menu / edit the reboot menu
4. edit the lockscreen settings
For those of us suffering from network-derived timezone resetting to GMT+0 (not a fun thing to happen overnight when you need your alarm clock!), there is this possible solution:
http://review.cyanogenmod.org/#/c/83219/
Love this thread.......
Thanks @sysKin., have you try diffrenent toolchain ?
happyta5 said:
have you try diffrenent toolchain ?
Click to expand...
Click to collapse
Not yet, not on this build. I did use a different toolchain when I compiled CM 10.2 but without any knowledge about how repo works it was just one huge mess. Many guides here only deepened my misunderstandings by showing me how to replace kernel toolchain (ie what builds the kernel) saying nothing about rest-of-android toolchain (and I don't even remember some details of that anymore...).
Also, I never managed to successfully compile CM 10.2 with contemporary GCC 4.9 - too many weird internal compiler errors and other strangeness. Do you have any information about successes with current tools? There wouldn't be much point using different toolchains if GCC/clang/etc remain the same (well, GCC 4.8.4 was released on 19th of December, might be worth trying).
With some pointers from this thread, I'm able to build CM12 using ArchiDroid linaro 4.8 and 4.9 ToolChain with -O3 Optimized. CM seems run faster. I'm using @F4k kernel for the moment since I like the undervolt alot. May be I'll try SaberMod ToolChain later .....
Cheers ...
happyta5 said:
With some pointers from this thread, I'm able to build CM12 using ArchiDroid linaro 4.8 and 4.9 ToolChain with -O3 Optimized. CM seems run faster.
Click to expand...
Click to collapse
Could you share more about what you did? In particular, did you change the "android-eabi" toolchain or the "arm-eabi" toolchain?
The only instructions I've seen which explain how to use linaro toolchain refer to the "android-eabi" one, and if my understanding is correct, that's used only for building the kernel...

Help me compile and build a Lollipop kernel (currently BlissPop preferable)

I want to compile a kernel for lollipop, but I always get somekind of error... Can this be cause of toolchain that I use or cause sources from GitHub arent good? Do u have any recomendation on stable, working source, and toolchain that goes along with it? I compiled cm11 rom, but couldn't compile just a kernel... Do u have any nice tutorials on that, ones that i found arent working for me...
i tried with this toolchain gcc/linux-x86/arm/arm-eabi-4.6 from tutorial source.android.com/source/building-kernels.html
download the kernel source. in this tutorial we will use the cm-12.1 cyanogen kernel.
Code:
git clone -b cm-12.1 https://github.com/CyanogenMod/lge-kernel-p880
there now is a folder in your home 'lge-kernel-p880'
download a toolchain. for now i prefer the google aosp toolchain because i am not knowing the code of the cyanogen kernel. compiling with other toolchains and recenter releases (for example 4.9 5.0 5.1 5.1 and 6.0 needs a few changes and fixes in the coding else it will not complete compiling)
Code:
git clone -b aosp-4.8-arm-eabi https://github.com/ArchiDroid/Toolchain toolchain
now that u have both u are ready to compile.
in terminal cd to the downloaded source.
Code:
cd lge-kernel-p880
set some things up and start compiling
Code:
export ARCH=arm
export CROSS_COMPILE=/home/[B]yourubuntu-username[/B]/toolchain/bin/arm-eabi-
make cyanogenmod_x3_defconfig
start compiling
Code:
make -j4
Now sit back, relax, and watch the code! Or you could read a book, watch ****, count your fingers, play with your toes...
If you have an error during the waterfall of code, find the part where it actually says *error* (you'll probably have to scroll upwards) and search it on Google or post it here.
If you manage to get something that says "the kernel zImage is ready" or something like that, that means you've made it!
You have officially compiled your own kernel from source! Now you need to put it in a flashable zip with the .ko files.
As i dont know what .ko files cyanogenmod compiles u should find this out yourself.
it is probably listed in the end of the terminal when the compiling is finished
hope this will bring u further then you are now.
mistercheese said:
download the kernel source. in this tutorial we will use the cm-12.1 cyanogen kernel.
Code:
git clone -b cm-12.1 https://github.com/CyanogenMod/lge-kernel-p880
there now is a folder in your home 'lge-kernel-p880'
download a toolchain. for now i prefer the google aosp toolchain because i am not knowing the code of the cyanogen kernel. compiling with other toolchains and recenter releases (for example 4.9 5.0 5.1 5.1 and 6.0 needs a few changes and fixes in the coding else it will not complete compiling)
Code:
git clone -b aosp-4.8-arm-eabi https://github.com/ArchiDroid/Toolchain toolchain
now that u have both u are ready to compile.
in terminal cd to the downloaded source.
Code:
cd lge-kernel-p880
set some things up and start compiling
Code:
export ARCH=arm
export CROSS_COMPILE=/home/[B]yourubuntu-username[/B]/toolchain/bin/arm-eabi-
make cyanogenmod_x3_defconfig
start compiling
Code:
make -j4
Now sit back, relax, and watch the code! Or you could read a book, watch ****, count your fingers, play with your toes...
If you have an error during the waterfall of code, find the part where it actually says *error* (you'll probably have to scroll upwards) and search it on Google or post it here.
If you manage to get something that says "the kernel zImage is ready" or something like that, that means you've made it!
You have officially compiled your own kernel from source! Now you need to put it in a flashable zip with the .ko files.
As i dont know what .ko files cyanogenmod compiles u should find this out yourself.
it is probably listed in the end of the terminal when the compiling is finished
hope this will bring u further then you are now.
Click to expand...
Click to collapse
Ty for help, i tried it, it worked, i guess it was the toolchain the first time...
After that i compiled euphoria kernel, but with uber 5.2 which didnt work for cm kernel...
I had to change some < > to " ", why are sources set with wrong ones, or am i making some mistake?
I replaced only zImage with euphoria zImage in anykernel .zip, can something go wrong when i do it like that?

Categories

Resources