[HTC One V] :
Hello everyone. Today I decided I wanted to give back to the One V community with a tutorial on building a kernel. This is not specific to the Primoc/u and contains the directions for both. The source even includes both! So lets hit the ground running.

Note: for the most up to date instructions visit here

Now youll need to have access to sudo to get the packages needed. here are the commands to get packages

Ubuntu 10.04-11.10:

sudo apt-get update; sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc gcc

Ubuntu 12.04

sudo apt-get update; sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386 gcc

Now, to get the source run these commands

cd ~/
mkdir kernel
cd kernel
git clone git://github.com/teamblueridge/MSM7X30_KERNEL.git onev_kernel
cd onev_kernel

first you are changing to your home directory. Next your making a folder for kernels, and then pulling the source from github. This source is modified and maintained by me, so I know it stays working. Finally your changing into the kernels directory. Now how do we build this thing you ask. Well we have to do some more prep work. Lets start that prep work

run these commands

cd ~/
mkdir toolchains
cd toolchains
#this takes some time
git clone https://android.googlesource.com/platform/prebuilt android_prebuilt
cd ~/kernel/onev_kernel

Now we select our branch

for ics run

git checkout ics

For jb

git checkout jb-hack

Now were ready to build. Basically your grabbing the android prebuilts which includes the needed toolchain in the steps before.

Now heres the fun codes

Okay below, i have a -jX in the command. This is the number of parallell builds. This will be the number of your CPU's plus one. If you have no clue how many cpus you have run this code below and add one

grep -c processor /proc/cpuinfo

To make CDMA

make ARCH=arm primoc_defconfig
make -jX ARCH=arm CROSS_COMPILE="~/toolchains/android_prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-"

To make GSM

make ARCH=arm primou_defconfig
make -jX ARCH=arm CROSS_COMPILE="~/toolchains/android_prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-"

So whats going on here you ask now? your using gnu make to build a kernel! arm is the architecture, CROSS_COMPILE is the toolchain we downloaded and -j`grep -c processor /proc/cpuinfo` will find the number of cpu cores you have and adjust the speed for your system!

So now your kernel is created and you want the kernel image to stick in your boot.img. Well its always located at ~/kernel/onev_kernel/arch/arm/boot/zImage any modules you selected are listed at the end of the build

If you were wondering, you can also modify the .config with this command

Primoc

make mrproper"
make ARCH=arm primoc_defconfig
make menuconfig

Primou

make mrproper
make ARCH=arm primou_defconfig
make menuconfig

Want the easy way out? Try this script

https://github.com/simonsimons34/kernel-building-script