码迷,mamicode.com
首页 > 移动开发 > 详细

Android Linux内核编译

时间:2015-01-12 14:43:27      阅读:259      评论:0      收藏:0      [点我收藏+]

标签:android   android开发   

平台:

Wind7_64 + Ubuntu12_04_64 + VMware

这里以Android5.0为例:

Android5.0 可以到这里下载:
115网盘礼包码:5lbd7crtk1wz
http://115.com/lb/5lbd7crtk1wz

Linux_source_goldfish 可以到这里下载:
115网盘礼包码:5lbd76rru5or
http://115.com/lb/5lbd76rru5or

Android5.0的编译可以参考:

遇到的问题

http://www.cnblogs.com/pengdonglin137/p/4197969.html

需要使用openjdk7

apt-get install openjdk-7-jdk
apt-get install openjdk-7-jre

编译:

技术分享
root@ubuntu:~/work/android/android5/android-5.0# . build/envsetup.sh 
including device/moto/shamu/vendorsetup.sh
including device/samsung/manta/vendorsetup.sh
including device/generic/mini-emulator-x86/vendorsetup.sh
including device/generic/mini-emulator-arm64/vendorsetup.sh
including device/generic/mini-emulator-mips/vendorsetup.sh
including device/generic/mini-emulator-x86_64/vendorsetup.sh
including device/generic/mini-emulator-armv7-a-neon/vendorsetup.sh
including device/lge/mako/vendorsetup.sh
including device/lge/hammerhead/vendorsetup.sh
including device/asus/tilapia/vendorsetup.sh
including device/asus/deb/vendorsetup.sh
including device/asus/grouper/vendorsetup.sh
including device/asus/flo/vendorsetup.sh
including device/asus/fugu/vendorsetup.sh
including sdk/bash_completion/adb.bash
root@ubuntu:~/work/android/android5/android-5.0# choosecombo 
Build type choices are:
     1. release
     2. debug

Which would you like? [1] 1


Which product would you like? [full] 


Variant choices are:
     1. user
     2. userdebug
     3. eng
Which would you like? [eng] 

============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=5.0
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
TARGET_CPU_VARIANT=generic
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86_64
HOST_OS=linux
HOST_OS_EXTRA=Linux-3.5.0-23-generic-x86_64-with-Ubuntu-12.04-precise
HOST_BUILD_TYPE=release
BUILD_ID=LRX21M
OUT_DIR=out
============================================

root@ubuntu:~/work/android/android5/android-5.0# make 
技术分享

编译完成后,设置工具链路径,为编译内核方便:

export PATH=$PATH:/root/work/android/android-5.0/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin

编译内核:

下载内核后,解压

技术分享
root@ubuntu:~/work/android/android5/goldfish# git branch -a
  master
  remotes/origin/HEAD -> origin/master
  remotes/origin/android-3.10
  remotes/origin/android-3.4
  remotes/origin/android-goldfish-2.6.29
  remotes/origin/android-goldfish-3.10
  remotes/origin/android-goldfish-3.4
  remotes/origin/linux-goldfish-3.0-wip
  remotes/origin/master
技术分享

由于Android5.0的模拟器使用的内核是3.4(可以用模拟器自带的内核启动一个模拟器,然后看一下内核版本 cat /proc/version ), 所以我们也是用3.4:

root@ubuntu:~/work/android/android5/goldfish# git checkout remotes/origin/android-goldfish-3.4 -b linux-3.4


然后修改Makefile

ARCH        ?= arm
CROSS_COMPILE    ?= arm-eabi-

配置内核

root@ubuntu:~/work/android/android5/goldfish# make goldfish_armv7_defconfig

注意:这个默认的内核并没有配置模块加载功能,需要执行make menuconfig设置,否则无法编译和加载内核模块

编译内核

make zImage -j2

用我们编出的内核启动模拟器:

root@ubuntu:~/work/android/android5/android-5.0# emulator64-arm -kernel ../goldfish/arch/arm/boot/zImage

其他精彩文章文章

android学习笔记(41)android选项菜单和子菜单(SubMenu )

android学习笔记(40)Notification的功能与用法

android学习笔记(42)android使用监听器来监听菜单事件

android学习笔记(43)android创建单选菜单和复选菜单

 jQuery教程(12)-ajax操作之基于请求加载数据

 jQuery教程(13)-ajax操作之追加 HTML

更多关于android开发文章

Android Linux内核编译

标签:android   android开发   

原文地址:http://blog.csdn.net/androidmylove/article/details/42641349

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!