推荐:Ubuntu 20.04 版本
Docker加速
# 编辑 Docker 配置文件
$ sudo vim /etc/docker/daemon.json# 加入以下配置项
{"registry-mirrors": ["https://dockerproxy.com","https://hub-mirror.c.163.com","https://mirror.baidubce.com","https://ccr.ccs.tencentyun.com"]
}# 重启docker
$ sudo service docker restart
Docker容器创建
# 拉取Ubuntu镜像
docker pull ubuntu:20.04# 关联源码目录并启动Docker,挂载使用绝对路径
cd ~/Source/04-RK3568/02-Projects/SDK_RK3568_Linux_ATK
sudo docker run -it -v ${PWD}:${PWD} --name Ubuntu20_RK3568 ubuntu:20.04# 环境依赖
apt-get update
apt-get install -y curl python2.7 python-pyelftools git ssh make gcc libssl-dev liblz4-tool expect g++ patchelf chrpath gawk texinfo chrpath diffstat binfmt-support qemu-user-static live-build bison flex fakeroot cmake gcc-multilib g++-multilib unzip device-tree-compiler python3-pip libncurses-dev python3-pyelftools vim mtd-utils# Docker 补充
apt install -y bc# 检出
cd /home/gaoyang3513/Source/04-RK3568/02-Projects/SDK_RK3568_Linux_ATK
.repo/repo/repo sync -l -j10
Python版本切换
# 添加
update-alternatives --install /usr/bin/python python /usr/bin/python2 100
update-alternatives --install /usr/bin/python python /usr/bin/python3 150# 切换
sudo update-alternatives --config python
Repo工具
mkdir ~/bin
export PATH=~/bin:$PATH# 下载
curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -o ~/bin/repo
chmod a+x ~/bin/repo
Git
git config --global user.name "gaoyang3513"
git config --global user.email "gaoyang3513@163.com"git config --global core.editor vim
开发
编译
./build.sh lunch# 目标
3. BoardConfig-rk3568-atk-evb1-ddr4-v10.mk
在编译根文件系统的过程中会通过网络下载很多的第三方库文件;首先,下载过程会占用很多时间导致编译时间拉长;其次,如果用户的网络环境不稳定或者第三方库文件的下载源发生变更,很容易导致下载失败,进而导致根文件系统编译出错;所以,为了加快根文件系统的编译过程、也为了降低编译根文件系统时出现问题的概率, 我们可以预先把编译根文件系统所需的第三方库文件拷贝到 SDK 中。
在容器外执行
sudo tar -xzf ../../01-Resource/Alientek_RK3568/Disk_B/02-ATK-DLRK3568_SDK/linux_sdk/dl.tgz -C ./buildroot/
编译
./build.sh all
问题
技巧
# 新开
sudo docker exec -it Ubuntu20_RK3568 /bin/bash