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

相关推荐
龙腾AI白云1 小时前
大模型在天文科研中的应用:天体数据分析
大数据·flask·逻辑回归·pygame
快乐非自愿2 小时前
抛弃传统AI:OpenClaw与Skill重构AI生产力,技术范式不可逆
大数据·人工智能
网络研究员2 小时前
Claude身份认证后还是被封?三条稳定防封策略
大数据·人工智能
TuCoder2 小时前
2026年了,景区制作智慧导地图有哪些选择?
大数据
2601_949925182 小时前
基于 OpenClaw 打造货代行业 AI 智能体架构实战
大数据·人工智能·架构·ai智能体
zhengyquan3 小时前
7000mAh 电池 + 独立 AI 键,小米 18 Pro 是堆料还是突破?
大数据·人工智能
geneculture3 小时前
意识的多学科定义:从16个视域,到融智学统合——基于“意+识”框架且区分“意识≠心智”系统研究
大数据·人工智能·融智学的重要应用·哲学与科学统一性·融智时代(杂志)·意识=意+识·智=信息处理+选择用意
Ai173163915793 小时前
GB200 NVL72超节点深度解析:架构、生态与产业格局
大数据·服务器·人工智能·神经网络·机器学习·计算机视觉·架构
观远数据3 小时前
跨部门BI推广权限治理指南:如何避免数据泄露与权责混乱
大数据·人工智能·数据分析
xierui1231234 小时前
探索型 AI 与交付型 AI:两种截然不同的技术物种
大数据·人工智能·效率工具·ai工具·大模型应用·aiagent·agent架构