Android源码编译好了之后,我们就可以运行它了。
1、配置环境变量:
/data/data/Android$ export PATH=$PATH:$(pwd)/out/host/linux-x86/bin
/data/data/Android$ export ANDROID_PRODUCT_OUT=$(pwd)/out/target/product/generic
2、通过emulator来启动模拟器,带上相应参数:
/data/data/Android$ emulator -kernel ./prebuilts/qemu-kernel/arm/kernel-qemu-armv7 -sysdir ./out/target/product/generic/ -system $ANDROID_PRODUCT_OUT/system.img -data $ANDROID_PRODUCT_OUT/userdata.img -ramdisk $ANDROID_PRODUCT_OUT/ramdisk.img
3、使用自己编译的kernel:
/data/data/Android$ emulator -kernel ./kernel/goldfish/arch/arm/boot/zImage -sysdir ./out/target/product/generic/ -system $ANDROID_PRODUCT_OUT/system.img -data $ANDROID_PRODUCT_OUT/userdata.img -ramdisk $ANDROID_PRODUCT_OUT/ramdisk.img
4、查看内核版本:
/data/data/Android$ adb shell
root@generic:/ # cd proc/
root@generic:/proc # cat version
Linux version 3.4.67-gea97df6 (USER@MACHINE) (gcc version 4.6.x-google 20120106 (prerelease) (GCC) ) #2 PREEMPT Sat Feb 7 17:48:18 CST 2015
Linux version 3.4.67-gea97df6 (USER@MACHINE) (gcc version 4.6.x-google 20120106 (prerelease) (GCC) ) #2 PREEMPT Sat Feb 7 17:48:18 CST 2015