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