预备工作
- 安装虚拟机工具VMware或者VirtualBox。
- 新建虚拟机,内存16GB及以上,硬盘100GB及以上。
- 安装Ubuntu,推荐使用20.04版本。用户名不能包含中文。
- 启动并进入Ubuntu虚拟机,以下步骤将在Ubuntu虚拟机中进行操作。
一、将Shell环境修改为bash
sudo dpkg-reconfigure dash
选择“No”。
二、替换Ubuntu软件源
在“https://mirrors.ustc.edu.cn/repogen/”下载对应版本最新的源。
在下载好的文件(sources.list)所在的位置开启一个终端窗口,执行下列命令。
备份原始文件:
sudo cp /etc/apt/sources.list /etc/apt/source.list.bak
替换源:
sudo mv -f sources.list /etc/apt/
更新软件包索引:
sudo apt update
三、安装必要的库和工具
需要分两步进行安装。注意,这里比较重要,官网文档用一步进行安装,会出现问题,导致安装不完整,从而导致后期编译出现“3000”错误。
sudo apt-get install binutils binutils-dev git git-lfs gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip m4 bc gnutls-bin python3.8 python3-pip ruby genext2fs device-tree-compiler make libffi-dev e2fsprogs pkg-config perl openssl libssl-dev libelf-dev libdwarf-dev u-boot-tools mtd-utils cpio doxygen liblz4-tool openjdk-8-jre gcc g++ texinfo dosfstools