Introducing XDA:DevCon – A Conference For Developers By Developers
XDA Developers Android and Mobile Development Forum
Forgot your password?
 
Post Reply+
Tip us?
 
pastime1971
Old
(Last edited by pastime1971; 4th October 2011 at 04:32 PM.)
#1  
pastime1971's Avatar
Senior Member - OP
Thanks Meter 1079
Posts: 1,877
Join Date: Apr 2011
Location: Pasadena, CA
Default [HOW TO] compile lge_star_kernel for cm7

this thread is a short how to compile lge_star_kernel for cm7. as i am a noobie, if there is mistake, wrong, etc. please correct me.

there is cm kernel how to at http://wiki.cyanogenmod.com/wiki/Bui...el_from_source. i will make a few change from there for p990 (shown in bold)
benee in vorkKernel project posted how to compile vorkKernel at https://github.com/VorkTeam/vorkKernel-Scripts/wiki
git tutorial at http://gitref.org/creating/
lge-kernel-star is at http://github.com/CyanogenMod/lge-kernel-star/

# how to #

0. install required development support package : (see cm kernel how to)
0. assuming that cm rom source in ~/android/system and kernel source in ~/android/kernel for 1A and 1B or ~/android/system/kernel for 1C

1A. download kernel source : (first time only. you can use git for deltas only. see post #4 and follow step 1B instead)
> mkdir -p ~/android/kernel
> cd ~/android/kernel
> git clone git://github.com/CyanogenMod/lge-kernel-star.git
> cd lge-kernel-star

1B. update kernel source by git for new commits
> cd ~/android/kernel/lge-kernel-star
> git pull

1C. alternatively, set up git for cm repo
> cp local_manifest.xml ~/android/system/.repo/local_manifest.xml
> cd ~/android/system
> repo sync -j16 kernel/lge-kernel-star
> cd ~/android/system/kernel/lge-kernel-star

2. set up compiler prefix : we need "ARM EABI Toolchain" from prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/ in CM ROM source tree (4.4.3 also works, and i'm using it)
> export CCOMPILER=${HOME}/android/system/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-

3. copy config
> cp arch/arm/configs/star_cyanogenmod_defconfig .config

4. run configuration
> make ARCH=arm CROSS_COMPILE=$CCOMPILER oldconfig

5. build
> make ARCH=arm CROSS_COMPILE=$CCOMPILER -j`grep 'processor' /proc/cpuinfo | wc -l`

6. copy kernel and modules to cm source device folder (zImage is renamed as kernel)
> cp arch/arm/boot/zImage ~/android/system/device/lge/p990/kernel
> cp drivers/net/wireless/bcm4329/wireless.ko ~/android/system/device/lge/p990/prebuilt/wireless.ko

7. build CM ROM using the compiled kernel and modules

p.s. i use a bash script that does 2 to 6 automatically.
Nexus 4 on T-Mobile US, CM-10.1 kang
LG P990 (no SIM card), LGP990AT-00-V20s-EUR-XX-MAY-21-2012+0 BB, CM-10.1 kang
my xda thread for ICS/JB port of PDroid source
FFU5y xda thread for JB 4.2.1 of OpenPDroid source
mateorod's xda thread for auto patcher
The Following 5 Users Say Thank You to pastime1971 For This Useful Post: [ Click to Expand ]
 
pastime1971
Old
(Last edited by pastime1971; 20th August 2011 at 06:15 PM.)
#2  
pastime1971's Avatar
Senior Member - OP
Thanks Meter 1079
Posts: 1,877
Join Date: Apr 2011
Location: Pasadena, CA
kernel source mod

# version : the current versioning that shows up in Settings > About phone > kernel version is a bit hard to follow if everybody compiles his/her own kernel. i customize lge-kernel-star/scripts/mkcompile_h and use date as version

46: DATETODAY=`date +"%Y%m%d"`
47: UTS_VERSION="$DATETODAY#$VERSION"

# compiled by : since i have a different username on linux system that i use, force it to show the name you want on it.

67: echo \#define LINUX_COMPILE_BY \"YOUR_NAME\"
68: echo \#define LINUX_COMPILE_HOST \"YOUR_MACHINE\"
Nexus 4 on T-Mobile US, CM-10.1 kang
LG P990 (no SIM card), LGP990AT-00-V20s-EUR-XX-MAY-21-2012+0 BB, CM-10.1 kang
my xda thread for ICS/JB port of PDroid source
FFU5y xda thread for JB 4.2.1 of OpenPDroid source
mateorod's xda thread for auto patcher
The Following User Says Thank You to pastime1971 For This Useful Post: [ Click to Expand ]
 
pastime1971
Old
(Last edited by pastime1971; 22nd August 2011 at 06:50 PM.)
#3  
pastime1971's Avatar
Senior Member - OP
Thanks Meter 1079
Posts: 1,877
Join Date: Apr 2011
Location: Pasadena, CA
here is my (simplified) shell script to compile kernel

Code:
#!/bin/sh
export CCOMPILER=${HOME}/android/system/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
cd ${HOME}/android/kernel/lge-kernel-star || exit
${CCOMPILER}gcc --verbose || exit # show the cross compiler
\cp arch/arm/configs/star_cyanogenmod_defconfig .config
make ARCH=arm CROSS_COMPILE=$CCOMPILER oldconfig 
make ARCH=arm CROSS_COMPILE=$CCOMPILER -j`grep 'processor' /proc/cpuinfo | wc -l`
edit: added a printout of manual checking of compiler in line 4
Nexus 4 on T-Mobile US, CM-10.1 kang
LG P990 (no SIM card), LGP990AT-00-V20s-EUR-XX-MAY-21-2012+0 BB, CM-10.1 kang
my xda thread for ICS/JB port of PDroid source
FFU5y xda thread for JB 4.2.1 of OpenPDroid source
mateorod's xda thread for auto patcher
 
pastime1971
Old
(Last edited by pastime1971; 20th August 2011 at 07:02 PM.)
#4  
pastime1971's Avatar
Senior Member - OP
Thanks Meter 1079
Posts: 1,877
Join Date: Apr 2011
Location: Pasadena, CA
Following is from myfluxi

Quote:
Originally Posted by myfluxi View Post
Hey, it's me again. Regarding the kernel thread, cloning the kernel ressources is not very efficient, instead add the git to your repository and just download deltas. Edit (typically) ~/android/.repo/local_manifest.xml by adding:

Code:

<project path="kernel/lge-kernel-star" name="CyanogenMod/lge-kernel-star.git" remote="github" revision="android-tegra-2.6.32" />

And a late happy birthday...

Cheers
Marc
Nexus 4 on T-Mobile US, CM-10.1 kang
LG P990 (no SIM card), LGP990AT-00-V20s-EUR-XX-MAY-21-2012+0 BB, CM-10.1 kang
my xda thread for ICS/JB port of PDroid source
FFU5y xda thread for JB 4.2.1 of OpenPDroid source
mateorod's xda thread for auto patcher
 
temasek
Old
(Last edited by temasek; 20th August 2011 at 10:14 PM.)
#5  
temasek's Avatar
Recognized Contributor
Thanks Meter 23234
Posts: 13,260
Join Date: Feb 2010
Location: Singapore
Thanks for sharing. I suppose that's the next fun thing to learn.

Oh btw how do u add/remove kernel or init.rc commits?
Samsung Galaxy S3 i9300 - CM10.1 SelfKANG ( KANG Thread )
Nexus 7 3G tilapia - CM10.1 SelfKANG ( KANG Thread )

Vadonka's temasek.hopto.org: temasek
Dev-Host: temasek
MediaFire: temasek

Twitter: temasek71

 
sibbor
Old
(Last edited by sibbor; 21st August 2011 at 01:26 AM.)
#6  
sibbor's Avatar
Senior Member
Thanks Meter 316
Posts: 646
Join Date: Jul 2008

 
DONATE TO ME
Exactly what I looked for the other day. Thanks a lot pastime1971!!
This time I won't fail ;)

EDIT: but I did... I guess it's the export that made me fail?
Code:
sibbor@ubuntu:~/android/kernel/lge-kernel-star$ make ARCH=arm CROSS_COMPILE=$CCOMPILER -j`grep 'processor' /proc/cpuinfo | wc -l`
scripts/kconfig/conf -s arch/arm/Kconfig
  CHK     include/linux/version.h
  SYMLINK include/asm -> include/asm-arm
make[1]: `include/asm-arm/mach-types.h' is up to date.
  CHK     include/linux/utsrelease.h
  CC      scripts/mod/empty.o
cc1: error: unrecognized command line option "-mlittle-endian"
cc1: error: unrecognized command line option "-mapcs"
cc1: error: unrecognized command line option "-mno-sched-prolog"
cc1: error: unrecognized command line option "-mno-thumb-interwork"
scripts/mod/empty.c:1:0: error: unknown ABI (aapcs-linux) for -mabi= switch
scripts/mod/empty.c:1:0: error: bad value (armv5t) for -march= switch
make[2]: *** [scripts/mod/empty.o] Error 1
make[1]: *** [scripts/mod] Error 2
make: *** [scripts] Error 2
Developer of GetRIL (XDA thread)
See your device's RIL and baseband version and download & install a new RIL even without on-the-fly!



HTC One X
ROM: CM 10.1 (official) or AOSP 4.2.2 - Thanks pabx, tbalden & Co
Hboot: 1.39

ASUS Transformer Pad TF300T
CM 10.1 (official) - Thanks XpLoDWilD!

LG Optimus 2X
CM 10.1 (official) - Thanks Ricardo Cerqueira!
 
pastime1971
Old
#7  
pastime1971's Avatar
Senior Member - OP
Thanks Meter 1079
Posts: 1,877
Join Date: Apr 2011
Location: Pasadena, CA
Quote:
Originally Posted by temasek View Post
Thanks for sharing. I suppose that's the next fun thing to learn.

Oh btw how do u add/remove kernel or init.rc commits?
the way i understand it is that boot.img is built w/ kernel (as prebuilt) and init ram disk when you brunch.
there are several init.rc involved. (see out/target/product/p990/root/)
for example w/ secure clock commit, init.p990.rc is from device/lge/p990/init.p990.rc

so, i build (brunch) cyanogen w/ kernel (zImage goes to device/lge/p990/kernel and modules go to device/lge/p990/prebuilt/) compiled as above and init.rc's changed in cm (you could cherry pick them, i suppose)

for kernel itself, i don't know if you can cherry pick them or not. typically, i just apply diff patches. (if someone know how to cherry pick kernel commits, please let us know.)
Nexus 4 on T-Mobile US, CM-10.1 kang
LG P990 (no SIM card), LGP990AT-00-V20s-EUR-XX-MAY-21-2012+0 BB, CM-10.1 kang
my xda thread for ICS/JB port of PDroid source
FFU5y xda thread for JB 4.2.1 of OpenPDroid source
mateorod's xda thread for auto patcher
The Following User Says Thank You to pastime1971 For This Useful Post: [ Click to Expand ]
 
temasek
Old
#8  
temasek's Avatar
Recognized Contributor
Thanks Meter 23234
Posts: 13,260
Join Date: Feb 2010
Location: Singapore
Quote:
Originally Posted by pastime1971 View Post
the way i understand it is that boot.img is built w/ kernel (as prebuilt) and init ram disk when you brunch.
there are several init.rc involved. (see out/target/product/p990/root/)
for example w/ secure clock commit, init.p990.rc is from device/lge/p990/init.p990.rc

so, i build (brunch) cyanogen w/ kernel (zImage goes to device/lge/p990/kernel and modules go to device/lge/p990/prebuilt/) compiled as above and init.rc's changed in cm (you could cherry pick them, i suppose)

for kernel itself, i don't know if you can cherry pick them or not. typically, i just apply diff patches. (if someone know how to cherry pick kernel commits, please let us know.)
Thanks.

I'll have a go and it when I'm free. Good to have u onboard.
Samsung Galaxy S3 i9300 - CM10.1 SelfKANG ( KANG Thread )
Nexus 7 3G tilapia - CM10.1 SelfKANG ( KANG Thread )

Vadonka's temasek.hopto.org: temasek
Dev-Host: temasek
MediaFire: temasek

Twitter: temasek71

 
pastime1971
Old
(Last edited by pastime1971; 22nd August 2011 at 11:53 PM.)
#9  
pastime1971's Avatar
Senior Member - OP
Thanks Meter 1079
Posts: 1,877
Join Date: Apr 2011
Location: Pasadena, CA
Quote:
Originally Posted by sibbor View Post
Exactly what I looked for the other day. Thanks a lot pastime1971!!
This time I won't fail ;)

EDIT: but I did... I guess it's the export that made me fail?
can you "echo $CCOMPILER" or "env | grep CCOMPILER" before make to ensure that it is exported correctly ?
it re-defines to use those arm-eabi-gcc and others. see lge-kernel-star/Makefile, line 309 : CC = $(CROSS_COMPILE)gcc
without it, you would be calling gcc which doesn't understand -mlittle-endian or other options in that log

edit: i commented out the line of export from my shell script, and i get the exact same error message. it must be export issue.

edit: you should get the following when you do "${CCOMPILER}gcc --verbose"

> ${CCOMPILER}gcc --verbose
Using built-in specs.
Target: arm-eabi
Configured with: /home/jingyu/projects/gcc/android-toolchainsrc/build/../gcc/gcc-4.4.3/configure --prefix=/usr/local --target=arm-eabi --host=x86_64-linux-gnu --build=x86_64-linux-gnu --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --with-gmp=/home/jingyu/projects/gcc/toolchain_build/gingerbreadobj/temp-install --with-mpfr=/home/jingyu/projects/gcc/toolchain_build/gingerbreadobj/temp-install --disable-libssp --enable-threads --disable-nls --disable-libmudflap --disable-libgomp --disable-libstdc__-v3 --disable-sjlj-exceptions --disable-shared --disable-tls --with-float=soft --with-fpu=vfp --with-arch=armv5te --enable-target-optspace --with-abi=aapcs --with-gcc-version=4.4.3 --with-binutils-version=2.19 --with-gmp-version=4.2.4 --with-mpfr-version=2.4.1 --with-gdb-version=7.1.x --with-arch=armv5te --with-multilib-list=mandroid --with-sysroot=/usr/local/google/home/android/cupcake_rel_root --enable-gold=both/gold --program-transform-name='s&^&arm-eabi-&'
Thread model: single
Nexus 4 on T-Mobile US, CM-10.1 kang
LG P990 (no SIM card), LGP990AT-00-V20s-EUR-XX-MAY-21-2012+0 BB, CM-10.1 kang
my xda thread for ICS/JB port of PDroid source
FFU5y xda thread for JB 4.2.1 of OpenPDroid source
mateorod's xda thread for auto patcher
 
pastime1971
Old
(Last edited by pastime1971; 25th August 2011 at 07:51 AM.)
#10  
pastime1971's Avatar
Senior Member - OP
Thanks Meter 1079
Posts: 1,877
Join Date: Apr 2011
Location: Pasadena, CA
Quote:
Originally Posted by myfluxi
Quote:
Originally Posted by pastime1971
Dear Marc,

Do you know how to set up local copy of git for lge-kernel-star ?
I can add that line to cm/.repo/local_manifest.xml and it works.

But I would like to have a separate one just for kernel.
I can copy .repo from cm and strip it down, and leave just kernel. That works as well.
But I was wondering if there is a better way to do it. I tried to "repo init -u git://github.com/CyanogenMod/lge-kernel-star.git -b android-tegra-2.6.32" but it fails w/ the following message: #error message deleted#

besides, the source goes into .repo/manifests/
maybe I need to use git command directly ?

regards,

pastime
Hey,

if you just want to be on top of things of our beloved lge-kernel-star, maybe just:

git clone git://github.com/CyanogenMod/lge-kernel-star.git

and then sync with

cd lge-kernel-star
git [pull | fetch]

What do you think?

Cheers
Marc
thanks for your advice. i updated the first post accordingly.

edit: w/ today's commit, i tried "git fetch", and nothing happens. tried "git pull" and it downloads new commits. updated the first post. comment welcome if you know the difference between fetch and pull.
Nexus 4 on T-Mobile US, CM-10.1 kang
LG P990 (no SIM card), LGP990AT-00-V20s-EUR-XX-MAY-21-2012+0 BB, CM-10.1 kang
my xda thread for ICS/JB port of PDroid source
FFU5y xda thread for JB 4.2.1 of OpenPDroid source
mateorod's xda thread for auto patcher

 
Post Reply+
Tags
compile, kernel
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Go to top of page...