Android 车载系统源码下载与编译

ubuntu安装略...

  1. 打开终端,设置root密码切换root用户:
damon@damon-desktop:~$ sudo passwd root
[sudo] damon 的密码: 
输入新的 UNIX 密码: 
重新输入新的 UNIX 密码: 
passwd:已成功更新密码
damon@damon-desktop:~$ su
密码: 
root@damon-desktop:/home/damon#
  1. 安装软件包:
root@damon-desktop:/home/damon# apt-get install -y git-core gnupg flex bison build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev libgl1-mesa-dev libxml2-utils xsltproc unzip fontconfig openjdk-8-jdk vim 
  1. 源码下载

环境准备:

root@damon-desktop:/home/damon# snap install git-repo
git-repo 1.12.37-3 from Jim Hodapp (jhodapp) installed
root@damon-desktop:/home/damon# mkdir ~/bin
root@damon-desktop:/home/damon# PATH=~/bin:$PATH
root@damon-desktop:/home/damon# curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo > ~/bin/repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 45723  100 45723    0     0   214k      0 --:--:-- --:--:-- --:--:--  214k
root@damon-desktop:/home/damon# chmod a+x ~/bin/repo
root@damon-desktop:/home/damon# mkdir aosp_9
root@damon-desktop:/home/damon# cd aosp_9/
root@damon-desktop:/home/damon/aosp_9# export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/'

修改repo的python版本:

root@damon-desktop:/home/damon/aosp_9# python3 --version
Python 3.6.9
root@damon-desktop:/home/damon/aosp_9# vim ~/bin/repo

第一行#!/usr/bin/env python 改为 #!/usr/bin/env python3
初始化repo:

root@damon-desktop:/home/damon/aosp_9# git config --global user.name damon
root@damon-desktop:/home/damon/aosp_9# git config --global user.email [email protected]
root@damon-desktop:/home/damon/aosp_9# repo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest -b android-9.0.0_r61

Your identity is: damon 
If you want to change this, please re-run 'repo init' with --config-name

Testing colorized output (for 'repo diff', 'repo status'):
  black    red      green    yellow   blue     magenta   cyan     white 
  bold     dim      ul       reverse 
Enable color display in this user account (y/N)? y

repo has been initialized in /home/damon/aosp_9/
If this is not the directory in which you want to initialize repo, please run:
   rm -r /home/damon/aosp_9//.repo
and try again.

同步拉取Android 源码:

root@damon-desktop:/home/damon/aosp_9# repo sync -c -j8

编译源码:

root@damon-desktop:/home/damon/aosp_9# source build/envsetup.sh 
including device/generic/car/vendorsetup.sh
including device/generic/mini-emulator-arm64/vendorsetup.sh
including device/generic/mini-emulator-armv7-a-neon/vendorsetup.sh
including device/generic/mini-emulator-mips/vendorsetup.sh
including device/generic/mini-emulator-mips64/vendorsetup.sh
including device/generic/mini-emulator-x86/vendorsetup.sh
including device/generic/mini-emulator-x86_64/vendorsetup.sh
including device/generic/uml/vendorsetup.sh
including device/google/cuttlefish/vendorsetup.sh
including device/google/marlin/vendorsetup.sh
including device/google/muskie/vendorsetup.sh
including device/google/taimen/vendorsetup.sh
including device/linaro/hikey/vendorsetup.sh
including sdk/bash_completion/adb.bash
root@damon-desktop:/home/damon/aosp_9# lunch aosp_car_x86_64-userdebug

============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=9
TARGET_PRODUCT=aosp_car_x86_64
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_ARCH=x86_64
TARGET_ARCH_VARIANT=x86_64
TARGET_2ND_ARCH=x86
TARGET_2ND_ARCH_VARIANT=x86_64
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-5.4.0-128-generic-x86_64-Ubuntu-18.04.6-LTS
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=PI
OUT_DIR=out
============================================
root@damon-desktop:/home/damon/aosp_9# make -j8
......
The new table will be used at the next reboot.
The operation has completed successfully.

#### build completed successfully (02:02:41 (hh:mm:ss)) ####

启动编译好的模拟器镜像:

root@damon-desktop:/home/damon/aosp_9# emulator
emulator: WARNING: Couldn't find crash service executable /home/damon/aosp_9/prebuilts/android-emulator/linux-x86_64/emulator64-crash-service

emulator: WARNING: system partition size adjusted to match image file (2562 MB > 800 MB)

emulator: WARNING: cannot read adb public key file: /root/.android/adbkey.pub
Your emulator is out of date, please update by launching Android Studio:
 - Start Android Studio
 - Select menu "Tools > Android > SDK Manager"
 - Click "SDK Tools" tab
 - Check "Android Emulator" checkbox
 - Click "OK"

模拟器运行界面:


Android 车载系统源码下载与编译_第1张图片
模拟器运行界面

也可以通过同一套源码编译多个目标产物,并同时保持多个目标的编译结果。可以在使用 lunch 命令设置新的编译目标前指定新的输出目录即可(默认为 out 目录):

export OUT_DIR=new_out

你可能感兴趣的:(Android 车载系统源码下载与编译)