嵌入式开发 centos7 交叉编译环境准备

1. 安装centos7,启动图像化界面。

参考:https://blog.csdn.net/qq_23014435/article/details/74347925

# systemctl get-default //获取当前系统启动模式

更改模式命令:systemctl set-default graphical.target由命令行模式更改为图形界面模式

                         systemctl set-default multi-user.target由图形界面模式更改为命令行模式

重启机器获得想要的启动界面。

2. centos7 安装samba

参考:https://www.cnblogs.com/hnxxcxg/p/6841778.html

  关闭防火墙:systemctl disable firewalld.service

  or  添加防火墙规则: firewall-cmd --permanent --zone=public --add-service=samba

        firewall-cmd --reload

关闭selinux: vim /etc/selinux/config   设置:SELINUX=disabled

##############################################################

3.安装arm-linux-gcc 

将 压缩包  tar zxvf xxx.tar  -C / 解压到根目录下

在  /root/.bashrc 下添加  export PATH=$PATH:/usr/local/arm/x.x.x/bin

source /root/.bashrc

4.安装arm  linux gdb server.

解压 tar zxvf  xxx.tar.gz

cd  arm-gdb-x.x

./buildall

##################################################################

第三步第四步,比较老的方式,新的方式参见:GNU  MCU Eclipse

####################################################################

https://gnu-mcu-eclipse.github.io/toolchain/arm/install/

3.介绍一下 xpm package manager

https://www.npmjs.com/package/xpm

xpm is a Node.js CLI application to manage xPacks.

xPacks are general purpose software C/C++ packages, intended to enhance code sharingand reusing during the development of C/C++ libraries and applications, much the same as npm modules do so nicely in the JavaScript ecosystem.

Xpacks类似于 javascript 生态圈的 npm ,旨在提高C/C++ 包管理,代码分享的效率和代码的重用性。

 4.如何在linux 系统上安装xpm 包管理工具呢?

       首先逃不开的还是要linux系统上安装npm 包管理工具,然后用npm 去安装xpm----OMG!!!。

       https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-a-centos-7-server

       (1) 安装 node.js

        这里我们不用源码安装的方式,也不采用预编译的包的方式 而是采用最简单的

       ###############坑###########  EPEL Repository 不是最新版本的 nodejs##########

         Install a Package from the EPEL Repository

          sudo yum install epel-release

          sudo yum install nodejs

      ###############################坑############################改用 预编译包的形式

       下载 LTS 版本的  https://nodejs.org/download/release/latest-dubnium/

         sudo tar --strip-components 1 -xzvf node-v* -C /usr/local

      

         检查nodejs 版本

         node --version

          v10.14.2

        (2)安装 xpm  参考: https://www.npmjs.com/package/xpm   

   $ mkdir -p "${HOME}"/Library/npm
   $ npm config set prefix "${HOME}"/Library/npm $ echo 'export PATH="${HOME}"/Library/npm/bin:${PATH}' >> "${HOME}"/.profile $ source "${HOME}"/.profile

npm install --global xpm

         检查 xpm 版本

       xpm --version

        0.4.5

        (3) 利用xpm 安装交叉工具链

             参考:https://gnu-mcu-eclipse.github.io/toolchain/arm/install/

           xpm install --global @gnu-mcu-eclipse/arm-none-eabi-gcc

          墙内速度比较慢: 参考github主页 https://github.com/gnu-mcu-eclipse/arm-none-eabi-gcc/releases

    去github主页下载下来手动安装方法:

    

GNU/Linux

The GNU/Linux versions of GNU MCU Eclipse ARM Embedded GCC are packed as .tgz archives. Download the latest version named like:

  • gnu-mcu-eclipse-arm-none-eabi-gcc-7.2.1-1.1-20180401-0515-centos64.tgz
  • gnu-mcu-eclipse-arm-none-eabi-gcc-7.2.1-1.1-20180401-0515-centos32.tgz

As the name implies, the binaries were created on CentOS, but can be executed on most recent GNU/Linux distributions (they were tested on Debian, Ubuntu, Manjaro, SuSE and Fedora). Select the -centos64 file for 64-bit machines and the -centos32 file for 32-bit machines.

To install the toolchain, unpack the archive and copy it to /${HOME}/opt/gnu-mcu-eclipse/arm-none-eabi-gcc/:

$ mkdir -p "${HOME}"/opt $ cd "${HOME}"/opt $ tar xf ~/Downloads/gnu-mcu-eclipse-arm-none-eabi-gcc-7.2.1-1.1-20180401-0515-debian64.tgz $ chmod -R -w "${HOME}"/opt/gnu-mcu-eclipse/arm-none-eabi-gcc/7.2.1-1.1-20180401-0515

测试是否安装成功的方法:
$ "${HOME}"/opt/gnu-mcu-eclipse/arm-none-eabi-gcc/7.2.1-1.1-20180401-0515/bin/arm-none-eabi-gcc --version arm-none-eabi-gcc (GNU MCU Eclipse ARM Embedded GCC, 64-bit)
 

           

猜你喜欢

转载自www.cnblogs.com/qifei-liu/p/10173860.html