1. 环境准备和工具安装
1.1 更新系统并安装必要工具
# 更新系统
sudo apt update && sudo apt upgrade -y
# 安装基础开发工具
sudo apt install -y \
git build-essential device-tree-compiler \
u-boot-tools bc cpio flex bison \
python3 python3-pip python3-venv \
swig libssl-dev libncurses-dev \
dosfstools parted fdisk e2fsprogs \
qemu-user-static binfmt-support \
curl wget axel rsync pv tree file
# 安装交叉编译工具链
sudo apt install -y \
gcc-aarch64-linux-gnu \
g++-aarch64-linux-gnu \
binutils-aarch64-linux-gnu
1.2 创建工作目录结构
# 创建项目目录
mkdir -p ~/rk3588_ubuntu20.04/{sources,build,output,rootfs}
目录说明:
- sources: 存放源码
- build: 编译目录
- output: 输出文件
- rootfs: 根文件系统
2. 获取必要的源码和工具
2.1 获取 U-Boot 源码
第一种(克隆):
cd sources
git clone --depth 1 https://github.com/rockchip-linux/u-boot.git
第二种(下载解压):
cd sources
wget ftp://ftp.denx.de/pub/u-boot/u-boot-2023.10.tar.bz2
tar -xjf u-boot-2023.10.tar.bz2
mv u-boot-2023.10 u-boot
rm u-boot-2023.10.tar.bz2
2.2 获取内核源码
cd sources
git clone https://github.com/rockchip-linux/kernel.git -b develop-5.10
2.3 获取 Rockchip 工具和固件
cd sources
git clone https://github.com/rockchip-linux/rkbin.git
2.4 下载 Ubuntu Base 根文件系统
cd ~/rk3588_ubuntu20.04
wget http://cdimage.ubuntu.com/ubuntu-base/releases/20.04/release/ubuntu-base-20.04.4-base-arm64.tar.gz

