blob: b3b9c6656e6f132c63287b09ff4a68f55c01e77f [file] [log] [blame]
HOW TO REBUILT THE ANDROID EMULATOR-SPECIFIC KERNEL:
====================================================
I. Helper script:
-----------------
We now provide a helper script to rebuild the kernel,
it is under $AOSP/prebuilts/qemu-kernel/build-kernel.sh.
Make sure to use a checkout of aosp/master, not one of the aosp/studio-XXX
branches, the latter do not contain the prebuilt target toolchain binaries
required to rebuild the kernel.
You need the sources in android.googlesource.com/kernel/goldfish.git,
in branch origin/android-goldfish-<version>, where <version> is the
kernel version that applies to your system image.
Roughly speaking:
2.6.27 -> Anything before Gingerbread. (<= Android 2.2)
2.6.29 -> For Gingerbread (2.3) until JellyBean MR2 (4.2.x)
3.4 -> For KitKat (4.4.x) and Lollipop (5.0)
3.10 -> For M, which is not available yet.
To rebuild the ARMv7-A one:
/path/to/build-kernel.sh --out=$ANDROID/prebuilt/android-arm/kernel
To rebuild the x86 kernel:
/path/to/build-kernel.sh --arch=x86 --out=$ANDROID/prebuilt/android-x86/kernel
To rebuild the MIPS kernel:
/path/to/build-kernel.sh --arch=mips --out=$ANDROID/prebuilts/qemu-kernel/mips
To rebuild the MIPS64 kernel (version >= 3.10 only):
/path/to/build-kernel.sh --arch=mips64 --out=$ANDROID/prebuilts/qemu-kernel/mips64 --gcc-version=4.9
To rebuild the x86_64 kernel (version >= 3.10 only):
/path/to/build-kernel.sh --arch=x86_64 --out=$ANDROID/prebuilts/qemu-kernel/x86_64
To rebuild the ARM64 kernel (version >= 3.10 only):
/path/to/rebuild-kerenl.sh --arch=arm64 --out=$ANDROID/prebuilts/qemu-kernel/arm64
By default the script tries to find an appropriate toolchain from
$AOSP/prebuilts/gcc/, but you can specify a different one using the
--cross=<prefix> option.
See build-kernel.sh --help for more options and details.
II. Rebuilding from scratch:
----------------------------
If you don't or can't use the script, here are manual instructions:
You need to have an appropriate cross-toolchain in your path
(e.g. 'arm-eabi-gcc --version' must work)
then (for version 2.6.29):
git clone https://android.googlesource.com/kernel/goldfish.git kernel-goldfish
cd kernel-goldfish
git checkout origin/android-goldfish-2.6.29
export CROSS_COMPILE=arm-eabi-
export ARCH=arm
export SUBARCH=arm
make goldfish_defconfig # configure the kernel
make -j2 # build it
=> this generates a file named arch/arm/boot/zImage
NOTE: Branch android-goldfish-2.6.27 is obsolete now. Do not use it.
Now, you can use it with:
emulator -kernel path/to/your/new/zImage <other-options>
You can build an ARMv7-compatible kernel image by using goldfish_armv7_defconfig
in the above instructions (instead of goldfish_defconfig). Note that you will
need to enable ARMv7 emulation by using the -cpu cortex-a8 option, as in:
emulator -kernel path/to/your/new/zImage <other-options> -qemu -cpu cortex-a8
As a special convenience, if the name of your kernel image ends in -armv7, then
the emulator binary will automatically enable ARMv7 emulation for you, so doing
the following should be equivalent
emulator -kernel path/to/your/kernel-armv7 <other-options>
Voila !