【深入浅出imx8企业级开发实战 | 03】imx8qxp一键独立编译指南

本文详述了如何使用optee项目的build工程进行i.MX8QXP的独立编译,涵盖环境搭建、源码下载、工具链配置、项目修改、编译及烧录全过程,特别针对C0版本芯片进行了适配,包括解决内核版本、OpenSC依赖、strace调试等问题。
摘要由CSDN通过智能技术生成

这是机器未来的第54篇文章

原文首发地址:https://robotsfutures.blog.csdn.net/article/details/126924015

《深入浅出i.MX8企业级开发实战》快速导航:

【01】imx8qxp yocto工程构建指南
【02】Yocto工程repo源码gitee加速配置方法


写在开始:

  • 博客简介:专注AIoT领域,追逐未来时代的脉搏,记录路途中的技术成长!
  • 博主社区:AIoT机器智能, 欢迎加入!
  • 专栏简介:imx8qxp小白从拿到板子到完成项目的过程记录
  • 面向人群:嵌入式工程师

1. 概述

optee的build.git工程不仅可以整体管理imx8qxp的所有的源码编译,也可以仅仅利用build.git来编译自定义的imx8qxp源码项目, 博主利用optee的repo项目编译imx8qxp项目时发现出现了版本不兼容的情况,因此决定仅使用build.git来组织整个Imx8qxp的项目,相关的源代码版本按照yocto工程的版本选择。

本文描述了imx8qxp利用optee项目的build工程整体编译的过程,op-tee项目的build工程仅支持imx8m,这里通过修改使其支持imx8qxp芯片。

整个项目包含的内容挺多的,包含u-boot、atf、optee、optee-client、seco、scfw、kernel、rootfs、mkimage,并生成包含所有固件的烧写固件。

2. 功能评估

在正式开启之前可以直接使用官方编译好的固件烧写到开发板中运行,避免自己构建yocto工程,耗时耗力。需要登录才能下载:

https://www.nxp.com/webapp/Download?colCode=L5.15.5_1.0.1_MX8QXPC0&appType=license

3. 环境搭建

功能评估通过后,就开始搭建自己的项目框架了。整个项目包含的内容挺多的,包含u-boot、atf、optee、optee-client、seco、scfw、kernel、rootfs、mkimage。

3.1 创建项目根目录

mkdir imx8qxp_project

3.1 下载源码

  • git源码
echo Linaro工具链项目构建体系项目,选择最新的3.18.0版本
git clone https://github.com/OP-TEE/build.git 
echo imx8qxp Yocto-5.15.5版本配套的uboot版本
git clone https://source.codeaurora.org/external/imx/uboot-imx -b lf_v2021.04
echo imx8qxp Yocto-5.15.5版本配套的atf版本
git clone https://source.codeaurora.org/external/imx/imx-atf -b lf_v2.4
echo imx8qxp Yocto-5.15.5版本配套的linnux kernel版本
git clone https://source.codeaurora.org/external/imx/linux-imx -b lf-5.15.y
echo imx8qxp Yocto-5.15.5版本配套的boot打包工具imx-mkimage版本
git clone https://source.codeaurora.org/external/imx/imx-mkimage -b lf-5.15.5_1.0.0
echo imx8qxp Yocto-5.15.5版本配套的optee-os版本
git clone https://source.codeaurora.org/external/imx/imx-optee-os -b lf-5.15.5_1.0.0
echo imx8qxp Yocto-5.15.5版本配套的optee-client版本
git clone https://source.codeaurora.org/external/imx/imx-optee-client -b lf-5.15.5_1.0.0
echo imx8qxp Yocto-5.15.5版本配套的optee-test版本
git clone https://source.codeaurora.org/external/imx/imx-optee-test -b lf-5.15.5_1.0.0
echo imx8qxp Yocto-5.15.5版本配套的optee-example版本
git clone https://github.com/linaro-swg/optee_examples.git
echo imx8qxp支持5.15.5的较早期的版本,新版本可能有兼容性问题,选择2021.11版本
git clone https://git.buildroot.net/buildroot -b 2021.11.x

build.git切换到3.18.0

cd build
git checkout -b 3.18.0-rc1 3.18.0-rc1
  • 下载源码
# imx8qxp Yocto-5.15.5版本配套的scfw版本
https://www.nxp.com/webapp/Download?colCode=L5.15.5_1.0.1_SCFWKIT-1.12.1&appType=license
  • yocto源码

因为seco没有找到官方的源码下载地址,从yocto工程提取,提取方式如下:

$ bitbake -e imx-seco  | grep ^S=
S="/media/dev/removable_disk/imx-yocto-bsp/imx8qxpc0mek_wayland_mini/tmp/work/cortexa35-mx8-poky-linux/imx-seco/3.8.5-r0/imx-seco-3.8.5"

将 imx-seco-3.8.5拷贝到imx8qxp_project目录下即可。其它源码若下载速度过慢,也可以从yocto工程中提取。

代码语法为:

bitbake -e [源码名称]  | grep ^S=

因为官方的build.git中的Maikefile中有很多写死的路径,导致修改仓库目录经常出现问题,因此保持源码目录和官方一致,减少出错。

$ mv imx-optee-os optee_os
$ mv imx-optee-client/ optee_client
$ mv imx-optee-test/ optee_test
$ mv uboot-imx/ u-boot
$ mv linux-imx/ linux
$ mv imx-atf/ trusted-firmware-a

源码获取完毕后的结构如下:

$ tree -L 1
.
├── build
├── buildroot
├── imx-mkimage
├── imx-scfw-porting-kit-1.12.1
├── imx-seco-3.8.5
├── linux
├── optee_client
├── optee_examples
├── optee_os
├── optee_test
├── toolchains
├── trusted-firmware-a
└── u-boot

3.3 下载工具链

3.3.1 下载Cortex-A35 aarch64工具链

cd build
$ make -f toolchain.mk 
Downloading gcc-arm-10.2-2020.11-x86_64-arm-none-linux-gnueabihf ...

下载完毕后,在build上级目录会新增一个toolchains的文件夹,包含已经解压安装完毕的aarch64工具链

3.3.2 下载scfw工具链

因为scfw是M4的内核编译工具链和A35内核不一样,需要安装。工具链搭建手册参考imx-scfw-porting-kit-1.12.1/packages/imx-scfw-porting-kit-1.12.1/doc/pdf/sc_fw_port.pdf手册的P3.2章节,GNU交叉编译工具链的版本选择8-2018-q4-major, 博主使用的Ubuntu2004的系统,选择Linux64位版本。

  • 下载M4工具链
$ wget -c https://developer.arm.com/-/media/Files/downloads/gnu-rm/8-2018q4/gcc-arm-none-eabi-8-2018-q4-major-linux.tar.bz2 --no-check-certificate
  • 解压工具链
$ tar xvjf tar gcc-arm-none-eabi-8-2018-q4-major-linux.tar.bz2
  • 配置工具链路径
$ export TOOLS=/home/dev/workspace/imx8qxp_project/imx-scfw-porting-kit-1.12.1/

可以为源码创建一个符号链接,减少跳转

$ ln -sf packages/imx-scfw-porting-kit-1.12.1/src/scfw_export_mx8qx_b0/ source

scfw目前仅有b0版本的代码,可以支持c0芯片

4. 配置项目

直接运行补丁,让项目支持I.MX8QXP芯片

先备份build目录下的imx.mk

cd build
cp imx.mk imx.mk.bak

我已经将项目相关的修改生成补丁文件。

4.1 提取build工程修改补丁

$ diff -uNr -x ".git" build ../build > imx8qxp_build.patch 

将如下代码保存为imx8qxp.patch文件

diff -uNr -x .git build/br-ext/configs/toolchain-aarch32 ../build/br-ext/configs/toolchain-aarch32
--- build/br-ext/configs/toolchain-aarch32	2022-09-13 11:34:13.204631722 +0800
+++ ../build/br-ext/configs/toolchain-aarch32	2022-09-13 11:33:34.036505050 +0800
@@ -3,7 +3,7 @@
 BR2_TOOLCHAIN_EXTERNAL_PATH="%TOP_DIR%/toolchains/aarch32"
 BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="arm-linux-gnueabihf"
 BR2_TOOLCHAIN_EXTERNAL_GCC_10=y
-BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_20=y
+BR2_TOOLCHAIN_EXTERNAL_HEADERS_5_15=y
 BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y
 BR2_TOOLCHAIN_EXTERNAL_CXX=y
 
diff -uNr -x .git build/br-ext/configs/toolchain-aarch64 ../build/br-ext/configs/toolchain-aarch64
--- build/br-ext/configs/toolchain-aarch64	2022-09-13 11:34:13.204631722 +0800
+++ ../build/br-ext/configs/toolchain-aarch64	2022-09-13 11:33:34.036505050 +0800
@@ -3,7 +3,7 @@
 BR2_TOOLCHAIN_EXTERNAL_PATH="%TOP_DIR%/toolchains/aarch64"
 BR2_TOOLCHAIN_EXTERNAL_CUSTOM_PREFIX="aarch64-linux-gnu"
 BR2_TOOLCHAIN_EXTERNAL_GCC_10=y
-BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_20=y
+BR2_TOOLCHAIN_EXTERNAL_HEADERS_5_15=y
 BR2_TOOLCHAIN_EXTERNAL_CUSTOM_GLIBC=y
 BR2_TOOLCHAIN_EXTERNAL_CXX=y
 
diff -uNr -x .git build/br-ext/package/opensc/opensc.mk ../build/br-ext/package/opensc/opensc.mk
--- build/br-ext/package/opensc/opensc.mk	2022-09-13 11:34:13.208631735 +0800
+++ ../build/br-ext/package/opensc/opensc.mk	2022-09-13 11:33:34.036505050 +0800
@@ -4,8 +4,8 @@
 #
 ################################################################################
 
-OPENSC_VERSION = 0.21.0
-OPENSC_SOURCE = OpenSC-$(OPENSC_VERSION).tar.gz
+OPENSC_VERSION = 0.22.0
+OPENSC_SOURCE = opensc-$(OPENSC_VERSION).tar.gz
 OPENSC_SITE = $(call github,OpenSC,OpenSC,$(OPENSC_VERSION))
 #OPENSC_SITE_METHOD = git
 
diff -uNr -x .git build/common.mk ../build/common.mk
--- build/common.mk	2022-09-13 11:34:13.236631826 +0800
+++ ../build/common.mk	2022-09-13 11:33:34.048505087 +0800
@@ -36,7 +36,10 @@
 OPTEE_TEST_PATH			?= $(ROOT)/optee_test
 OPTEE_EXAMPLES_PATH		?= $(ROOT)/optee_examples
 OPTEE_RUST_PATH			?= $(ROOT)/optee_rust
+BUILDROOT_PATH			?= $(ROOT)/buildroot
 BUILDROOT_TARGET_ROOT		?= $(ROOT)/out-br/target
+IMX_SECO_PATH			?= $(ROOT)/imx-seco-3.8.5/firmware/seco
+IMX_SCFW_PATH			?= $(ROOT)/imx-scfw-porting-kit-1.12.1/source/build_mx8qx_b0
 
 # default high verbosity. slow uarts shall specify lower if prefered
 CFG_TEE_CORE_LOG_LEVEL		?= 3
@@ -310,7 +313,7 @@
 BR2_PACKAGE_OPTEE_TEST_EXT_GP_PACKAGE := $(GP_PACKAGE)
 BR2_PACKAGE_OPTEE_TEST_EXT_WITH_TLS_TESTS := $(WITH_TLS_TESTS)
 BR2_PACKAGE_OPTEE_TEST_EXT_WITH_CXX_TESTS := $(WITH_CXX_TESTS)
-BR2_PACKAGE_STRACE ?= y
+BR2_PACKAGE_STRACE ?= n
 ifeq ($(XEN_BOOT),y)
 BR2_TARGET_GENERIC_GETTY_PORT ?= "console"
 else
@@ -332,6 +335,8 @@
 append-var = $(call append-var_,$(1),$(2),$(if $(call y-or-n,$($(1))),,$(double-quote)))
 append-br2-vars = $(foreach var,$(filter BR2_%,$(.VARIABLES)),$(call append-var,$(var),$(1)))
 
+#		--br-defconfig $(BUILDROOT_PATH)/configs/freescale_imx8qxpmek_defconfig \
+
 .PHONY: buildroot
 buildroot: optee-os optee-rust
 	@mkdir -p ../out-br
diff -uNr -x .git build/imx.mk ../build/imx.mk
--- build/imx.mk	2022-09-13 11:34:13.216631761 +0800
+++ ../build/imx.mk	2022-09-13 11:33:34.048505087 +0800
@@ -8,8 +8,9 @@
 override COMPILE_S_USER    := 64
 override COMPILE_S_KERNEL  := 64
 
-OPTEE_OS_PLATFORM = imx-mx8mqevk
-BR2_TARGET_GENERIC_GETTY_PORT = ttymxc0
+OPTEE_OS_PLATFORM = imx-mx8qxpmek
+# BR2_TARGET_GENERIC_GETTY_PORT = ttymxc0
+BR2_TARGET_GENERIC_GETTY_PORT = ttyLP0
 BR2_TARGET_ROOTFS_EXT2=y
 BR2_TARGET_ROOTFS_EXT2_4=y
 
@@ -51,7 +52,7 @@
 #	BL32_EXTRA1=$(OPTEE_OS_PAGER_V2_BIN) \
 #	BL32_EXTRA2=$(OPTEE_OS_PAGEABLE_V2_BIN) \
 
-TF_A_FLAGS  = PLAT=imx8mq SPD=opteed DEBUG_CONSOLE=1 DEBUG=0 V=1
+TF_A_FLAGS  = PLAT=imx8qx SPD=opteed DEBUG_CONSOLE=1 DEBUG=0 V=1
 TF_A_FLAGS += BL32=$(ROOT)/optee_os/out/arm/core/tee-raw.bin
 
 tfa: optee-os u-boot
@@ -66,11 +67,11 @@
 
 U-BOOT_EXPORTS = CROSS_COMPILE="$(CCACHE)$(AARCH64_CROSS_COMPILE)"
 
-U-BOOT_DEFCONFIG_FILES := $(U-BOOT_PATH)/configs/imx8mq_evk_defconfig \
+U-BOOT_DEFCONFIG_FILES := $(U-BOOT_PATH)/configs/imx8qxp_mek_defconfig \
 			  $(BUILD_PATH)/kconfigs/uboot_imx8.conf
 
 $(U-BOOT_PATH)/.config: $(U-BOOT_DEFCONFIG_FILES)
-	$(U-BOOT_EXPORTS) $(MAKE) -C $(U-BOOT_PATH) imx8mq_evk_defconfig
+	$(U-BOOT_EXPORTS) $(MAKE) -C $(U-BOOT_PATH) imx8qxp_mek_defconfig
 	(cd $(U-BOOT_PATH) && \
                 ARCH=arm64 \
                 scripts/kconfig/merge_config.sh $(U-BOOT_DEFCONFIG_FILES))
@@ -96,7 +97,7 @@
 ################################################################################
 LINUX_DEFCONFIG_COMMON_ARCH := arm64
 LINUX_DEFCONFIG_COMMON_FILES := \
-		$(LINUX_PATH)/arch/arm64/configs/defconfig \
+		$(LINUX_PATH)/arch/arm64/configs/imx_v8_defconfig \
 		$(CURDIR)/kconfigs/imx.conf
 
 linux-defconfig: $(LINUX_PATH)/.config
@@ -129,7 +130,7 @@
 
 $(ROOT)/out-firmware/$(FIRMWARE_BIN):
 	mkdir -p $(ROOT)/out-firmware
-	(cd $(ROOT)/out-firmware && wget $(FIRMWARE_BIN_URL))
+	(cd $(ROOT)/out-firmware && wget $(FIRMWARE_BIN_URL) --no-check-certificate) 
 
 $(FIRMWARE_PATH)/.unpacked: $(ROOT)/out-firmware/$(FIRMWARE_BIN)
 	(cd $(ROOT)/out-firmware && \
@@ -149,18 +150,22 @@
 ################################################################################
 mkimage: u-boot tfa ddr-firmware
 	ln -sf $(ROOT)/optee_os/out/arm/core/tee-raw.bin \
-		$(MKIMAGE_PATH)/iMX8M/tee.bin
-	ln -sf $(ROOT)/trusted-firmware-a/build/imx8mq/release/bl31.bin \
-		$(MKIMAGE_PATH)/iMX8M/
-	ln -sf $(LPDDR_BIN_PATH)/lpddr4_pmu_train_*.bin $(MKIMAGE_PATH)/iMX8M/
-	ln -sf $(U-BOOT_PATH)/u-boot-nodtb.bin $(MKIMAGE_PATH)/iMX8M/
-	ln -sf $(U-BOOT_PATH)/spl/u-boot-spl.bin $(MKIMAGE_PATH)/iMX8M/
-	ln -sf $(U-BOOT_PATH)/arch/arm/dts/imx8mq-evk.dtb \
-		$(MKIMAGE_PATH)/iMX8M/fsl-imx8mq-evk.dtb
-	ln -sf $(U-BOOT_PATH)/tools/mkimage $(MKIMAGE_PATH)/iMX8M/mkimage_uboot
-	$(MAKE) -C $(MKIMAGE_PATH) SOC=iMX8M flash_spl_uboot
-#> +If you want to run with HDMI, copy signed_hdmi_imx8m.bin to imx-mkimage/iMX8M
-#> +make SOC=iMX8M flash_spl_uboot or make SOC=iMX8M flash_hdmi_spl_uboot to
+		$(MKIMAGE_PATH)/iMX8QX/tee.bin
+	ln -sf $(ROOT)/trusted-firmware-a/build/imx8qx/release/bl31.bin \
+		$(MKIMAGE_PATH)/iMX8QX/
+	ln -sf $(IMX_SECO_PATH)/mx8qxb0-ahab-container.img $(MKIMAGE_PATH)/iMX8QX/
+	ln -sf $(IMX_SCFW_PATH)/scfw_tcm.bin   $(MKIMAGE_PATH)/iMX8QX/	
+	ln -sf $(LPDDR_BIN_PATH)/lpddr4_pmu_train_*.bin $(MKIMAGE_PATH)/iMX8QX/
+	ln -sf $(U-BOOT_PATH)/u-boot-nodtb.bin $(MKIMAGE_PATH)/iMX8QX/
+	ln -sf $(U-BOOT_PATH)/spl/u-boot-spl.bin $(MKIMAGE_PATH)/iMX8QX/
+	ln -sf $(U-BOOT_PATH)/arch/arm/dts/imx8qxp-mek.dtb \
+		$(MKIMAGE_PATH)/iMX8QX/fsl-imx8qxp-mek.dtb
+	ln -sf $(U-BOOT_PATH)/tools/mkimage $(MKIMAGE_PATH)/iMX8QX/mkimage_uboot
+	ln -sf $(U-BOOT_PATH)/u-boot.bin $(MKIMAGE_PATH)/iMX8QX/u-boot.bin	
+	$(MAKE) -C $(MKIMAGE_PATH)/&& cp mkimage_imx8 $(MKIMAGE_PATH)
+	$(MAKE) -C $(MKIMAGE_PATH) SOC=iMX8QX flash_spl
+#> +If you want to run with HDMI, copy signed_hdmi_imx8m.bin to imx-mkimage/iMX8QX
+#> +make SOC=iMX8QX flash_spl_uboot or make SOC=iMX8QX flash_hdmi_spl_uboot to
 #> +generate flash.bin.
 mkimage-clean:
 	cd $(MKIMAGE_PATH) && git clean -xdf
@@ -214,8 +219,9 @@
 endif
 
 .PHONY: flash-image
-flash-image: buildroot mkimage linux
-	$(MAKE) flash-image-only
+flash-image: buildroot mkimage linux flash-image-only
+	$(info make boot.img finished!)
+#	$(MAKE) flash-image-only
 
 .PHONY: flash-image-only
 flash-image-only: $(ROOT)/out-br/images/ramdisk.img $(ROOT)/out/boot.scr
@@ -225,7 +231,7 @@
 	mformat -i $(BOOT_IMG).fat -n 64 -h 255 -T 131072 -v "BOOT IMG" -C ::
 	mcopy -i $(BOOT_IMG).fat $(LINUX_PATH)/arch/arm64/boot/Image ::
 	mcopy -i $(BOOT_IMG).fat \
-		$(LINUX_PATH)/arch/arm64/boot/dts/freescale/imx8mq-evk.dtb ::
+		$(LINUX_PATH)/arch/arm64/boot/dts/freescale/imx8qxp-mek.dtb ::
 	mcopy -i $(BOOT_IMG).fat $(ROOT)/out/boot.scr ::
 
 ifeq ($(USE_PERSISTENT_ROOTFS),1)
@@ -237,5 +243,5 @@
 
 	dd if=$(BOOT_IMG).fat of=$(BOOT_IMG) bs=$(FLASH_PARTITIONS_BLOCK_SIZE) \
 		seek=$(FLASH_PARTITION_BOOT_START_BLOCK) conv=fsync,notrunc
-	dd if=$(ROOT)/imx-mkimage/iMX8M/flash.bin of=$(BOOT_IMG) bs=1k seek=33 \
+	dd if=$(ROOT)/imx-mkimage/iMX8QX/flash.bin of=$(BOOT_IMG) bs=1k seek=32 \
 		conv=fsync,notrunc
Binary files build/mkimage_imx8 and ../build/mkimage_imx8 differ

4.1.1 内核版本配置

  • 修改build/br-ext/configs/toolchain-aarch64文件中的BR2_TOOLCHAIN_EXTERNAL_HEADERS
BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_20=y

BR2_TOOLCHAIN_EXTERNAL_HEADERS_5_15=y
  • 修改工具链中的内核版本

修改toolchains/aarch64/aarch64-none-linux-gnu/libc/usr/include/linux/version.h文件中的

#define LINUX_VERSION_CODE 267277

#define LINUX_VERSION_CODE 331525

内核版本规则为:331525对应十六进制为0x050F05,对应5.15.5版本

4.1.2 提示找不到OpenSC-0.22.0.tar.gz: No such file or directory

opensc下载目录发生变化,opensc-0.21已不存在,需要调整,修改build/br-ext/package/opensc/opensc.mk文件中的

OPENSC_VERSION = 0.21.0
OPENSC_SOURCE = /OpenSC-$(OPENSC_VERSION).tar.gz

OPENSC_VERSION = 0.22.0
OPENSC_SOURCE = /opensc-$(OPENSC_VERSION).tar.gz

4.1.3 关闭strace内核调试

strace5.14.0编译出错,暂时先关闭,保证整体通过,后续根据需要再开启。修改build/common.mk中的

BR2_PACKAGE_STRACE ?= y

BR2_PACKAGE_STRACE ?= n

4.1.4 修改build/imx8qxp.mk中的out-firmware配置

修改build/imx8qxp.mkMakefile文件,wget $(FIRMWARE_BIN_URL))后面增加–no-check-certificate选项不检测证书,否则会下载报错。

$(ROOT)/out-firmware/$(FIRMWARE_BIN):
	mkdir -p $(ROOT)/out-firmware
	(cd $(ROOT)/out-firmware && wget $(FIRMWARE_BIN_URL) --no-check-certificate) 

4.1.5 修改imx-mkimage中的mkimage

mkimage: u-boot tfa ddr-firmware
	ln -sf $(ROOT)/optee_os/out/arm/core/tee-raw.bin \
		$(MKIMAGE_PATH)/iMX8QX/tee.bin
	ln -sf $(ROOT)/trusted-firmware-a/build/imx8qx/release/bl31.bin \
		$(MKIMAGE_PATH)/iMX8QX/
	ln -sf $(IMX_SECO_PATH)/mx8qxb0-ahab-container.img $(MKIMAGE_PATH)/iMX8QX/
	ln -sf $(IMX_SCFW_PATH)/scfw_tcm.bin   $(MKIMAGE_PATH)/iMX8QX/	
	ln -sf $(LPDDR_BIN_PATH)/lpddr4_pmu_train_*.bin $(MKIMAGE_PATH)/iMX8QX/
	ln -sf $(U-BOOT_PATH)/u-boot-nodtb.bin $(MKIMAGE_PATH)/iMX8QX/
	ln -sf $(U-BOOT_PATH)/spl/u-boot-spl.bin $(MKIMAGE_PATH)/iMX8QX/
	ln -sf $(U-BOOT_PATH)/arch/arm/dts/imx8qxp-mek.dtb \
		$(MKIMAGE_PATH)/iMX8QX/fsl-imx8qxp-mek.dtb
	ln -sf $(U-BOOT_PATH)/tools/mkimage $(MKIMAGE_PATH)/iMX8QX/mkimage_uboot
	ln -sf $(U-BOOT_PATH)/u-boot.bin $(MKIMAGE_PATH)/iMX8QX/u-boot.bin	
	# 添加行
	$(MAKE) -C $(MKIMAGE_PATH)/&& cp mkimage_imx8 $(MKIMAGE_PATH)
	$(MAKE) -C $(MKIMAGE_PATH) SOC=iMX8QX flash_spl

4.1.6 build文件夹下的imx.mk配置flash-image

.PHONY: flash-image
flash-image: buildroot mkimage linux flash-image-only
	$(info make boot.img finished!)
#	$(MAKE) flash-image-only

4.1.7 IMX8QXP芯片C0版本支持

根据芯片实际版本型号选择

$(MAKE) -C $(MKIMAGE_PATH) SOC=iMX8QX flash_spl REV=C0

4.2 提取optee_test的修改补丁

diff -uNr -x ".git" optee_test ../optee_test > imx8qxp_optee_test.patch

将如下代码保存为imx8qxp_optee_test.patch

diff -uNr -x .git optee_test/host/xtest/CMakeLists.txt ../optee_test/host/xtest/CMakeLists.txt
--- optee_test/host/xtest/CMakeLists.txt	2022-09-13 11:48:14.785407109 +0800
+++ ../optee_test/host/xtest/CMakeLists.txt	2022-09-13 11:33:28.848488526 +0800
@@ -59,6 +59,7 @@
 	xtest_main.c
 	xtest_test.c
 	xtest_uuid_helpers.c
+	crypto_perf.c
 )
 
 if (WITH_GP_TESTS)
@@ -128,6 +129,7 @@
 	PRIVATE adbg/include
 	PRIVATE ${OPTEE_TEST_SDK}/host_include
 	PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
+	PRIVATE ../../ta/crypto_perf/include
 	${GP_INCLUDES}
 )

4.3 提取toolchains修改补丁

diff -uNr -x ".git" toolchains ../toolchains > imx8qxp_toolchains.patch

将以下代码保存为imx8qxp_toolchains.patch

diff -uNr -x .git toolchains/aarch64/aarch64-none-linux-gnu/libc/usr/include/linux/version.h ../toolchains/aarch64/aarch64-none-linux-gnu/libc/usr/include/linux/version.h
--- toolchains/aarch64/aarch64-none-linux-gnu/libc/usr/include/linux/version.h	2022-09-13 13:55:25.642865459 +0800
+++ ../toolchains/aarch64/aarch64-none-linux-gnu/libc/usr/include/linux/version.h	2022-09-13 11:33:32.888501388 +0800
@@ -1,2 +1,3 @@
-#define LINUX_VERSION_CODE 267277
+//#define LINUX_VERSION_CODE 267277
+#define LINUX_VERSION_CODE 331525
 #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))

然后执行如下代码打补丁:

$cd build
$ patch -p1 < ../imx8qxp_build.patch 
patching file br-ext/configs/toolchain-aarch32
patching file br-ext/configs/toolchain-aarch64
patching file br-ext/package/opensc/opensc.mk
patching file common.mk
patching file imx.mk
$ cd ../optee_test
$ patch -p1 < ../imx8qxp_optee_test.patch 
patching file host/xtest/CMakeLists.txt
$ cd ../toolchains
$ patch -p1 < ../imx8qxp_toolchains.patch 
patching file aarch64/aarch64-none-linux-gnu/libc/usr/include/linux/version.h

5. 编译

5.1 编译scfw

# 编译语法
Usage: make TARGET OPTIONS

image-20220825134055584

# 只支持B0版本
make qx R=B0 M=1 D=1 V=1

上面的选项开启了很多调试,正式发布时用这个选项编译

make qx R=B0 M=0 D=0 V=0

生成的镜像位置为imx-scfw-porting-kit-1.12.1/source/build_mx8qx_b0/scfw_tcm.bin

5.2 编译整个imx8qxp项目

包含uboot、atf、scfw、seco、optee-os、optee-client、kernel、rootfs, 并且打包成最终的img镜像

cd build
make -f imx.mk

6. 烧录镜像

烧录镜像到sd卡

6.1 查看SD卡设备号

$ df -h
Filesystem       Size  Used Avail Use% Mounted on
...
/dev/sda1         64M   30M   35M  46% /media/dev/BOOT IMG
/dev/sda2        230M  131M   83M  62% /media/dev/rootfs

或者

$dmesg
...
[   52.811970] sd 5:0:0:0: [sda] 123205632 512-byte logical blocks: (63.1 GB/58.7 GiB)
[   52.812745] sda: detected capacity change from 0 to 123205632
[   52.813798]  sda: sda1 sda2
[   53.806606] EXT4-fs (sda2): recovery complete
[   53.816517] EXT4-fs (sda2): mounted filesystem with ordered data mode. Opts: (null). Quota mode: none.

可以看到设备号为sda

6.2 烧写固件

​ if 指定输入源,of指定输出源,根据上面查询的设备号输入

sudo dd bs=4M if=../out/boot.img of=/dev/sda status=progress conv=fsync
$ pwd
/home/dev/workspace/imx8qxp_project/build
$ sudo dd bs=4M if=../out/boot.img of=/dev/sda status=progress conv=fsync
[sudo] password for dev: 
18+0 records in
18+0 records out
75497472 bytes (75 MB, 72 MiB) copied, 8.4205 s, 9.0 MB/s

烧写之后就可以启动了,注意板卡,如果是C0的芯片版本则在mkimage时选择REV=C0,默认是B0版本。

7. 测试

7.1 启动测试

U-Boot 2021.04 (Sep 13 2022 - 11:23:18 +0800)

CPU:   NXP i.MX8QXP RevB A35 at 1200 MHz at 26C

Model: NXP i.MX8QXP MEK
Board: iMX8QXP MEK
Boot:  SD1
DRAM:  3 GiB
TCPC:  Vendor ID [0x1fc9], Product ID [0x5110], Addr [I2C1 0x50]
MMC:   FSL_SDHC: 0, FSL_SDHC: 1
Loading Environment from MMC... *** Warning - bad CRC, using default environment

[*]-Video Link 0it6263_i2c_reg_read, read err 3
faill to read from it6263 revision, ret 3
 (1280 x 720)
        [0] dpu@56180000, video
        [1] lvds-channel@0, display
        [2] lvds-to-hdmi-bridge@4c, video_bridge
In:    serial
Out:   serial
Err:   serial

 BuildInfo: 
  - SCFW c1e35e09, SECO-FW c9de51c0, IMX-MKIMAGE 22346a32, ATF 2cad065
  - U-Boot 2021.04 

switch to partitions #0, OK
mmc1 is current device
flash target is MMC:1
Net:   eth0: ethernet@5b040000 [PRIME]
Warning: ethernet@5b050000 (eth1) using random MAC address - ae:cc:f5:83:12:71
, eth1: ethernet@5b050000
Fastboot: Normal
Normal Boot
Hit any key to stop autoboot:  0 
switch to partitions #0, OK
mmc1 is current device
753 bytes read in 2 ms (367.2 KiB/s)
Running bootscript from mmc ...
## Executing script at 80280000
100451 bytes read in 5 ms (19.2 MiB/s)
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND
optee node missing, trying to add it
optee {
        method = "smc";
        compatible = "linaro,optee-tz";
};
41069056 bytes read in 460 ms (85.1 MiB/s)
7743550 bytes read in 90 ms (82.1 MiB/s)
Moving Image from 0x80280000 to 0x80400000, end=82bc0000
## Loading init Ramdisk from Legacy Image at 83100000 ...
   Image Name:   
   Image Type:   AArch64 Linux RAMDisk Image (gzip compressed)
   Data Size:    7743486 Bytes = 7.4 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 83000000
   Booting using the fdt blob at 0x83000000
   Using Device Tree in place at 0000000083000000, end 000000008301ffff
Disable clock-controller@585a0000 rsrc 411 not owned
Disable jr@40000 rsrc 502 not owned
Disable clock-controller@5a4d0000 rsrc 62 not owned
Disable clock-controller@5ac90000 rsrc 102 not owned

Starting kernel ...

imx_pwr_domain_on cpu_id 1
I/TC: Secondary CPU 1 initializing
I/TC: Secondary CPU 1 switching to normal world boot
imx_pwr_domain_on cpu_id 2
I/TC: Secondary CPU 2 initializing
I/TC: Secondary CPU 2 switching to normal world boot
imx_pwr_domain_on cpu_id 3
I/TC: Secondary CPU 3 initializing
I/TC: Secondary CPU 3 switching to normal world boot
[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd042]
[    0.000000] Linux version 5.15.32 (dev@zsm) (aarch64-linux-gnu-gcc (GNU Toolchain for the A-profile Architecture 10.2-2020.11 (arm-10.16)) 10.2.1 20201103, GNU ld (GNU Toolchain for the A-profile Arch2
[    0.000000] Machine model: Freescale i.MX8QXP MEK
[    0.000000] efi: UEFI not found.
[    0.000000] Reserved memory: created CMA memory pool at 0x00000000c0000000, size 960 MiB
[    0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[    0.000000] Reserved memory: created DMA memory pool at 0x0000000090400000, size 1 MiB
[    0.000000] OF: reserved mem: initialized node vdevbuffer, compatible id shared-dma-pool
[    0.000000] Reserved memory: created DMA memory pool at 0x0000000094300000, size 1 MiB
[    0.000000] OF: reserved mem: initialized node vdev0buffer@94300000, compatible id shared-dma-pool
[    0.000000] NUMA: No NUMA configuration found
[    0.000000] NUMA: Faking a node at [mem 0x0000000080200000-0x00000008bfffffff]
[    0.000000] NUMA: NODE_DATA [mem 0x8bf9b6c00-0x8bf9b8fff]
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x0000000080200000-0x00000000ffffffff]
[    0.000000]   DMA32    empty
[    0.000000]   Normal   [mem 0x0000000100000000-0x00000008bfffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000080200000-0x0000000083ffffff]
[    0.000000]   node   0: [mem 0x0000000084000000-0x00000000861fffff]
[    0.000000]   node   0: [mem 0x0000000086200000-0x000000008fffffff]
[    0.000000]   node   0: [mem 0x0000000090000000-0x000000009001ffff]
[    0.000000]   node   0: [mem 0x0000000090020000-0x00000000900fefff]
[    0.000000]   node   0: [mem 0x00000000900ff000-0x00000000900fffff]
[    0.000000]   node   0: [mem 0x0000000090100000-0x00000000903fffff]
[    0.000000]   node   0: [mem 0x0000000090400000-0x00000000904fffff]
[    0.000000]   node   0: [mem 0x0000000090500000-0x0000000091ffffff]
[    0.000000]   node   0: [mem 0x0000000092000000-0x0000000094bfffff]
[    0.000000]   node   0: [mem 0x0000000094c00000-0x00000000fdffffff]
[    0.000000]   node   0: [mem 0x0000000880000000-0x00000008bfffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000080200000-0x00000008bfffffff]
[    0.000000] psci: probing for conduit method from DT.
[    0.000000] psci: PSCIv1.1 detected in firmware.
[    0.000000] psci: Using standard PSCI v0.2 function IDs
[    0.000000] psci: Trusted OS migration not required
[    0.000000] psci: SMC Calling Convention v1.2
[    0.000000] percpu: Embedded 20 pages/cpu s41688 r8192 d32040 u81920
[    0.000000] Detected VIPT I-cache on CPU0
[    0.000000] CPU features: detected: GIC system register CPU interface
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 765448
[    0.000000] Policy zone: Normal
[    0.000000] Kernel command line: 
[    0.000000] Dentry cache hash table entries: 524288 (order: 10, 4194304 bytes, linear)
[    0.000000] Inode-cache hash table entries: 262144 (order: 9, 2097152 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] software IO TLB: mapped [mem 0x00000000bc000000-0x00000000c0000000] (64MB)
[    0.000000] Memory: 1739044K/3110912K available (20032K kernel code, 3306K rwdata, 9984K rodata, 6656K init, 544K bss, 388828K reserved, 983040K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] rcu: Preemptible hierarchical RCU implementation.
[    0.000000] rcu:     RCU event tracing is enabled.
[    0.000000] rcu:     RCU restricting CPUs from NR_CPUS=256 to nr_cpu_ids=4.
[    0.000000]  Trampoline variant of Tasks RCU enabled.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] GICv3: GIC: Using split EOI/Deactivate mode
[    0.000000] GICv3: 512 SPIs implemented
[    0.000000] GICv3: 0 Extended SPIs implemented
[    0.000000] GICv3: Distributor has no Range Selector support
[    0.000000] Root IRQ handler: gic_handle_irq
[    0.000000] GICv3: 16 PPIs implemented
[    0.000000] GICv3: CPU0: found redistributor 0 region 0:0x0000000051b00000
[    0.000000] random: get_random_bytes called from start_kernel+0x478/0x664 with crng_init=0
[    0.000000] arch_timer: cp15 timer(s) running at 8.00MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x1d854df40, max_idle_ns: 440795202120 ns
[    0.000000] sched_clock: 56 bits at 8MHz, resolution 125ns, wraps every 2199023255500ns
[    0.003229] Console: colour dummy device 80x25
[    0.003996] printk: console [tty0] enabled
[    0.004106] Calibrating delay loop (skipped), value calculated using timer frequency.. 16.00 BogoMIPS (lpj=32000)
[    0.004142] pid_max: default: 32768 minimum: 301
[    0.004229] LSM: Security Framework initializing
[    0.004315] Mount-cache hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.004352] Mountpoint-cache hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.005983] rcu: Hierarchical SRCU implementation.
[    0.012305] EFI services will not be available.
[    0.012635] smp: Bringing up secondary CPUs ...
[    0.023052] Detected VIPT I-cache on CPU1
[    0.023088] GICv3: CPU1: found redistributor 1 region 0:0x0000000051b20000
[    0.023145] CPU1: Booted secondary processor 0x0000000001 [0x410fd042]
[    0.033585] Detected VIPT I-cache on CPU2
[    0.033614] GICv3: CPU2: found redistributor 2 region 0:0x0000000051b40000
[    0.033645] CPU2: Booted secondary processor 0x0000000002 [0x410fd042]
[    0.044074] Detected VIPT I-cache on CPU3
[    0.044101] GICv3: CPU3: found redistributor 3 region 0:0x0000000051b60000
[    0.044130] CPU3: Booted secondary processor 0x0000000003 [0x410fd042]
[    0.044201] smp: Brought up 1 node, 4 CPUs
[    0.044318] SMP: Total of 4 processors activated.
[    0.044333] CPU features: detected: 32-bit EL0 Support
[    0.044347] CPU features: detected: 32-bit EL1 Support
[    0.044364] CPU features: detected: CRC32 instructions
[    0.052767] CPU: All CPU(s) started at EL2
[    0.052848] alternatives: patching kernel code
[    0.055006] devtmpfs: initialized
[    0.070592] KASLR disabled due to lack of seed
[    0.070810] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.070850] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[    0.120257] pinctrl core: initialized pinctrl subsystem
[    0.121571] DMI not present or invalid.
[    0.122157] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.123603] DMA: preallocated 512 KiB GFP_KERNEL pool for atomic allocations
[    0.123749] DMA: preallocated 512 KiB GFP_KERNEL|GFP_DMA pool for atomic allocations
[    0.123942] DMA: preallocated 512 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations
[    0.124055] audit: initializing netlink subsys (disabled)
[    0.124228] audit: type=2000 audit(0.120:1): state=initialized audit_enabled=0 res=1
[    0.126400] thermal_sys: Registered thermal governor 'step_wise'
[    0.126410] thermal_sys: Registered thermal governor 'power_allocator'
[    0.126835] cpuidle: using governor menu
[    0.127055] hw-breakpoint: found 6 breakpoint and 4 watchpoint registers.
[    0.127172] ASID allocator initialised with 65536 entries
[    0.130115] Serial: AMBA PL011 UART driver
[    0.130272] imx mu driver is registered.
[    0.130328] imx rpmsg driver is registered.
[    0.223884] platform bus@56220000:ldb@562210e0: Fixing up cyclic dependency with 56180000.dpu
[    0.225678] platform 56228000.dsi_host: Fixing up cyclic dependency with 56180000.dpu
[    0.227182] platform bus@56220000:ldb@562410e0: Fixing up cyclic dependency with 56180000.dpu
[    0.228962] platform 56248000.dsi_host: Fixing up cyclic dependency with 56180000.dpu
[    0.254871] HugeTLB registered 1.00 GiB page size, pre-allocated 0 pages
[    0.254916] HugeTLB registered 32.0 MiB page size, pre-allocated 0 pages
[    0.254935] HugeTLB registered 2.00 MiB page size, pre-allocated 0 pages
[    0.254952] HugeTLB registered 64.0 KiB page size, pre-allocated 0 pages
[    0.256328] cryptd: max_cpu_qlen set to 1000
[    0.261317] ACPI: Interpreter disabled.
[    0.270947] iommu: Default domain type: Translated 
[    0.270986] iommu: DMA domain TLB invalidation policy: strict mode 
[    0.271699] vgaarb: loaded
[    0.272064] SCSI subsystem initialized
[    0.272525] usbcore: registered new interface driver usbfs
[    0.272591] usbcore: registered new interface driver hub
[    0.272642] usbcore: registered new device driver usb
[    0.277828] mc: Linux media interface: v0.10
[    0.277888] videodev: Linux video capture interface: v2.00
[    0.278014] pps_core: LinuxPPS API ver. 1 registered
[    0.278033] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.278066] PTP clock support registered
[    0.278535] EDAC MC: Ver: 3.0.0
[    0.285167] FPGA manager framework
[    0.285310] Advanced Linux Sound Architecture Driver Initialized.
[    0.286021] Bluetooth: Core ver 2.22
[    0.286075] NET: Registered PF_BLUETOOTH protocol family
[    0.286090] Bluetooth: HCI device and connection manager initialized
[    0.286111] Bluetooth: HCI socket layer initialized
[    0.286128] Bluetooth: L2CAP socket layer initialized
[    0.286155] Bluetooth: SCO socket layer initialized
[    0.287541] imx-scu scu: NXP i.MX SCU Initialized
[    0.304970] random: fast init done
[    0.314573] imx8qxp-pinctrl scu:pinctrl: Invalid fsl,pins or pins property in node /scu/pinctrl/wifi_initgrp
[    0.314650] imx8qxp-pinctrl scu:pinctrl: initialized IMX pinctrl driver
[    0.318663] clocksource: Switched to clocksource arch_sys_counter
[    0.318971] VFS: Disk quotas dquot_6.6.0
[    0.319043] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    0.319274] pnp: PnP ACPI: disabled
[    0.349058] NET: Registered PF_INET protocol family
[    0.349281] IP idents hash table entries: 65536 (order: 7, 524288 bytes, linear)
[    0.351673] tcp_listen_portaddr_hash hash table entries: 2048 (order: 3, 32768 bytes, linear)
[    0.351787] TCP established hash table entries: 32768 (order: 6, 262144 bytes, linear)
[    0.352041] TCP bind hash table entries: 32768 (order: 7, 524288 bytes, linear)
[    0.352566] TCP: Hash tables configured (established 32768 bind 32768)
[    0.352719] UDP hash table entries: 2048 (order: 4, 65536 bytes, linear)
[    0.352826] UDP-Lite hash table entries: 2048 (order: 4, 65536 bytes, linear)
[    0.353050] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.353592] RPC: Registered named UNIX socket transport module.
[    0.353614] RPC: Registered udp transport module.
[    0.353627] RPC: Registered tcp transport module.
[    0.353642] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.354725] PCI: CLS 0 bytes, default 64
[    0.355016] Unpacking initramfs...
[    0.367169] hw perfevents: enabled with armv8_cortex_a35 PMU driver, 7 counters available
[    0.369167] kvm [1]: IPA Size Limit: 40 bits
[    0.371526] kvm [1]: GICv3: no GICV resource entry
[    0.371552] kvm [1]: disabling GICv2 emulation
[    0.371582] kvm [1]: GIC system register CPU interface enabled
[    0.371746] kvm [1]: vgic interrupt IRQ9
[    0.371910] kvm [1]: Hyp mode initialized successfully
[    0.376369] Initialise system trusted keyrings
[    0.376625] workingset: timestamp_bits=42 max_order=20 bucket_order=0
[    0.384250] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.385070] NFS: Registering the id_resolver key type
[    0.385123] Key type id_resolver registered
[    0.385137] Key type id_legacy registered
[    0.385238] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.385257] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering...
[    0.385295] jffs2: version 2.2. (NAND) �© 2001-2006 Red Hat, Inc.
[    0.385774] 9p: Installing v9fs 9p2000 file system support
[    0.431422] Key type asymmetric registered
[    0.431474] Asymmetric key parser 'x509' registered
[    0.431620] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 243)
[    0.431643] io scheduler mq-deadline registered
[    0.431658] io scheduler kyber registered
[    0.516941] EINJ: ACPI disabled.
[    0.726249] mxs-dma 5b810000.dma-apbh: initialized
[    0.739649] Bus freq driver module loaded
[    0.748165] Freeing initrd memory: 7556K
[    0.780109] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    0.789963] SuperH (H)SCI(F) driver initialized
[    0.793339] msm_serial: driver initialized
[    0.796873] 5a060000.serial: ttyLP0 at MMIO 0x5a060010 (irq = 81, base_baud = 5000000) is a FSL_LPUART
[    0.796930] fsl-lpuart 5a060000.serial: Serial: Console lpuart rounded baud ratefrom 35971 to 115200
[    1.959170] printk: console [ttyLP0] enabled
[    1.964803] 5a070000.serial: ttyLP1 at MMIO 0x5a070010 (irq = 82, base_baud = 5000000) is a FSL_LPUART
[    1.975189] 5a080000.serial: ttyLP2 at MMIO 0x5a080010 (irq = 83, base_baud = 5000000) is a FSL_LPUART
[    1.985539] 5a090000.serial: ttyLP3 at MMIO 0x5a090010 (irq = 84, base_baud = 5000000) is a FSL_LPUART
[    2.072397] loop: module loaded
[    2.080598] megasas: 07.717.02.00-rc1
[    2.089904] imx ahci driver is registered.
[    2.112106] spi-nor spi0.0: mt35xu512aba (65536 Kbytes)
[    2.130147] tun: Universal TUN/TAP device driver, 1.6
[    2.140253] thunder_xcv, ver 1.0
[    2.143584] thunder_bgx, ver 1.0
[    2.146868] nicpf, ver 1.0
[    2.157556] hclge is initializing
[    2.160953] hns3: Hisilicon Ethernet Network Driver for Hip08 Family - version
[    2.168215] hns3: Copyright (c) 2017 Huawei Corporation.
[    2.173649] e1000: Intel(R) PRO/1000 Network Driver
[    2.178560] e1000: Copyright (c) 1999-2006 Intel Corporation.
[    2.184499] e1000e: Intel(R) PRO/1000 Network Driver
[    2.189488] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
[    2.195473] igb: Intel(R) Gigabit Ethernet Network Driver
[    2.200892] igb: Copyright (c) 2007-2014 Intel Corporation.
[    2.206541] igbvf: Intel(R) Gigabit Virtual Function Network Driver
[    2.212832] igbvf: Copyright (c) 2009 - 2012 Intel Corporation.
[    2.220820] sky2: driver version 1.30
[    2.231291] VFIO - User Level meta-driver version: 0.3
[    2.254554] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    2.261166] ehci-pci: EHCI PCI platform driver
[    2.265733] ehci-platform: EHCI generic platform driver
[    2.271847] ehci-orion: EHCI orion driver
[    2.276506] ehci-exynos: EHCI Exynos driver
[    2.281262] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    2.287533] ohci-pci: OHCI PCI platform driver
[    2.292081] ohci-platform: OHCI generic platform driver
[    2.298032] ohci-exynos: OHCI Exynos driver
[    2.306164] usbcore: registered new interface driver uas
[    2.311671] usbcore: registered new interface driver usb-storage
[    2.329369] input: sc-powerkey as /devices/platform/sc-powerkey/input/input0
[    2.342418] imx-sc-rtc scu:rtc: registered as rtc0
[    2.347581] imx-sc-rtc scu:rtc: setting system clock to 1970-01-01T03:00:49 UTC (10849)
[    2.360055] i2c_dev: i2c /dev entries driver
[    2.400824] Bluetooth: HCI UART driver ver 2.3
[    2.405346] Bluetooth: HCI UART protocol H4 registered
[    2.410506] Bluetooth: HCI UART protocol BCSP registered
[    2.415866] Bluetooth: HCI UART protocol LL registered
[    2.421032] Bluetooth: HCI UART protocol ATH3K registered
[    2.426474] Bluetooth: HCI UART protocol Three-wire (H5) registered
[    2.433189] Bluetooth: HCI UART protocol Broadcom registered
[    2.438908] Bluetooth: HCI UART protocol QCA registered
[    2.454254] sdhci: Secure Digital Host Controller Interface driver
[    2.461554] sdhci: Copyright(c) Pierre Ossman
[    2.470605] Synopsys Designware Multimedia Card Interface Driver
[    2.482874] sdhci-pltfm: SDHCI platform and OF driver helper
[    2.500129] ledtrig-cpu: registered to indicate activity on CPUs
[    2.511899] SMCCC: SOC_ID: ARCH_SOC_ID not implemented, skipping ....
[    2.520290] usbcore: registered new interface driver usbhid
[    2.523419] mmc0: SDHCI controller on 5b010000.mmc [5b010000.mmc] using ADMA
[    2.525912] usbhid: USB HID core driver
[    2.544646] mxc-isi 58100000.isi: mxc_isi.0 registered successfully
[    2.553869] mxc-isi 58110000.isi: mxc_isi.1 registered successfully
[    2.563220] mxc-isi 58120000.isi: mxc_isi.2 registered successfully
[    2.572484] mxc-isi 58130000.isi: mxc_isi.3 registered successfully
[    2.581716] mxc-isi 58140000.isi: mxc_isi.4 registered successfully
[    2.610382]  cs_system_cfg: CoreSight Configuration manager initialised
[    2.614255] mmc0: new HS400 MMC card at address 0001
[    2.622881] mmcblk0: mmc0:0001 R1J57L 29.1 GiB 
[    2.627286] optee: probing for conduit method.
[    2.629496]  mmcblk0: p1 p2
arTC:1   t[ e e _ en2.t6r3y1_9e6x4c]h aonpgtee_ec:a praebivilsiitoien s3:1.1052  D(8y0n7a6m2i9ca 0s)h
  ed memory is disabled
o    2.6354D5/4T]C :m?m c0 bltke0eb_otoat_0i:n imt_mcp0s:e0u0d0o1_ tRa1_Js5e7sLsi 8o.n:002 9M9i LB o
 kup pseudo TA 7011a688-ddde-4053-a5a9-7b3c4ddf13b8
D/TC:? 0 tee_ta_init_pseudo_ta_session:312 Open device.pta
D/TC:? 0 tee_ta_init_pseudo_ta_session:329 device.pta : 7011a688-ddde-4053-a5a9-7b3c4ddf13b8
R1TC:? 0 tee_ta_c[ l o s e2_.s6es74s1io67n]: 5m1m2 cbcslke0sbso o0tx1f:e 0bmm1cf02:00 0i0d1  1
a JD5/7TLC :8?. 000  teMieB_t 
 _close_session:531 Destroy session
[    2.687112] optee: initialized driver
[    2.688516] mmcblk0rpmb: mmc0:0001 R1J57L 4.00 MiB, chardev (507:0)
[    2.700772] Galcore version 6.4.3.p4.398061
[    2.793096] [drm] Initialized vivante 1.0.0 20170808 for 80000000.imx8_gpu0_ss on minor 0
[    2.814032] NET: Registered PF_LLC protocol family
[    2.819569] NET: Registered PF_INET6 protocol family
[    2.825574] Segment Routing with IPv6
[    2.829322] In-situ OAM (IOAM) with IPv6
[    2.833317] NET: Registered PF_PACKET protocol family
[    2.838533] Bluetooth: RFCOMM TTY layer initialized
[    2.843510] Bluetooth: RFCOMM socket layer initialized
[    2.848728] Bluetooth: RFCOMM ver 1.11
[    2.852516] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[    2.857878] Bluetooth: BNEP filters: protocol multicast
[    2.863138] Bluetooth: BNEP socket layer initialized
[    2.868149] Bluetooth: HIDP (Human Interface Emulation) ver 1.2
[    2.874091] Bluetooth: HIDP socket layer initialized
[    2.879128] 8021q: 802.1Q VLAN Support v1.8
[    2.883352] lib80211: common routines for IEEE802.11 drivers
[    2.889164] 9pnet: Installing 9P2000 support
[    2.893512] tsn generic netlink module v1 init...
[    2.898343] Key type dns_resolver registered
[    2.902869] Loading compiled-in X.509 certificates
[    2.939909] mxs_phy 5b100000.usbphy: supply phy-3p0 not found, using dummy regulator
[    2.967578] imx-lpi2c 58226000.i2c: use pio mode
[    2.972769] i2c 16-006a: Fixing up cyclic dependency with 58227000.csi
[    2.991824] max9286_mipi 16-006a: max9286_read_reg:read reg error: reg=1e
[    2.998671] max9286 is not found, chip id reg 0x1e = 0x(ffffffff)
[    3.005845] i2c i2c-16: LPI2C adapter registered
[    3.012136] gpio-42 (scl): enforced open drain please flag it properly in DT/ACPI DSDT/board file
[    3.021101] imx-lpi2c 37230000.i2c: using scl,sda for recovery
[    3.026969] imx-lpi2c 37230000.i2c: use pio mode
[    3.032286] pca953x 17-0020: using no AI
[    3.036410] pca953x 17-0020: failed writing register
[    3.041399] pca953x: probe of 17-0020 failed with error -5
[    3.047741] i2c 17-003c: Fixing up cyclic dependency with 58261000.pcsi
[    3.055623] ov5640 17-003c: supply DOVDD not found, using dummy regulator
[    3.062608] ov5640 17-003c: supply AVDD not found, using dummy regulator
[    3.069379] ov5640 17-003c: supply DVDD not found, using dummy regulator
[    3.124770] ov5640 17-003c: ov5640_read_reg: error: reg=300a
[    3.130519] ov5640 17-003c: ov5640_check_chip_id: failed to read chip identifier
[    3.138454] ov5640: probe of 17-003c failed with error -5
[    3.145017] i2c i2c-17: LPI2C adapter registered
[    3.151480] imx-lpi2c 5a810000.i2c: use pio mode
[    3.157989] max732x 18-0068: failed reading
[    3.162226] max732x: probe of 18-0068 failed with error -5
[    3.167913] i2c i2c-1: Added multiplexed i2c bus 18
[    3.173054] i2c i2c-1: Added multiplexed i2c bus 19
[    3.178751] i2c i2c-1: Added multiplexed i2c bus 20
[    3.184277] pca953x 21-001a: using no AI
[    3.189796] pca953x 21-001d: using no AI
[    3.195075] i2c i2c-1: Added multiplexed i2c bus 21
[    3.200028] pca954x 1-0071: registered 4 multiplexed busses for I2C switch pca9646
[    3.207954] i2c 1-0050: Fixing up cyclic dependency with 5b130000.usb
[    3.216040] i2c i2c-1: LPI2C adapter registered
[    3.237962] pwm-backlight lvds_backlight@0: supply power not found, using dummy regulator
[    3.250834] pwm-backlight lvds_backlight@1: supply power not found, using dummy regulator
[    3.277743] dpu-core 56180000.dpu: driver probed
[    3.291520] pps pps0: new PPS source ptp0
[    3.303865] fec 5b040000.ethernet eth0: registered PHC device 0
[    3.390081] sdhci-esdhc-imx 5b020000.mmc: Got CD GPIO
[    3.395345] sdhci-esdhc-imx 5b020000.mmc: Got WP GPIO
[    3.426694] mxc-mipi-csi2 58227000.csi: lanes: 4, name: mxc-mipi-csi2.0
[    3.433255] mmc1: SDHCI controller on 5b020000.mmc [5b020000.mmc] using ADMA
[    3.437523] mxc-parallel-csi 58261000.pcsi: mxc_parallel_csi_probe probe successfully
[    3.514820] cs42xx8 17-0048: failed to get device ID, ret = -5
[    3.522061] cs42xx8: probe of 17-0048 failed with error -5
[    3.540407] imx-lpi2c 56226000.i2c: use pio mode
[    3.546717] i2c 22-004c: Fixing up cyclic dependency with bus@56220000:ldb@562210e0
[    3.610205] it6263 22-004c: Probe failed. Remote port 'lvds-channel@0' disabled
[    3.618896] i2c 22-003d: Fixing up cyclic dependency with 56228000.dsi_host
[    3.626277] adv7511 22-003d: supply avdd not found, using dummy regulator
[    3.633230] adv7511 22-003d: supply dvdd not found, using dummy regulator
[    3.640087] adv7511 22-003d: supply pvdd not found, using dummy regulator
[    3.646946] adv7511 22-003d: supply a2vdd not found, using dummy regulator
[    3.653886] adv7511 22-003d: supply v3p3 not found, using dummy regulator
[    3.660765] adv7511 22-003d: supply v1p2 not found, using dummy regulator
[    3.668182] adv7511 22-003d: Probe failed. Remote port 'dsi_host@56228000' disabled
[    3.676078] i2c i2c-22: LPI2C adapter registered
[    3.682483] imx-lpi2c 56246000.i2c: use pio mode
[    3.687627] i2c 23-004c: Fixing up cyclic dependency with bus@56220000:ldb@562410e0
[    3.770731] i2c 23-003d: Fixing up cyclic dependency with 56248000.dsi_host
[    3.778795] adv7511 23-003d: supply avdd not found, using dummy regulator
[    3.785748] adv7511 23-003d: supply dvdd not found, using dummy regulator
[    3.792610] adv7511 23-003d: supply pvdd not found, using dummy regulator
[    3.799464] adv7511 23-003d: supply a2vdd not found, using dummy regulator
[    3.806405] adv7511 23-003d: supply v3p3 not found, using dummy regulator
[    3.813301] adv7511 23-003d: supply v1p2 not found, using dummy regulator
[    3.820667] adv7511 23-003d: Probe failed. Remote port 'dsi_host@56248000' disabled
[    3.828596] i2c i2c-23: LPI2C adapter registered
[    3.838716] imx6q-pcie 5f010000.pcie: supply epdev_on not found, using dummy regulator
[    3.846211] imx-drm display-subsystem: bound imx-drm-dpu-bliteng.2 (ops dpu_bliteng_ops)
[    3.847108] imx6q-pcie 5f010000.pcie: No cache used with register defaults set!
[    3.855527] imx-drm display-subsystem: bound imx-dpu-crtc.0 (ops dpu_crtc_ops)
[    3.870097] imx-drm display-subsystem: bound imx-dpu-crtc.1 (ops dpu_crtc_ops)
[    3.877876] imx-drm display-subsystem: bound bus@56220000:ldb@562210e0 (ops imx8qxp_ldb_ops)
[    3.886392] [drm:drm_bridge_attach] *ERROR* failed to attach bridge /bus@56220000/dsi_host@56228000 to encoder DSI-89: -19
[    3.890678] imx6q-pcie 5f010000.pcie: PCIe PLL is locked.
[    3.897499] imx-drm display-subsystem: bound 56228000.dsi_host (ops nwl_dsi_component_ops)
[    3.903053] imx6q-pcie 5f010000.pcie: iATU unroll: disabled
[    3.916835] imx6q-pcie 5f010000.pcie: Detected iATU regions: 6 outbound, 6 inbound
[    3.924478] imx6q-pcie 5f010000.pcie: host bridge /bus@5f000000/pcie@0x5f010000 ranges:
[    3.932649] imx6q-pcie 5f010000.pcie:       IO 0x007ff80000..0x007ff8ffff -> 0x0000000000
[    3.940906] imx6q-pcie 5f010000.pcie:      MEM 0x0070000000..0x007fefffff -> 0x0070000000
[    3.949196] imx-drm display-subsystem: bound bus@56220000:ldb@562410e0 (ops imx8qxp_ldb_ops)
[    3.949336] imx6q-pcie 5f010000.pcie: iATU unroll: disabled
[    3.957704] [drm:drm_bridge_attach] *ERROR* failed to attach bridge /bus@56220000/dsi_host@56248000 to encoder DSI-90: -19
[    3.963277] imx6q-pcie 5f010000.pcie: Detected iATU regions: 6 outbound, 6 inbound
[    3.974363] imx-drm display-subsystem: bound 56248000.dsi_host (ops nwl_dsi_component_ops)
[    3.987590] mmc1: new ultra high speed SDR104 SDXC card at address 59b4
[    3.990827] [drm] Initialized imx-drm 1.0.0 20120507 for display-subsystem on minor 1
[    3.997481] mmcblk1: mmc1:59b4 SD000 58.7 GiB 
[    4.011460]  mmcblk1: p1
[    4.982673] imx6q-pcie 5f010000.pcie: Phy link never came up
[    4.990671] imx6q-pcie: probe of 5f010000.pcie failed with error -110
[    5.060629] imx-drm display-subsystem: [drm] Cannot find any crtc or sizes
[    5.086539] debugfs: Directory 'lvds1' with parent 'pm_genpd' already present!
[    5.094379] debugfs: Directory 'mipi1-i2c1' with parent 'pm_genpd' already present!
[    5.102078] debugfs: Directory 'mipi1-i2c0' with parent 'pm_genpd' already present!
[    5.109788] debugfs: Directory 'mipi1-pwm0' with parent 'pm_genpd' already present!
[    5.117483] debugfs: Directory 'mipi1' with parent 'pm_genpd' already present!
[    5.136755] isi-m2m 58100000.isi:m2m_device: Register m2m success for ISI.0
[    5.144026] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    5.160569] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    5.167335] platform regulatory.0: Direct firmware load for regulatory.db failed with error -2
[    5.176029] platform regulatory.0: Falling back to sysfs fallback for: regulatory.db
[    5.195959] ALSA device list:
[    5.198983]   No soundcards found.
[    5.204903] Freeing unused kernel memory: 6656K
[    5.227318] Run /init as init process
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK
Saving random seed: [    5.327529] random: dd: uninitialized urandom read (512 bytes read)
OK
Set permissions on /dev/tee*: OK
Create/set permissions on /data/tee: OK
Starting tee-supplicant: OK
D/TC:? 0 tee_ta_init_session_with_context:607 Re-open TA 7011a688-ddde-4053-a5a9-7b3c4ddf13b8
Starting network: D/TC:? 0 tee_ta_close_session:512 csess 0xfe0b1dc0 id 1
D/TC:? 0 tee_ta_close_session:531 Destroy session
OK

Welcome to Buildroot, type root or test to login

7.2 optee测试

输入xtest, 启动optee测试

$xtest
......
regression_6016 OK
regression_6017 OK
regression_6018 OK
regression_6019 OK
regression_6020 OK
regression_8001 OK
regression_8002 OK
regression_8101 OK
regression_8102 OK
regression_8103 OK
+-----------------------------------------------------
26182 subtests of which 0 failed
93 test cases of which 0 failed
0 test cases were skipped
TEE test application done!

说明optee可信执行环境运行正常!

8. 总结

以上就是详细的imx8企业级独立编译的全流程。

— 博主热门专栏推荐—

评论 67
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

机器未来

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值