模拟器emulator运行android源码编译出来的镜像,错误处理

一、取android 源码

#初始化源码   
repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-4.0.1_r1


repo sync

下载完以后

cd .repo/manifests
git branch -a

相看一下当前的分支

git branch -a
* default
  remotes/m/android-4.0.1_r1 -> origin/android-4.0.1_r1
  remotes/origin/adt_23.0.3

二、编译

整一个简单的编译脚本

#!/bin/bash


EnviromentSet()
{
        source build/envsetup.sh
}

ProjectSelect()
{
if [ -f "./myProjectNum" ];then
        myProjectNum=$(head -1 ./myProjectNum)
        rm ./myProjectNum
        lunch $myProjectNum
else
        echo "./myProjectNum not found"
        lunch
fi
}


JavaversionSet()
{
        PATH=/opt/java/jdk1.6.0_45/bin:$PATH
}

RunCommand()
{
        make -j2 2>&1 | tee build1.log
}

echo "full-eng" >./myProjectNum

EnviromentSet
ProjectSelect
JavaversionSet
RunCommand $*

三、运行

编译好源码后,使用以下脚本运行模拟器:

#!/bin/bash

EnviromentSet()
{
        source build/envsetup.sh
}

ProjectSelect()
{
if [ -f "./myProjectNum" ];then
        myProjectNum=$(head -1 ./myProjectNum)
        rm ./myProjectNum
        lunch $myProjectNum
else
        echo "./myProjectNum not found"
        lunch
fi
}

JavaversionSet()
{
        PATH=/opt/java/jdk1.6.0_45/bin:$PATH
}


RunCommand()
{
        #emulator -kernel prebuilt/android-arm/kernel/kernel-qemu-armv7
	out/host/linux-x86/bin/emulator -kernel prebuilt/android-arm/kernel/kernel-qemu-armv7 -system out/target/product/generic/system.img -data out/target/product/generic/userdata.img -ramdisk out/target/product/generic/ramdisk.img -skin QVGA -partition-size 1024
}

echo "full-eng" >./myProjectNum

EnviromentSet
ProjectSelect
JavaversionSet
RunCommand $*

./emulator.sh 
including device/samsung/maguro/vendorsetup.sh
including device/samsung/tuna/vendorsetup.sh
including device/ti/panda/vendorsetup.sh
including sdk/bash_completion/adb.bash

============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.0.1
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
HOST_ARCH=x86
HOST_OS=linux
HOST_BUILD_TYPE=release
BUILD_ID=ITL41D
============================================

错误一、

sh: 1: glxinfo: not found

fix:
sudo apt install mesa-utils

 

错误二、

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

fix:
使用源码编译出来的emulator :     out/host/linux-x86/bin/emulator

其它问题:

如果分区大小不够不提示类似816M>200M信息,则在使用emulator命令时,加入-partition-size 1024参数

你可能感兴趣的:(编译)