1、把sdk包上传给虚拟机。
2、解压sdk包:
root@ubuntu:/opt# tar -xvf sdk.tar.bz2
  • sdk/
  • sdk/poky-glibc-x86_64-myir-image-full-aarch64-myir-remi-1g-toolchain-3.1.20.sh


  • 复制代码
    时间有点久
    3、安装sdk
    root@ubuntu:/opt/sdk# ./poky-glibc-x86_64-myir-image-full-aarch64-myir-remi-1g-toolchain-3.1.20.sh
  • Poky (Yocto Project Reference Distro) SDK installer version 3.1.20
  • ==================================================================
  • Enter target directory for SDK (default: /opt/poky/3.1.20):
  • You are about to install the SDK to "/opt/poky/3.1.20". Proceed [Y/n]? y
  • Extracting SDK...................................................................................................................................................................................................................................................................................................................................................................................................................................................................done
  • Setting it up...done
  • SDK has been successfully set up and is ready to be used.
  • Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g.
  • $ . /opt/poky/3.1.20/environment-setup-aarch64-poky-linux
  • $ . /opt/poky/3.1.20/environment-setup-armv7vet2hf-neon-vfpv4-pokymllib32-linux-gnueabi
  • root@ubuntu:/opt/sdk# source /opt/poky/3.1.20/environment-setup-a
  • environment-setup-aarch64-poky-linux
  • environment-setup-armv7vet2hf-neon-vfpv4-pokymllib32-linux-gnueabi
  • root@ubuntu:/opt/sdk# source /opt/poky/3.1.20/environment-setup-a
  • environment-setup-aarch64-poky-linux
  • environment-setup-armv7vet2hf-neon-vfpv4-pokymllib32-linux-gnueabi
  • root@ubuntu:/opt/sdk# source /opt/poky/3.1.20/environment-setup-a
  • environment-setup-aarch64-poky-linux
  • environment-setup-armv7vet2hf-neon-vfpv4-pokymllib32-linux-gnueabi
  • root@ubuntu:/opt/sdk# source /opt/poky/3.1.20/environment-setup-a
  • environment-setup-aarch64-poky-linux
  • environment-setup-armv7vet2hf-neon-vfpv4-pokymllib32-linux-gnueabi
  • root@ubuntu:/opt/sdk# source /opt/poky/3.1.20/environment-setup-a
  • environment-setup-aarch64-poky-linux
  • environment-setup-armv7vet2hf-neon-vfpv4-pokymllib32-linux-gnueabi
  • root@ubuntu:/opt/sdk# source /opt/poky/3.1.20/environment-setup-a
  • environment-setup-aarch64-poky-linux
  • environment-setup-armv7vet2hf-neon-vfpv4-pokymllib32-linux-gnueabi
  • root@ubuntu:/opt/sdk# source /opt/poky/3.1.20/environment-setup-a
  • environment-setup-aarch64-poky-linux
  • environment-setup-armv7vet2hf-neon-vfpv4-pokymllib32-linux-gnueabi
  • root@ubuntu:/opt/sdk# source /opt/poky/3.1.20/environment-setup-a
  • environment-setup-aarch64-poky-linux
  • environment-setup-armv7vet2hf-neon-vfpv4-pokymllib32-linux-gnueabi
  • root@ubuntu:/opt/sdk# source /opt/poky/3.1.20/environment-setup-a
  • environment-setup-aarch64-poky-linux
  • environment-setup-armv7vet2hf-neon-vfpv4-pokymllib32-linux-gnueabi
  • root@ubuntu:/opt/sdk# source /opt/poky/3.1.20/environment-setup-a
  • environment-setup-aarch64-poky-linux
  • environment-setup-armv7vet2hf-neon-vfpv4-pokymllib32-linux-gnueabi
  • root@ubuntu:/opt/sdk# source /opt/poky/3.1.20/environment-setup-a
  • environment-setup-aarch64-poky-linux
  • environment-setup-armv7vet2hf-neon-vfpv4-pokymllib32-linux-gnueabi
  • 复制代码
    4、加载sdk
    root@ubuntu:/opt/sdk# source /opt/poky/3.1.20/environment-setup-armv7vet2hf-neon-vfpv4-pokymllib32-linux-gnueabi
    复制代码

    5、检验sdk是否正确安装
    root@ubuntu:/opt/sdk# $CC -v
  • 复制代码
    在输出信息的最后,显示gcc version 8.3.0(GCC)说明安装成功。
    image.png
    6、创建文件,并验证:
    image.png
    image.png
    说明编译是成功的。上传到开发板,执行也是对的:
    image.png
    到此安装sdk成功,可以实现用c来交叉编译运行程序了。