700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > 龙芯交叉编译环境搭建之交叉编译工具链配置

龙芯交叉编译环境搭建之交叉编译工具链配置

时间:2024-03-17 08:17:25

相关推荐

龙芯交叉编译环境搭建之交叉编译工具链配置

龙芯交叉编译环境搭建之

交叉编译工具链配置

1 概括

本文档适用于龙芯3A3000/4000 UEFI代码编译,重点指导交叉编译环境的搭建方法,对系统安装不做介绍。

Ubuntu系统(版本为ubuntu-18.04.1-desktop-amd64.iso),交叉编译工具链(gcc-4.4.7-7215-n64-loongson.tar.gz)。

2 下载工具链

/index.php/GCC

下载gcc4.4.7 64位gcc-4.4.7-7215-n64-loongson.tar.gz。

3 配置工具链

将下载的gcc-4.4.7-7215-n64-loongson.tar.gz复制到/opt目录下,并解压。

tar -xvf gcc-4.4.7-7215-n64-loongson.tar.gz

设置环境变量:

export PATH=/opt/gcc-4.4.7-7215-n64-loongson/usr/bin/:$PATH

export LD_LIBRARY_PATH=/opt/gcc-4.4.7-7215-n64-loongson/usr/x86_64-unknown-linux-gnu/mips64el-redhat-linux/lib:$LD_LIBRARY_PATH

使用export命令查看,发现环境变量设置好了,我们就可以编译内核了。

————————————————————————————————

4 更改源

mv /etc/apt/sources.list /etc/apt/sources.list_bak

vi /etc/apt/sources.list

添加清华源,将源添加到改文件中。

deb https://mirrors.tuna./ubuntu/ bionic main restricted universe multiverse

deb-src https://mirrors.tuna./ubuntu/ bionic main restricted universe multiverse

deb https://mirrors.tuna./ubuntu/ bionic-updates main restricted universe multiverse

deb-src https://mirrors.tuna./ubuntu/ bionic-updates main restricted universe multiverse

deb https://mirrors.tuna./ubuntu/ bionic-backports main restricted universe multiverse

deb-src https://mirrors.tuna./ubuntu/ bionic-backports main restricted universe multiverse

deb https://mirrors.tuna./ubuntu/ bionic-security main restricted universe multiverse

deb-src https://mirrors.tuna./ubuntu/ bionic-security main restricted universe multiverse

deb https://mirrors.tuna./ubuntu/ bionic-proposed main restricted universe multiverse

deb-src https://mirrors.tuna./ubuntu/ bionic-proposed main restricted universe multiverse

添加完成后输入

sudo apt update //更新软件源

5 编译uefi需要添加以下依赖软件

sudo apt-get install gcc

sudo apt-get install g++

sudo apt-get install make

sudo apt-get install git

sudo apt-get install python

sudo apt-get install uuid-dev

sudo apt-get install acpica-tools

6 编译uefi代码命令

编译脚本文件目录:

LoongosnDemoBoardPkg/Script/

在编译的时候需要进入这个编译目录内,将上述的配置文件拷贝一份为.config,然后执行./build.sh来进行编译;如果没有拷贝配置文件,默认执行./build的时候会将单路开发板的配置文件自动拷贝为.config,并且询问用户;具体命令:

cd LoongsonDemoBoardPkg/Script/

cp Config/Ls3a30007a1000Single.cfg .config

./build.sh

编译生成的二进制目录:

Debug模式:Build/Ls3a30007a/DEBUG_GCC49/FV/LS3A30007A.fd

Release模式:Build/Ls3a30007a/RELEASE_GCC49/FV/LS3A30007A.fd

7 编译过程可能遇到的问题

在进行arm-linux-gcc交叉编译时遇到的一个问题:

error while loading shared libraries: libmpfr.so.4: cannot open shared object file: No such file or directory

加载共享库时出错:libmpfr.so.4:无法打开共享对象文件:没有这样的文件或目录

解决方法:

创建符号链接

sudo ln -s /usr/lib/x86_64-linux-gnu/libmpfr.so.6 /usr/lib/x86_64-linux-gnu/libmpfr.so.4

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。