px4 linux,Pixhawk原生固件PX4之一个脚本搞定Linux系统的环境配置

#!/bin/bash

## Bash script for setting up a PX4 development environment for Pixhawk/NuttX targets on Ubuntu LTS (16.04).

## It can be used for installing simulators and the NuttX toolchain.

##

## 这是用于在Ubuntu16.04s上为Pixhawk/Nuttx设置PX4开发环境的的Bash脚本

## 它可以用于安装模拟器以及Nuttx工具链

##

## Installs:

## - Common dependencies libraries, tools, and Gazebo8 simulator as defined in `ubuntu_sim.sh`

## - NuttX toolchain (i.e. gcc compiler)

## 安装说明:

## - 一般依赖库,工具,以及Gazebo8模拟器(在脚本ubuntu_sim.sh)

## - Nuttx工具链

echo "Downloading dependent script 'ubuntu_sim.sh'"

# Source the ubuntu_sim.sh script directly from github

# 从github上下载ubuntu_sim.sh脚本并source使其立即生效

ubuntu_sim=$(wget https://raw.githubusercontent.com/PX4/Devguide/master/build_scripts/ubuntu_sim.sh -O -)

wget_return_code=$?

# If there was an error downloading the dependent script, we must warn the user and exit at this point.

if [[ $wget_return_code -ne 0 ]]; then echo "Error downloading 'ubuntu_sim.sh'. Sorry but I cannot proceed further :("; exit 1; fi

# Otherwise source the downloaded script.

.

# NuttX

# 下载NuttX工具链

sudo apt-get install python-serial openocd \

flex bison libncurses5-dev autoconf texinfo \

libftdi-dev libtool zlib1g-dev -y

# Clean up old GCC

# 清除旧的GCC编译器

sudo apt-get remove gcc-arm-none-eabi gdb-arm-none-eabi binutils-arm-none-eabi gcc-arm-embedded -y

sudo add-apt-repository --remove ppa:team-gcc-arm-embedded/ppa -y

# Install GCC 5.4

# 安装GCC 5.4

gcc_dir=$HOME/gcc-arm-none-eabi-5_4-2016q2

echo "Installing GCC to: $gcc_dir"

if [ -d "$gcc_dir" ]

then

echo " GCC already installed."

else

pushd .

cd ~

wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/5_4-2016q2/gccarmnoneeabi542016q220160622linuxtar.bz2

tar -jxf gccarmnoneeabi542016q220160622linuxtar.bz2

exportline="export PATH=$HOME/gcc-arm-none-eabi-5_4-2016q2/bin:\$PATH"

if grep -Fxq "$exportline" ~/.profile; then echo " GCC path already set." ; else echo $exportline >> ~/.profile; fi

. ~/.profile

popd

# Install 32 bit support libraries (ignore if fails)

# 安装32位支持库

sudo dpkg --add-architecture i386

sudo apt-get update

sudo apt-get install libc6:i386 libgcc1:i386 libstdc++5:i386 libstdc++6:i386 -y

sudo apt-get install gcc-5.4-base:i386 -y

fi

# Go to the firmware directory

# 进入固件目录,在其他上面的脚本中clone了PX4固件

cd $clone_dir/Firmware

# Reboot the computer (required before building)

# 提示重启电脑

echo RESTART YOUR COMPUTER to complete installation of PX4 development toolchain

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值