如何编译android goldfish 3.4内核并在模拟器上运行

时间:2014-01-22 05:27:18

标签: android android-emulator android-source

首先让我告诉你我正在使用OS X 10.7.5开发MAC。我正在尝试编译Goldfish 3.4内核并在模拟器上运行它。它编译好,但是当我运行它时,模拟器打开并冻结。当我做一个“顶部”时,我可以看到模拟器像疯了一样运行,但屏幕上没有任何东西出现。这是我编译内核的方法

git clone https://android.googlesource.com/kernel/goldfish.git
git checkout -t origin/android-goldfish-3.4 -b goldfish3.4
make ARCH=arm goldfish_defconfig
make ARCH=arm SUBARCH=arm CROSS_COMPILE=/Volumes/androidSpace/android_work/prebuilts/gcc/darwin-x86/arm/arm-eabi-4.6/bin/arm-eabi-

然后我通过

运行模拟器
./emulator -debug init -kernel /Volumes/androidSpace/goldfish/goldfish/arch/arm/boot/zImage -system /Volumes/androidSpace/android_work/out/target/product/generic/system.img -ramdisk /Volumes/androidSpace/android_work/out/target/product/generic/ramdisk.img -avd firstAvd -wipe-data

以下是运行模拟器

的调试输出的最后一部分
QEMU options list:
emulator: argv[00] = "./emulator64-arm"
emulator: argv[01] = "-android-hw"
emulator: argv[02] = "/Users/deathwillarrive/.android/avd/firstAvd.avd/hardware-qemu.ini"
Concatenated QEMU options:
./emulator64-arm -android-hw /Users/deathwillarrive/.android/avd/firstAvd.avd/hardware-qemu.ini
emulator: registered 'boot-properties' qemud service
emulator: nand_add_dev: system,size=0x22600000,initfile=/Volumes/androidSpace/android_work/out/target/product/generic/system.img,pagesize=512,extrasize=0
emulator: mapping 'system' NAND image to /tmp/android-deathwillarrive/emulator-2Wyv0t
emulator: nand_add_dev: userdata,size=0xc800000,file=/Users/deathwillarrive/.android/avd/firstAvd.avd/userdata-qemu.img,initfile=/Users/deathwillarrive/.android/avd/firstAvd.avd/userdata.img,pagesize=512,extrasize=0
emulator: registered 'boot-properties' qemud service
emulator: Adding boot property: 'dalvik.vm.heapsize' = '64m'
emulator: Adding boot property: 'qemu.sf.lcd_density' = '320'
emulator: Adding boot property: 'qemu.hw.mainkeys' = '0'
emulator: Adding boot property: 'qemu.sf.fake_camera' = 'none'
emulator: nand_add_dev: cache,size=0x4200000,file=/Users/deathwillarrive/.android/avd/firstAvd.avd/cache.img,pagesize=512,extrasize=0
emulator: Initializing hardware OpenGLES emulation support
emulator: Kernel parameters: qemu.gles=0 qemu=1 console=ttyS0 android.qemud=ttyS1 android.checkjni=1 ndns=1
emulator: Trace file name is not set

emulator: autoconfig: -scale 0.583594
emulator: Could not open file: (null)/system/build.prop: No such file or directory
emulator: control console listening on port 5554, ADB on port 5555
emulator: sent '0012host:emulator:5555' to ADB server
emulator: ping program: /Volumes/androidSpace/android_work/out/host/darwin-x86/bin/./DDSs

输出只是冻结在这里。有没有人知道构建3.4金鱼内核的步骤。

1 个答案:

答案 0 :(得分:10)

目标“goldfish_defconfig”为ARM 926配置内核,但现在仿真器配置为在arm7架构上运行。你应该使用“goldfish_armv7_defconfig”。

按照以下步骤为模拟器构建3.4内核

git clone https://android.googlesource.com/kernel/goldfish.git
git checkout -t origin/android-goldfish-3.4 -b goldfish3.4

make ARCH=arm goldfish_armv7_defconfig
make ARCH=arm SUBARCH=arm CROSS_COMPILE=/Volumes/androidSpace/android_work/prebuilts/gcc/darwin-x86/arm/arm-eabi-4.6/bin/arm-eabi-

这应该构建一个3.4内核,你可以这样运行(我假设你的目录结构有默认的sdk ramdisk.img)

./emulator -debug init -kernel /Volumes/androidSpace/goldfish/goldfish/arch/arm/boot/zImage -system /Volumes/androidSpace/android_work/out/target/product/generic/system.img -ramdisk /Volumes/androidSpace/android_work/out/target/product/generic/ramdisk.img -avd firstAvd -wipe-data

试一试,告诉我们