Android Linux kernel Compilation
Platform:
Wind7_64 + Ubuntu12_04_64 + VMware
Here we use Android5.0 as an example:
Android5.0 can be downloaded here:
115 online storage package code: 5lbd7crtk1wz
Http://115.com/lb/5lbd7crtk1wz
Linux_source_goldfish can be downloaded here:
115 online storage package code: 5lbd76rru5or
Http://115.com/lb/5lbd76rru5or
For Android5.0 compilation, refer:
Problems encountered
Openjdk7 is required
apt-get install openjdk-7-jdkapt-get install openjdk-7-jre
Compile:
root@ubuntu:~/work/android/android5/android-5.0# . build/envsetup.sh including device/moto/shamu/vendorsetup.shincluding device/samsung/manta/vendorsetup.shincluding device/generic/mini-emulator-x86/vendorsetup.shincluding device/generic/mini-emulator-arm64/vendorsetup.shincluding device/generic/mini-emulator-mips/vendorsetup.shincluding device/generic/mini-emulator-x86_64/vendorsetup.shincluding device/generic/mini-emulator-armv7-a-neon/vendorsetup.shincluding device/lge/mako/vendorsetup.shincluding device/lge/hammerhead/vendorsetup.shincluding device/asus/tilapia/vendorsetup.shincluding device/asus/deb/vendorsetup.shincluding device/asus/grouper/vendorsetup.shincluding device/asus/flo/vendorsetup.shincluding device/asus/fugu/vendorsetup.shincluding sdk/bash_completion/adb.bashroot@ubuntu:~/work/android/android5/android-5.0# choosecombo Build type choices are: 1. release 2. debugWhich would you like? [1] 1Which product would you like? [full] Variant choices are: 1. user 2. userdebug 3. engWhich would you like? [eng] ============================================PLATFORM_VERSION_CODENAME=RELPLATFORM_VERSION=5.0TARGET_PRODUCT=fullTARGET_BUILD_VARIANT=engTARGET_BUILD_TYPE=releaseTARGET_BUILD_APPS=TARGET_ARCH=armTARGET_ARCH_VARIANT=armv7-aTARGET_CPU_VARIANT=genericTARGET_2ND_ARCH=TARGET_2ND_ARCH_VARIANT=TARGET_2ND_CPU_VARIANT=HOST_ARCH=x86_64HOST_OS=linuxHOST_OS_EXTRA=Linux-3.5.0-23-generic-x86_64-with-Ubuntu-12.04-preciseHOST_BUILD_TYPE=releaseBUILD_ID=LRX21MOUT_DIR=out============================================root@ubuntu:~/work/android/android5/android-5.0# make
After compilation, set the toolchain path to facilitate kernel Compilation:
export PATH=$PATH:/root/work/android/android-5.0/prebuilts/gcc/linux-x86/arm/arm-eabi-4.8/bin
Compile the kernel:
Download the kernel and decompress it.
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
Because the android 3.4 simulator uses the kernel 3.4 (you can start a simulator with the kernel that comes with the simulator, and then check the kernel version cat/proc/version), we also use:
root@ubuntu:~/work/android/android5/goldfish# git checkout remotes/origin/android-goldfish-3.4 -b linux-3.4
Then modify the Makefile
ARCH ?= armCROSS_COMPILE ?= arm-eabi-
Configure the kernel
root@ubuntu:~/work/android/android5/goldfish# make goldfish_armv7_defconfig
Note: The default kernel does not have the module loading function. You need to execute make menuconfig settings. Otherwise, the kernel module cannot be compiled or loaded.
Compile the kernel
make zImage -j2
Start the simulator with the compiled kernel:
root@ubuntu:~/work/android/android5/android-5.0# emulator64-arm -kernel ../goldfish/arch/arm/boot/zImage