安装包也可以关注公众号:一口Linux
后台回复 :ubuntu

一、环境搭建

环境的安装需要安装以下几个软件:

  1. vmware:在该软件中可以安装其他操作系统
  2. ubuntu 16.04:编译程序都在ubuntu中编译
  3. 交叉编译器:编译能在开发板上运行的代码,需要安装该工具。

1. vmware安装

下载地址
https://www.vmware.com/go/getworkstation-win

安装步骤

(1)双击VMware-workstation-full.exe,然后下一步
linux环境搭建-ubuntu16.04安装_ubuntu16

(2)勾选我接受许可协议,下一步

linux环境搭建-ubuntu16.04安装_系统安装_02

(3)更改软件的安装位置,下一步 或者不更改位置直接下一步

linux环境搭建-ubuntu16.04安装_系统安装_03

(4)如不想自动检查更新软件的话,不勾选直接下一步

linux环境搭建-ubuntu16.04安装_ubuntu16_04

(5)两个勾打上在桌面和菜单栏创建软件图标,下一步

linux环境搭建-ubuntu16.04安装_ubuntu16_05

(6)下一步之后选择安装

linux环境搭建-ubuntu16.04安装_系统安装_06

(7)完成安装

linux环境搭建-ubuntu16.04安装_系统安装_07

(8)然后双击启动VMware输入密钥
linux环境搭建-ubuntu16.04安装_系统安装_08

linux环境搭建-ubuntu16.04安装_系统安装_09

点击我希望试用即可。

2. ubuntu

下载地址:
http://mirrors.aliyun.com/ubuntu-releases/20.04.2/ubuntu-20.04.2.0-desktop-amd64.iso

linux环境搭建-ubuntu16.04安装_系统安装_10
linux环境搭建-ubuntu16.04安装_ubuntu16_11

linux环境搭建-ubuntu16.04安装_ubuntu16_12
linux环境搭建-ubuntu16.04安装_系统安装_13

linux环境搭建-ubuntu16.04安装_系统安装_14

linux环境搭建-ubuntu16.04安装_系统安装_15

linux环境搭建-ubuntu16.04安装_系统安装_16

linux环境搭建-ubuntu16.04安装_系统安装_17

linux环境搭建-ubuntu16.04安装_系统安装_18

3. 安装必备工具

为了方便拷贝文件到ubuntu中,还需要安装vm-tools,执行以下命令:
鼠标点进ubuntu任意位置,然后按下组合键:ctrl+alt + t,即可打开命令终端。
执行以下命令

peng@ubuntu:~$sudo apt-get autoremove open-vm-tools
peng@ubuntu:~$sudo apt-get install open-vm-tools-desktop

会提示输入密码,输入之前安装的设置的密码即可。

3. 安装交叉编译工具

执行以下操作:
创建目录toolchain,并修改权限

1. root@ubuntu:/home/peng# mkdir toolchain2. root@ubuntu:/home/peng# chmod 777 toolchain

linux环境搭建-ubuntu16.04安装_ubuntu16_19

将gcc-4.6.4.tar.xz拷贝到toolchain目录下。
linux环境搭建-ubuntu16.04安装_系统安装_20

解压该压缩包:

root@ubuntu:/home/peng# cd toolchain/root@ubuntu:/home/peng/toolchain# tar xvf gcc-4.6.4.tar.xz

修改文件/etc/bash.bashrc添加如下内容

export  PATH=$PATH:/home/peng/toolchain/gcc-4.6.4/bin

重启配置文件:

root@ubuntu:/home/peng/toolchain#source  /etc/bash.bashrc

安装库第三方库:

root@ubuntu:/home/peng/toolchain# apt-get install lsb-core

工具链的测试:

root@ubuntu:/home/peng/toolchain# arm-none-linux-gnueabi-gcc  –v

得到以下结果,说明安装成功:

root@ubuntu:/home/peng/toolchain# arm-none-linux-gnueabi-gcc -v
Using built-in specs.COLLECT_GCC=arm-none-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/home/peng/toolchain/gcc-4.6.4/bin/../libexec/gcc/arm-arm1176jzfssf-linux-gnueabi/4.6.4/lto-wrapper
Target: arm-arm1176jzfssf-linux-gnueabi
Configured with: /work/builddir/src/gcc-4.6.4/configure --build=i686-build_pc-linux-gnu --host=i686-build_pc-linux-gnu --target=arm-arm1176jzfssf-linux-gnueabi --prefix=/opt/TuxamitoSoftToolchains/arm-arm1176jzfssf-linux-gnueabi/gcc-4.6.4 --with-sysroot=/opt/TuxamitoSoftToolchains/arm-arm1176jzfssf-linux-gnueabi/gcc-4.6.4/arm-arm1176jzfssf-linux-gnueabi/sysroot --enable-languages=c,c++ --with-arch=armv6zk --with-cpu=arm1176jzf-s --with-tune=arm1176jzf-s --with-fpu=vfp --with-float=softfp --with-pkgversion='crosstool-NG hg+default-2685dfa9de14 - tc0002' --disable-sjlj-exceptions --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --disable-libquadmath --disable-libquadmath-support --with-gmp=/work/builddir/arm-arm1176jzfssf-linux-gnueabi/buildtools --with-mpfr=/work/builddir/arm-arm1176jzfssf-linux-gnueabi/buildtools --with-mpc=/work/builddir/arm-arm1176jzfssf-linux-gnueabi/buildtools --with-ppl=/work/builddir/arm-arm1176jzfssf-linux-gnueabi/buildtools --with-cloog=/work/builddir/arm-arm1176jzfssf-linux-gnueabi/buildtools --with-libelf=/work/builddir/arm-arm1176jzfssf-linux-gnueabi/buildtools --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --enable-threads=posix --enable-target-optspace --without-long-double-128 --disable-nls --disable-multilib --with-local-prefix=/opt/TuxamitoSoftToolchains/arm-arm1176jzfssf-linux-gnueabi/gcc-4.6.4/arm-arm1176jzfssf-linux-gnueabi/sysroot --enable-c99 --enable-long-longThread model: posix
gcc version 4.6.4 (crosstool-NG hg+default-2685dfa9de14 - tc0002)