Howto BUILD the LINUX KERNEL for the Android EMULATOR (Eclair version)

DOWNLOAD THE KERNEL SOURCE CODEFirst we download the kernel source code from http://android.git.kernel.orgWithin that page there are kernels for other platforms too. We choose to download kernel/common project from there.$git clone git://android.git.kernel.org/kernel/commonWe check which branch we have downloaded:$git branchit shows * android-2.6.27, not the one we are searching for:To list all remote available branches:$git branch -r origin/HEAD -> origin/android-2.6.27 origin/android-2.6.25 origin/android-2.6.27 origin/android-2.6.29 origin/android-2.6.32 origin/android-goldfish-2.6.27 origin/android-goldfish-2.6.29What does goldfish mean? (from android-kernel mail list)Goldfish is the kernel hacked branch that supports the qemu based arm emulator for android, so it is the one we need.Download GOLDFISH kernel version$git checkout --track -b android-goldfish-2.6.29 origin/android-goldfish-2.6.29$git branch android-2.6.27 * android-goldfish-2.6.29RUNNING THE EMULATORWithin this link we will find how to get the android emulator, and launch it.Building Android in Debian SidShowing the kernel version running in the emulator$adb shell#cat /proc/versionLinux version 2.6.29-00261-g0097074 (digit@digit.mtv.corp.google.com) (gcc version 4.4.0 (GCC) ) #14 Tue Feb 2 15:49:02 PST 2010OBTAINING KERNEL CONFIGURATIONWe are going to obtain the kernel configuration .config file from within our running emulator.$cd common # we enter in the kernel source directory.$adb pull /proc/config.gz . # get compressed .config file from the emulator.$gunzip config.gz # uncompress it.$cp config .config # rename it into .configNow you can edit .config file the way it suits you the most.BUILDING AND COMPILING THE KERNELCROSS_COMPILE environment variable stores the path to the arm cross compiling toolchain. I use the one which comes with android source code.$ARCH=arm CROSS_COMPILE=/path/to/mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi- makeExecuting make will build the kernel.Last lines will show: Kernel: arch/arm/boot/Image is ready Kernel: arch/arm/boot/zImage is readySo we have obtained Image and zImage kernel binary files.RUN THE EMULATOR USING THE NEW COMPILED KERNEL IMAGEWe need -kernel option:$emulator -kernel /path/to/common/arch/arm/boot/zImage -show-kernel -verboseWe can check now the kernel version:$adb shell# cat /proc/versionLinux version 2.6.29-00262-gb0d93fb (user@myPC) (gcc version 4.4.0 (GCC) ) #1 Sun May 2 14:27:31 CEST 2010If we do not specify kernel option it usually uses the prebuilt one:$emulator -show-kernel -verboseemulator: argv[01] = "-kernel"emulator: argv[02] = "/path/to/mydroid/prebuilt/android-arm/kernel/kernel-qemu"ACTIVATING MODULE LOADING SUPPORT IN THE KERNELModule loading support is previously disabled in the kernel, if we want to load modules in the kernel we have to enable it:edit .config file and set:CONFIG_MODULES=y$ ARCH=arm CROSS_COMPILE=/path/to/mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0/bin/arm-eabi- makeI am asked about some options when executing make. I ask yes for module related options.After compiling I see several modules have been built.MODPOST 6 modules CC drivers/video/fb_sys_fops.mod.o LD [M] drivers/video/fb_sys_fops.ko CC drivers/video/syscopyarea.mod.o LD [M] drivers/video/syscopyarea.ko CC drivers/video/sysfillrect.mod.o LD [M] drivers/video/sysfillrect.ko CC drivers/video/sysimgblt.mod.o LD [M] drivers/video/sysimgblt.ko CC drivers/video/vfb.mod.o LD [M] drivers/video/vfb.koWe can upload the modules in the emulator and install them:$adb push drivers/video/fb_sys_fops.ko /data$adb shell#insmod /data/fb_sys_fops.ko

更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. 几行代码看程序员的水平——Android文件
  2. Ubuntu下进行Android开发的相关配置
  3. 更换linux/android的启动logo
  4. android 数据库 SQLiteOpenHelper和Conte
  5. Android透明界面与ListView动态刷新
  6. Android调试工具之ADB
  7. android ContentResolver详解
  8. 对TabHost、TabWidget的理解分析
  9. Android四大布局之表格布局行列位置控制
  10. android 5大数据存储