RK android13编译环境搭建与常用编译命令
1 使用清华的源
1.1 备份sources.list
sudo cp -f /etc/apt/sources.list /etc/apt/sources.list.bak
1.2 用下面的内容替换/etc/apt/sources.list里面的内容
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
deb http://us.archive.ubuntu.com/ubuntu/ xenial main universe
deb-src http://us.archive.ubuntu.com/ubuntu/ xenial main universe
deb http://security.ubuntu.com/ubuntu trusty-security main
deb http://us.archive.ubuntu.com/ubuntu/ trusty main universe
1.3 更新源
sudo apt-get update
2 安装编译环境
sudo apt-get install curl
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 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 ccache
sudo apt-get install libssl-dev
sudo apt-get install dpkg-dev libsdl1.2-dev libesd0-dev -y
sudo apt install libncurses5 gawk -y
sudo apt-get install openssh-server
sudo apt-get install repo ssh make gcc liblz4-tool expect g++ patchelf chrpath gawk texinfo chrpath diffstat binfmt-support qemu-user-static live-build bison flex fakeroot cmake device-tree-compiler python-pip zstd rsync bc time
若sh 不为bash,请将symlink /bin/sh→dash 更改为/bin/sh→bash。
- 使用如下命令:
sudo rm /bin/sh
- 使用如下命令:
sudo ln -s /bin/bash /bin/sh
3 常用编译命令
cd 到项目的根目录 RK3568_ANDROID13R01RKR3
3.1 设置项目的编译命令,环境变量
source build-quec.sh
这一步是其它编译命令的基础
3.1 编译所有模块
build-all-image
3.2 编译android
./build -A
3.2 编译kernel
makekernel
3.3 编译uboot
makeboot
3.4 编译android
./build.sh -A
3.5其它编译命令
可以通过
./build.sh -?
来查看:
/RK3568_ANDROID13R01RKR3$ ./build.sh -?
./build.sh: illegal option -- ?
USAGE: [-U] [-CK] [-A] [-p] [-o] [-u] [-v VERSION_NAME]
No ARGS means use default build option
WHERE: -U = build uboot
-C = build kernel with Clang
-K = build kernel
-A = build android
-p = will build packaging in IMAGE
-o = build OTA package
-u = build update.img
-v = build android with 'user' or 'userdebug'
-d = huild kernel dts name
-V = build version
-J = build jobs
编译生成的各种镜像的目录是
\RK3568_ANDROID13R01RKR3\rockdev\Image-rk3568_t