参考文档:https://www.phytec.de/cdocuments/?doc=d4PmEQ#L876e.A1STM32MP1BSPManual-BuildingtheBSPBuildingtheBSP

编译环境的准备

虚拟机

不推荐在虚拟机上安装/编译BSP,如果必须要在虚拟机上使用,请务必满足表格的配置要求,并且在编译时,尽量减少宿主机器这边的负载,或者说在编译时尽量不使用宿主机器。


我们推荐的编译系统为ubuntu 18.04 Desktop amd64位版本,对编译系统的最低机器要求如下:

项目

要求

内存8G或更大
硬盘100G或更大
CPU4线程或更多
网络正常网络,没有限制端口

ubuntu系统的安装没有特殊要求,在安装完后,需要额外为系统安装一些软件来满足BSP的编译需求。

我们的编译环境使用的是yocto,因此编译环境的要求也是按照yocto的要求:yocto文档(老版本) yocto文档,我们这里将需要安装的软件总结如下:

yocto版本

安装的软件

2.6

$ sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
build-essential chrpath socat cpio python python3 python3-pip python3-pexpect \
xz-utils debianutils iputils-ping libsdl1.2-dev xterm g++-multilib

yocto的版本请在 BSP版本、设备树、config文件对照表 / BSP version, device tree, config file cross reference table 中查找

下载/编译离线BSP

请在 http://ftp.phytec.cn/STM32MP1/ 中下载,以下以PD21.1.1为例。

请注意在所有以下操作都不要在root用户下操作,请使用普通用户来执行这些指令。

下载离线编译包,该包大概2G。

$ wget http://ftp.phytec.cn/STM32MP1/BSP-Yocto-OpenSTLinux-STM32MP1-PD21.1.1/BSP-Yocto-OpenSTLinux-STM32MP1-PD21.1.1.src.mirror.tar.xz

下载完后解压到本用户文件夹的一个目录中,如~/bsp

bob@32tb:~/bsp/BSP-Yocto-OpenSTLinux-STM32MP1-PD21.1.1$ ls -l
total 96
drwxr-xr-x 3 bob bob  4096 Jun 29 20:29 build-openstlinuxeglfs-phycore-stm32mp1-2
drwxr-xr-x 3 bob bob  4096 Jun 29 20:29 build-openstlinuxeglfs-phycore-stm32mp1-6
drwxr-xr-x 3 bob bob  4096 Jun 29 20:29 build-openstlinuxweston-phycore-stm32mp1-3
drwxr-xr-x 3 bob bob  4096 Jun 29 20:29 build-openstlinuxweston-phycore-stm32mp1-4
drwxr-xr-x 9 bob bob  4096 Jun 29 18:56 layers
-r-xr-xr-x 1 bob bob  1215 Jun 29 18:56 openstlinux-init-phytec.sh
-rwxr-xr-x 1 bob bob 24647 Jun 29 18:53 phyLinux
-rw-r--r-- 1 bob bob   152 Jun 29 20:31 site.conf
drwxr-xr-x 3 bob bob 36864 Jun 29 20:24 src_mirror
drwxr-xr-x 2 bob bob  4096 Jun 29 18:56 tools

在BSP-Yocto-OpenSTLinux-STM32MP1-PD21.1.1目录中执行

bob@32tb:~/bsp/BSP-Yocto-OpenSTLinux-STM32MP1-PD21.1.1$ source layers/meta-st-openstlinux-phytec/scripts/openstlinux-init-phytec.sh
[HOST DISTRIB check]
Linux Distrib: Ubuntu
Linux Release: 16.04

[WARNING] Skip checking for Linux Distrib required package installation.
[WARNING] (missing Ubuntu_16.04 file in /mnt/rd/home/bob/bsp/BSP-Yocto-OpenSTLinux-STM32MP1-PD21.1.1/layers/meta-st/scripts folder)

[BUILD_DIR configuration]
  1. build-openstlinuxeglfs-phycore-stm32mp1-2   -  DISTRO is 'openstlinux-eglfs' and MACHINE is 'phycore-stm32mp1-2'
  2. build-openstlinuxeglfs-phycore-stm32mp1-6   -  DISTRO is 'openstlinux-eglfs' and MACHINE is 'phycore-stm32mp1-6'
  3. build-openstlinuxweston-phycore-stm32mp1-3  -  DISTRO is 'openstlinux-weston' and MACHINE is 'phycore-stm32mp1-3'
  4. build-openstlinuxweston-phycore-stm32mp1-4  -  DISTRO is 'openstlinux-weston' and MACHINE is 'phycore-stm32mp1-4'
  5. NEW                                         -  *** SET NEW DISTRO AND MACHINE BUILD CONFIG ***
Which one would you like? [build-openstlinuxweston-phycore-stm32mp1-4] 3
Selected BUILD_DIR: build-openstlinuxweston-phycore-stm32mp1-3

[source layers/openembedded-core/oe-init-build-env][with previous config]

===========================================================================
Configuration files have been created for the following configuration:

    DISTRO            :  openstlinux-weston
    DISTRO_CODENAME   :  dunfell
    MACHINE           :  phycore-stm32mp1-3
    BB_NUMBER_THREADS :  <no-custom-config-set>
    PARALLEL_MAKE     :  <no-custom-config-set>

    BUILDDIR          :  build-openstlinuxweston-phycore-stm32mp1-3
    DOWNLOAD_DIR      :  <disable>
    SSTATE_DIR        :  <disable>

    SOURCE_MIRROR_URL :  file:///mnt/rd/home/bob/bsp/BSP-Yocto-OpenSTLinux-STM32MP1-PD21.1.1/build-openstlinuxweston-phycore-stm32mp1-3/../src_mirror
    SSTATE_MIRRORS    :  <disable>

    WITH_EULA_ACCEPTED:  YES

===========================================================================

Available images for OpenSTLinux layers are:

  - Official OpenSTLinux images:
      st-image-weston       -   OpenSTLinux weston image with basic Wayland support (if enable in distro)

  - Other OpenSTLinux images:
      - Supported images:
          st-image-core         -   OpenSTLinux core image


You can now run 'bitbake <image>'

bob@32tb:~/bsp/BSP-Yocto-OpenSTLinux-STM32MP1-PD21.1.1/build-openstlinuxweston-phycore-stm32mp1-3$

其中phycore-stm32mp1-2/3/4/6的区别请参考 

镜像名说明
openstlinux-eglfs无X11,无Wayland
openstlinux-weston使用wayland,Weston作为显示后端

此时环境就可进行编译。

bob@32tb:~/bsp/BSP-Yocto-OpenSTLinux-STM32MP1-PD21.1.1/build-openstlinuxweston-phycore-stm32mp1-3$ bitbake st-image-weston
NOTE: Started PRServer with DBfile: /mnt/rd/home/bob/bsp/BSP-Yocto-OpenSTLinux-STM32MP1-PD21.1.1/build-openstlinuxweston-phycore-stm32mp1-3/cache/prserv
.sqlite3, IP: 127.0.0.1, PORT: 35889, PID: 31346
NOTE: /mnt/rd/home/bob/bsp/BSP-Yocto-OpenSTLinux-STM32MP1-PD21.1.1/layers/meta-st/meta-st-openstlinux/recipes-st/images/st-image-resize-initrd.bb: ENABLE_PARTITIONS_IMAGE not enabled
Parsing recipes: 100% |##################################################################################################################| Time: 0:00:21
Parsing of 2599 .bb files complete (0 cached, 2599 parsed). 3807 targets, 142 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION           = "1.46.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "ubuntu-16.04"
TARGET_SYS           = "arm-ostl-linux-gnueabi"
MACHINE              = "phycore-stm32mp1-3"
DISTRO               = "openstlinux-weston"
DISTRO_VERSION       = "3.1-snapshot-20210707"
TUNE_FEATURES        = "arm vfp cortexa7 neon vfpv4 thumb callconvention-hard"
TARGET_FPU           = "hard"
DISTRO_CODENAME      = "dunfell"
ACCEPT_EULA_phycore-stm32mp1-3 = "1"
GCCVERSION           = "9.%"
PREFERRED_PROVIDER_virtual/kernel = "linux-stm32mp"
meta-phytec          = "HEAD:3ba7567532bcda55d9d73deff80a350877b68d07"
meta-st-openstlinux-phytec = "HEAD:90481eec20c4f9f362ce36eb0a52170cc46a1913"
meta-python
meta-oe
meta-gnome
meta-initramfs
meta-multimedia
meta-networking
meta-webserver
meta-filesystems
meta-perl            = "HEAD:144077083457ccb75700777d5e6b1da9aaff01aa"
meta-st-stm32mp      = "HEAD:955b1d9a5f706013d718687b1afa6e3022c68fac"
meta-qt5             = "HEAD:fdd19517e17240b0b61765bd02fc483a1bde986f"
meta-st-openstlinux  = "HEAD:9160c08dfcd0b7ec0eb8f1fd96672695b09680d5"
meta                 = "HEAD:b39bda4cc62db12c0edfbe489d5a7f5988ede6a9"

NOTE: Fetching uninative binary shim http://downloads.yoctoproject.org/releases/uninative/2.9/x86_64-nativesdk-libc.tar.xz;sha256sum=d07916b95c419c81541
a19c8ef0ed8cbd78ae18437ff28a4c8a60ef40518e423 (will check PREMIRRORS first)
Initialising tasks:   1% |##                                                                                                             | ETA:  0:00:09
  • No labels