├── .gitmodules ├── README.txt ├── build-kernel.sh ├── custom-kernels ├── tun.ko ├── zImage-tun-m ├── zImage-tun-n └── zImage-tun-y ├── install-su.sh └── su ├── Superuser-debug.apk └── su /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "goldfish"] 2 | path = goldfish 3 | url = https://android.googlesource.com/kernel/goldfish 4 | [submodule "prebuilt"] 5 | path = prebuilt 6 | url = https://android.googlesource.com/platform/prebuilt 7 | [submodule "Superuser"] 8 | path = Superuser 9 | url = git://github.com/koush/Superuser 10 | [submodule "Widgets"] 11 | path = Widgets 12 | url = git://github.com/koush/Widgets 13 | -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- 1 | This project contains scripts for building emulator kernels. 2 | The build script included compiles variants 3 | - with TUN/TAP support compiled in 4 | - with TUN/TAP support as module 5 | - with no TUN/TAP and module support. 6 | 7 | It also contains a script for installing a su application onto the 8 | emulator. It can be used by a developer or in automated test 9 | environments. 10 | 11 | A precompiled version of su and Superuser.apk is included in the su 12 | directory. For an explanation on how to compile su see (3). 13 | 14 | 15 | Sources: 16 | 17 | (1) Code a World, building android custom kernel for emulator 18 | http://pengliang.is-programmer.com/2011/7/1/android_kernel_buiding.27708.html 19 | 20 | (2) AOSP, Building Kernels 21 | http://source.android.com/source/building-kernels.html 22 | git clone https://android.googlesource.com/kernel/goldfish 23 | git clone https://android.googlesource.com/platform/prebuilt 24 | 25 | (3) github, koush / Superuser 26 | https://github.com/koush/Superuser 27 | 28 | (4) Android NDK 29 | http://developer.android.com/tools/sdk/ndk/index.html 30 | http://dl.google.com/android/ndk/android-ndk-r8e-linux-x86.tar.bz2 31 | 32 | -------------------------------------------------------------------------------- /build-kernel.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | [ -e custom-kernels ] || mkdir custom-kernels 6 | 7 | export PATH=$(pwd)/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin:$PATH 8 | export ARCH=arm 9 | export SUBARCH=arm 10 | export CROSS_COMPILE=arm-eabi- 11 | 12 | cd goldfish 13 | 14 | 15 | #build with tun support compiled in 16 | [ -f .config ] && rm .config 17 | make goldfish_defconfig 18 | grep -v CONFIG_TUN .config > .config2 19 | mv .config2 .config 20 | echo CONFIG_TUN=y >> .config 21 | make 22 | cp arch/arm/boot/zImage ../custom-kernels/zImage-tun-y 23 | 24 | 25 | #build with tun support as module 26 | [ -f .config ] && rm .config 27 | make goldfish_defconfig 28 | grep -v CONFIG_TUN .config > .config2 29 | mv .config2 .config 30 | cat - >> .config << EOF 31 | CONFIG_TUN=m 32 | 33 | CONFIG_MODULES=y 34 | CONFIG_MODULE_FORCE_LOAD=y 35 | CONFIG_MODULE_UNLOAD=y 36 | CONFIG_MODULE_FORCE_UNLOAD=y 37 | CONFIG_MODVERSIONS=y 38 | CONFIG_MODULE_SRCVERSION_ALL=n 39 | 40 | CONFIG_KPROBES=n 41 | CONFIG_MTD_TESTS=n 42 | CONFIG_MEILHAUS=n 43 | CONFIG_COMEDI=n 44 | CONFIG_CRYPTO_TEST=n 45 | EOF 46 | make 47 | cp arch/arm/boot/zImage ../custom-kernels/zImage-tun-m 48 | cp ./drivers/net/tun.ko ../custom-kernels/tun.ko 49 | 50 | #build with no tun support and no module support 51 | [ -f .config ] && rm .config 52 | make goldfish_defconfig 53 | grep -v CONFIG_TUN .config > .config2 54 | mv .config2 .config 55 | echo CONFIG_TUN=n >> .config 56 | make 57 | cp arch/arm/boot/zImage ../custom-kernels/zImage-tun-n 58 | 59 | -------------------------------------------------------------------------------- /custom-kernels/tun.ko: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fries/android-emulator-root/d0400634667e4d49b231afb8d963cdee82ff0e8e/custom-kernels/tun.ko -------------------------------------------------------------------------------- /custom-kernels/zImage-tun-m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fries/android-emulator-root/d0400634667e4d49b231afb8d963cdee82ff0e8e/custom-kernels/zImage-tun-m -------------------------------------------------------------------------------- /custom-kernels/zImage-tun-n: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fries/android-emulator-root/d0400634667e4d49b231afb8d963cdee82ff0e8e/custom-kernels/zImage-tun-n -------------------------------------------------------------------------------- /custom-kernels/zImage-tun-y: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fries/android-emulator-root/d0400634667e4d49b231afb8d963cdee82ff0e8e/custom-kernels/zImage-tun-y -------------------------------------------------------------------------------- /install-su.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | adb remount 4 | adb push su/su /system/xbin/su 5 | #adb shell chmod 06755 /system 6 | adb shell chmod 06755 /system/xbin/su 7 | adb install -r su/Superuser-debug.apk 8 | 9 | -------------------------------------------------------------------------------- /su/Superuser-debug.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fries/android-emulator-root/d0400634667e4d49b231afb8d963cdee82ff0e8e/su/Superuser-debug.apk -------------------------------------------------------------------------------- /su/su: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fries/android-emulator-root/d0400634667e4d49b231afb8d963cdee82ff0e8e/su/su --------------------------------------------------------------------------------