The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 1 | HOW TO REBUILT THE ANDROID EMULATOR-SPECIFIC KERNEL: |
| 2 | ==================================================== |
| 3 | |
David 'Digit' Turner | 5c25d3d | 2011-03-05 00:20:16 +0100 | [diff] [blame] | 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 | |
SeongJae Park | 9849988 | 2013-03-26 11:35:47 +0900 | [diff] [blame] | 10 | You need the sources in android.googlesource.com/kernel/goldfish.git, |
David 'Digit' Turner | 21f55a8 | 2011-10-04 20:07:58 +0200 | [diff] [blame] | 11 | in branch origin/android-goldfish-2.6.29 |
David 'Digit' Turner | 5c25d3d | 2011-03-05 00:20:16 +0100 | [diff] [blame] | 12 | |
David 'Digit' Turner | 21f55a8 | 2011-10-04 20:07:58 +0200 | [diff] [blame] | 13 | To rebuild the ARMv5TE kernel: |
David 'Digit' Turner | 5c25d3d | 2011-03-05 00:20:16 +0100 | [diff] [blame] | 14 | |
| 15 | cd $KERNEL_SOURCES |
| 16 | /path/to/rebuild-kernel.sh --out=$ANDROID/prebuilt/android-arm/kernel |
| 17 | |
David 'Digit' Turner | 21f55a8 | 2011-10-04 20:07:58 +0200 | [diff] [blame] | 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 | |
David 'Digit' Turner | 5c25d3d | 2011-03-05 00:20:16 +0100 | [diff] [blame] | 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 | |
Bhanu Chetlapalli | 88f828e | 2012-05-21 16:39:51 -0700 | [diff] [blame] | 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 | |
David 'Digit' Turner | 5c25d3d | 2011-03-05 00:20:16 +0100 | [diff] [blame] | 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 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 45 | You need to have the Android toolchain in your path |
| 46 | (i.e. 'arm-eabi-gcc --version' must work) |
| 47 | |
| 48 | then: |
| 49 | |
SeongJae Park | 9849988 | 2013-03-26 11:35:47 +0900 | [diff] [blame] | 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 |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 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 | |
David 'Digit' Turner | 18d7ef7 | 2010-08-24 09:13:31 -0700 | [diff] [blame] | 62 | NOTE: Branch android-goldfish-2.6.27 is obsolete now. Do not use it. |
| 63 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 64 | Now, you can use it with: |
| 65 | |
| 66 | emulator -kernel path/to/your/new/zImage <other-options> |
| 67 | |
David 'Digit' Turner | 18d7ef7 | 2010-08-24 09:13:31 -0700 | [diff] [blame] | 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 | |
The Android Open Source Project | 8b23a6c | 2009-03-03 19:30:32 -0800 | [diff] [blame] | 82 | Voila ! |