• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1HOW TO REBUILT THE ANDROID EMULATOR-SPECIFIC KERNEL:
2====================================================
3
4I. Helper script:
5-----------------
6
7We now provide a helper script to rebuild the kernel,
8it is under distrib/rebuild-kernel.sh.
9
10You need the sources in android.googlesource.com/kernel/goldfish.git,
11in branch origin/android-goldfish-2.6.29
12
13To rebuild the ARMv5TE kernel:
14
15  cd $KERNEL_SOURCES
16  /path/to/rebuild-kernel.sh --out=$ANDROID/prebuilt/android-arm/kernel
17
18To rebuild the ARMv7-A one:
19
20  cd $KERNEL_SOURCES
21  /path/to/rebuild-kernel.sh --armv7 --out=$ANDROID/prebuilt/android-arm/kernel
22
23To rebuild the x86 kernel:
24
25  cd $KERNEL_SOURCES
26  /path/to/rebuild-kernel.sh --arch=x86 --out=$ANDROID/prebuilt/android-x86/kernel
27
28To rebuild the MIPS kernel:
29
30  cd $KERNEL_SOURCES
31  /path/to/rebuild-kernel.sh --arch=mips --out=$ANDROID/prebuilts/qemu-kernel/mips
32
33Note that you will need to have your cross-toolchain in your path.
34If this is not the case, the script will complain and give you the
35expected name. Use --cross=<prefix> to specify a different toolchain.
36
37See rebuild-kernel.sh --help for more options and details.
38
39
40II. Rebuilding from scratch:
41----------------------------
42
43If you don't or can't use the script, here are manual instructions:
44
45You need to have the Android toolchain in your path
46(i.e. 'arm-eabi-gcc --version' must work)
47
48then:
49
50git clone https://android.googlesource.com/kernel/goldfish.git kernel-goldfish
51cd kernel-goldfish
52git checkout origin/android-gldfish-2.6.29
53
54export CROSS_COMPILE=arm-eabi-
55export ARCH=arm
56export SUBARCH=arm
57make goldfish_defconfig    # configure the kernel
58make -j2                   # build it
59
60=> this generates a file named arch/arm/boot/zImage
61
62NOTE: Branch android-goldfish-2.6.27 is obsolete now. Do not use it.
63
64Now, you can use it with:
65
66  emulator -kernel path/to/your/new/zImage <other-options>
67
68
69You can build an ARMv7-compatible kernel image by using goldfish_armv7_defconfg
70in the above instructions (instead of goldfish_defconfig). Note that you will
71need to enable ARMv7 emulation by using the -cpu cortex-a8 option, as in:
72
73  emulator -kernel path/to/your/new/zImage <other-options> -qemu -cpu cortex-a8
74
75As a special convenience, if the name of your kernel image ends in -armv7, then
76the emulator binary will automatically enable ARMv7 emulation for you, so doing
77the following should be equivalent
78
79  emulator -kernel path/to/your/kernel-armv7 <other-options>
80
81
82Voila !
83