编译Hboot2
前提条件
- 一台带网络端口且操作系统为Ubuntu 22.04的x86 Linux服务器。
- Linux服务器已安装python、make、gcc、unzip、pigz、bison、flex、libncurses-dev、squashfs-tools、bc、device-tree-compiler、libssl-dev、cmake与交叉编译工具链。

- 所有的依赖必须用root用户进行安装。
- 用户可以通过如下命令进行安装上述依赖。
apt-get install -y python3 make gcc unzip pigz bison flex libncurses-dev squashfs-tools bc device-tree-compiler libssl-dev cmake
- 交叉编译工具链安装请参见安装工具链。
操作步骤
- 登录Linux服务器。
- 执行如下命令,切换至root用户。
su - root
- 执行如下命令,安装编译所需依赖库。
apt-get install uuid-dev
- 使用WinSCP工具或其他工具,将下载软件包获取的源码包“Ascend310B-hboot2-source.tar.gz”上传至Linux系统root用户属组目录下,例如“/opt”。详细操作请参见10.2-使用WinSCP传输文件。
- 执行如下命令,进入源码包所在目录,例如“/opt”。
cd /opt
- 执行如下命令,解压源码包“Ascend310B-hboot2-source.tar.gz”。
tar -xzvf Ascend310B-hboot2-source.tar.gz
- 执行如下命令,进入“Ascend310B-hboot2-source”目录。
cd Ascend310B-hboot2-source
- 根据用户需求修改对应的源码文件,具体操作请参见Demo参考。
- 执行如下命令,进入“Ascend310B-hboot2-source”目录。
cd /opt/Ascend310B-hboot2-source
- 执行如下命令,编译“AS310B_HBOOT2_UEFI.fd”文件。
bash build.sh hboot2
出现如下回显,且生成“AS310B_HBOOT2_UEFI.fd”文件表示编译“AS310B_HBOOT2_UEFI.fd”文件成功。
generate /opt/Ascend310B-hboot2-source/output/AS310B_HBOOT2_UEFI.fd success! sign /opt/Ascend310B-hboot2-source/output/AS310B_HBOOT2_UEFI.fd success!
编译后的“AS310B_HBOOT2_UEFI.fd”文件会自动存放于“Ascend310B-hboot2-source/output”目录下。
父主题: Hboot2源码编译