Android Linux内核编译_移动开发_编程开发_程序员俱乐部

中国优秀的程序员网站程序员频道CXYCLUB技术地图
热搜:
更多>>
 
您所在的位置: 程序员俱乐部 > 编程开发 > 移动开发 > Android Linux内核编译

Android Linux内核编译

 2015/1/11 15:41:18  摩斯电码  程序员俱乐部  我要评论(0)
  • 摘要:平台:Wind7_64+Ubuntu12_04_64+VMware这里以Android5.0为例:Android5.0可以到这里下载:android-5.0.tar.gz115网盘礼包码:5lbd7crtk1wzhttp://115.com/lb/5lbd7crtk1wzLinux_source_goldfish可以到这里下载:Linux_source_goldfish.tar.gz115网盘礼包码:5lbd76rru5orhttp://115
  • 标签:android Linux 编译 Linux内核 内核

平台:

Wind7_64 + Ubuntu12_04_64 + VMware

 

这里以Android5.0为例:

 

Android5.0 可以到这里下载:

 android-5.0.tar.gz
115网盘礼包码:5lbd7crtk1wz
http://115.com/lb/5lbd7crtk1wz

 

Linux_source_goldfish 可以到这里下载:

 Linux_source_goldfish.tar.gz
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

 

上一篇: Let’s do this!新手程序员的入门指南 下一篇: 没有下一篇了!
发表评论
用户名: 匿名