目录
3.mipsel-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not de
前言
编译完的openwrt Image包含了平台交叉编译器等,本文主要说交叉编译的位置和安装方法
一、关于openwrt源码获取和编译
详情参考:https://openwrt.org/docs/guide-developer/quickstart-build-images 这是openwrt的官方网址按着步骤下载和编译就可以
二、编译完的交叉编译器工具位置
首先到 Image的位置:/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/bin
三、添加交叉编译器路径到环境变量
1. /etc/profile 用来设置系统环境参数,比如$PATH. 这里面的环境变量是对系统内所有用户生效的。
2. /etc/bashrc 这个文件设置系统bash shell相关的东西,对系统内所有用户生效。只要用户运行bash命令,那么这里面的东西就在起作用。
查看交叉编译器的路径:pwd
forlinx@ubuntu:~/lorawan/openwrt/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/bin$ pwd
/home/forlinx/lorawan/openwrt/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/bin
查看交叉编译器的名称:/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/bin
ls
1.添加bash环境变量(推荐)
注意:重登shell界面生效
sudo vi /etc/bash.bashrc
直接在文件底部添加路径
生效
source /etc/bash.bashrc
查看安装
mipsel-openwrt-linux-gcc -v
输出安装信息
2.添加全局环境变量
注意:添加到这里要重启系统/虚拟机才能生效
sudo vim /etc/profile
这里的路径是我的Image路径,注意自己的路径,在文件最后添加路径
export PATH=/home/forlinx/lorawan/openwrt/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/bin:$PATH
source /etc/bash.bashrc
安装版本查看
mipsel-openwrt-linux-gcc -v
3.mipsel-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not de
追加到全局变量的后面
sudo vim /etc/profile
注意:自己工具链的路径
export STAGING_DIR=home/will/workspeace/4grouter/openwrt/staging_dir/toolchain-mipsel_24kc_gcc-8.4.0_musl/bin:$STAGING_DIR