0
  • 聊天消息
  • 系统消息
  • 评论与回复
登录后你可以
  • 下载海量资料
  • 学习在线课程
  • 观看技术视频
  • 写文章/发帖/加入社区
创作中心

完善资料让更多小伙伴认识你,还能领取20积分哦,立即完善>

3天内不再提示

Linux:制作mipsel 交叉工具链 (更新版)

如意 来源:CSDN 作者:CaspianSea 2020-06-23 08:56 次阅读

1.代码结构为:

setup ---》 源代码压缩包

src ---》源码

~/code/cross-compile$ ls src/

binutils-2.24 gcc-4.7.1 gdb-7.6.2 glibc-2.18

build --》 编译目录

:~/code/cross-compile$ ls build/

binutils gcc gdb glibc

kernel ----》 内核代码:

~/code/cross-compile/kernel$ ls

linux-3.10

2.编译 binutils

在build/binutils 下,执行命令:

。./。./src/binutils-2.24/configure --target=mipsel-linux-gnueabi --prefix=/home/charles/code/cross-compile/embedded-toolchain/cross-tools --with-sysroot=/home/charles/code/cross-compile/embedded-toolchain

然后,执行 make, make install 安装

3. 编译 GCC stage 1

在 build/gcc目录下,执行

AR=ar LDFLAGS=“-Wl,-rpath=/home/charles/code/cross-compile/embedded-toolchain/cross-tools/lib” 。./。./src/gcc-4.7.1/configure --prefix=/home/charles/code/cross-compile/embedded-toolchain/cross-tools --target=mipsel-linux-gnueabi --with-sysroot=/home/charles/code/cross-compile/embedded-toolchain --with-gmp=/usr/local --with-mpfr=/usr/local --with-ppl=/usr/local --with-newlib --without-headers --disable-multilib --disable-nls --disable-decimal-float --disable-libgomp --disable-libmudflap --disable-libssp --disable-shared --disable-threads --enable-languages=c --with-float=soft --with-arch=mips32r2 --with-tune=mips32r2

然后,

make all-gcc all-target-libgcc

make install-gcc install-target-libgcc

4. 安装内核头文件

进入到内核代码目录,

执行命令:

ARCH=mips make mrproper

ARCH=mips make headers_check

ARCH=mips CROSS_COMPILE=mipsel-gcc-linux-gnueabi make INSTALL_HDR_PATH=/home/charles/code/cross-compile/embedded-toolchain/usr headers_install

find /home/charles/code/cross-compile/embedded-toolchain/usr/include/ -name “.install” -or -name “。.install.cmd” | xargs rm -fv ;\

5. 编译 GLIBC

进入到 build/glibc,执行

BUILD_CC=gcc CC=mipsel-linux-gnueabi-gcc AR=mipsel-linux-gnueabi-ar RANLIB=mipsel-linux-gnueabi-ranlib 。./。./src/glibc-2.18/configure --prefix=/usr --host=mipsel-linux --enable-add-ons --with-fp=no libc_cv_forced_unwind=yes libc_cv_c_cleanup=yes libc_cv_ctors_header=yes --with-tune=mips32r2 --with-arch=mips32r2 --with-headers=/home/charles/code/cross-compile/embedded-toolchain/usr/include

把步骤3生成的mipsel gcc 加入到 path:

export PATH=$PATH:/home/charles/code/cross-compile/embedded-toolchain/cross-tools/bin

执行

make

make install install_root=/home/charles/code/cross-compile/embedded-toolchain

6.编译最后的GCC

AR=ar LDFLAGS=“-Wl,-rpath=/home/charles/code/cross-compile/embedded-toolchain/cross-tools/lib” 。./。./src/gcc-4.7.1/configure --prefix=/home/charles/code/cross-compile/embedded-toolchain/cross-tools --target=mipsel-linux-gnueabi --with-sysroot=/home/charles/code/cross-compile/embedded-toolchain --with-gmp=/usr/local --with-mpfr=/usr/local --with-ppl=/usr/local --disable-multilib --disable-libssp --disable-nls --disable-libstdcxx-pch --with-arch=mips32r2 --with-tune=mips32r2 --enable-languages=c,c++ --with-float=soft --with-mips-plt --disable-libgomp --disable-libmudflap --enable-poison-system-directories --enable-symvers=gnu --enable-long-long --enable-threads --enable-shared --enable-lto --enable-__cxa_atexit --with-gnu-as --with-gnu-ld

再执行

make all-gcc -j10 -i -k

make all-target-libgcc

make install-gcc

make install-target-libgcc

make

make install

最后,看一下生成的gcc的信息

。/mipsel-linux-gnueabi-gcc -v

Using built-in specs.

COLLECT_GCC=。/mipsel-linux-gnueabi-gcc

COLLECT_LTO_WRAPPER=/home/charles/toolchain/embedded-toolchain/cross-tools/bin/。./libexec/gcc/mipsel-linux-gnueabi/4.7.1/lto-wrapper

Target: mipsel-linux-gnueabi

Configured with: 。./。./src/gcc-4.7.1/configure --prefix=/home/charles/code/cross-compile/embedded-toolchain/cross-tools --target=mipsel-linux-gnueabi --with-sysroot=/home/charles/code/cross-compile/embedded-toolchain --with-gmp=/usr/local --with-mpfr=/usr/local --with-ppl=/usr/local --disable-multilib --disable-libssp --disable-nls --disable-libstdcxx-pch --with-float=soft --with-arch=mips32r2 --with-tune=mips32r2 --enable-languages=c,c++ --with-float=soft --with-mips-plt --disable-libgomp --disable-libmudflap --enable-poison-system-directories --enable-symvers=gnu --enable-long-long --enable-threads --enable-shared --enable-lto --enable-__cxa_atexit --with-gnu-as --with-gnu-ld

Thread model: posix

gcc version 4.7.1 (GCC)

声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉
  • Linux
    +关注

    关注

    87

    文章

    10942

    浏览量

    206540
  • 开发工具链
    +关注

    关注

    0

    文章

    5

    浏览量

    1569
收藏 人收藏

    评论

    相关推荐

    linux服务器端口怎么开放?

    save 或 sudo systemctl enable iptables 二、firewalld: CentOS/RHEL 7及更新版本: 启动firewalld服务:
    的头像 发表于 12-19 17:21 360次阅读

    linux镜像制作工具

    Linux镜像制作工具是一类非常重要的工具,可以用于创建定制的Linux操作系统镜像。这些工具可以帮助开发人员、系统管理员和
    的头像 发表于 11-23 09:56 712次阅读

    国微芯EDA重磅发布多款自研数字EDA工具及软件系统!

    芯天成版图集成工具EsseDBScope,是基于国微芯EDA统一数据底座研发的标志性工具,本次推出的更新版本,新增了IP merge、LVL、Signal tracing、PG Find short等功能。
    发表于 11-16 10:00 179次阅读
    国微芯EDA重磅发布多款自研数字EDA<b class='flag-5'>工具</b>及软件系统!

    实战经验 | TouchGFX从旧版本更新新版本的方法

    TouchGFX 不断进行软件版本更新,其提供的功能也越来越丰富,有些新的功能只有更新的版本才有,所以很多时候会面临将旧版本的 TouchGFX 迁移到更新版本的问题。在创建 TouchGFX 应用时,生成
    的头像 发表于 11-01 17:15 327次阅读

    基本的Linux仿真环境和交叉编译工具的配置

    基本的Linux仿真环境和交叉编译工具的配置
    发表于 10-09 06:27

    Linux交叉编译选项与源码与目标文件分离

    交叉编译选项 编译Linux,通常只需要运行 make menuconfig 配置要编译的模块,然后运行 make 。Linux默认是做本地编译,也就是编译位本机使用的内核。 在嵌入式开发中,经常
    的头像 发表于 09-27 11:48 366次阅读

    linux下的工具在哪里下载?

    linux下的工具在哪里下载??我看网上的介绍文章说有ubuntu的,另外k-flash在哪里下载?
    发表于 09-15 06:23

    请问Nuclei studio 2022版本是不是不需要HBird SDk环境配置与工具安装了?

    Nuclei studio 2022.2版本是不是不需要HBird SDk环境配置与工具安装了,还是说新版需要装什么不需要装什么,急!(windows和Linux如果不一样的话能分别
    发表于 08-12 07:49

    Linux中生成新的gcc工具后,如何使用链接脚本来生成能够被e203使用的.verilog文件?

    求在Linux中生成新的gcc工具后,如何使用链接脚本来生成能够被e203使用的.verilog文件,希望老师能够提供较为详细的步骤指导,万分感谢!
    发表于 08-12 07:11

    如何使用ARM编译器工具构建Linux应用程序或库?

    以下概述了使用ARM编译器工具构建Linux应用程序或库,并描述了限制和要求
    发表于 08-02 15:34

    求助,有可靠的arm-linux-gcc 4.3.4的交叉编译工具吗?

    有大佬能提供arm-linux-gcc 4.3.4交叉编译工具吗,或者解答下我的疑惑。 我使用N9H26跑linux系统时出现了如下问题:
    发表于 06-19 14:57

    如何定制Buildroot文件系统-基于TQT507开发板

    的可以直接烧写到机器上运行的Linux系统软件(包含boot、kernel、rootfs以及rootfs中的各种库和应用程序)。 Buildboot也可以单独通过配置和使用交叉编译工具
    发表于 06-01 09:03

    嵌入式Linux开发日志:交叉编译工具

    由四大部分组成:交叉编译工具链、BootLoader、内核和根文件系统。今天这篇文章,跟大家介绍下怎么获取和设置交叉编译工具链。
    发表于 05-24 15:43 411次阅读
    嵌入式<b class='flag-5'>Linux</b>开发日志:<b class='flag-5'>交叉</b>编译<b class='flag-5'>工具</b>链

    交叉编译之LoongArch(Makefile,CMake,AutoTool等方式)

    mips架构),目前mips64el用的交叉编译工具是mips64el-linux-gcc-8.x.tar.gz 命令如下: export PATH=$PATH:/opt
    发表于 05-07 18:55

    imx-v4l2-overlay.c编译错误“linux/mxcfb.h,没有这样的文件或目录是为什么?

    在我独立编译imx-v4l2-overlay的时候。c、交叉编译器报告mxcfb. 找不到 h 文件。这个文件在linux源码中可以找到,但是在交叉编译工具
    发表于 04-17 06:10