嵌入式开发 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)
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· go语言实现终端里的倒计时
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
· 【杂谈】分布式事务——高大上的无用知识?