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


时间有点久
3、安装sdk
  1. root@ubuntu:/opt/sdk# ./poky-glibc-x86_64-myir-image-full-aarch64-myir-remi-1g-toolchain-3.1.20.sh
  2. Poky (Yocto Project Reference Distro) SDK installer version 3.1.20
  3. ==================================================================
  4. Enter target directory for SDK (default: /opt/poky/3.1.20):
  5. You are about to install the SDK to "/opt/poky/3.1.20". Proceed [Y/n]? y
  6. Extracting SDK...................................................................................................................................................................................................................................................................................................................................................................................................................................................................done
  7. Setting it up...done
  8. SDK has been successfully set up and is ready to be used.
  9. Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g.
  10. $ . /opt/poky/3.1.20/environment-setup-aarch64-poky-linux
  11. $ . /opt/poky/3.1.20/environment-setup-armv7vet2hf-neon-vfpv4-pokymllib32-linux-gnueabi
  12. root@ubuntu:/opt/sdk# source /opt/poky/3.1.20/environment-setup-a
  13. environment-setup-aarch64-poky-linux
  14. environment-setup-armv7vet2hf-neon-vfpv4-pokymllib32-linux-gnueabi
  15. root@ubuntu:/opt/sdk# source /opt/poky/3.1.20/environment-setup-a
  16. environment-setup-aarch64-poky-linux
  17. environment-setup-armv7vet2hf-neon-vfpv4-pokymllib32-linux-gnueabi
  18. root@ubuntu:/opt/sdk# source /opt/poky/3.1.20/environment-setup-a
  19. environment-setup-aarch64-poky-linux
  20. environment-setup-armv7vet2hf-neon-vfpv4-pokymllib32-linux-gnueabi
  21. root@ubuntu:/opt/sdk# source /opt/poky/3.1.20/environment-setup-a
  22. environment-setup-aarch64-poky-linux
  23. environment-setup-armv7vet2hf-neon-vfpv4-pokymllib32-linux-gnueabi
  24. root@ubuntu:/opt/sdk# source /opt/poky/3.1.20/environment-setup-a
  25. environment-setup-aarch64-poky-linux
  26. environment-setup-armv7vet2hf-neon-vfpv4-pokymllib32-linux-gnueabi
  27. root@ubuntu:/opt/sdk# source /opt/poky/3.1.20/environment-setup-a
  28. environment-setup-aarch64-poky-linux
  29. environment-setup-armv7vet2hf-neon-vfpv4-pokymllib32-linux-gnueabi
  30. root@ubuntu:/opt/sdk# source /opt/poky/3.1.20/environment-setup-a
  31. environment-setup-aarch64-poky-linux
  32. environment-setup-armv7vet2hf-neon-vfpv4-pokymllib32-linux-gnueabi
  33. root@ubuntu:/opt/sdk# source /opt/poky/3.1.20/environment-setup-a
  34. environment-setup-aarch64-poky-linux
  35. environment-setup-armv7vet2hf-neon-vfpv4-pokymllib32-linux-gnueabi
  36. root@ubuntu:/opt/sdk# source /opt/poky/3.1.20/environment-setup-a
  37. environment-setup-aarch64-poky-linux
  38. environment-setup-armv7vet2hf-neon-vfpv4-pokymllib32-linux-gnueabi
  39. root@ubuntu:/opt/sdk# source /opt/poky/3.1.20/environment-setup-a
  40. environment-setup-aarch64-poky-linux
  41. environment-setup-armv7vet2hf-neon-vfpv4-pokymllib32-linux-gnueabi
  42. root@ubuntu:/opt/sdk# source /opt/poky/3.1.20/environment-setup-a
  43. environment-setup-aarch64-poky-linux
  44. environment-setup-armv7vet2hf-neon-vfpv4-pokymllib32-linux-gnueabi
4、加载sdk
  1. root@ubuntu:/opt/sdk# source /opt/poky/3.1.20/environment-setup-armv7vet2hf-neon-vfpv4-pokymllib32-linux-gnueabi

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