SDK包括交叉工具链,以及编译需要的根文件系统,其中有如头文件,库等。

不同版本对安装SDK的主机要求不同,请阅读对应版本的release notes,如 PD20.1.2 。这里以PD20.1.2为例。

  • Ubuntu 18.04 64位
  • 600G以上空余空间
  • 13GB内存
  • 8核或以上
  • 可在linux下访问SD卡
  • 可访问互联网

注意以下操作均在ubuntu的终端中进行操作,除非特殊声明否则不能使用root用户或者sudo来执行。

主机配置

在主机安装以下软件

sudo apt-get update
sudo apt-get install xinetd tftpd nfs-kernel-server minicom build-essential libncurses5-dev autoconf automake dos2unix screen lrzsz lzop flex libssl-dev u-boot-tools
操作记录
bob@u18:~$ sudo apt-get update
[sudo] password for bob:
Hit:1 http://cn.archive.ubuntu.com/ubuntu bionic InRelease
Hit:2 http://cn.archive.ubuntu.com/ubuntu bionic-updates InRelease
Hit:3 http://cn.archive.ubuntu.com/ubuntu bionic-backports InRelease
Hit:4 http://cn.archive.ubuntu.com/ubuntu bionic-security InRelease
Reading package lists... Done

bob@u18:~/sdk/bin$ sudo apt-get install xinetd tftpd nfs-kernel-server minicom build-essential libncurses5-dev autoconf automake dos2unix screen lrzsz lzop flex libssl-dev u-boot-tools
[sudo] password for bob:
Reading package lists... Done
Building dependency tree
Reading state information... Done
screen is already the newest version (4.6.2-1ubuntu1.1).
screen set to manually installed.
The following additional packages will be installed:
  autotools-dev binutils binutils-common binutils-x86-64-linux-gnu cpp cpp-7 device-tree-compiler dpkg-dev fakeroot g++ g++-7 gcc gcc-7 gcc-7-base
  keyutils libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan4 libatomic1 libbinutils libc-dev-bin libc6 libc6-dev
  libcc1-0 libcilkrts5 libdpkg-perl libfakeroot libfile-copy-recursive-perl libfile-fcntllock-perl libfl-dev libfl2 libgcc-7-dev libgomp1 libisl19
  libitm1 liblsan0 libmpc3 libmpx2 libnfsidmap2 libquadmath0 libstdc++-7-dev libtinfo-dev libtirpc1 libtsan0 libubsan0 linux-libc-dev m4 make
  manpages-dev nfs-common rpcbind update-inetd
Suggested packages:
  autoconf-archive gnu-standards autoconf-doc libtool gettext binutils-doc cpp-doc gcc-7-locales debian-keyring bison flex-doc g++-multilib
  g++-7-multilib gcc-7-doc libstdc++6-7-dbg gcc-multilib gdb gcc-doc gcc-7-multilib libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan4-dbg
  liblsan0-dbg libtsan0-dbg libubsan0-dbg libcilkrts5-dbg libmpx2-dbg libquadmath0-dbg glibc-doc bzr ncurses-doc libssl-doc libstdc++-7-doc m4-doc
  make-doc watchdog
Recommended packages:
  libubootenv-tool
The following NEW packages will be installed:
  autoconf automake autotools-dev binutils binutils-common binutils-x86-64-linux-gnu build-essential cpp cpp-7 device-tree-compiler dos2unix
  dpkg-dev fakeroot flex g++ g++-7 gcc gcc-7 gcc-7-base keyutils libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan4
  libatomic1 libbinutils libc-dev-bin libc6-dev libcc1-0 libcilkrts5 libdpkg-perl libfakeroot libfile-copy-recursive-perl libfile-fcntllock-perl
  libfl-dev libfl2 libgcc-7-dev libgomp1 libisl19 libitm1 liblsan0 libmpc3 libmpx2 libncurses5-dev libnfsidmap2 libquadmath0 libssl-dev
  libstdc++-7-dev libtinfo-dev libtirpc1 libtsan0 libubsan0 linux-libc-dev lrzsz lzop m4 make manpages-dev minicom nfs-common nfs-kernel-server
  rpcbind tftpd u-boot-tools update-inetd xinetd
The following packages will be upgraded:
  libc6
1 upgraded, 66 newly installed, 0 to remove and 29 not upgraded.
Need to get 50.8 MB of archives.
After this operation, 186 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libc6 amd64 2.27-3ubuntu1.6 [2,831 kB]
Get:2 http://cn.archive.ubuntu.com/ubuntu bionic/main amd64 m4 amd64 1.4.18-1 [197 kB]
Get:3 http://cn.archive.ubuntu.com/ubuntu bionic/main amd64 flex amd64 2.6.4-6 [316 kB]
Get:4 http://cn.archive.ubuntu.com/ubuntu bionic/main amd64 autoconf all 2.69-11 [322 kB]
Get:5 http://cn.archive.ubuntu.com/ubuntu bionic/main amd64 autotools-dev all 20180224.1 [39.6 kB]
Get:6 http://cn.archive.ubuntu.com/ubuntu bionic/main amd64 automake all 1:1.15.1-3ubuntu2 [509 kB]
Get:7 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 binutils-common amd64 2.30-21ubuntu1~18.04.7 [197 kB]
Get:8 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libbinutils amd64 2.30-21ubuntu1~18.04.7 [489 kB]
Get:9 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 binutils-x86-64-linux-gnu amd64 2.30-21ubuntu1~18.04.7 [1,839 kB]
Get:10 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 binutils amd64 2.30-21ubuntu1~18.04.7 [3,388 B]
Get:11 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libc-dev-bin amd64 2.27-3ubuntu1.6 [71.9 kB]
Get:12 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 linux-libc-dev amd64 4.15.0-194.205 [990 kB]
Get:13 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libc6-dev amd64 2.27-3ubuntu1.6 [2,587 kB]
Get:14 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 gcc-7-base amd64 7.5.0-3ubuntu1~18.04 [18.3 kB]
Get:15 http://cn.archive.ubuntu.com/ubuntu bionic/main amd64 libisl19 amd64 0.19-1 [551 kB]
Get:16 http://cn.archive.ubuntu.com/ubuntu bionic/main amd64 libmpc3 amd64 1.1.0-1 [40.8 kB]
Get:17 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 cpp-7 amd64 7.5.0-3ubuntu1~18.04 [8,591 kB]
Get:18 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 cpp amd64 4:7.4.0-1ubuntu2.3 [27.7 kB]
Get:19 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libcc1-0 amd64 8.4.0-1ubuntu1~18.04 [39.4 kB]
Get:20 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libgomp1 amd64 8.4.0-1ubuntu1~18.04 [76.5 kB]
Get:21 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libitm1 amd64 8.4.0-1ubuntu1~18.04 [27.9 kB]
Get:22 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libatomic1 amd64 8.4.0-1ubuntu1~18.04 [9,192 B]
Get:23 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libasan4 amd64 7.5.0-3ubuntu1~18.04 [358 kB]
Get:24 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 liblsan0 amd64 8.4.0-1ubuntu1~18.04 [133 kB]
Get:25 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libtsan0 amd64 8.4.0-1ubuntu1~18.04 [288 kB]
Get:26 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libubsan0 amd64 7.5.0-3ubuntu1~18.04 [126 kB]
Get:27 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libcilkrts5 amd64 7.5.0-3ubuntu1~18.04 [42.5 kB]
Get:28 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libmpx2 amd64 8.4.0-1ubuntu1~18.04 [11.6 kB]
Get:29 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libquadmath0 amd64 8.4.0-1ubuntu1~18.04 [134 kB]
Get:30 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libgcc-7-dev amd64 7.5.0-3ubuntu1~18.04 [2,378 kB]
Get:31 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 gcc-7 amd64 7.5.0-3ubuntu1~18.04 [9,381 kB]
Get:32 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 gcc amd64 4:7.4.0-1ubuntu2.3 [5,184 B]
Get:33 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libstdc++-7-dev amd64 7.5.0-3ubuntu1~18.04 [1,471 kB]
Get:34 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 g++-7 amd64 7.5.0-3ubuntu1~18.04 [9,697 kB]
Get:35 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 g++ amd64 4:7.4.0-1ubuntu2.3 [1,568 B]
Get:36 http://cn.archive.ubuntu.com/ubuntu bionic/main amd64 make amd64 4.1-9.1ubuntu1 [154 kB]
Get:37 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libdpkg-perl all 1.19.0.5ubuntu2.4 [212 kB]
Get:38 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 dpkg-dev all 1.19.0.5ubuntu2.4 [607 kB]
Get:39 http://cn.archive.ubuntu.com/ubuntu bionic/main amd64 build-essential amd64 12.4ubuntu1 [4,758 B]
Get:40 http://cn.archive.ubuntu.com/ubuntu bionic/main amd64 libfakeroot amd64 1.22-2ubuntu1 [25.9 kB]
Get:41 http://cn.archive.ubuntu.com/ubuntu bionic/main amd64 fakeroot amd64 1.22-2ubuntu1 [62.3 kB]
Get:42 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 keyutils amd64 1.5.9-9.2ubuntu2.1 [48.1 kB]
Get:43 http://cn.archive.ubuntu.com/ubuntu bionic/main amd64 libalgorithm-diff-perl all 1.19.03-1 [47.6 kB]
Get:44 http://cn.archive.ubuntu.com/ubuntu bionic/main amd64 libalgorithm-diff-xs-perl amd64 0.04-5 [11.1 kB]
Get:45 http://cn.archive.ubuntu.com/ubuntu bionic/main amd64 libalgorithm-merge-perl all 0.08-3 [12.0 kB]
Get:46 http://cn.archive.ubuntu.com/ubuntu bionic/main amd64 libfile-copy-recursive-perl all 0.40-1 [16.9 kB]
Get:47 http://cn.archive.ubuntu.com/ubuntu bionic/main amd64 libfile-fcntllock-perl amd64 0.22-3build2 [33.2 kB]
Get:48 http://cn.archive.ubuntu.com/ubuntu bionic/main amd64 libfl2 amd64 2.6.4-6 [11.4 kB]
Get:49 http://cn.archive.ubuntu.com/ubuntu bionic/main amd64 libfl-dev amd64 2.6.4-6 [6,320 B]
Get:50 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libtinfo-dev amd64 6.1-1ubuntu1.18.04 [81.3 kB]
Get:51 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libncurses5-dev amd64 6.1-1ubuntu1.18.04 [174 kB]
Get:52 http://cn.archive.ubuntu.com/ubuntu bionic/main amd64 libnfsidmap2 amd64 0.25-5.1 [27.2 kB]
Get:53 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libssl-dev amd64 1.1.1-1ubuntu2.1~18.04.20 [1,568 kB]
Get:54 http://cn.archive.ubuntu.com/ubuntu bionic-updates/universe amd64 lrzsz amd64 0.12.21-10~build0.18.04.1 [74.8 kB]
Get:55 http://cn.archive.ubuntu.com/ubuntu bionic/universe amd64 lzop amd64 1.03-4 [39.8 kB]
Get:56 http://cn.archive.ubuntu.com/ubuntu bionic/main amd64 manpages-dev all 4.15-1 [2,217 kB]
Get:57 http://cn.archive.ubuntu.com/ubuntu bionic/universe amd64 minicom amd64 2.7.1-1 [239 kB]
Get:58 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 libtirpc1 amd64 0.2.5-1.2ubuntu0.1 [75.7 kB]
Get:59 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 rpcbind amd64 0.2.3-0.6ubuntu0.18.04.4 [42.1 kB]
Get:60 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 nfs-common amd64 1:1.3.4-2.1ubuntu5.5 [206 kB]
Get:61 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 nfs-kernel-server amd64 1:1.3.4-2.1ubuntu5.5 [93.8 kB]
Get:62 http://cn.archive.ubuntu.com/ubuntu bionic/universe amd64 xinetd amd64 1:2.3.15.3-1 [108 kB]
Get:63 http://cn.archive.ubuntu.com/ubuntu bionic/universe amd64 tftpd amd64 0.17-18ubuntu3 [14.3 kB]
Get:64 http://cn.archive.ubuntu.com/ubuntu bionic-updates/main amd64 u-boot-tools amd64 2020.10+dfsg-1ubuntu0~18.04.2 [162 kB]
Get:65 http://cn.archive.ubuntu.com/ubuntu bionic/main amd64 update-inetd all 4.44 [18.1 kB]
Get:66 http://cn.archive.ubuntu.com/ubuntu bionic/main amd64 device-tree-compiler amd64 1.4.5-3 [239 kB]
Get:67 http://cn.archive.ubuntu.com/ubuntu bionic/universe amd64 dos2unix amd64 7.3.4-3 [351 kB]
Fetched 50.8 MB in 9s (5,383 kB/s)
Extracting templates from packages: 100%
Preconfiguring packages ...
(Reading database ... 67432 files and directories currently installed.)
Preparing to unpack .../libc6_2.27-3ubuntu1.6_amd64.deb ...
Unpacking libc6:amd64 (2.27-3ubuntu1.6) over (2.27-3ubuntu1.5) ...
Setting up libc6:amd64 (2.27-3ubuntu1.6) ...
Selecting previously unselected package m4.
(Reading database ... 67432 files and directories currently installed.)
Preparing to unpack .../00-m4_1.4.18-1_amd64.deb ...
Unpacking m4 (1.4.18-1) ...
Selecting previously unselected package flex.
Preparing to unpack .../01-flex_2.6.4-6_amd64.deb ...
Unpacking flex (2.6.4-6) ...
Selecting previously unselected package autoconf.
Preparing to unpack .../02-autoconf_2.69-11_all.deb ...
Unpacking autoconf (2.69-11) ...
Selecting previously unselected package autotools-dev.
Preparing to unpack .../03-autotools-dev_20180224.1_all.deb ...
Unpacking autotools-dev (20180224.1) ...
Selecting previously unselected package automake.
Preparing to unpack .../04-automake_1%3a1.15.1-3ubuntu2_all.deb ...
Unpacking automake (1:1.15.1-3ubuntu2) ...
Selecting previously unselected package binutils-common:amd64.
Preparing to unpack .../05-binutils-common_2.30-21ubuntu1~18.04.7_amd64.deb ...
Unpacking binutils-common:amd64 (2.30-21ubuntu1~18.04.7) ...
Selecting previously unselected package libbinutils:amd64.
Preparing to unpack .../06-libbinutils_2.30-21ubuntu1~18.04.7_amd64.deb ...
Unpacking libbinutils:amd64 (2.30-21ubuntu1~18.04.7) ...
Selecting previously unselected package binutils-x86-64-linux-gnu.
Preparing to unpack .../07-binutils-x86-64-linux-gnu_2.30-21ubuntu1~18.04.7_amd64.deb ...
Unpacking binutils-x86-64-linux-gnu (2.30-21ubuntu1~18.04.7) ...
Selecting previously unselected package binutils.
Preparing to unpack .../08-binutils_2.30-21ubuntu1~18.04.7_amd64.deb ...
Unpacking binutils (2.30-21ubuntu1~18.04.7) ...
Selecting previously unselected package libc-dev-bin.
Preparing to unpack .../09-libc-dev-bin_2.27-3ubuntu1.6_amd64.deb ...
Unpacking libc-dev-bin (2.27-3ubuntu1.6) ...
Selecting previously unselected package linux-libc-dev:amd64.
Preparing to unpack .../10-linux-libc-dev_4.15.0-194.205_amd64.deb ...
Unpacking linux-libc-dev:amd64 (4.15.0-194.205) ...
Selecting previously unselected package libc6-dev:amd64.
Preparing to unpack .../11-libc6-dev_2.27-3ubuntu1.6_amd64.deb ...
Unpacking libc6-dev:amd64 (2.27-3ubuntu1.6) ...
Selecting previously unselected package gcc-7-base:amd64.
Preparing to unpack .../12-gcc-7-base_7.5.0-3ubuntu1~18.04_amd64.deb ...
Unpacking gcc-7-base:amd64 (7.5.0-3ubuntu1~18.04) ...
Selecting previously unselected package libisl19:amd64.
Preparing to unpack .../13-libisl19_0.19-1_amd64.deb ...
Unpacking libisl19:amd64 (0.19-1) ...
Selecting previously unselected package libmpc3:amd64.
Preparing to unpack .../14-libmpc3_1.1.0-1_amd64.deb ...
Unpacking libmpc3:amd64 (1.1.0-1) ...
Selecting previously unselected package cpp-7.
Preparing to unpack .../15-cpp-7_7.5.0-3ubuntu1~18.04_amd64.deb ...
Unpacking cpp-7 (7.5.0-3ubuntu1~18.04) ...
Selecting previously unselected package cpp.
Preparing to unpack .../16-cpp_4%3a7.4.0-1ubuntu2.3_amd64.deb ...
Unpacking cpp (4:7.4.0-1ubuntu2.3) ...
Selecting previously unselected package libcc1-0:amd64.
Preparing to unpack .../17-libcc1-0_8.4.0-1ubuntu1~18.04_amd64.deb ...
Unpacking libcc1-0:amd64 (8.4.0-1ubuntu1~18.04) ...
Selecting previously unselected package libgomp1:amd64.
Preparing to unpack .../18-libgomp1_8.4.0-1ubuntu1~18.04_amd64.deb ...
Unpacking libgomp1:amd64 (8.4.0-1ubuntu1~18.04) ...
Selecting previously unselected package libitm1:amd64.
Preparing to unpack .../19-libitm1_8.4.0-1ubuntu1~18.04_amd64.deb ...
Unpacking libitm1:amd64 (8.4.0-1ubuntu1~18.04) ...
Selecting previously unselected package libatomic1:amd64.
Preparing to unpack .../20-libatomic1_8.4.0-1ubuntu1~18.04_amd64.deb ...
Unpacking libatomic1:amd64 (8.4.0-1ubuntu1~18.04) ...
Selecting previously unselected package libasan4:amd64.
Preparing to unpack .../21-libasan4_7.5.0-3ubuntu1~18.04_amd64.deb ...
Unpacking libasan4:amd64 (7.5.0-3ubuntu1~18.04) ...
Selecting previously unselected package liblsan0:amd64.
Preparing to unpack .../22-liblsan0_8.4.0-1ubuntu1~18.04_amd64.deb ...
Unpacking liblsan0:amd64 (8.4.0-1ubuntu1~18.04) ...
Selecting previously unselected package libtsan0:amd64.
Preparing to unpack .../23-libtsan0_8.4.0-1ubuntu1~18.04_amd64.deb ...
Unpacking libtsan0:amd64 (8.4.0-1ubuntu1~18.04) ...
Selecting previously unselected package libubsan0:amd64.
Preparing to unpack .../24-libubsan0_7.5.0-3ubuntu1~18.04_amd64.deb ...
Unpacking libubsan0:amd64 (7.5.0-3ubuntu1~18.04) ...
Selecting previously unselected package libcilkrts5:amd64.
Preparing to unpack .../25-libcilkrts5_7.5.0-3ubuntu1~18.04_amd64.deb ...
Unpacking libcilkrts5:amd64 (7.5.0-3ubuntu1~18.04) ...
Selecting previously unselected package libmpx2:amd64.
Preparing to unpack .../26-libmpx2_8.4.0-1ubuntu1~18.04_amd64.deb ...
Unpacking libmpx2:amd64 (8.4.0-1ubuntu1~18.04) ...
Selecting previously unselected package libquadmath0:amd64.
Preparing to unpack .../27-libquadmath0_8.4.0-1ubuntu1~18.04_amd64.deb ...
Unpacking libquadmath0:amd64 (8.4.0-1ubuntu1~18.04) ...
Selecting previously unselected package libgcc-7-dev:amd64.
Preparing to unpack .../28-libgcc-7-dev_7.5.0-3ubuntu1~18.04_amd64.deb ...
Unpacking libgcc-7-dev:amd64 (7.5.0-3ubuntu1~18.04) ...
Selecting previously unselected package gcc-7.
Preparing to unpack .../29-gcc-7_7.5.0-3ubuntu1~18.04_amd64.deb ...
Unpacking gcc-7 (7.5.0-3ubuntu1~18.04) ...
Selecting previously unselected package gcc.
Preparing to unpack .../30-gcc_4%3a7.4.0-1ubuntu2.3_amd64.deb ...
Unpacking gcc (4:7.4.0-1ubuntu2.3) ...
Selecting previously unselected package libstdc++-7-dev:amd64.
Preparing to unpack .../31-libstdc++-7-dev_7.5.0-3ubuntu1~18.04_amd64.deb ...
Unpacking libstdc++-7-dev:amd64 (7.5.0-3ubuntu1~18.04) ...
Selecting previously unselected package g++-7.
Preparing to unpack .../32-g++-7_7.5.0-3ubuntu1~18.04_amd64.deb ...
Unpacking g++-7 (7.5.0-3ubuntu1~18.04) ...
Selecting previously unselected package g++.
Preparing to unpack .../33-g++_4%3a7.4.0-1ubuntu2.3_amd64.deb ...
Unpacking g++ (4:7.4.0-1ubuntu2.3) ...
Selecting previously unselected package make.
Preparing to unpack .../34-make_4.1-9.1ubuntu1_amd64.deb ...
Unpacking make (4.1-9.1ubuntu1) ...
Selecting previously unselected package libdpkg-perl.
Preparing to unpack .../35-libdpkg-perl_1.19.0.5ubuntu2.4_all.deb ...
Unpacking libdpkg-perl (1.19.0.5ubuntu2.4) ...
Selecting previously unselected package dpkg-dev.
Preparing to unpack .../36-dpkg-dev_1.19.0.5ubuntu2.4_all.deb ...
Unpacking dpkg-dev (1.19.0.5ubuntu2.4) ...
Selecting previously unselected package build-essential.
Preparing to unpack .../37-build-essential_12.4ubuntu1_amd64.deb ...
Unpacking build-essential (12.4ubuntu1) ...
Selecting previously unselected package libfakeroot:amd64.
Preparing to unpack .../38-libfakeroot_1.22-2ubuntu1_amd64.deb ...
Unpacking libfakeroot:amd64 (1.22-2ubuntu1) ...
Selecting previously unselected package fakeroot.
Preparing to unpack .../39-fakeroot_1.22-2ubuntu1_amd64.deb ...
Unpacking fakeroot (1.22-2ubuntu1) ...
Selecting previously unselected package keyutils.
Preparing to unpack .../40-keyutils_1.5.9-9.2ubuntu2.1_amd64.deb ...
Unpacking keyutils (1.5.9-9.2ubuntu2.1) ...
Selecting previously unselected package libalgorithm-diff-perl.
Preparing to unpack .../41-libalgorithm-diff-perl_1.19.03-1_all.deb ...
Unpacking libalgorithm-diff-perl (1.19.03-1) ...
Selecting previously unselected package libalgorithm-diff-xs-perl.
Preparing to unpack .../42-libalgorithm-diff-xs-perl_0.04-5_amd64.deb ...
Unpacking libalgorithm-diff-xs-perl (0.04-5) ...
Selecting previously unselected package libalgorithm-merge-perl.
Preparing to unpack .../43-libalgorithm-merge-perl_0.08-3_all.deb ...
Unpacking libalgorithm-merge-perl (0.08-3) ...
Selecting previously unselected package libfile-copy-recursive-perl.
Preparing to unpack .../44-libfile-copy-recursive-perl_0.40-1_all.deb ...
Unpacking libfile-copy-recursive-perl (0.40-1) ...
Selecting previously unselected package libfile-fcntllock-perl.
Preparing to unpack .../45-libfile-fcntllock-perl_0.22-3build2_amd64.deb ...
Unpacking libfile-fcntllock-perl (0.22-3build2) ...
Selecting previously unselected package libfl2:amd64.
Preparing to unpack .../46-libfl2_2.6.4-6_amd64.deb ...
Unpacking libfl2:amd64 (2.6.4-6) ...
Selecting previously unselected package libfl-dev:amd64.
Preparing to unpack .../47-libfl-dev_2.6.4-6_amd64.deb ...
Unpacking libfl-dev:amd64 (2.6.4-6) ...
Selecting previously unselected package libtinfo-dev:amd64.
Preparing to unpack .../48-libtinfo-dev_6.1-1ubuntu1.18.04_amd64.deb ...
Unpacking libtinfo-dev:amd64 (6.1-1ubuntu1.18.04) ...
Selecting previously unselected package libncurses5-dev:amd64.
Preparing to unpack .../49-libncurses5-dev_6.1-1ubuntu1.18.04_amd64.deb ...
Unpacking libncurses5-dev:amd64 (6.1-1ubuntu1.18.04) ...
Selecting previously unselected package libnfsidmap2:amd64.
Preparing to unpack .../50-libnfsidmap2_0.25-5.1_amd64.deb ...
Unpacking libnfsidmap2:amd64 (0.25-5.1) ...
Selecting previously unselected package libssl-dev:amd64.
Preparing to unpack .../51-libssl-dev_1.1.1-1ubuntu2.1~18.04.20_amd64.deb ...
Unpacking libssl-dev:amd64 (1.1.1-1ubuntu2.1~18.04.20) ...
Selecting previously unselected package lrzsz.
Preparing to unpack .../52-lrzsz_0.12.21-10~build0.18.04.1_amd64.deb ...
Unpacking lrzsz (0.12.21-10~build0.18.04.1) ...
Selecting previously unselected package lzop.
Preparing to unpack .../53-lzop_1.03-4_amd64.deb ...
Unpacking lzop (1.03-4) ...
Selecting previously unselected package manpages-dev.
Preparing to unpack .../54-manpages-dev_4.15-1_all.deb ...
Unpacking manpages-dev (4.15-1) ...
Selecting previously unselected package minicom.
Preparing to unpack .../55-minicom_2.7.1-1_amd64.deb ...
Unpacking minicom (2.7.1-1) ...
Selecting previously unselected package libtirpc1:amd64.
Preparing to unpack .../56-libtirpc1_0.2.5-1.2ubuntu0.1_amd64.deb ...
Unpacking libtirpc1:amd64 (0.2.5-1.2ubuntu0.1) ...
Selecting previously unselected package rpcbind.
Preparing to unpack .../57-rpcbind_0.2.3-0.6ubuntu0.18.04.4_amd64.deb ...
Unpacking rpcbind (0.2.3-0.6ubuntu0.18.04.4) ...
Selecting previously unselected package nfs-common.
Preparing to unpack .../58-nfs-common_1%3a1.3.4-2.1ubuntu5.5_amd64.deb ...
Unpacking nfs-common (1:1.3.4-2.1ubuntu5.5) ...
Selecting previously unselected package nfs-kernel-server.
Preparing to unpack .../59-nfs-kernel-server_1%3a1.3.4-2.1ubuntu5.5_amd64.deb ...
Unpacking nfs-kernel-server (1:1.3.4-2.1ubuntu5.5) ...
Selecting previously unselected package xinetd.
Preparing to unpack .../60-xinetd_1%3a2.3.15.3-1_amd64.deb ...
Unpacking xinetd (1:2.3.15.3-1) ...
Selecting previously unselected package tftpd.
Preparing to unpack .../61-tftpd_0.17-18ubuntu3_amd64.deb ...
Unpacking tftpd (0.17-18ubuntu3) ...
Selecting previously unselected package u-boot-tools.
Preparing to unpack .../62-u-boot-tools_2020.10+dfsg-1ubuntu0~18.04.2_amd64.deb ...
Unpacking u-boot-tools (2020.10+dfsg-1ubuntu0~18.04.2) ...
Selecting previously unselected package update-inetd.
Preparing to unpack .../63-update-inetd_4.44_all.deb ...
Unpacking update-inetd (4.44) ...
Selecting previously unselected package device-tree-compiler.
Preparing to unpack .../64-device-tree-compiler_1.4.5-3_amd64.deb ...
Unpacking device-tree-compiler (1.4.5-3) ...
Selecting previously unselected package dos2unix.
Preparing to unpack .../65-dos2unix_7.3.4-3_amd64.deb ...
Unpacking dos2unix (7.3.4-3) ...
Setting up libquadmath0:amd64 (8.4.0-1ubuntu1~18.04) ...
Setting up libgomp1:amd64 (8.4.0-1ubuntu1~18.04) ...
Setting up libatomic1:amd64 (8.4.0-1ubuntu1~18.04) ...
Setting up minicom (2.7.1-1) ...
Setting up xinetd (1:2.3.15.3-1) ...
Setting up libcc1-0:amd64 (8.4.0-1ubuntu1~18.04) ...
Setting up make (4.1-9.1ubuntu1) ...
Setting up libnfsidmap2:amd64 (0.25-5.1) ...
Setting up lzop (1.03-4) ...
Setting up libtsan0:amd64 (8.4.0-1ubuntu1~18.04) ...
Setting up libssl-dev:amd64 (1.1.1-1ubuntu2.1~18.04.20) ...
Setting up linux-libc-dev:amd64 (4.15.0-194.205) ...
Setting up u-boot-tools (2020.10+dfsg-1ubuntu0~18.04.2) ...
Setting up libdpkg-perl (1.19.0.5ubuntu2.4) ...
Setting up libtinfo-dev:amd64 (6.1-1ubuntu1.18.04) ...
Setting up keyutils (1.5.9-9.2ubuntu2.1) ...
Setting up dos2unix (7.3.4-3) ...
Setting up m4 (1.4.18-1) ...
Setting up liblsan0:amd64 (8.4.0-1ubuntu1~18.04) ...
Setting up tftpd (0.17-18ubuntu3) ...
Note: xinetd currently is not fully supported by update-inetd.
      Please consult /usr/share/doc/xinetd/README.Debian and itox(8).
Setting up gcc-7-base:amd64 (7.5.0-3ubuntu1~18.04) ...
Setting up binutils-common:amd64 (2.30-21ubuntu1~18.04.7) ...
Setting up libfile-fcntllock-perl (0.22-3build2) ...
Setting up libmpx2:amd64 (8.4.0-1ubuntu1~18.04) ...
Setting up autotools-dev (20180224.1) ...
Setting up libtirpc1:amd64 (0.2.5-1.2ubuntu0.1) ...
Setting up libfakeroot:amd64 (1.22-2ubuntu1) ...
Setting up lrzsz (0.12.21-10~build0.18.04.1) ...
Setting up libalgorithm-diff-perl (1.19.03-1) ...
Setting up libfl2:amd64 (2.6.4-6) ...
Setting up libmpc3:amd64 (1.1.0-1) ...
Setting up device-tree-compiler (1.4.5-3) ...
Setting up libc-dev-bin (2.27-3ubuntu1.6) ...
Setting up manpages-dev (4.15-1) ...
Setting up libc6-dev:amd64 (2.27-3ubuntu1.6) ...
Setting up libitm1:amd64 (8.4.0-1ubuntu1~18.04) ...
Setting up libfile-copy-recursive-perl (0.40-1) ...
Setting up rpcbind (0.2.3-0.6ubuntu0.18.04.4) ...
Created symlink /etc/systemd/system/multi-user.target.wants/rpcbind.service → /lib/systemd/system/rpcbind.service.
Created symlink /etc/systemd/system/sockets.target.wants/rpcbind.socket → /lib/systemd/system/rpcbind.socket.
Setting up libisl19:amd64 (0.19-1) ...
Setting up update-inetd (4.44) ...
Setting up libasan4:amd64 (7.5.0-3ubuntu1~18.04) ...
Setting up libbinutils:amd64 (2.30-21ubuntu1~18.04.7) ...
Setting up flex (2.6.4-6) ...
Setting up libcilkrts5:amd64 (7.5.0-3ubuntu1~18.04) ...
Setting up nfs-common (1:1.3.4-2.1ubuntu5.5) ...

Creating config file /etc/idmapd.conf with new version
Adding system user `statd' (UID 111) ...
Adding new user `statd' (UID 111) with group `nogroup' ...
Not creating home directory `/var/lib/nfs'.
Created symlink /etc/systemd/system/multi-user.target.wants/nfs-client.target → /lib/systemd/system/nfs-client.target.
Created symlink /etc/systemd/system/remote-fs.target.wants/nfs-client.target → /lib/systemd/system/nfs-client.target.
nfs-utils.service is a disabled or a static unit, not starting it.
Setting up libubsan0:amd64 (7.5.0-3ubuntu1~18.04) ...
Setting up nfs-kernel-server (1:1.3.4-2.1ubuntu5.5) ...
Created symlink /etc/systemd/system/multi-user.target.wants/nfs-server.service → /lib/systemd/system/nfs-server.service.
Job for nfs-server.service canceled.

Creating config file /etc/exports with new version

Creating config file /etc/default/nfs-kernel-server with new version
Setting up autoconf (2.69-11) ...
Setting up fakeroot (1.22-2ubuntu1) ...
update-alternatives: using /usr/bin/fakeroot-sysv to provide /usr/bin/fakeroot (fakeroot) in auto mode
Setting up libgcc-7-dev:amd64 (7.5.0-3ubuntu1~18.04) ...
Setting up cpp-7 (7.5.0-3ubuntu1~18.04) ...
Setting up libfl-dev:amd64 (2.6.4-6) ...
Setting up libstdc++-7-dev:amd64 (7.5.0-3ubuntu1~18.04) ...
Setting up libncurses5-dev:amd64 (6.1-1ubuntu1.18.04) ...
Setting up libalgorithm-merge-perl (0.08-3) ...
Setting up libalgorithm-diff-xs-perl (0.04-5) ...
Setting up automake (1:1.15.1-3ubuntu2) ...
update-alternatives: using /usr/bin/automake-1.15 to provide /usr/bin/automake (automake) in auto mode
Setting up binutils-x86-64-linux-gnu (2.30-21ubuntu1~18.04.7) ...
Setting up cpp (4:7.4.0-1ubuntu2.3) ...
Setting up binutils (2.30-21ubuntu1~18.04.7) ...
Setting up gcc-7 (7.5.0-3ubuntu1~18.04) ...
Setting up g++-7 (7.5.0-3ubuntu1~18.04) ...
Setting up gcc (4:7.4.0-1ubuntu2.3) ...
Setting up dpkg-dev (1.19.0.5ubuntu2.4) ...
Setting up g++ (4:7.4.0-1ubuntu2.3) ...
update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode
Setting up build-essential (12.4ubuntu1) ...
Processing triggers for libc-bin (2.27-3ubuntu1.5) ...
Processing triggers for systemd (237-3ubuntu10.56) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for mime-support (3.60ubuntu1) ...
Processing triggers for ureadahead (0.100.0-21) ...
Processing triggers for install-info (6.5.0.dfsg.1-2) ...
bob@u18:~/sdk/bin$

准备SDK文件

文件名为 processor-sdk-linux-bundle-am57xx-phycore-kit.tar.xz 该文件是在使用yocto编译镜像时生成的,也可以从 http://ftp.phytec.cn/ 对应的BSP中下载标准镜像对应的SDK。

这里使用下载的sdk

wget --content-disposition "http://ftp.phytec.cn/?r=/download&path=L0FNNTd4L0JTUC1Zb2N0by1USVNESy1BTTU3eHgtUEQyMC4xLjIvc2RrL3Byb2Nlc3Nvci1zZGstbGludXgtYnVuZGxlLWFtNTd4eC1waHljb3JlLWtpdC50YXIueHo%3D"
操作记录
bob@u18:~$ wget --content-disposition "http://ftp.phytec.cn/?r=/download&path=L0FNNTd4L0JTUC1Zb2N0by1USVNESy1BTTU3eHgtUEQyMC4xLjIvc2RrL3Byb2Nlc3Nvci1zZGstbGludXgtYnVuZGxlLWFtNTd4eC1waHljb3JlLWtpdC50YXIueHo%3D"
--2022-11-02 05:01:38--  http://ftp.phytec.cn/?r=/download&path=L0FNNTd4L0JTUC1Zb2N0by1USVNESy1BTTU3eHgtUEQyMC4xLjIvc2RrL3Byb2Nlc3Nvci1zZGstbGludXgtYnVuZGxlLWFtNTd4eC1waHljb3JlLWtpdC50YXIueHo%3D
Resolving ftp.phytec.cn (ftp.phytec.cn)... 183.239.159.114
Connecting to ftp.phytec.cn (ftp.phytec.cn)|183.239.159.114|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3368831920 (3.1G) [application/x-xz]
Saving to: ‘processor-sdk-linux-bundle-am57xx-phycore-kit.tar.xz’

processor-sdk-linux-bundle-am57xx-phy 100%[=======================================================================>]   3.14G  18.2MB/s    in 3m 13s

2022-11-02 05:04:52 (16.6 MB/s) - ‘processor-sdk-linux-bundle-am57xx-phycore-kit.tar.xz’ saved [3368831920/3368831920]

bob@u18:~$

安装SDK

建议将sdk安装在当前用户的home,也就是~文件夹中。

建立一个sdk文件夹并进入新建的目录

mkdir sdk
cd sdk
操作记录
bob@u18:~$ mkdir sdk
bob@u18:~$ cd sdk/
bob@u18:~/sdk$

解压缩SDK到本地

tar -Jxf ../processor-sdk-linux-bundle-am57xx-phycore-kit.tar.xz
操作记录
bob@u18:~/sdk$ tar -Jxf ../processor-sdk-linux-bundle-am57xx-phycore-kit.tar.xz
bob@u18:~/sdk$ ls
bin  board-support  docs  example-applications  filesystem  linux-devkit.sh  Makefile  Rules.make  sdk-install.sh  setup.sh
bob@u18:~/sdk$

运行SDK安装脚本

./sdk-install.sh
操作记录
bob@u18:~/sdk$ ./sdk-install.sh
/home/bob/sdk
basename: missing operand
Try 'basename --help' for more information.
/home/bob/sdk
Enter target directory for SDK (default: /usr/local/arago-2019.11): /home/bob/sdk/linux-devkit
You are about to install the SDK to "/home/bob/sdk/linux-devkit". Proceed[Y/n]?Y
Extracting SDK...done
Setting it up...done
SDK has been successfully set up and is ready to be used.

Installation completed!
bob@u18:~/sdk$

使用SDK编译hello world程序

在命令行使用SDK之前,需要运行SDK中的脚本对当前终端窗口进行初始化:

source ~/sdk/linux-devkit/environment-setup
操作记录
bob@u18:~$ source ~/sdk/linux-devkit/environment-setup
[linux-devkit]:~>

在初始化后,当前窗口就具有了交叉编译的环境变量,头文件、文件系统的路径均已设置好

[linux-devkit]:~> export
declare -x AR="arm-linux-gnueabihf-ar"
declare -x AS="arm-linux-gnueabihf-as"
declare -x CC="arm-linux-gnueabihf-gcc --sysroot=/home/bob/sdk/linux-devkit/sysroots/armv7at2hf-neon-linux-gnueabi"
declare -x CFLAGS=" -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard --sysroot=/home/bob/sdk/linux-devkit/sysroots/armv7at2hf-neon-linux-gnueabi"
declare -x CONFIGURE_FLAGS="--target=arm-linux-gnueabi --host=arm-linux-gnueabi --build=x86_64-linux --with-libtool-sysroot=/home/bob/sdk/linux-devkit/sysroots/armv7at2hf-neon-linux-gnueabi"
...

使用VIM编辑新建或者下载文件到编译环境中。hello.c

如果对VIM不熟可以先看一下教程,如:vim简明教程--半小时从入门到精通

vim hello.c

代码:

#include <stdio.h>
 
int main()
{
	printf("Hello World!\n");
}

编译C为可执行文件,注意这个执行的执行需要在经过 SDK使用前初始化 的终端环境中。

$CC -O hello.c -o hello
操作记录
[linux-devkit]:~> vim hello.c
[linux-devkit]:~> ls
hello.c  processor-sdk-linux-bundle-am57xx-phycore-kit.tar.xz  sdk
[linux-devkit]:~> $CC -O hello.c -o hello
[linux-devkit]:~>

编译后将文件复制到优盘,这一步可以通过图形界面,或者终端操作均可。

插入优盘后首先确认要复制的分区

[linux-devkit]:~> dmesg | tail
[ 7676.124540] usbcore: registered new interface driver uas
[ 7677.193816] scsi 3:0:0:0: Direct-Access     General  USB Flash Disk   1.00 PQ: 0 ANSI: 4
[ 7677.194542] sd 3:0:0:0: Attached scsi generic sg2 type 0
[ 7677.212798] sd 3:0:0:0: [sdb] 30548096 512-byte logical blocks: (15.6 GB/14.6 GiB)
[ 7677.224142] sd 3:0:0:0: [sdb] Write Protect is off
[ 7677.224148] sd 3:0:0:0: [sdb] Mode Sense: 03 00 00 00
[ 7677.235932] sd 3:0:0:0: [sdb] No Caching mode page found
[ 7677.237225] sd 3:0:0:0: [sdb] Assuming drive cache: write through
[ 7677.316943]  sdb: sdb1
[ 7677.413714] sd 3:0:0:0: [sdb] Attached SCSI removable disk

如上面例子确认优盘为sdb1,建立优盘mount的文件夹

mkdir usb
操作记录
[linux-devkit]:~> mkdir usb
[linux-devkit]:~> 

挂在优盘到usb文件夹

sudo mount /dev/sdb1 usb/
操作记录
[linux-devkit]:~> sudo mount /dev/sdb1 usb/
[sudo] password for bob:
[linux-devkit]:~>

复制文件到优盘

sudo cp hello usb/
操作记录
[linux-devkit]:~> sudo cp hello usb/
[linux-devkit]:~>

取消挂载

sync
sudo umount usb
操作记录
[linux-devkit]:~> sync
[linux-devkit]:~> sudo umount usb
[linux-devkit]:~>

此时将优盘插在开发板上。

操作记录
root@am57xx-phycore-kit:~# [  104.422517] usb 3-1: new high-speed USB device number 2 using xhci-hcd
[  104.603079] usb 3-1: New USB device found, idVendor=8644, idProduct=8005, bcdDevice= 1.00
[  104.611299] usb 3-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[  104.619376] usb 3-1: Product: USB Flash Disk
[  104.624014] usb 3-1: Manufacturer: General
[  104.629272] usb 3-1: SerialNumber: 04730D0000008009
[  104.853751] usb-storage 3-1:1.0: USB Mass Storage device detected
[  104.874506] scsi host1: usb-storage 3-1:1.0
[  104.880997] usbcore: registered new interface driver usb-storage
[  104.893525] usbcore: registered new interface driver uas
[  105.924104] scsi 1:0:0:0: Direct-Access     General  USB Flash Disk   1.00 PQ: 0 ANSI: 4
[  105.950981] sd 1:0:0:0: [sda] 30548096 512-byte logical blocks: (15.6 GB/14.6 GiB)
[  105.969500] sd 1:0:0:0: [sda] Write Protect is off
[  105.976377] sd 1:0:0:0: [sda] No Caching mode page found
[  105.981883] sd 1:0:0:0: [sda] Assuming drive cache: write through
[  105.993762]  sda: sda1
[  105.998295] sd 1:0:0:0: [sda] Attached SCSI removable disk

开发板会自动挂载优盘

cd /run/media/sda1/
操作记录
root@am57xx-phycore-kit:~# cd /run/media/sda1/
root@am57xx-phycore-kit:/run/media/sda1# 

运行hello文件

./hello
操作记录
root@am57xx-phycore-kit:/run/media/sda1# ./hello
Hello World!
root@am57xx-phycore-kit:/run/media/sda1#
  • No labels