[GUIDE] How to compile kernel for Xperia E3. - Sony Xperia E3

This guide is focused on xperia e3 but for other devices process will be simler too.
This guide is not in good shape now i will keep improving it and making it easier and better.
if xperia e3 don,t have too many developers then become one.
Requirements
linux os. -recommended ubuntu 14.04 LTS
(you can install ubuntu on virtualbox or dual boot ubuntu with windows)
cross compiler tool chain -recomended Linaro GCC 4.9.3 optimized for arm-cortex_a7
kernel source code. download it from sony or you can compile my nitrogen kernel only if you have D2212/02 recomended.
unlocked bootloader
tools for building boot.img Download HERE
Sony Kernel
D2202/12 DOWNLOAD
D2203/06/43 DOWNLOAD
Nitrogen Kernel
D2202/12/03/06/43 DOWNLOAD
config for lte varriants is not uploaded but u may find it in your device /proc/config.gz
extarct config from config.gz and rename it to Nitrogen_lte_defconfig and put it in
<kernel source folder>/arch/arm/config/<here>
Setting up Environment in Ubuntu.
boot up ubuntu and open Home directory.
create two new folder.
one with name "toolchain"
one with name "build"
now extract your toolchain to toolchain folder it must contain these folders
Code:
arm-cortex_a7-linux-gnueabihf
bin
include
lib
libexec
share
(depends on toolchain you have)
Extracting Nitrogen source code
if you downloaded zip then extract that zip home dir.
then rename flamingo-kernel folder to kernel
else you can use these commands
Code:
sudo apt-get update
sudo apt-get install git
then
Code:
git clone https://github.com/vinay94185vinay/Flamingo-kernel.git
after that rename flamingo kernel to kernel.
How to extract sony source code
open terminal type
Code:
tar -xjvf
then drag n drop source code file
then hit enter. (it will extract files in home firectory)
open your firmware number folder. eg: 18.5.C.0.19
delete extarnal folder then move/copy "kernel" folder to home dir.
and then extract build tools to build folder.
Compiling.
open an terminal (CTRL+ALT+T) and type
Code:
cd Kernel
(this will change directory to kernel folder.)
then type
Code:
export CROSS_COMPILE=[COLOR="Green"]~/toolchain/bin/[/COLOR][COLOR="Red"]arm-cortex_a7-linux-gnueabihf-[/COLOR]
(red line depend on tool chain and green line on it,s location)
how to find correct red line for toolchain.
open toolchain folder
then bin
in my case it contains files like
arm-cortex_a7-linux-gnueabihf-addr2line
arm-cortex_a7-linux-gnueabihf-ar
arm-cortex_a7-linux-gnueabihf-as
see all files contains that red line.
now you must understood how to know that line.
for sony kernel source code type
For D2202 and D2212
Code:
make [COLOR="Red"]ARCH=arm CROSS_COMPILE=$CROSS_COMPILE[/COLOR] [COLOR="Green"]arima_8226ds_dp_defconfig[/COLOR]
For D2203 and D2206 and D2243
Code:
make [COLOR="Red"]ARCH=arm CROSS_COMPILE=$CROSS_COMPILE[/COLOR] [COLOR="Green"]arima_8926ss_dp_defconfig[/COLOR]
"RED" line make sure that you compile kernel for arm based cpu that is in your android device
if you remove this line you will end up making a kernel for your pc.
"GREEN" is to load an preset default configuration for compiling kernel
it contains what thing,s has to be compiled in this kernel.
for nitrogen kernel source code type
D2202 and D2212
Code:
make ARCH=arm CROSS_COMPILE=$CROSS_COMPILE Nitrogen_defconfig
D2203 and D2206 and D2243
Code:
make ARCH=arm CROSS_COMPILE=$CROSS_COMPILE Nitrogen_lte_defconfig
Now type for dualcore cpu
Code:
make ARCH=arm CROSS_COMPILE=$CROSS_COMPILE [COLOR="red"]-j3[/COLOR]
"red" -j3 tell,s compiler to make 3 job,s which is good for intel dual core cpu.
if you have dual core amd cpu it should be better for you to have 2 job,s mean -j2
and -j4 for quard core.
for quard core cpu
Code:
make ARCH=arm CROSS_COMPILE=$CROSS_COMPILE -j5
(do it like this cores + 1)
now wait for untill your kernel get compiled.
it may take long time. depend on how fast and how many cores your cpu have.
if you don,t get any error then
you have compiled your kernel :good:.
building boot.img
copy zimage from kernel/arch/arm/boot folder.
to build/msm8226_flamingo/<zimage>
now in msm8226_flamingo folder.
open new_stock_files/<according to your device>/
copy ramdisk. and dt.img to msm8226_flamingo folder.
now open terminal (CTRL+ALT+T) and type
Code:
cd build/msm8226_flamingo/
then
Code:
./makeit.sh
(don,t forget dot.)
now you can see boot.img in build/msm8226_flamingo folder.
now you can flash boot.img with fastboot or flashtool.
feel free to ask if you don,t understand or have error in any step.

RESERVED
adding features.
adding your and kernel name in kernel version.
adding kernel name
in kernel folder you will see Makefile open and edit it.
find these lines.
Code:
VERSION = 3
PATCHLEVEL = 4
SUBLEVEL = 0
[COLOR=Red]EXTRAVERSION = [/COLOR]
NAME = Saber-toothed Squirrel
write name of kernel next to extraversion (highlited in red)
like this
Code:
VERSION = 3
PATCHLEVEL = 4
SUBLEVEL = 0
[COLOR=red]EXTRAVERSION = -My_Kernel[/COLOR]
NAME = Saber-toothed Squirrel
adding your name.
open kernel/scripts
edit file called mkcompile_h
find lines like this
Code:
# [All][Main][SI][DMS][44408][akenhsu] Fix the builder and build machine avoiding 'arima' in kernel version 20140926 BEGIN
# LINUX_COMPILE_BY=$(whoami | sed 's/\\/\\\\/')
LINUX_COMPILE_BY=`echo [COLOR=red]build_admin`[/COLOR]
# [All][Main][SI][DMS][44408][akenhsu] 20140926 END
else
LINUX_COMPILE_BY=$KBUILD_BUILD_USER
fi
if test -z "$KBUILD_BUILD_HOST"; then
# [All][Main][SI][DMS][44408][akenhsu] Fix the builder and build machine avoiding 'arima' in kernel version 20140926 BEGIN
# LINUX_COMPILE_HOST=`hostname`
LINUX_COMPILE_HOST=`echo[COLOR=green] ubuntu_builder`[/COLOR]
# [All][Main][SI][DMS][44408][akenhsu] 20140926 END
change red one to your name and green one to your host it will look like this in kernel version.
build_admin@ubuntu_builder
change it like this
Code:
# [All][Main][SI][DMS][44408][akenhsu] Fix the builder and build machine avoiding 'arima' in kernel version 20140926 BEGIN
# LINUX_COMPILE_BY=$(whoami | sed 's/\\/\\\\/')
LINUX_COMPILE_BY=`echo [COLOR=red]my_name`[/COLOR]
# [All][Main][SI][DMS][44408][akenhsu] 20140926 END
else
LINUX_COMPILE_BY=$KBUILD_BUILD_USER
fi
if test -z "$KBUILD_BUILD_HOST"; then
# [All][Main][SI][DMS][44408][akenhsu] Fix the builder and build machine avoiding 'arima' in kernel version 20140926 BEGIN
# LINUX_COMPILE_HOST=`hostname`
LINUX_COMPILE_HOST=`echo[COLOR=red] i_compiled_on[/COLOR]`
# [All][Main][SI][DMS][44408][akenhsu] 20140926 END
adding governors and i/o sheduer
http://xda-university.com/as-a-developer/adding-features-to-your-kernel

fixing error.
#1
if you get error with line
Code:
[-Werror=implicit-function-declaration]
like this one
Code:
CC drivers/video/msm/mdss/mdss_dsi_host.o
CC drivers/video/msm/mdss/mdss_dsi_cmd.o
CC drivers/video/msm/mdss/mdss_dsi_panel.o
drivers/video/msm/mdss/mdss_dsi_panel.c: In function ‘mdss_dsi_panel_reset’:
drivers/video/msm/mdss/mdss_dsi_panel.c:291:3: error: implicit declaration of function ‘mdss_dsi_request_gpios’ [COLOR="Red"][-Werror=implicit-function-declaration][/COLOR]
rc = mdss_dsi_request_gpios(ctrl_pdata);
^
cc1: some warnings being treated as errors
make[4]: *** [drivers/video/msm/mdss/mdss_dsi_panel.o] Error 1
make[3]: *** [drivers/video/msm/mdss] Error 2
make[2]: *** [drivers/video/msm] Error 2
make[1]: *** [drivers/video] Error 2
make: *** [drivers] Error 2
then open makefile in kernel folder and find line
Code:
CFLAGS_KERNEL =
and make it like this
Code:
CFLAGS_KERNEL = -w
then save and exit you will not see that error again.

I will try it
Thanks bro

arpit.j said:
I will try it
Thanks bro
Click to expand...
Click to collapse
export command was incorrect.
i fixed it and added details of it.

hi,
guy,s some info here.
if you compile nitrogen kernel from source code it will give you some extra features that i added in source code after release of Nitrogen 4.1.
nitrogen kernel source code have
- prima wifi drivers
- headset in high performance mode
- zzmove governor
- 30% faster input output
- enhance power efecency with series of NVIDIA patches
- some tweaks for ASoc
- Enabled TCP Congestions like high speed,westwood etc.
if you want these features then compile kernel from source.
i will keep adding features to source code
only D2202 and D2212 is supported.
Don,t forget the poll at top of thread.

any on making any kernel.

Hello
Thank you ver much, Vinay
Today i built my first Android kernel for D2203. Before i had your kernel LTE.7z from this post http://forum.xda-developers.com/xperia-e3/general/simplified-guide-to-root-sony-xperia-e3-t3012248 It was work perfectly. On my new kernel i have no CWM recovery. How to restore recovery?
Thanks

pjk11 said:
Hello
Thank you ver much, Vinay
Today i built my first Android kernel for D2203. Before i had your kernel LTE.7z from this post http://forum.xda-developers.com/xperia-e3/general/simplified-guide-to-root-sony-xperia-e3-t3012248 It was work perfectly. On my new kernel i have no CWM recovery. How to restore recovery?
Thanks
Click to expand...
Click to collapse
for a recovery you need a ramdisk with recovery. Tell me which recovery you want i can give you that ramdisk.
Sent from my Xperia E3 using XDA Free mobile app

vinay said:
for a recovery you need a ramdisk with recovery. Tell me which recovery you want i can give you that ramdisk.
Sent from my Xperia E3 using XDA Free mobile app
Click to expand...
Click to collapse
I have this kernel with cwm:
Code:
[email protected]:/ $ uname -a
Linux localhost [email protected] #2 SMP PREEMPT Wed Mar 25 19:54:11 IST 2015 armv7l GNU/Linux
Where i can download this sources, your config, and ramdisk with cwm?
Thanks.

pjk11 said:
I have this kernel with cwm:
Code:
[email protected]:/ $ uname -a
Linux localhost [email protected] #2 SMP PREEMPT Wed Mar 25 19:54:11 IST 2015 armv7l GNU/Linux
Where i can download this sources, your config, and ramdisk with cwm?
Thanks.
Click to expand...
Click to collapse
use this ramdisk while building boot.img
http://www.mediafire.com/download/w1xt9um1dm95mpp/ramdisk.cpio.gz
extract my config from your device.
/proc/config.gz

vinay said:
use this ramdisk while building boot.img
http://www.mediafire.com/download/w1xt9um1dm95mpp/ramdisk.cpio.gz
extract my config from your device.
/proc/config.gz
Click to expand...
Click to collapse
Thank you very much.
I have a questions. In normal linux complining i copy myconfig to .config and make oldconfig. But i dont how do it in android? And what are these files:
Code:
[[email protected] configs [j0]$>>> ls *arima*
arima_8226ds_ap_defconfig arima_8226ds_pdp2_defconfig arima_8226ss_dp_defconfig arima_8926ds_ap_defconfig arima_8926ds_pdp2_defconfig arima_8926ss_dp_defconfig
arima_8226ds_dp2_defconfig arima_8226ds_sp_defconfig arima_8226ss_pdp1_defconfig arima_8926ds_dp2_defconfig arima_8926ds_sp_defconfig arima_8926ss_pdp1_defconfig
arima_8226ds_dp_defconfig arima_8226ss_ap_defconfig arima_8226ss_pdp2_defconfig arima_8926ds_dp_defconfig arima_8926ss_ap_defconfig arima_8926ss_pdp2_defconfig
arima_8226ds_pdp1_defconfig arima_8226ss_dp2_defconfig arima_8226ss_sp_defconfig arima_8926ds_pdp1_defconfig arima_8926ss_dp2_defconfig arima_8926ss_sp_defconfig
[[email protected] configs [j0]$>>>
Whats is difference of these files?
Regards

pjk11 said:
Thank you very much.
I have a questions. In normal linux complining i copy myconfig to .config and make oldconfig. But i dont how do it in android? And what are these files:
Code:
[[email protected] configs [j0]$>>> ls *arima*
arima_8226ds_ap_defconfig arima_8226ds_pdp2_defconfig arima_8226ss_dp_defconfig arima_8926ds_ap_defconfig arima_8926ds_pdp2_defconfig arima_8926ss_dp_defconfig
arima_8226ds_dp2_defconfig arima_8226ds_sp_defconfig arima_8226ss_pdp1_defconfig arima_8926ds_dp2_defconfig arima_8926ds_sp_defconfig arima_8926ss_pdp1_defconfig
arima_8226ds_dp_defconfig arima_8226ss_ap_defconfig arima_8226ss_pdp2_defconfig arima_8926ds_dp_defconfig arima_8926ss_ap_defconfig arima_8926ss_pdp2_defconfig
arima_8226ds_pdp1_defconfig arima_8226ss_dp2_defconfig arima_8226ss_sp_defconfig arima_8926ds_pdp1_defconfig arima_8926ss_dp2_defconfig arima_8926ss_sp_defconfig
[[email protected] configs [j0]$>>>
Whats is difference of these files?
Regards
Click to expand...
Click to collapse
all are default configrations.
you should put config in /arch/arm/config/<here>
and rename it to something like my_defconfig
then use make ARCH=arm CROSS_COMPILE=$ROSS_COMPILE my_defconfig
because you may have to use make clean&&make mrproper many times which wiill delete .config keeping it in arch/arm/config
will kepp it safe.
and
arima_8226ds_dp_defconfig
is config for xperia e3.
arima (some sort of secret name for xperia e3)
8226 (name of cpu)
ds (d=>dual s=> sim)
dp (i don,t know)
defconfig (default config)

vinay said:
all are default configrations.
you should put config in /arch/arm/config/<here>
and rename it to something like my_defconfig
then use make ARCH=arm CROSS_COMPILE=$ROSS_COMPILE my_defconfig
because you may have to use make clean&&make mrproper many times which wiill delete .config keeping it in arch/arm/config
will kepp it safe.
and
arima_8226ds_dp_defconfig
is config for xperia e3.
arima (some sort of secret name for xperia e3)
8226 (name of cpu)
ds (d=>dual s=> sim)
dp (i don,t know)
defconfig (default config)
Click to expand...
Click to collapse
Thank you very much, Vinay.
Regards

guide updated.
added link to a guide about adding features to your kernel
if you wan,t to learn anything more just ask me..

vinay pls hlp me , nothing happens after adding this ( export CROSS_COMPILE=~/toolchain/bin/arm-cortex_a7-linux-gnueabihf-) line in terminal , do i need to install some xtra apps in ubuntu? because i have install ubuntu for the 1st time through virtualbox, and pls make a video for this guide.

himfa71 said:
vinay pls hlp me , nothing happens after adding this ( export CROSS_COMPILE=~/toolchain/bin/arm-cortex_a7-linux-gnueabihf-) line in terminal , do i need to install some xtra apps in ubuntu? because i have install ubuntu for the 1st time through virtualbox, and pls make a video for this guide.
Click to expand...
Click to collapse
nothing will happen after that command actually it tells terminal $CROSS_COMPILE is equal to home/username/toolchain/bin/arm-cortex_a7-linux-gnueabihf-

vinay pls see this , im getting these error,
Code:
[email protected]:~$ cd kernel
[email protected]:~/kernel$ export CROSS_COMPILE=~/toolchain/bin/arm-cortex_a7-linux-gnueabihf-
[email protected]:~/kernel$ make ARCH=arm CROSS_COMPILE=$CROSS_COMPILE Nitrogen_defconfig
drivers/cpufreq/Kconfig:236:warning: multi-line strings not supported
drivers/cpufreq/Kconfig:288:warning: multi-line strings not supported
drivers/net/wireless/ath/Kconfig:27: can't open file "drivers/net/wireless/ath/carl9170/Kconfig"
make[1]: *** [Nitrogen_defconfig] Error 1
make: *** [Nitrogen_defconfig] Error 2
[email protected]:~/kernel$ make ARCH=arm CROSS_COMPILE=$CROSS_COMPILE -j3
scripts/kconfig/conf --silentoldconfig Kconfig
drivers/cpufreq/Kconfig:236:warning: multi-line strings not supported
drivers/cpufreq/Kconfig:288:warning: multi-line strings not supported
drivers/net/wireless/ath/Kconfig:27: can't open file "drivers/net/wireless/ath/carl9170/Kconfig"
make[2]: *** [silentoldconfig] Error 1
make[1]: *** [silentoldconfig] Error 2
make: *** No rule to make target `include/config/auto.conf', needed by `include/config/kernel.release'. Stop.
[email protected]:~/kernel$

himfa71 said:
vinay pls see this , im getting these error,
Code:
[email protected]:~$ cd kernel
[email protected]:~/kernel$ export CROSS_COMPILE=~/toolchain/bin/arm-cortex_a7-linux-gnueabihf-
[email protected]:~/kernel$ make ARCH=arm CROSS_COMPILE=$CROSS_COMPILE Nitrogen_defconfig
drivers/cpufreq/Kconfig:236:warning: multi-line strings not supported
drivers/cpufreq/Kconfig:288:warning: multi-line strings not supported
drivers/net/wireless/ath/Kconfig:27: can't open file "drivers/net/wireless/ath/carl9170/Kconfig"
make[1]: *** [Nitrogen_defconfig] Error 1
make: *** [Nitrogen_defconfig] Error 2
[email protected]:~/kernel$ make ARCH=arm CROSS_COMPILE=$CROSS_COMPILE -j3
scripts/kconfig/conf --silentoldconfig Kconfig
drivers/cpufreq/Kconfig:236:warning: multi-line strings not supported
drivers/cpufreq/Kconfig:288:warning: multi-line strings not supported
drivers/net/wireless/ath/Kconfig:27: can't open file "drivers/net/wireless/ath/carl9170/Kconfig"
make[2]: *** [silentoldconfig] Error 1
make[1]: *** [silentoldconfig] Error 2
make: *** No rule to make target `include/config/auto.conf', needed by `include/config/kernel.release'. Stop.
[email protected]:~/kernel$
Click to expand...
Click to collapse
did you used git clone or downloaded zip.
TRY
Code:
chmod -R 777 ~/kernel
and ~/kernel is path to folder which contains kernel source code.

i downloaded the zip, and after this "chmod -R 777 ~/kernel" command im still getting same error,
thanks vinay for help, but now im leaving this kernel compiling, thanks.

Related

Need help compiling my first kernel

I am now trying to make my own kernel for the HoFo ROM with BFS. I would appreciate a little help, as this is my first at making a kernel. So far I am unsuccessful. Here are the steps that I have taken so far:
1) I've downloaded the source and placed them in ../msm
git clone git://android.git.kernel.org/kernel/msm.git
Click to expand...
Click to collapse
2) I've downloaded the ARM files and placed them in ../msm/arm-2009q1
3) I applied TT's patch:
patch -p1 < kernel-2.6.27-TT-V3.patch
Click to expand...
Click to collapse
4) I used gboddina's config:
http://forum.xda-developers.com/showthread.php?t=550558
5) I set the path:
export PATH=../msm/arm-2009q1/bin:$PATH
Click to expand...
Click to collapse
6) I tried compiling:
make zImage ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi-
Click to expand...
Click to collapse
And I get this error:
HOSTCC scripts/basic/fixdep
HOSTCC scripts/basic/docproc
HOSTCC scripts/kconfig/conf.o
scripts/kconfig/conf.c: In function ‘conf_askvalue’:
scripts/kconfig/conf.c:104: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result
scripts/kconfig/conf.c: In function ‘conf_choice’:
scripts/kconfig/conf.c:306: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result
HOSTCC scripts/kconfig/kxgettext.o
SHIPPED scripts/kconfig/zconf.tab.c
SHIPPED scripts/kconfig/lex.zconf.c
SHIPPED scripts/kconfig/zconf.hash.c
HOSTCC scripts/kconfig/zconf.tab.o
HOSTLD scripts/kconfig/conf
scripts/kconfig/conf -s arch/arm/Kconfig
CHK include/linux/version.h
UPD include/linux/version.h
Generating include/asm-arm/mach-types.h
CHK include/linux/utsrelease.h
UPD include/linux/utsrelease.h
SYMLINK include/asm -> include/asm-arm
CC kernel/bounds.s
arm-none-linux-gnueabi-gcc: error trying to exec 'cc1': execvp: No such file or directory
make[1]: *** [kernel/bounds.s] Error 1
make: *** [prepare0] Error 2
Click to expand...
Click to collapse
Any ideas about what is causing this error? The path is correct...
Seems like a missing file to me. Check paths and try again.
I am sure the path is correct. I also added a line with the path in the Makefile as this post has suggested:
http://forum.xda-developers.com/showthread.php?t=531194
VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 27
EXTRAVERSION =
NAME = Rotary Wombat
CROSS_COMPILE=/home/paul/Desktop/msm/arm-2009q1/bin/arm-none-linux-gnueabi-
Click to expand...
Click to collapse
Try adding the absolute path rather than the relative and see if it helps.
I just entered the absolute path in step 6 and it started compiling. Thanks.
One more question, to switch to the 2.6.29 kernel version, do I just follow these commands:
$ cd kernel
$ git checkout --track -b android-2.6.29 origin/android-2.6.29
Click to expand...
Click to collapse
Hey, i. Am not ignirung you. Iam away from laptop until later today - when i get back i wiltry to help. I may write a how to for basic stuff...
Here is what I do to build the kernel.
I havent had too many errors - I guess I am lucky.
1)Get and build android source: http://source.android.com/download. I didn't specify a branch when I did my repo init:
Code:
repo init -u git://android.git.kernel.org/platform/manifest.git
2)You need to add the location of arm-eabi- to your PATH. arm-eabi- is located in
Code:
<android source dir>/prebuilt/linux-x86/toolchain/arm-eabi-4.3.1
3)Create a script or an alias that will let you run make for the kernel without always specifying options. The command used to make the kernel is:
Code:
make ARCH=arm CROSS_COMPILE=arm-eabi-
I created an alias to makeand.
4. Get the kernel source from cyanogen's github.
Code:
mkdir cyan-kernel
cd cyan-kernel
git clone git://github.com/cyanogen/cm-kernel.git
git branch -r
checkout --track -b cm-donut-4.1 origin/cm-donut-4.1
5. You can create a config or use one from a 32B device. There have been a few posted in my thread. The config is located in /proc/config.gz on the device. config.gz needs to be extracted and renamed to .config. Put the kernel config in the directory of the kernel source
6. You need to patch the kernel from TigerTael. It will edit the memory settings to enable the phone to boot.
http://www.4shared.com/file/128338342/3ef0c7a9/kernel-2627-TT-V3patchtar.html
7. Apply the patch to the kernel source:
Code:
cd <kernel source dir>
patch -p3 < patch_location
The -p3 means that it will ignore the first 3 / in the filenames in the patch file. It is hard to explain but google should help.
8. Make the kernel using the script or aliased command
Code:
makeand
9. The built kernel will be the zImage file in /arch/arm/boot. You can just rename this file repack it into your boot.img.
10. The wlan.ko must be generated to correspond to the kernel.
Code:
cd <cupcake source>/system/wlan/ti/sta_dk_4_0_4_32
make KERNEL_DIR="<kernel source dir>" ARCH=arm
Thank-you very much!
I ran into a few problems with the config. I tried using one of the config's that I found in your thread for 4.1.11.1, but I still had 40 options thrown at me. Many of the options where new to me and I didn't know what to choose.
hotweiss said:
Thank-you very much!
I ran into a few problems with the config. I tried using one of the config's that I found in your thread for 4.1.11.1, but I still had 40 options thrown at me. Many of the options where new to me and I didn't know what to choose.
Click to expand...
Click to collapse
Something is wrong - I idnt get any options when I used those config files. Make sure you are downloading them, removing the .zip, and extracting the .gz file. Then rename the extracted file to .config and put it in the root folder of the source. Hope that helps.
bcrook said:
Something is wrong - I idnt get any options when I used those config files. Make sure you are downloading them, removing the .zip, and extracting the .gz file. Then rename the extracted file to .config and put it in the root folder of the source. Hope that helps.
Click to expand...
Click to collapse
Ok I have successfully built my own kernel! I loaded your kernel on my device and then pulled the config - it compiled with your config. Now the next problem. To get the camera working I have to change the driver from video4linux to i2c; as explained by cyanogen. Any ideas?
hotweiss said:
Ok I have successfully built my own kernel! I loaded your kernel on my device and then pulled the config - it compiled with your config. Now the next problem. To get the camera working I have to change the driver from video4linux to i2c; as explained by cyanogen. Any ideas?
Click to expand...
Click to collapse
Nope...maybe check out the config for an option. I really have idea - i just patch and compile lol.
bcrook said:
Nope...maybe check out the config for an option. I really have idea - i just patch and compile lol.
Click to expand...
Click to collapse
Well I removed all of the video4linux options from the config, as they are the only new changes that I see which could be related - yet the camera still doesn't work. Any ideas?
hotweiss said:
Well I removed all of the video4linux options from the config, as they are the only new changes that I see which could be related - yet the camera still doesn't work. Any ideas?
Click to expand...
Click to collapse
Maybe do defconfig and see if that works...if it does compare the .config files.
bcrook said:
Maybe do defconfig and see if that works...if it does compare the .config files.
Click to expand...
Click to collapse
Well I ran:
make defconfig
Click to expand...
Click to collapse
...which gave me a huge 60 kb config. The problem now is what to look for
I just tried using gboddina's V6 config with cyanogen's 4.1.11.1 kernel source, whereby I filled in all of the extra options by cross-referencing the 4.1.11.1 config. It was going by alright until I got this error:
CHK include/linux/compile.h
UPD include/linux/compile.h
CC init/version.o
LD init/built-in.o
LD vmlinux
arch/arm/mach-msm/built-in.o: In function `msm_init_pmic_vibrator':
htc_headset.c.init.text+0x23d8): undefined reference to `timed_output_dev_register'
make: *** [vmlinux] Error
Click to expand...
Click to collapse
I have success! I used the last good cyanogen config - version 4.1.8, and have successfully compiled version 4.1.11.1. Besides that, I comared the two configs to make sure everything is the same.
I am now having problems compiling the wlan driver:
rm -f ./libestadrv.a
make -C /home/paul/Desktop/hope/cyanogen M=`pwd` ARCH=arm CROSS_COMPILE=arm-eabi- modules
make[1]: arm-eabi-gcc: Command not found
make[1]: Entering directory `/home/paul/Desktop/hope/cyanogen'
CC [M] /home/paul/mydroid/system/wlan/ti/sta_dk_4_0_4_32/./common/src/core/data_ctrl/Tx/MsduList.o
/bin/sh: arm-eabi-gcc: command not found
make[2]: *** [/home/paul/mydroid/system/wlan/ti/sta_dk_4_0_4_32/./common/src/core/data_ctrl/Tx/MsduList.o] Error 127
make[1]: *** [_module_/home/paul/mydroid/system/wlan/ti/sta_dk_4_0_4_32] Error 2
make[1]: Leaving directory `/home/paul/Desktop/hope/cyanogen'
make: *** [libestadrv.a] Error 2
Click to expand...
Click to collapse
For some reason the path is not seen. Any ideas?
hotweiss said:
I am now having problems compiling the wlan driver:
For some reason the path is not seen. Any ideas?
Click to expand...
Click to collapse
Try this:
Code:
make KERNEL_DIR="<kernel source dir>" ARCH=arm
I also needed to make sure I had the up to date android source code.
bcrook said:
Try this:
Code:
make KERNEL_DIR="<kernel source dir>" ARCH=arm
I also needed to make sure I had the up to date android source code.
Click to expand...
Click to collapse
Yes, that's the command I used.
I just downloaded the repo today.
I had the same problem when compiling the kernel. I had to set the path directly. Now there is no way to set a direct path to the arm binaries.

[GUIDE] Building a Kernel - Step by step

As requested by many people I decided to make this guide. Unfortunately I want everyone to know that you HAVE to do this in Linux(Ubuntu 12.04 in this case). You could do this in Cygwin but you have to look for other guides for that as I have never used it and don't know much about it.
Happy building~~!
Requirements
64bit Ubuntu
Python 2.4--2.7
Code:
sudo apt-get install python
Git 1.7 or newer
Code:
sudo apt-get install git-core
Installing Android SDK
Download the SDK here: http://developer.android.com/sdk/index.html
Extract the SDK and place it in your home directory.
I renamed my SDK to android-sdk to make it easier to navigate to.
Go to your home folder, press Ctrl+H to show hidden files, and open up your .bashrc file.
Add these lines at the bottom of the file(Change path according to your SDK dir):
Code:
# Android tools
export PATH=${PATH}:~/android-sdk/tools
export PATH=${PATH}:~/android-sdk/platform-tools
export PATH=${PATH}:~/bin
Find your .profile file and add this at the bottom of the file:
Code:
PATH="$HOME/android-sdk/tools:$HOME/android-sdk/platform-tools:$PATH"
Check for updates by entering this in terminal:
Code:
android
Install required packages(12.04)
Code:
sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl libc6-dev libncurses5-dev:i386 lib32ncurses5-dev 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
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
Toolchain and Source
Open your terminal and type :
Code:
mkdir android
cd android
mkdir kernel
Type this to get your toolchains. I used the linaro toolchain in my kernel using DooMLoRD's great prebuilt toolchains.
Code:
git clone git://github.com/DooMLoRD/android_prebuilt_toolchains.git toolchains
Git clone your kernel repo of choice into android/kernel. I shall use arco's 3.0.x kernel repo as reference.
Code:
git clone git://github.com/arco/samsung-kernel-msm7x30.git -b ics-3.0
Any modifications you wish to do should be done here. Like changing cpu frequency, adding governors, patching the kernel etc... I might add some examples later on. Till then please google how to do this.
Click to expand...
Click to collapse
Building The Kernel
Part A. Pre-build Steps
A. Open terminal and change to the root of your kernel directory
B. Type "export ARCH=arm"
C. Type "export CROSS_COMPILE=~/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-"
Part B. The First Build
A. Type "make ariesve_defconfig"
B. Type "make menuconfig" and make the required changes to use any modules you added or similar changes.
C. Type "make -j<maximum number of jobs>"
Part C. Re-Builds
A. Type "make clean"
B. Type "make oldconfig"
C. Type "make -j<maximum number of jobs>"
Part D. Building Modules
You have two options:
A. Type "make modules"
B. Type "make path/to/your/module.ko"
Explanation of all parts :
Part A.(These steps are required every time you close your terminal and re-open it to build again.)
A. Ok shouldn’t need to explain this.
B. This command sets your target architecture.
C. Defines the path to the toolchain we are going to use to compile our kernel. You can change this to point towards whatever toolchain you have downloaded or feel like using, the way it is currently configured it will use the Linaro toolchain that we downloaded above.
Part B.(These only need to be run the first time you build a kernel.)
A. Load's your configuration file.
B. Open up a menu to configure your kernel. It will use the config file you loaded in the previous step as a base.
C. Viola start the build. I typically allow 1 job per core, so on my quad core machine I put "make -j5". Just raising that number will not make your build faster, your processor needs to be able to support the number of jobs you are assigning it.
Part C. (Use the command's when you are building any-time outside of the first)
A. This command gets rid of any old/outdated binaries or modules you compiled before, and let's start fresh. I like to run it every time I build unless my changes are really small and localized.
B. A very awesome command, it parses through what has changed and only prompts you about new options.
C. See the explanation for the above "Part C.".
Part D.(Use these for just building kernel modules.)
A. This will re-build all modules.
B. Will rebuild just the module you need. Very useful when you need to rebuild a WiFi module.
Making the boot.img
Make sure that you got the .ko files that were listed when your kernel got built. These are the modules like the WiFi module that are needed. If you didn't really take notice of where those files are and just want to do it a bit more easily you can use these commands(thanks to Recognized Dev Hacre)
Code:
A. Open a terminal
B. Change to your root kernel directory
C. Type "mkdir ../<your_kernel>_output"
D. Type "cp arch/arm/boot/zImage ../<your_kernel>_output/zImage"
E. Type "find . -name "*.ko" -exec cp {} ../<your_kernel>_output \;"
Normally we would need to do many stuff with mkbootimg but this utility by koush is much easier for you guys. Later on try to learn the normal way though . http://forum.xda-developers.com/showthread.php?t=748106
After flashing the kernel to your device and it boots properly you can now use "adb push" to push the earlier .ko files to system/lib/modules/. Of course, make sure your device is plugged in and has adb debugging on. For example:
Code:
adb push dhd.ko system/lib/modules/dhd.ko
Another way of doing this would be to add a system/lib/modules folder in your kernels flashable zip which in my opinion is easier.
Click to expand...
Click to collapse
Andddd that is it . Pretty easy really even if it might be a bit time consuming. Kernels aren't really an expertise of mine so I probably won't be able to help much but please ask any questions you might need below with your error in a pastebin link ^_^.
Credits:
arco68 for his source
ivendor also for the source
thewadegeek for his kernel tutorial I based on
DooMLoRD for his toolchain
Everyone who requested this tutorial
This tutorial was based off of thewadegeek's tutorial : http://forum.xda-developers.com/showthread.php?t=1748297
Very awesome!
Sick!
Nice tutorial! Add it to the wiki ^^
broodplank1337 said:
Nice tutorial! Add it to the wiki ^^
Click to expand...
Click to collapse
Added to the useful dev guides ^_^ Also threw my CM10 guide in there. Thanks for reminding me.
Very good
Why this error?
david @ david: ~ $ make ariesve_defconfig
make: *** No rule to make target 'ariesve_defconfig. "Alto.
davidteri91 said:
Why this error?
david @ david: ~ $ make ariesve_defconfig
make: *** No rule to make target 'ariesve_defconfig. "Alto.
Click to expand...
Click to collapse
Make sure you are in the correct dir. You should be in android/kernel/(your kernel dir)/
Sent from my GT-I9001 using xda premium
and this error
david @ david-desktop: ~ / $ make-j2 android/kernel/samsung-kernel-msm7x30
scripts / kconfig / conf - silentoldconfig kconfig
*** Error during update of the configuration.
make [2]: *** [silentoldconfig] Error 1
make [1]: *** [silentoldconfig] Error 2
make: *** No rule to make target 'include / config / auto.conf "necessary to" include / config / kernel.release'. Stop.
davidteri91 said:
and this error
david @ david-desktop: ~ / $ make-j2 android/kernel/samsung-kernel-msm7x30
scripts / kconfig / conf - silentoldconfig kconfig
*** Error during update of the configuration.
make [2]: *** [silentoldconfig] Error 1
make [1]: *** [silentoldconfig] Error 2
make: *** No rule to make target 'include / config / auto.conf "necessary to" include / config / kernel.release'. Stop.
Click to expand...
Click to collapse
you are not in your kernel dir i think
Sent from my GT-I9001 using xda app-developers app
EternalFame said:
you are not in your kernel dir i think
Sent from my GT-I9001 using xda app-developers app
Click to expand...
Click to collapse
root @ david-desktop :/ # export home/david/android/kernel/samsung-kernel-msm7x30 ARCH = arm
root @ david-desktop :/ # export home/david/android/kernel/samsung-kernel-msm7x30 CROSS_COMPILE = ~ / android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-
root @ david-desktop :/ # make ariesve_defconfig home/david/android/kernel/samsung-kernel-msm7x30
#
# Configuration written to. Config
#
root @ david-desktop :/ # make-j3 home/david/android/kernel/samsung-kernel-msm7x30
make: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: program not found
scripts / kconfig / conf - silentoldconfig kconfig
make: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: program not found
CHK include / linux / version.h
/ Home/david/android/kernel/samsung-kernel-msm7x30/scripts/gcc-version.sh: line 25: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi -gcc: No such file or directory
/ Home/david/android/kernel/samsung-kernel-msm7x30/scripts/gcc-version.sh: line 26: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi -gcc: No such file or directory
/ Home/david/android/kernel/samsung-kernel-msm7x30/scripts/gcc-version.sh: line 25: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi -gcc: No such file or directory
/ Home/david/android/kernel/samsung-kernel-msm7x30/scripts/gcc-version.sh: line 26: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi -gcc: No such file or directory
CHK include / generated / utsrelease.h
HOSTCC scripts / kallsyms
CC scripts / mod / empty.o
/ Bin / sh: 1: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: not found
make [2]: *** [scripts / mod / empty.o] Error 127
make [1]: *** [scripts / mod] Error 2
make [1]: *** is expected to finish other tasks ....
make [1]: "include / generated / mach-types.h 'is up to date.
CC kernel / bounds.s
/ Bin / sh: 1: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: not found
make [1]: *** [kernel / bounds.s] Error 127
make: *** [prepare0] Error 2
make: *** is expected to finish other tasks ....
make: *** [scripts] Error 2
did you install the linaro toolchain?
Sent from my GT-I9001 using xda app-developers app
EternalFame said:
did you install the linaro toolchain?
Sent from my GT-I9001 using xda app-developers app
Click to expand...
Click to collapse
yes
davidteri91 said:
yes
Click to expand...
Click to collapse
Did you make sure you set its path correctly? If it still doesn't work, add this to your .bashrc file in your home dir.(after pressing ctrl+h to see hidden files)
Code:
#Android Toolchain PATH
export ARCH=arm
export CCOMPILE=$CROSS_COMPILE
export CROSS_COMPILE=arm-eabi-
export PATH=$PATH:/home/david/android/kernel/toolchains/linux-x86/toolchain/arm-eabi-linaro-4.6.2/bin
Xistance said:
Did you make sure you set its path correctly? If it still doesn't work, add this to your .bashrc file in your home dir.(after pressing ctrl+h to see hidden files)
Code:
#Android Toolchain PATH
export ARCH=arm
export CCOMPILE=$CROSS_COMPILE
export CROSS_COMPILE=arm-eabi-
export PATH=$PATH:/home/david/android/kernel/toolchains/linux-x86/toolchain/arm-eabi-linaro-4.6.2/bin
Click to expand...
Click to collapse
Nothing
root @ david-desktop :/ # export home/david/android/kernel/samsung-kernel-msm7x30 ARCH = arm
root @ david-desktop :/ # export home/david/android/kernel/samsung-kernel-msm7x30 CROSS_COMPILE = ~ / android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-
root @ david-desktop :/ # make ariesve_defconfig home/david/android/kernel/samsung-kernel-msm7x30
HOSTCC scripts / basic / fixdep
HOSTCC scripts / kconfig / conf.o
SHIPPED scripts / kconfig / zconf.tab.c
SHIPPED scripts / kconfig / lex.zconf.c
SHIPPED scripts / kconfig / zconf.hash.c
HOSTCC scripts / kconfig / zconf.tab.o
HOSTLD scripts / kconfig / conf
#
# Configuration written to. Config
#
root @ david-desktop :/ # make-j2 home/david/android/kernel/samsung-kernel-msm7x30
make: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: program not found
scripts / kconfig / conf - silentoldconfig kconfig
make: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: program not found
CHK include / linux / version.h
UPD include / linux / version.h
/ Home/david/android/kernel/samsung-kernel-msm7x30/scripts/gcc-version.sh: line 25: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi -gcc: No such file or directory
/ Home/david/android/kernel/samsung-kernel-msm7x30/scripts/gcc-version.sh: line 26: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi -gcc: No such file or directory
/ Home/david/android/kernel/samsung-kernel-msm7x30/scripts/gcc-version.sh: line 25: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi -gcc: No such file or directory
/ Home/david/android/kernel/samsung-kernel-msm7x30/scripts/gcc-version.sh: line 26: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi -gcc: No such file or directory
CHK include / generated / utsrelease.h
UPD include / generated / utsrelease.h
HOSTCC scripts / genksyms / genksyms.o
SHIPPED scripts / genksyms / lex.c
SHIPPED scripts / genksyms / parse.h
SHIPPED scripts / genksyms / keywords.c
SHIPPED scripts / genksyms / parse.c
HOSTCC scripts / genksyms / lex.o
CC scripts / mod / empty.o
/ Bin / sh: 1: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: not found
make [2]: *** [scripts / mod / empty.o] Error 127
make [1]: *** [scripts / mod] Error 2
make [1]: *** is expected to finish other tasks ....
Generating include / generated / mach-types.h
CC kernel / bounds.s
/ Bin / sh: 1: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: not found
make [1]: *** [kernel / bounds.s] Error 127
make: *** [prepare0] Error 2
make: *** is expected to finish other tasks ....
HOSTCC scripts / genksyms / parse.o
HOSTLD scripts / genksyms / genksyms
make: *** [scripts] Error 2
davidteri91 said:
Nothing
root @ david-desktop :/ # export home/david/android/kernel/samsung-kernel-msm7x30 ARCH = arm
root @ david-desktop :/ # export home/david/android/kernel/samsung-kernel-msm7x30 CROSS_COMPILE = ~ / android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-
root @ david-desktop :/ # make ariesve_defconfig home/david/android/kernel/samsung-kernel-msm7x30
HOSTCC scripts / basic / fixdep
HOSTCC scripts / kconfig / conf.o
SHIPPED scripts / kconfig / zconf.tab.c
SHIPPED scripts / kconfig / lex.zconf.c
SHIPPED scripts / kconfig / zconf.hash.c
HOSTCC scripts / kconfig / zconf.tab.o
HOSTLD scripts / kconfig / conf
#
# Configuration written to. Config
#
root @ david-desktop :/ # make-j2 home/david/android/kernel/samsung-kernel-msm7x30
make: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: program not found
scripts / kconfig / conf - silentoldconfig kconfig
make: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: program not found
CHK include / linux / version.h
UPD include / linux / version.h
/ Home/david/android/kernel/samsung-kernel-msm7x30/scripts/gcc-version.sh: line 25: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi -gcc: No such file or directory
/ Home/david/android/kernel/samsung-kernel-msm7x30/scripts/gcc-version.sh: line 26: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi -gcc: No such file or directory
/ Home/david/android/kernel/samsung-kernel-msm7x30/scripts/gcc-version.sh: line 25: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi -gcc: No such file or directory
/ Home/david/android/kernel/samsung-kernel-msm7x30/scripts/gcc-version.sh: line 26: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi -gcc: No such file or directory
CHK include / generated / utsrelease.h
UPD include / generated / utsrelease.h
HOSTCC scripts / genksyms / genksyms.o
SHIPPED scripts / genksyms / lex.c
SHIPPED scripts / genksyms / parse.h
SHIPPED scripts / genksyms / keywords.c
SHIPPED scripts / genksyms / parse.c
HOSTCC scripts / genksyms / lex.o
CC scripts / mod / empty.o
/ Bin / sh: 1: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: not found
make [2]: *** [scripts / mod / empty.o] Error 127
make [1]: *** [scripts / mod] Error 2
make [1]: *** is expected to finish other tasks ....
Generating include / generated / mach-types.h
CC kernel / bounds.s
/ Bin / sh: 1: / root/android/kernel/toolchains/arm-eabi-linaro-4.6.2/bin/arm-eabi-gcc: not found
make [1]: *** [kernel / bounds.s] Error 127
make: *** [prepare0] Error 2
make: *** is expected to finish other tasks ....
HOSTCC scripts / genksyms / parse.o
HOSTLD scripts / genksyms / genksyms
make: *** [scripts] Error 2
Click to expand...
Click to collapse
Do you mind PM'ing me the steps you took?
when you say...
"Part A. Pre-build Steps
A. Open terminal and change to the root of your kernel directory"
which directory do you mean exactly? the folder we have created named "kernel"?
It cant be that, so...
and the rest of steps are done over that same directory, right?
i get error at step B if i choose the kernel folder (empty)
Code:
make: *** No rule to make target `ariesv_defconfig'. Stop.
jaggyjags said:
when you say...
"Part A. Pre-build Steps
A. Open terminal and change to the root of your kernel directory"
which directory do you mean exactly? the folder we have created named "kernel"?
It cant be that, so...
and the rest of steps are done over that same directory, right?
i get error at step B if i choose the kernel folder (empty)
Code:
make: *** No rule to make target `ariesv_defconfig'. Stop.
Click to expand...
Click to collapse
Yeah, sorry for the confusion. You are supposed to be in the kernel repo folder(the folder with msm7x30 in its name). Since that folder in necessarily the "kernel" itself I just called it that without thinking about the folders name.
Sent from my GT-I9001 using xda premium
what do mean in line C. Type "make -j<maximum number of jobs>, with maximum number of jobs?
jjaacckk94 said:
what do mean in line C. Type "make -j<maximum number of jobs>, with maximum number of jobs?
Click to expand...
Click to collapse
It means 1-2x the threads your CPU can handle. If you don't know how many just do -j(CPU cores + 1)
Sent from my GT-I9001 using xda premium

[Q] conflict between android and linux "chroot' kernel

Hi its me again
I try to install my wireless key "based chipset RTL8187" under backtrack "chroot", but without success, believe in me, I had to go and solve a lot of problems in the "chroot" although I'm almost nil in linux, but now I'm stuck with this problem for several days, following a lot of tutorials here and elsewhere, I show you a few lines of command to develop;
[email protected]:~# modprobe rtl8187
FATAL: Could not load /lib/modules/3.1.10-10.6.1.15.3/modules.dep: No such file or directory
Click to expand...
Click to collapse
trying to install the driver
ifconfig wlan0 down
rmmod r8187 rtl8187 2>/dev/null
wget http://dl.aircrack-ng.org/drivers/rtl8187_linux_26.1010.zip
unzip rtl8187_linux_26.1010.zip
cd rtl8187_linux_26.1010.0622.2006/
wget http://patches.aircrack-ng.org/rtl8187_2.6.27.patch
wget http://patches.aircrack-ng.org/rtl8187_2.6.32.patch
tar xzf drv.tar.gz
tar xzf stack.tar.gz
patch -Np1 -i rtl8187_2.6.27.patch
patch -Np1 -i rtl8187_2.6.32.patch
make
make install
make -C /lib/modules/3.1.10-10.6.1.15.3/build M=/sdcard/BT5/rtl8187L_linux_1041.0209.2012/rtl8187 CC=gcc modules
make[1]: Entering directory `/lib/modules/3.1.10-10.6.1.15.3/build'
make[1]: *** No rule to make target `modules'. Stop.
make[1]: Leaving directory `/lib/modules/3.1.10-10.6.1.15.3/build'
make: *** [modules] Error 2
make -C /lib/modules/3.1.10-10.6.1.15.3/build M=/sdcard/BT5/rtl8187L_linux_1041.0209.2012/rtl8187 CC=gcc modules
make[1]: Entering directory `/lib/modules/3.1.10-10.6.1.15.3/build'
make[1]: *** No rule to make target `modules'. Stop.
make[1]: Leaving directory `/lib/modules/3.1.10-10.6.1.15.3/build'
make: *** [modules] Error 2
Click to expand...
Click to collapse
when I search for Linux realise
[email protected]:~# uname -a
Linux localhost 3.1.10-10.6.1.15.3 #1 SMP PREEMPT Wed May 1 13:26:11 CEST 2013 armv7l GNU/Linux
Click to expand...
Click to collapse
when I search for Linux headers
[email protected]:~# dpkg -l |grep header
ii foremost 1.5.7-bt0 A console program to recover files based on their headers, footers, and internal data structures.
ii libpcap0.8-dev 1.0.0-6 development library and header files for libpcap0.8
ii libssl-dev 0.9.8k-7ubuntu8.6 SSL development libraries, header files and documentation
ii linux-headers-2.6.31-607-imx51 2.6.31-607.13 Linux kernel headers for version 2.6.31 on I.MX51-based systems
ii linux-headers-2.6.32-204 2.6.32-204.16 Header files related to linux-mvl-dove kernel version 2.6.32
ii linux-headers-2.6.32-204-dove 2.6.32-204.16 Linux kernel headers for version 2.6.32 on dove-based systems
ii linux-headers-2.6.33-500 2.6.33-500.6 Header files related to linux-ti-omap kernel version 2.6.33
ii linux-headers-2.6.33-500-omap 2.6.33-500.6 Linux kernel headers for version 2.6.33 on OMAP3-based systems
ii linux-headers-dove 2.6.32.204.7 Generic Linux kernel headers
ii linux-headers-imx51 2.6.31.607.8 Linux kernel headers for imx51 machines
ii linux-headers-omap 2.6.33.500.2 Linux kernel headers -- omap
Click to expand...
Click to collapse
but there is no linux-headers-3.1.10-10.6.1.15.3
Also i installed module-assistant_0.11.6_all.deb and ran this command:
[email protected]:~# su -c 'm-a update && m-a prepare'
Updated infos about 42 packages
Getting source for kernel version: 3.1.10-10.6.1.15.3
apt-get install linux-headers-3.1.10-10.6.1.15.3
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Couldn't find package linux-headers-3.1.10-10.6.1.15.3
apt-get install build-essential
Reading package lists... Done
Building dependency tree
Reading state information... Done
build-essential is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 20 not upgraded.
Click to expand...
Click to collapse
but no luck
I know that 3.1.10-10.6.1.15.3 kernel comes from the android Os, so it doesn't exist in the image of backtrack,
what can I do please !! and is there any way to get it work under Android instead of internal wifi ....thanks
what a deception

[GUIDE] How to compile kernel EASIEST WAY + add features + useful tools

Hi guys!
I wrote this guide because after a few month of kernel development i found useful tools and tricks than helped me a lot and speeded up my work and i want to share with you this knowledge.
Setup computer and download sources​
Code:
Minumum reqirement:
* C knowledge
* Ubuntu 12.04 (13.10 if you want use Kdevelop + linux kernel plugin)
* Internet connection, possibly fast and unlimited
* the boot.img of the ROM you want to support with your kernel (AOSP, SENSE etc etc...)
* [URL="http://forum.xda-developers.com/showthread.php?t=2519416"]zImage switcher[/URL]
Install required package:
Linux 12.04;
Code:
sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2 bin86 libqt3-headers libqt3-mt-dev wget libncurses5 git-core nautilus-open-terminal
linux 13.10:
Code:
sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2 bin86 qt4-dev-tools wget libncurses5 git-core nautilus-open-terminal
and restart your PC.
Download Source:
Go to /home/<username>, create a new folder called "kernel", and enter in that folder.
right click somewhere in "kernel" folder and select "open terminal here" (CooL AH?)
and run
Code:
git clone <kernel-source-code-for-your-device-repository>
for example for HTC One S will be
Code:
git clone https://github.com/CyanogenMod/android_kernel_htc_msm8960.git
Download the toolchain
There are a lot of toolchain, stock, linaro optimized, based on gcc 4.7, based on gcc 4.8 the choice is yours! in this tutorial we use google gcc 4.7 toolchain.
Go to /home/<username>, create a new folder called "toolchains", and enter in that folder.
right click -> open terminal here
Code:
git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7
Build the kernel​
Build the kernel:
in this part we will work in "/home/<username>/kernels/<kernel-folder>" folder, i'll call it <root>
go to "<root>/arch/arm/configs" and copy "<you-device-name>_defconfig" to <root>
rename <you-device-name>_defconfig to ".config"
open a terminal window in <root>
type:
Code:
make ARCH=arm CROSS_COMPILE=/home/<username>/toolchains/arm-eabi-4.7/bin/arm-eabi- > compileLog
and the compilation will start.
Some explanation:
"ARCH=arm" tells to compiler what arch the kernel is made for
"CROSS_COMPILE=xxxxxx" tells to "make" the compiler to use
"> compileLog" saves all the messages in a file called compileLog, it's easier to read than terminal window
Click to expand...
Click to collapse
Pack the kernel to boot.img:
Unpack zImage switcher somewhere, i'll call that folder <ZimgSw>.
copy in the same folder of "repack.sh" file the stock boot.img and yout zImage, you can find it in <root>/arch/arm/boot.
run the script
Code:
./repack.sh
now in <ZimgSw> there's a new file called newBoot.img, that's your kernel!
to find the modules (*.ko files) open a teminal windows to <root> and type
Code:
find ./ -name "*.ko" -exec cp {} <absolute/path/destination/folder> \;
now you have the boot.img and the modules, download a custom kernel and use the flashable zip to make your flashable zip, just replace the modules and the boot.img!
Add features​Add features to kernel:
"Woah! i'd like to add intellimand governor to my kernel"
First you need to find a git repository that contains intellimand governor, than the commit that added the governor.
for example https://github.com/rmbq/android_kernel_htc_msm8960/commit/6c87d0e0b3c82ffff8c0704dfde7369872f5602f
Open a terminal window in <root>
type:
Code:
git remote add rmbq https://github.com/rmbq/android_kernel_htc_msm8960.git -b cm-10.2
git fetch rmbq
git cherry-pick 6c87d0e0b3c82ffff8c0704dfde7369872f5602f
Explanations:
Code:
git remote add rmbq https://github.com/rmbq/android_kernel_htc_msm8960.git -b cm-10.2
add a link to https://github.com/rmbq/android_kernel_htc_msm8960.git branch cm-10.2 and called it "rmbq"
Code:
git fetch rmbq
download all the commit history to your PC without modify your sources
Code:
git cherry-pick 6c87d0e0b3c82ffff8c0704dfde7369872f5602f
apply the commit 6c87d0e0b3c82ffff8c0704dfde7369872f5602f to your source
Click to expand...
Click to collapse
in termial window type:
Code:
make ARCH=arm xconfig
will open a new window where you can configure your kernel's features
press ctrl+f (find) and serach for "intellimand" and tick the checkbox. save clicking the floppy disk in upper left corner.
the modified configuration file will be saved in ".config"
now we can build the kernel again, but first type
Code:
make ARCH=arm clean CROSS_COMPILE=/home/<username>/toolchains/prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.8/bin/arm-linux-androideabi-
this will remove all the compiled files of previous build.
View git commits history​you can easly view all the commits in your repo:
open a terminal window in <root> and type
Code:
gitk
will open a GUI where you can see all the commits, what files were modified for each commit, the author of the commit.
you can also revert commits.
There are other GUI for git, i also like "gitg"
Hacking the kernel
suggested by @pirlano​for easy work on kernel sources, add features & co. you can use kdevelop + linux kernel plugin, here is a guide
http://www.gnurou.org/code/kdevelop-kernel
and a video guide:
http://video.linux.com/videos/kernel-browsing-and-hacking-using-kdevelop
NOTE: for linux kernel plugin ubuntu 13.10 is required
if something is not working or it's not clear or you have useful tips just tell me and i'll update the guide
Nice! I usually use kdevelop + linux kernel plugin, so i have a fast IDE and i can save compilation config, fix warning and errors on the fly, and use git from a gui, it's a good solution for me
pirlano said:
Nice! I usually use kdevelop + linux kernel plugin, so i have a fast IDE and i can save compilation config, fix warning and errors on the fly, and use git from a gui, it's a good solution for me
Click to expand...
Click to collapse
cool! if you want/have time write a small tutorial for your method and i'll add to OP
EDIT: meanwhile i added this guide http://www.gnurou.org/code/kdevelop-kernel
rmbq said:
cool! if you want/have time write a small tutorial for your method and i'll add to OP
EDIT: meanwhile i added this guide http://www.gnurou.org/code/kdevelop-kernel
Click to expand...
Click to collapse
And video guide from a nVidia tegra developer
http://video.linux.com/videos/kernel-browsing-and-hacking-using-kdevelop
Hi rmbq,
many thanks for your tutorial! I really appreciate it as I already made some first steps with compiling Roms. Now I'll try to make a kernel
Sent from my One S using XDA Premium 4 mobile app
UPDATE:
added git GUI section
Thanks for this tutorial. Maybe I will finally sit down to making my own kernel someday. If I can do it for linux why can't I for android.
@rmbq
I get an error when i run the command
sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2 bin86 libqt3-headers libqt3-mt-dev wget libncurses5 git-core nautilus-open-terminal
Click to expand...
Click to collapse
Error
$ sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2 bin86 libqt3-headers libqt3-mt-dev wget libncurses5 git-core nautilus-open-terminal
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package libqt3-headers
E: Unable to locate package libqt3-mt-dev
Click to expand...
Click to collapse
This is my first time trying to build a kernel, How do i fix it?
Edit:
Im running Ubuntu 13.10
phanitej said:
@rmbq
I get an error when i run the command
Error
This is my first time trying to build a kernel, How do i fix it?
Edit:
Im running Ubuntu 13.10
Click to expand...
Click to collapse
Hi!
instead
Code:
sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2 bin86 libqt3-headers libqt3-mt-dev wget libncurses5 git-core nautilus-open-terminal
can you try to run
Code:
sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2 bin86 qt4-dev-tools wget libncurses5 git-core nautilus-open-terminal
and see if "make xconfig" (qt is required only for this command) is working? i haven't got ubuntu 13.10 so i can't test
rmbq said:
Hi!
instead
Code:
sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2 bin86 libqt3-headers libqt3-mt-dev wget libncurses5 git-core nautilus-open-terminal
can you try to run
Code:
sudo apt-get install -y build-essential kernel-package libncurses5-dev bzip2 bin86 qt4-dev-tools wget libncurses5 git-core nautilus-open-terminal
and see if "make xconfig" (qt is required only for this command) is working? i haven't got ubuntu 13.10 so i can't test
Click to expand...
Click to collapse
Tried the command. Did not get any errors. But after downloading source i dont see the kernel folder insde the kernel. What am i doing wrong?
Im trying to build a hammerhead kernel so used the below link
git clone https://android.googlesource.com/kernel/msm.git
Click to expand...
Click to collapse
phanitej said:
Tried the command. Did not get any errors. But after downloading source i dont see the kernel folder insde the kernel. What am i doing wrong?
Im trying to build a hammerhead kernel so used the below link
Click to expand...
Click to collapse
because "master" branch (the default branch) is empty.
open a terminal in <root> and type
Code:
git checkout android-msm-hammerhead-3.4-kk-r1
and you will switch from master branch to android-msm-hammerhead-3.4-kk-r1 branch, i think it's the more updated branch for hammerhead. now you should see all the folders and files of your kernel
rmbq said:
because "master" branch (the default branch) is empty.
open a terminal in <root> and type
Code:
git checkout android-msm-hammerhead-3.4-kk-r1
and you will switch from master branch to android-msm-hammerhead-3.4-kk-r1 branch, i think it's the more updated branch for hammerhead. now you should see all the folders and files of your kernel
Click to expand...
Click to collapse
First of all, a big thanks to your patience for helping me out.
The above command did show up files. I then went to root and tried to use make
make ARCH=arm CROSS_COMPILE=/home/phanitej/toolchain/prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.8/bin/arm-linux-androideabi- > compileLog
Click to expand...
Click to collapse
It gives an error. I made sure the path is correct.
make[2]: *** [silentoldconfig] Error 1
make[1]: *** [silentoldconfig] Error 2
make: *** No rule to make target `include/config/auto.conf', needed by `include/config/kernel.release'. Stop.
phanitej said:
First of all, a big thanks to your patience for helping me out.
The above command did show up files. I then went to root and tried to use make
It gives an error. I made sure the path is correct.
make[2]: *** [silentoldconfig] Error 1
make[1]: *** [silentoldconfig] Error 2
make: *** No rule to make target `include/config/auto.conf', needed by `include/config/kernel.release'. Stop.
Click to expand...
Click to collapse
did you do these steps?
go to "<root>/arch/arm/configs" and copy "<you-device-name>_defconfig" to <root>
rename <you-device-name>_defconfig to ".config"
if yes try to (in <root>):
Code:
make ARCH=arm xconfig
save clickn' the floppy
Code:
make ARCH=arm CROSS_COMPILE=/home/<username>/toolchains/prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.8/bin/arm-linux-androideabi- > compileLog
P.S. to post code / script / terminal commands use CODE tag instead QUOTE
rmbq said:
did you do these steps?
go to "<root>/arch/arm/configs" and copy "<you-device-name>_defconfig" to <root>
rename <you-device-name>_defconfig to ".config"
if yes try to (in <root>):
Code:
make ARCH=arm xconfig
save clickn' the floppy
Code:
make ARCH=arm CROSS_COMPILE=/home/<username>/toolchains/prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.8/bin/arm-linux-androideabi- > compileLog
P.S. to post code / script / terminal commands use CODE tag instead QUOTE
Click to expand...
Click to collapse
Thanks for the tip Will use code tag from now on for codes.
After running
Code:
make ARCH=arm xconfig
I got the kernel config window. Saved it without modifying anything. THen ran the other command. Gives error. Checked the log and found few errors.
phanitej said:
Thanks for the tip Will use code tag from now on for codes.
After running
Code:
make ARCH=arm xconfig
I got the kernel config window. Saved it without modifying anything. THen ran the other command. Gives error. Checked the log and found few errors.
Click to expand...
Click to collapse
probably your new .config has got wrong configuration, try to delete .config in <root> (if you don't see it press ctrl+h)
and do again
go to "<root>/arch/arm/configs" and copy "<you-device-name>_defconfig" to <root>
rename <you-device-name>_defconfig to ".config"
this time run the make command without make xconfig
rmbq said:
probably your new .config has got wrong configuration, try to delete .config in <root> (if you don't see it press ctrl+h)
and do again
go to "<root>/arch/arm/configs" and copy "<you-device-name>_defconfig" to <root>
rename <you-device-name>_defconfig to ".config"
this time run the make command without make xconfig
Click to expand...
Click to collapse
Still got error
make[1]: *** [init/main.o] Error 1
make: *** [init] Error 2
Just to make sure im doing it right.
I copied hammerhead_defconfig to <root> and renamed it to .config
Then ran the make command without make xconfig i.e
Code:
make ARCH=arm CROSS_COMPILE=/home/phanitej/toolchain/prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.8/bin/arm-linux-androideabi- > compileLog
phanitej said:
Still got error
make[1]: *** [init/main.o] Error 1
make: *** [init] Error 2
Just to make sure im doing it right.
I copied hammerhead_defconfig to <root> and renamed it to .config
Then ran the make command without make xconfig i.e
Code:
make ARCH=arm CROSS_COMPILE=/home/phanitej/toolchain/prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.8/bin/arm-linux-androideabi- > compileLog
Click to expand...
Click to collapse
can you try to:
open <root>/Makefile
go to line 375 (it's "-fno-delete-null-pointer-checks") and replace this line with "-fno-delete-null-pointer-checks -march=armv7-a"
save and try to compile again
rmbq said:
can you try to:
open <root>/Makefile
go to line 375 (it's "-fno-delete-null-pointer-checks") and replace this line with "-fno-delete-null-pointer-checks -march=armv7-a"
save and try to compile again
Click to expand...
Click to collapse
Edited that, still no go
What am i doing wrong?
phanitej said:
Edited that, still no go
What am i doing wrong?
Click to expand...
Click to collapse
and if you change toolchain?
try to download this http://releases.linaro.org/13.11/co...ndroid-toolchain-eabi-4.8-2013.11-x86.tar.bz2
unpack it in toolchain folder and run make with new CROSS_COMPILE path
CROSS_COMPILE=/home/phanitej/toolchain/new folder/bin/new files name
to know the "new files name" go to
/home/phanitej/toolchain/prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.8/bin
you can see all files are starting with "arm-linux-androideabi-" that's why the command is
Code:
CROSS_COMPILE=/home/phanitej/toolchain/prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.8/bin/[COLOR="Red"]arm-linux-androideabi-[/COLOR]
make the same thing with the new toolchain
EDIT: shuold be
Code:
CROSS_COMPILE=/home/phanitej/toolchain/[COLOR="Red"]android-toolchain-eabi[/COLOR]/bin/[COLOR="Red"]arm-eabi-[/COLOR]
EDIT2: if still not working try to modify line 357 of <root>/Makefile from
CFLAGS_KERNEL =
to
CFLAGS_KERNEL = -mtune=cortex-a15 -mfpu=neon-vfpv4

How to specify a custom defconfig file in Android 10 Kernel compilation

I wanted to enable certain kernel features and in my Android 10 build for Pixel 3. I downloaded and built the correct msm kernel and successfully flashed it on the Pixel. To build the kernel I'm using the build/build.sh from the kernel source. I tried adding a custom defconfig file in private/msm-google/arch/arm64/configs/ and changing the DEFCONFIG variable in build.config to that file. When I compile I get following error:
Code:
++ echo ERROR: savedefconfig does not match private/msm-google/arch/arm64/configs/sdm845_defconfig
ERROR: savedefconfig does not match private/msm-google/arch/arm64/configs/sdm845_defconfig
How can I compile the kernel with a custom defconfig? It doesn't have to be through the build.sh method (although it would be preferable)
gardeimasei said:
I wanted to enable certain kernel features and in my Android 10 build for Pixel 3. I downloaded and built the correct msm kernel and successfully flashed it on the Pixel. To build the kernel I'm using the build/build.sh from the kernel source. I tried adding a custom defconfig file in private/msm-google/arch/arm64/configs/ and changing the DEFCONFIG variable in build.config to that file. When I compile I get following error:
Code:
++ echo ERROR: savedefconfig does not match private/msm-google/arch/arm64/configs/sdm845_defconfig
ERROR: savedefconfig does not match private/msm-google/arch/arm64/configs/sdm845_defconfig
How can I compile the kernel with a custom defconfig? It doesn't have to be through the build.sh method (although it would be preferable)
Click to expand...
Click to collapse
I don't know if it's solved, but I solved the problem removing the "check defconfig" in build.config (the symlink in the root which points to the kernel build.config).
Change
Code:
POST_DEFCONFIG_CMDS="check_defconfig"
to
Code:
POST_DEFCONFIG_CMDS=""
I've been working with a Google engineer who showed me the fix for my savedefconfig problem. Maybe it will fix yours, too.
The key is to set ARCH:
Code:
$ export ARCH=arm64
Here's the context and full procedure. My work is based on the b1c1_defconfig config. Your directory names may vary.
Code:
$ cd private/msm-google
$ export ARCH=arm64 # this is the magic line
$ make b1c1_defconfig # This sets up the config for my hardware. Yours is probably different.
$ make menuconfig
Now edit the kernel configuration and save it as ".config", the default.
When you're done:
Code:
$ make savedefconfig
$ cp defconfig arch/arm64/configs/b1c1_defconfig # or whatever your hardware configuration is
$ make mrproper
With luck, you won't see any savedefconfig problems.

Categories

Resources