当前位置: 代码迷 >> 综合 >> Ubuntu20.04 AOSP编译环境配置
  详细解决方案

Ubuntu20.04 AOSP编译环境配置

热度:86   发布时间:2023-11-19 15:57:31.0

Ubuntu20.04 AOSP&RK平台编译环境配置

1.安装和配置步骤:

先更换为阿里源,见步骤6
?
之后终端执行
?
sudo apt-get update
?
sudo apt-get upgrade

2.安装 git

sudo apt-get install git
?
git config --global user.name "用户名" 
git config --global user.email "邮箱" 
?

3.安装OpenJDK

3.1 安装jdk:18.04默认集成了jdk1.8的源,可直接执行以下安装;sudo apt-get install openjdk-8-jdk   //jdk1.8sudo apt-get install openjdk-11-jdk  //jdk 11
3.2 sudo update-alternatives --config java //查看java版本,选择对应版本sudo update-alternatives --config javac //查看javac版本,选择对应版本

4.搭建环境

终端执行:
sudo apt-get install libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev g++-multilib
sudo apt-get install -y git flex bison gperf build-essential libncurses5-dev:i386
sudo apt-get install tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386
sudo apt-get install dpkg-dev libsdl1.2-dev libssl-dev
sudo apt-get install git-core gnupg flex bison gperf build-essential
sudo apt-get install zip curl zlib1g-dev gcc-multilib g++-multilib
sudo apt-get install libc6-dev-i386
sudo apt-get install lib32ncurses5-dev x11proto-core-dev libx11-dev
sudo apt-get install libgl1-mesa-dev libxml2-utils xsltproc unzip m4
sudo apt-get install lib32z-dev
sudo apt-get install libncurses5
sudo apt-get install libpng-dev  
sudo apt-get install libssl-dev 
sudo apt-get install libswitch-perl
sudo apt install python-crypto 
?
最后在 .bashrc 文件中添加:
export LC_ALL=C

5.切换默认python为python2

Ubuntu 20.04默认使用的是python3 编译时需要用到python2,配置软链接使用python2 1.安装python2sudo apt install python22.安装完成后我们可以使用如下命令来检查目前可用的 Python 版本:ls /usr/bin/python*
?3.设置默认方式(替代版本)sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 1

6.Ubuntu切换为阿里源

使用vim或者gedit编辑/etc/apt/sources.list

Ubuntu 18.04

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
?
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
?
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
?
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
?
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
?

Ubuntu 20.04

deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
?
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
?
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
?
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
?
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

RK平台编译环境

sudo apt-get install device-tree-compiler
  相关解决方案