Custom Kernel developement for Android Emulator

3,024 views
Skip to first unread message

Peerke

unread,
Jan 31, 2011, 7:01:45 AM1/31/11
to Android Linux Kernel Development
Hi,

I like to build my own custom kernel to use with the Android Emulator.
I know how to build my own Android Emulator image and how to set the
kernel that you want use when booting the emulator. But I have no idea
how to build a custom kernel for the emulator and what should be in
there to keep the emulator working.

Does anyone has some starting point for me or some documentation?

raja pavan

unread,
Jan 31, 2011, 7:24:30 AM1/31/11
to android...@googlegroups.com
- Download the goldfish kernel from android git.
- Install android sdk on your machine
- /home/raja/Downloads/android-sdk-linux_86/platforms will have a folder each for avd api versions
- Create avd for api of your choice
- Build goldfish kernel for you ur choice of kernel configuration and place in folder corresponding to avd's api
- /home/raja/Downloads/android-sdk-linux_86/platforms/android-9/images will have kernel-qemu, replace with your kernel. 



Peerke

unread,
Jan 31, 2011, 8:20:43 AM1/31/11
to Android Linux Kernel Development
Thanks for your fast response!

I have 2 questions:

* How do I download the goldfish kernel from the android git? I
downloaded a kernel with 'git clone git://android.git.kernel.org/kernel/common.git',
but this doesn't give me a goldfish_defconfig. So I guess I need to
download something else.

* How to build a goldfish kernel? That works in the same way as any
other linux kernel? (Starting from the goldfish_defconfig?)
> > unsubscribe: android-kerne...@googlegroups.com<android-kernel%2Bunsubscribe@go oglegroups.com>
> > website:http://groups.google.com/group/android-kernel

raja pavan

unread,
Jan 31, 2011, 8:29:17 AM1/31/11
to android...@googlegroups.com
 
Open this link and click on snapshot, this will download the latest version of 2.6.29 goldfish kernel.
(2) make menuconfig and select gold fish as your target [I did not check these step, but I am almost sure these are the steps]
 
You can chose the desired config for your kernel-qemu at this step.
 
If you need to build for ARM , make ARCH=arm CROSS_COMPILE=/usr/local/arm/arm-gcc/bin/gnu-arm-  Image(please use sppropriate name to your gcc cross compiler)
 
(3) Rename Image (arch/arm/boot) to kernel-qemu
 
(4) Use it with emulator [steps from Previous Mail]
 
(5) You can create a sophisticated qemu using goldfish, I rely on this even for learning arm assembly.

 

Peerke

unread,
Jan 31, 2011, 8:32:16 AM1/31/11
to Android Linux Kernel Development
Somehow the link that you provided doesn't work. I get a '404 - No
such project ' message.


On Jan 31, 2:29 pm, raja pavan <rajain...@gmail.com> wrote:
> (1)http://android.git.kernel.org/?p=kernel/common.git;a=tree;h=b0d93fb04...
>
> Open this link and click on snapshot, this will download the *latest version
> of 2.6.29 goldfish kernel*.

raja pavan

unread,
Jan 31, 2011, 8:46:13 AM1/31/11
to android...@googlegroups.com
that may not be the exact link but keywords are
(2.6.29, goldfish)
snapshot
 
I was able to download and start the build. need to test the same on emulator.

raja pavan

unread,
Jan 31, 2011, 9:33:18 AM1/31/11
to android...@googlegroups.com
You can even pull the .config of the kernel running in the emulator

adb pull /proc/config.gz

Then make whatever changes you would like to the kernel configuration and use this kernel on emulator.

This makes sense ?

Raja

Peter Fortuin

unread,
Jan 31, 2011, 11:15:47 AM1/31/11
to android...@googlegroups.com
I have a running kernel now.
Thanks for the help!


2011/1/31 raja pavan <raja...@gmail.com>

raja pavan

unread,
Jan 31, 2011, 12:26:19 PM1/31/11
to android...@googlegroups.com
Most Welcome 

Is it possible to share the reason why you have built a new kernel for emulator?

If possible share the .config 

Thanks
Raja 

Aldrin Montana

unread,
Feb 13, 2011, 3:36:17 PM2/13/11
to android...@googlegroups.com
Hi,

Just to expand on this thread, I managed to successfully boot 2.6.29 goldfish on an emulator, but I'm curious how to compile a kernel for an actual device? particularly an HTC G1. Is it suggested that I continue to use the 2.6.29 kernel, or should I use a newer version?

I tried compiling 2.6.35 previously and none of my config files seemed to be correct as I kept getting compile errors or the emulator would not boot the compiled kernel (this is using the msm_config or a goldfish_defconfig pulled from the running emulator running platform 2.3 and api level 9 via adb get).

raja pavan

unread,
Feb 15, 2011, 6:14:02 AM2/15/11
to android...@googlegroups.com
Try with these steps
 
(1) Take the kernel running on your phone.
(2) Download the vanila kernel with the same version as above.
(3) Do a winmerge/meld (or any other diff-merge tool).
These differences (go deep into the source tree mainly in the arch/arm folder if your phone is based on ARM or into the specific processor specific arch code) are chip driver of your phone (hardware specific code), the differences will be distributed in 10-15 places.
(4) Take diff of the 1&2 , this will be the chip driver.
(5) Logically attach this diff to the kernel of your choice.
(6) Build the kernel.
(7) Logically fix each and every build error encountered while building the kernel.
 
Do not hesitate to move/replace some header files from phone kernel (mainly from arch/arm folder) to new kernel, as it is, in this process.
 
This is the correct and proven approach

Wishes
Raja Pavan

Aldrin Montana

unread,
Feb 16, 2011, 1:53:18 AM2/16/11
to android...@googlegroups.com
thank you raja

Earlence

unread,
Feb 17, 2011, 9:57:02 AM2/17/11
to Android Linux Kernel Development
you dont need to do all those steps.
Android modified kernels are available and can be built out of the
box.
http://android.git.kernel.org/?p=kernel/linux-2.6.git;a=tree

clone whichever branch you need (msm etc)

Cheers,
Earlence

On Feb 16, 7:53 am, Aldrin Montana <drinmont...@gmail.com> wrote:
> thank you raja
>
> On Tue, Feb 15, 2011 at 3:14 AM, raja pavan <rajain...@gmail.com> wrote:
> > *Try with these steps *
>
> > (1) Take the kernel running on your phone.
> > (2) Download the vanila kernel with the same version as above.
> > (3) Do a winmerge/meld (or any other diff-merge tool).
> > These differences (go deep into the source tree mainly in the arch/arm
> > folder if your phone is based on ARM or into the specific processor specific
> > arch code) are *chip driver* of your phone (hardware specific code), the
> > differences will be distributed in 10-15 places.
> > (4) Take *diff *of the 1&2 , this will be the chip driver.
> > (5) Logically attach this* diff* to the kernel of your choice.
> > (6) Build the kernel.
> > (7) Logically fix *each and every build error* encountered while building
> > the kernel.
>
> > Do not hesitate to move/replace some header files from phone kernel
> > (mainly from arch/arm folder) to new kernel, as it is, in this process.
>
> > This is the correct and proven approach
>
> > Wishes
> > Raja Pavan
> > On Mon, Feb 14, 2011 at 2:06 AM, Aldrin Montana <drinmont...@gmail.com>wrote:
>
> >> Hi,
>
> >> Just to expand on this thread, I managed to successfully boot 2.6.29
> >> goldfish on an emulator, but I'm curious how to compile a kernel for an
> >> actual device? particularly an HTC G1. Is it suggested that I continue to
> >> use the 2.6.29 kernel, or should I use a newer version?
>
> >> I tried compiling 2.6.35 previously and none of my config files seemed to
> >> be correct as I kept getting compile errors or the emulator would not boot
> >> the compiled kernel (this is using the msm_config or a goldfish_defconfig
> >> pulled from the running emulator running platform 2.3 and api level 9 via
> >> adb get).
>
> >>   On Mon, Jan 31, 2011 at 9:26 AM, raja pavan <rajain...@gmail.com>wrote:
>
> >>>   Most Welcome
>
> >>> Is it possible to share the reason why you have built a new kernel for
> >>> emulator?
>
> >>> If possible share the .config
>
> >>> Thanks
> >>> Raja
>
> >>> On Mon, Jan 31, 2011 at 9:45 PM, Peter Fortuin <peter.fort...@gmail.com>wrote:
>
> >>>> I have a running kernel now.
> >>>> Thanks for the help!
>
> >>>> 2011/1/31 raja pavan <rajain...@gmail.com>
>
> >>>>>  You can even pull the .config of the kernel running in the emulator
>
> >>>>> adb pull /proc/config.gz
>
> >>>>> Then make whatever changes you would like to the kernel configuration
> >>>>> and use this kernel on emulator.
>
> >>>>> This makes sense ?
>
> >>>>> Raja
>
> >>>>> On Mon, Jan 31, 2011 at 7:16 PM, raja pavan <rajain...@gmail.com>wrote:
>
> >>>>>> that may not be the exact link but keywords are
> >>>>>>  http://android.git.kernel.org/
> >>>>>> projects <http://android.git.kernel.org/> / kernel/common.git<http://android.git.kernel.org/?p=kernel/common.git;a=summary>
> >>>>>> (2.6.29, goldfish)
> >>>>>> snapshot
>
> >>>>>> I was able to download and start the build. need to test the same on
> >>>>>> emulator.
>
> >>>>>>> > > > > unsubscribe: android-kerne...@googlegroups.com<android-kernel%2Bunsu...@googlegroups.com>
> >>>>>>> <android-kernel%2Bunsubscribe@go oglegroups.com>
> >>>>>>> > > <android-kernel%2Bunsubscribe@go oglegroups.com>
> >>>>>>> > > > > website:http://groups.google.com/group/android-kernel
>
> >>>>>>> > > --
> >>>>>>> > >  unsubscribe: android-kerne...@googlegroups.com<android-kernel%2Bunsu...@googlegroups.com>
> >>>>>>> <android-kernel%2Bunsubscribe@go oglegroups.com>
> >>>>>>> > > website:http://groups.google.com/group/android-kernel
>
> >>>>>>> --
> >>>>>>> unsubscribe: android-kerne...@googlegroups.com<android-kernel%2Bunsu...@googlegroups.com>
> >>>>>>> website:http://groups.google.com/group/android-kernel
>
> >>>>> --
> >>>>> unsubscribe: android-kerne...@googlegroups.com<android-kernel%2Bunsu...@googlegroups.com>
> >>>>> website:http://groups.google.com/group/android-kernel
>
> >>>> --
> >>>>  unsubscribe: android-kerne...@googlegroups.com<android-kernel%2Bunsu...@googlegroups.com>
> >>>> website:http://groups.google.com/group/android-kernel
>
> >>> --
> >>>   unsubscribe: android-kerne...@googlegroups.com<android-kernel%2Bunsu...@googlegroups.com>
> >>> website:http://groups.google.com/group/android-kernel
>
> >>   --
> >> unsubscribe: android-kerne...@googlegroups.com<android-kernel%2Bunsu...@googlegroups.com>
> >> website:http://groups.google.com/group/android-kernel
>
> >  --
> > unsubscribe: android-kerne...@googlegroups.com<android-kernel%2Bunsu...@googlegroups.com>
> > website:http://groups.google.com/group/android-kernel

Aldrin Montana

unread,
Feb 17, 2011, 4:34:12 PM2/17/11
to android...@googlegroups.com
Thanks Earlence, always helping me out ^__^

Reply all
Reply to author
Forward
0 new messages