前言:之前用的VMware 10+在华清远见培训时老师给配好的Ubuntu 12.04。然后这次参加研电赛时,选用企业命题,使用的是匠牛社区工业派的东西,官方说他们用的系统环境是Ubuntu 16/18的,就萌生了想更新一下软件环境的想法。
1、VMware 14安装:
我之前有VMware 10,参考了CSDN网友的方案,下载安装VMware 14的时候,自动识别的之前安装了VMware10,就升级就可以了,最后产品密匙填一下就OK了。
参考:VMware14中文破解版,CSDN网友方案:https://blog.csdn.net/qq_31362105/article/details/80706096
2、Ubuntu 18.04 lts安装
直接去官网下载Ubuntu 18.04 lts 镜像,地址:https://www.ubuntu.com/download/desktop
虚拟机安装Ubuntu,网上资料很多,都可参考,如有问题,可留言交流
这都不是重点,重点是安装好新的Ubuntu后,装gcc等各种嵌入式开发相关的工具,麻烦的很。我根据我装的过程,记录了下来,或许假以时日,还会有用。
上述环境装完后,配置下共享文件夹,共享文件夹配置方法网上很多,也不再累述,但可以交流。
系统安装完成过后,网络在虚拟机内直接可用,真好。如果不能用,还需要首先配置下网络,否则后边没法apt-get命令下载更新软件。
这我安装好的虚拟机:
以上都不是重点。重点是那些嵌入式开发常用的工具,都怎么装。
1、安装GCC
这也是第一次重头开始弄环境,所以也是摸着石头过河,遇到什么弄什么。之间发生的很多问题百度或者csdn,有的也懵懵懂懂,到现在有的问题我也没办法解释很清楚为什么,为什么就。。。突然好了。。。
上边是依赖关系,所以安装顺序应该是:
m4->gmp->mpfr->mpc->gcc
相关网址:m4 可以直接使用apt-get工具。
mpc依赖gmp和mpfr,下载网址:
GMP: https://gmplib.org/download/gmp/gmp-6.1.2.tar.lz
MPFR: https://www.mpfr.org/mpfr-current/mpfr-4.0.2.tar.xz
MPC: http://www.multiprecision.org/mpc/download.html
GCC: https://gcc.gnu.org/
得到文件:
gmp-6.1.2.tar.lz
mpc-1.10.tar.gz
mpfr-4.0.2.tar.xz
将文件移动到 /usr/local下,进行工作。
安装解压工具 sudo apt-get install lzip
解压 gmp-6.1.2.tar.lz 分两步:
lzip -dv gmp-6.1.2.tar.lz 得到 gmp-6.1.2.tar
tar -xvf gmp-6.1.2.tar 得到gmp-6.1.2文件夹
解压 mpc-1.10.tar.gz:
tar -xzvf mpc-1.10.tar.gz 得到mpc-1.10文件夹
解压mpfr-4.0.2.tar.xz 分两步:
xz -dv mpfr-4.0.2.tar.xz 得到mpfr-4.0.2.tar
tar -xvf mpfr-4.0.2.tar 得到mpfr-4.0.2文件夹
1.1安装gmp:
#cd gmp-6.1.2
#mkdir temp
#cd temp
#../configure --prefix=/usr/local/gmp-6.1.2
#make
#make check
检查没有错误,就
#make install
如果#../configure --prefix=/usr/local/gmp-6.1.2出错,查看config.log和编译过程,和别人的对比,查找出错原因
错误1:“checking for gawk... no”。
安装gawk:sudo apt-get install gawk。
错误2:“checking whether make sets $(MAKE)... no”。
安装make:sudo apt-get install make。
错误n:反正还是出不来makefile文件,所以尝试了更新apt源
更新了apt下载源:
百度source.list源
备份source.list为source.list.db
将百度的源地址 复制到 source.list 后边,命令可以用:cat /地址/new >>/etc/apt/ source.list
sudo apt-get update
sudo apt-get upgrade
有的包不能更新,使用了推荐的方式:
sudo apt-get update --fix-missing
sudo apt-get upgrade
更新后,先直接用aptitude安装了gcc,貌似竟然直接成功了。。。
但是奇怪gmp -v显示并没有安装,为什么直接能安装gcc
然后执行#../configure --prefix=/usr/local/gmp-6.1.2
出来了makefile ,进而make,make install
写入环境变量:
~/.bashrc改变当前用户的环境变量
/etc/profile改变所有用户的环境变量
#vim /etc/profile
最后一行添加:
export LD_LIBRARY_PATH=/usr/local/gmp-6.1.2/lib:$LD_LIBRARY_PATH
保存退出,source一下
#source /etc/profile
虽然貌似成功的安装了gcc,但是不放心,还是把依赖都装了一遍。
1.2安装mpfc:
同样建立文件夹:
#mkdir temp
#cd temp
#../configure --prefix=/usr/local/mpfr-3.1.0 --with-gmp=/usr/local/gmp-5.0.1
#make
#make check
#make install
1.3安装mpc:
同样建立文件夹:
#mkdir temp
#cd temp
#../configure --prefix=/usr/local/mpc-1.0.2 --with-gmp=/usr/local/gmp-5.0.1 --with-mpfr=/usr/local/mpfr-3.1.0
#make
#make check
#make install
2、使用apt-get安装的其它东西:
Vim:sudo apt-get install vim
ssh :sudo apt-get install openssh-server
gcc/g++:sudo apt-get install build-essential
串口工具:sudo apt-get install cutecom
编译linux kernel需要安装u-boot-tools:sudo apt-get install u-boot-tools
版本控制:sudo apt-get install git
git:sudo apt-get install git
u-boot-tools:sudo apt-get install u-boot-tools
3、未安装,但可能有用的东西
3.1 制作根文件系统需要安装mtd工具
如 mtd-utils等
apt-get install zlib1g-dev liblzo2-dev uuid-dev
到http://www.linux-mtd.infradead.org/source.html下载source
解压
export WITHOUT_XATTR=1 或者make后面加入CFLAGS编译选项"-DWITHOUT_XATTR"
make
make install
3.2 编译一些开源代码,如,含有m4、autoconfig、automake等配置文件,需要运行./autogen.sh
sudo apt-get install autoconf automake libtool
3.3 ubuntu16.04编译mtd-utils时出现.....bin/as: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory错误
可安装:
sudo apt-get install lib32z1
3.4 安装nfs服务器
a.sudo apt-get install nfs-kernel-server portmap
b.sudo vim /etc/experts在最后添加如下内容:
/home/default/work/nfs_rootfs/ *(rw,sync,no_root_squash)
c.sudo /etc/init.d/nfs-kernel-server restart ,重启服务