我正在尝试在 android lollipop 上运行修改后的 android 内核。我下载了 Android sdk api-22 x86 并使用以下命令编译了金鱼:
$ git clone https://android.googlesource.com/kernel/goldfish.git
$ cd goldfish/
$ git checkout -t origin/android-goldfish-3.4 -b goldfish3.4
$ git clone https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/x86/i686-linux-android-4.6
$ export PATH=$(pwd)/x86_64-linux-android-4.7/bin:$PATH
$ export CROSS_COMPILE=x86_64-linux-android-
$ make ARCH=x86 CC="${CROSS_COMPILE}gcc -mno-android" goldfish_defconfig
$ make ARCH=x86 CC="${CROSS_COMPILE}gcc -mno-android" bzImage
使用上述命令已生成arch/x86/boot/bzImage
并成功完成编译。
当我尝试使用自定义编译内核运行模拟器时
$ ./tools/emulator -debug init -kernel ~/Android_Project/goldfish/arch/x86/boot/bzImage -system ./system-images/android-22/google_apis/x86/system.img -ramdisk ./system-images/android-22/google_apis/x86/ramdisk.img -avd Nexus_S_API_22 -wipe-data -qemu -enable-kvm -show-kernel
emulator:Found AVD name 'Nexus_S_API_22'
emulator:Found AVD target architecture: x86
emulator: Found directory: /home/umer/Android/Sdk/system-images/android-22/google_apis/x86/
emulator:Probing for /home/umer/Android/Sdk/system-images/android-22/google_apis/x86//kernel-ranchu: file exists
emulator:Auto-config: -engine qemu2 (based on configuration)
emulator: Found directory: /home/umer/Android/Sdk/system-images/android-22/google_apis/x86/
emulator:Found target-specific 64-bit emulator binary: /home/umer/Android/Sdk/tools/qemu/linux-x86_64/qemu-system-i386
emulator:Adding library search path: '/home/umer/Android/Sdk/tools/lib64'
emulator:Adding library search path: '/home/umer/Android/Sdk/tools/lib64/libstdc++'
emulator: Found directory: /home/umer/Android/Sdk/system-images/android-22/google_apis/x86/
emulator: Found directory: /home/umer/Android/Sdk/system-images/android-22/google_apis/x86/
sh: 1: glxinfo: not found
emulator:GPU emulation enabled using 'host' mode
emulator: Adding library search path for Qt: '/home/umer/Android/Sdk/tools/lib64/qt/lib'
emulator: Setting Qt plugin search path: QT_QPA_PLATFORM_PLUGIN_PATH=/home/umer/Android/Sdk/tools/lib64/qt/plugins
emulator: Running :/home/umer/Android/Sdk/tools/qemu/linux-x86_64/qemu-system-i386
emulator: qemu backend: argv[00] = "/home/umer/Android/Sdk/tools/qemu/linux-x86_64/qemu-system-i386"
emulator: qemu backend: argv[01] = "-debug"
emulator: qemu backend: argv[02] = "init"
emulator: qemu backend: argv[03] = "-kernel"
emulator: qemu backend: argv[04] = "/home/umer/Android_Project/goldfish/arch/x86/boot/bzImage"
emulator: qemu backend: argv[05] = "-system"
emulator: qemu backend: argv[06] = "./system-images/android-22/google_apis/x86/system.img"
emulator: qemu backend: argv[07] = "-ramdisk"
emulator: qemu backend: argv[08] = "./system-images/android-22/google_apis/x86/ramdisk.img"
emulator: qemu backend: argv[09] = "-avd"
emulator: qemu backend: argv[10] = "Nexus_S_API_22"
emulator: qemu backend: argv[11] = "-wipe-data"
emulator: qemu backend: argv[12] = "-qemu"
emulator: qemu backend: argv[13] = "-enable-kvm"
emulator: qemu backend: argv[14] = "-show-kernel"
emulator: Concatenated backend parameters:
/home/umer/Android/Sdk/tools/qemu/linux-x86_64/qemu-system-i386 -debug init -kernel /home/umer/Android_Project/goldfish/arch/x86/boot/bzImage -system ./system-images/android-22/google_apis/x86/system.img -ramdisk ./system-images/android-22/google_apis/x86/ramdisk.img -avd Nexus_S_API_22 -wipe-data -qemu -enable-kvm -show-kernel
emulator: Android virtual device file at: /home/umer/.android/avd/Nexus_S_API_22.ini
emulator: virtual device content at /home/umer/.android/avd/Nexus_S_API_22.avd
emulator: virtual device config file: /home/umer/.android/avd/Nexus_S_API_22.avd/config.ini
emulator: using core hw config path: /home/umer/.android/avd/Nexus_S_API_22.avd/hardware-qemu.ini
emulator: Found AVD target API level: 22
emulator: Read property file at /home/umer/Android/Sdk/system-images/android-22/google_apis/x86//build.prop
emulator: No boot.prop property file found.
emulator: found skin 'nexus_5' in directory: /home/umer/Android/Sdk/skins/
emulator: autoconfig: -skin nexus_5
emulator: autoconfig: -skindir /home/umer/Android/Sdk/skins/
emulator: Target arch = 'x86'
emulator: Auto-config: -qemu -cpu qemu32
emulator: ERROR: New emulator backend requires minimum kernel version 3.10+ (currently got lower)
Please make sure you've got updated system images and do not force the specific kernel image together with the engine version