Ubuntu 22.0.4编译Android系统Rom

安装 ptyon2.7:

sudo apt install python2

whereis python2

sudo ln -s /usr/bin/python2 python

安装JDK:

sudo apt-get install openjdk-8-jdk

安装fastboot:

sudo apt-get install android-tools-fastboot

安装Repo:

sudo apt-get update

sudo apt-get install repo

或者:

$ mkdir -p ~/.bin

$ PATH="${HOME}/.bin:${PATH}"

$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/.bin/repo

$ chmod a+rx ~/.bin/repo

安装依赖库:

sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip m4 libssl-dev~

安装 build-essential:

sudo apt-get install build-essential

配置SSH

  • 设置SSH Public keys:

终端执行ssh-keygen一直回车,执行完毕后将id_rsa_pub的内容复制下来,添加到setting key里面的new ssh key 框内,并点击aad new ssh key。

id_rsa-pub文件位置:~/.ssh/id_rsa_pub

  • 在终端配置本地gitconfig

git config --global user.name "你的邮箱前缀"

git config --global user.email "你的邮箱(带@xxx.com)"

下载代码&编译:

复制代码

repo init -u xxx -b xxx -m xxx.xml

repo sync -j 20

source build/envsetup.sh

lunch xxxx-userdebug

make -j 20

编译报错:

报错:Found class java.io.PrintWriter, but unable to insert @libcore.util.NonNull:

复制代码

cd prebuilts/misc/linux-x86/flex

rm flex-2.5.39

tar zxf flex-2.5.39.tar.gz

cd flex-2.5.39

./configure

make

mv flex ../cd ../

rm -rf flex-2.5.39

mv flex flex-2.5.39

参考:https://forum.odroid.com/viewtopic.php?p=358525#p358525

https://www.yii666.com/article/568439.html

https://zhuanlan.zhihu.com/p/157110146

https://wiki.odroid.com/odroid-n2/software/building_android#android

报错:clang: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory

复制代码

sudo apt install libncurses5

报错:multiple definition of `yylloc'; dtc-lexer.lex.o (symbol from plugin):(.text+0x0): first defined here

修改:kernel-4.14/scripts/dtc/dtc-lexer.lex.c_shipped

复制代码

YYLTYPE yylloc;修改为:extern YYLTYPE yylloc;

参考:https://blog.csdn.net/Golden_Chen/article/details/123297964

https://github.com/BPI-SINOVOIP/BPI-M4-bsp/issues/4

https://lkml.org/lkml/2020/4/1/1206

https://zhuanlan.zhihu.com/p/432591735

New address family defined, please update secclass_map.

修改:kernel-4.14/scripts/selinux/genheaders/genheaders.c

复制代码

-#include <sys/socket.h>+#include <linux/socket.h>

修改:kernel-4.14/scripts/scripts/selinux/mdp/mdp.c

复制代码

-#include <sys/socket.h>+#include <linux/socket.h>

参考:https://fxkxb.com/index.php/archives/15/

刷机:

~/rom/out/target/product/mico_x10a/MT8168_Android_scatter.txt

整体修改点:

建议直接安装Ubuntu16 会比较顺利,如果已经使用了22.0.4 ,不想重装系统,可以参考本文档进行修改

参考:

https://wiki.odroid.com/odroid-n2/software/building_android#android

相关推荐
SelectDB16 小时前
阶跃星辰基于 SelectDB 构建 PB 级 Agent 可观测平台
大数据·数据库·aigc
Elasticsearch1 天前
Elasticsearch ES|QL:现已支持视图、子查询和读取时模式定义
elasticsearch
Elasticsearch4 天前
Kibana 中的 SNMP 拓扑数据:从采集到 Canvas
elasticsearch
大大大大晴天4 天前
Hudi技术内幕:RecordPayload到RecordMerger
大数据
SelectDB5 天前
秒级弹性、最高降本 70%:SelectDB Serverless 如何重塑云数仓资源效率
大数据·后端·云原生
WhoAmI5 天前
MapReduce框架原理解析一:InputFormat
大数据·hadoop
WhoAmI5 天前
MapReduce框架原理解析三:OutputFormat
大数据·hadoop
WhoAmI5 天前
MapReduce框架原理解析二:Shuffle
大数据·hadoop
大大大大晴天6 天前
Hudi技术内幕:Key Generation原理与实践
大数据