我是靠谱客的博主 丰富火龙果,最近开发中收集的这篇文章主要介绍居于mtk芯片安卓车机系统具体流程!/bin/bash#ALPS(Android4.1 based) build environment profile setting#Overwrite JAVA_HOME environment variable setting if already existsexport PATHSKIN1: SKIN2:!/bin/shcopy /autochips/kernel/includeto/kernel/includelunch!/bin/shif [ -z,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

一:车机系统框架 
这里写图片描述 
MCU 功能 
 电源控制 
 Radio 控制(RDS) 
 按键检测(Panel/Remote/SW) 
 常见信号检查(倒车/大灯/刹车) 
 CAN 模块通讯 
 ARM-MCU 通讯 
 进出碟控制 
 翻转马达系统 
 屏驱(此种情况倒车一般用 mcu 控制) 
AMR 功能 
 wifi 、BT、 gps、3/4G 
 显示、触摸 
 多媒体播放(SD 卡、U 盘) 
 倒车显示 
 语音 
 AUX 
 胎压、DVR、CMMB 
 CVBS 输出(后排输出) 
二:安卓启动流程 
这里写图片描述 
 第一阶段:Android 设备上电后,首先会从处理器片上 ROM 的启动引导代码开始执行,片上 ROM 会寻找 Bootloader 
代码,并加载到内存。(这一步由“芯片厂商”负责设计和实现) 
 第二阶段:Bootloader 开始执行,首先负责完成硬件的初始化,然后找到 Linux 内核代码,并加载到内存。(这一 
步由“设备厂商”负责设计和实现) 
 第三阶段:Linux 内核开始启动,初始化各种软硬件环境,加载驱动程序,挂载根文件系统,并执行 init 程序, 
由此开启 Android 的世界。(这一步则是 Android 内核开发过程中需要涉及的地方) 
init 程序最核心的工作主要有 3 点: 
(1) 创建和挂载一些系统目录/设备节点,设置权限,如:/dev, /proc, and /sys 
(2) 解析 init.rc 和 init..rc,并启动属性服务,以及一系列的服务和进程。 
(3) 显示 boot logo,默认是“Android”字样 
 第四阶段:Zygote 进程、SystemServer 进程创建 Zygote 进程由 init 进程创建,SystemServer 进程由 Zygote 创建 
 第五阶段:订制的service 启动:例举包括以下服务( 添加的所有关键服务) 
CBMService; 
CanbusService; 
McuService; 
RadioService; 
SettingService; 
McuCBMService; 
PandoraService; 
SWCService; 
 第六阶段:启动完成阶段。当所有的服务都启动完毕后,SystemServer 会打印出“Making services ready”,然后 
通过 ActivityManager 启动 Home 界面,并发送“ACTION_BOOT_COMPLETED”广播消息(到此真正看到了主界面) 
三:代码结构 
这里写图片描述 
这里写图片描述 
核心服务路径:autochipsframeworksbaseservicesjavacom… 
APP 路径:autochipspackages

四:编译说明(AC8217平台代码而论) 
全编译 
1 . mbldenv.sh 导出编译需要的编译工具相关环境变量 
2 . selfenv 拷贝 autochips 到相关目录主要拷贝以下目录: 
3 . selfbuild 
实际上 selfbuild 仅是 autochipsbuildbuild.all 脚本的符号链接。在没有参数的情况下,selfbuild 会依次执行 build.env, 
build.uboot,build.kernel,build.driver,build.arm2,build.android,build.otapackage,build.makeimage 这 7 个 sh 脚本。 
相当分步执行以下:(当要单独编译部分时可以单独以下某句命令方法) 
1.source./build.env2../selfbuild uboot 编译 uboot 
3../selfbuilddriverATCdriver4../selfbuild kernel 编译 linux kernel 
5../selfbuildarm2arm26../selfbuild android 编译 android 
7.$./selfbuild makeimage 生成最后需要烧写到板子上的 Image( 把多余的 apk 删除同时打包镜像) 
模块编译 
1 : 用 mm 或 mmm 编译相应模块 
2: . selfbuild makeimage 生产镜像

附上编译脚本片段代码: 
**

mbldenv.sh脚本文件

**

!/bin/bash

#

ALPS(Android4.1 based) build environment profile setting

#

Overwrite JAVA_HOME environment variable setting if already exists

PATH=/mtktools/mtk-toolchain/gnuarm-4.2.1/image-tools:PATHPATH=/mtktools/mtktoolchain/gnuarm4.4.1/crosstools/usr/local/bin:PATH 
PATH=/mtktools/mtk-toolchain/vfp_4.5.1_2.6.27_cortex-a9-rhel4_002/i686/bin:PATHANTHOME=/usr/local/antexportANTHOMEexportMTKJAVAHOME=/usr/local/jdk1.6.032exportPATH=MTK_JAVA_HOME/bin:ANTHOME/bin:PATH 
export ANDROID_JAVA_HOME=MTKJAVAHOMEexportANDROIDJAVATOOLCHAIN=MTK_JAVA_HOME/bin/ 
export JAVA_HOME=MTKJAVAHOMEexportJREHOME={JAVA_HOME}/jre 
export CLASSPATH=.:JAVAHOME/lib:{JRE_HOME}/lib

export PATH

unset USERNAME

SKIN1: SKIN2:

export SKIN=Skin2

selfenv脚本文件:

!/bin/sh

export ANDROID4=pwd 
export ANDROID_SRC=ANDROID4exportKERNELSRC=ANDROID4/kernel 
export KERNELDIR=KERNELSRC/exportAUTOCHIPSDIR=ANDROID4/autochips 
export DRIVERS_DIR=AUTOCHIPSDIR/protect/platform/kernel/driversexportPUBLICDRIVERSDIR=AUTOCHIPS_DIR/platform/kernel/drivers 
export DRIVERS_INC=AUTOCHIPSDIR/platform/kernel/drivers/incexportARM2SRC=AUTOCHIPS_DIR/platform/arm2 
export DISPLAY_HARDWARE_INC=AUTOCHIPSDIR/hardware/atc/displayexportUBOOTSRC=AUTOCHIPS_DIR/platform/uboot 
export SCRIPT_DIR=AUTOCHIPSDIR/buildexportANDROIDOUTPUT=ANDROID_SRC/out 
export DRIVERS_OUTPUT=AUTOCHIPSDIR/platform/kernel/drivers/outputexportDRIVERSLIB=AUTOCHIPS_DIR/platform/kernel/drivers/lib 
export AUTOCHIPS_TOOL=AUTOCHIPSDIR/toolsexportRELEASEFOLDERNAME=ANDROID4/image_release 
export BOARD_CFG_FILE=$AUTOCHIPS_DIR/device/atc/ac8317/BoardConfig.mk

export PATH=ANDROIDSRC/autochips/external/gstreameraggregate/bin/:AUTOCHIPS_TOOL:$PATH 
export JOB_NUM=grep processor /proc/cpuinfo |wc -l 
export CHIP_VER=8317

find AUTOCHIPSDIR/device/atc/ac8317/.overlay/build/typef|xargstouchcpruafAUTOCHIPS_DIR/device/atc/ac8317/.overlay/build/* $ANDROID_SRC/build/

copy /autochips/kernel/includeto/kernel/include

find AUTOCHIPSDIR/kernel/includetypef|xargstouchcpruafAUTOCHIPS_DIR/kernel/include/* $ANDROID_SRC/kernel/include/

INPUT_PARAM=$*

function check_parameter() 

if [ ! -z “echo "$INPUT_PARAM" | grep eng” ];then 
echo “eng” 
elif [ ! -z “echo "$INPUT_PARAM" | grep userdebug” ];then 
echo “userdebug” 
elif [ ! -z “echo "$INPUT_PARAM" | grep user” ];then 
echo “user” 
else 
echo “eng” 
fi 
}

retval=check_parameter $* 
source ANDROIDSRC/build/envsetup.shretval

INPUT_PARAM=INPUTPARAM/eng/INPUTPARAM={INPUT_PARAM/userdebug/} 
INPUT_PARAM=INPUTPARAM/user/INPUTPARAM=(echo $INPUT_PARAM)

lunch

if [ ! -z “echo "$INPUT_PARAM" | grep ?” ];then 
lunch 
else 
lunch 5 
fi

echo “env [$retval] setup completed!!!”

selfbuild脚本文件:

!/bin/sh

{

if [ -z which androidq ];then

#echo "no androidq, source bash_profile"
  • 1
  • 2

source ~/.bash_profile

source ~/.bashrc

fi

if [ ! -z which androidq ];then 
echo “androidq ok, build with it” 
ANDROIDQ=androidq 
else 
echo “no androidq, build without it” 
ANDROIDQ= 
fi

INPUT_PARA=$*

Copy Overlay folder to original

if [ ! -z “echo "$INPUT_PARA" | grep cpoverlay” ];then 
SCRIPTDIR/build.INPUT_PARA 
exit 0 
fi

process android version: user, userdebug, eng

if [ ! -z “echo "$INPUT_PARA" | grep eng” ];then 
export ANDROID_VER=eng 
elif [ ! -z “echo "$INPUT_PARA" | grep userdebug” ];then 
export ANDROID_VER=userdebug 
elif [ ! -z “echo "$INPUT_PARA" | grep user” ];then 
export ANDROID_VER=user 
else 
export ANDROID_VER=eng 
fi 
INPUT_PARA=INPUTPARA/eng/INPUTPARA={INPUT_PARA/userdebug/} 
INPUT_PARA=INPUTPARA/user/INPUTPARA=(echo $INPUT_PARA)

source autochips/build/build.env $ANDROID_VER

echo “export env: ANDROID4=ANDROID4if[!dAUTOCHIPS_DIR -o -z $AUTOCHIPS_DIR ];then 
echo “export some env var error, exit” 
exit 1 
fi

ALLIMAGES=”uboot kernel driver arm2 android otapackage makeimage clean cts”

check if para is nand

if [ ! -z “echo "$INPUT_PARA" | grep nand” ];then 
export AC83XX_BOOT_DEVICE=nand 
elif [ ! -z “echo "$INPUT_PARA" | grep sd2” ];then 
export AC83XX_BOOT_DEVICE=sd2 
else 
export AC83XX_BOOT_DEVICE=mmc 
fi

remove mmc para

INPUT_PARA=INPUTPARA/nand/INPUTPARA={INPUT_PARA/sd2/} 
INPUT_PARA=(echoINPUT_PARA)

echo “AC83XX_BOOT_DEVICE :$AC83XX_BOOT_DEVICE”

check if it is release build, debug build by default

if [ ! -z “echo "$INPUT_PARA" | grep debug” ];then 
export RELEASE_BUILD=false 
echo “build for debug” 
else 
export RELEASE_BUILD=true 
echo “build for release” 
fi

remove release or debug if it has

INPUT_PARA={INPUT_PARA%release}  
INPUT_PARA={INPUT_PARA%debug} 
INPUT_PARA=(echoINPUT_PARA)

if [ -z “INPUTPARA];thenIMAGELIST=ubootkerneldriverarm2androidotapackagemakeimageexportBUILDALL=trueechonoparam,default:IMAGE_LIST” 
echo -e “33[31m delete out(ANDROIDOUTPUT)folder?(y/n)33[0mreadt5RMOUTif[doutaRMOUT" = "y" -a "?=0];thenechoe33[31mbegindeleteout(ANDROID_OUTPUT) folder33[0m” 
ANDROIDQrmrfANDROID_OUTPUT 
fi 
else 
IMAGE_LIST=”$INPUT_PARA” 
export BUILD_ALL=false 
fi

if [ ! -z “echo $IMAGE_LIST | grep makeimage” ];then 
export MAKE_IMAGE=true 
IMAGE_LIST=${IMAGE_LIST%makeimage}

fi

for test

for PARAM in $IMAGE_LIST 
do 
if [ ! -z “echo "$ALLIMAGES" | grep $PARAM” ];then 
if [ ! -z “echo $PARAM | grep android” ];then 
if [ ! -z “echo $ANDROID_VER | grep eng” ];then 
BUILD_PARA=”eng” 
elif [ ! -z “echo $ANDROID_VER | grep userdebug” ];then 
BUILD_PARA=”userdebug” 
elif [ ! -z “echo $ANDROID_VER | grep user” ];then 
BUILD_PARA=”user” 
else 
BUILD_PARA=”” 
fi 
elif [ ! -z “echo $PARAM | grep kernel” ];then 
if [ ! -z “echo "$RELEASE_BUILD" | grep false” ]; then 
BUILD_PARA=”debug” 
elif [ ! -z “echo $ANDROID_VER | grep eng” ];then 
BUILD_PARA=”debug” 
else 
BUILD_PARA=”” 
fi 
elif [ ! -z “echo $PARAM | grep driver” ];then 
if [ ! -z “echo "$RELEASE_BUILD" | grep false” ]; then 
BUILD_PARA=”debug” 
else 
BUILD_PARA=”” 
fi 
else 
BUILD_PARA=”” 
fi

echo -e "33[32m build.$PARAM $BUILD_PARA33[0m"

if [ ! -x $SCRIPT_DIR/build.$PARAM ];then
  if [ ! -z "`echo $PARAM | grep otapackage`" ];then
  source autochips/build/build.env $AC83XX_BOOT_DEVICE
  fi
  echo -e "33[32m $SCRIPT_DIR/build.$PARAM $BUILD_PARA can't executable!33[0m"
  exit 1
fi

echo "++ build_dir is $SCRIPT_DIR, param is $PARAM, build_para is $BUILD_PARA++"
  $ANDROIDQ $SCRIPT_DIR/build.$PARAM $BUILD_PARA

  if [ "$?" != "0" ];then
    echo -e "33[31m build.$PARAM $BUILD_PARA error, stop!33[0m"
    exit 1
  else
    echo -e "33[32m build.$PARAM $BUILD_PARA OK!33[0m"
  fi
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20

else 
echo -e “33[31munknown cmd: $PARAM33[0m” 
fi 
done

build kernel and driver again to debug if no release

assume that arm2 image is only need to generate in

building all iamge, which means the whole image building

if [ ! -z “echo "$RELEASE_BUILD" | grep false” ]; then 
echo “it is debug build” 
if [ ! -z “echo "$BUILD_ALL" | grep true” ]; then 
echo “clean kernel and drivers” 
cd KERNELDIR && make clean && make mrproper  
    #cdDRIVERS_DIR && make clean 
echo “build kernel and driver again” 
ANDROIDQSCRIPT_DIR/build.kernel “debug” 
ANDROIDQSCRIPT_DIR/build.driver “debug” 
fi 
else 
echo “it is release build” 
fi

build image

if [ ! -z “echo $MAKE_IMAGE | grep true” ];then 
echo “Going to build images” 
$SCRIPT_DIR/build.makeimage 
fi

echo “build is done!” 
exit

} | tee buildlog.txt

最后

以上就是丰富火龙果为你收集整理的居于mtk芯片安卓车机系统具体流程!/bin/bash#ALPS(Android4.1 based) build environment profile setting#Overwrite JAVA_HOME environment variable setting if already existsexport PATHSKIN1: SKIN2:!/bin/shcopy /autochips/kernel/includeto/kernel/includelunch!/bin/shif [ -z的全部内容,希望文章能够帮你解决居于mtk芯片安卓车机系统具体流程!/bin/bash#ALPS(Android4.1 based) build environment profile setting#Overwrite JAVA_HOME environment variable setting if already existsexport PATHSKIN1: SKIN2:!/bin/shcopy /autochips/kernel/includeto/kernel/includelunch!/bin/shif [ -z所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(52)

评论列表共有 0 条评论

立即
投稿
返回
顶部