Modify optee syscall but does not work

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Modify optee syscall but does not work

607 Views
brucezhao
Contributor I

Hi,

    I am working on IMX8mpevp board,and fsl-release-bsp1-5.4.70-2.3.0 was used. I build optee_examples-3.19.0 random example on the board(run make TA_DEV_KIT_DIR=/usr/include/optee/export-user_ta_arm64/ on random/ta directory, run make on random/host directory), and it worked fine as follows.

Invoking TA to generate random UUD/TA: random_number_generate:74 has been called
ID...
I/TA: Generating random data over 16 bytes.
TA generated UUID value = 0xc15b5bb512f9f74b783d263cb1ad751a

random example call _utee_cryp_random_number_generate syscall. So I modify syscall_cryp_random_number_generate in optee-os, I add a patch. And I am sure the patch takes effective.


--- a/core/tee/tee_svc_cryp.c 2022-10-25 16:13:12.547214327 +0800
+++ b/core/tee/tee_svc_cryp.c 2022-10-25 16:14:32.128618185 +0800
@@ -3172,6 +3172,7 @@

TEE_Result syscall_cryp_random_number_generate(void *buf, size_t blen)
{
+#if 0
struct tee_ta_session *sess = NULL;
TEE_Result res = TEE_SUCCESS;

@@ -3191,6 +3192,9 @@
return res;

return res;
+#endif
+ memset(buf, 0, blen);
+ return TEE_SUCCESS;
}

TEE_Result syscall_authenc_init(unsigned long state, const void *nonce,

Then I rebuid optee-os,

$bitbake -c cleanall optee-os && bitbake optee-os

Then I got four deb packages, and I copy them to board and use dpkg to install them.

optee-os_3.10.0.imx-r0_arm64.deb

optee-os-dbg_3.10.0.imx-r0_arm64.deb

optee-os-dev_3.10.0.imx-r0_arm64.deb

optee-os-staticdev_3.10.0.imx-r0_arm64.deb

Then I reboot the board. And rebuild random example, copy ta to /lib/optee_armtz/. But its output makes no difference. I also tried to directly modify source code in git directory and use bitbake -c compile -f optee-os && bitbake optee-os, and it still makes no difference. It seems I did not make any change. But the md5 value in /lib/firmware/ directory on board really changed.

So my question is how to modify optee-os code and how to build and deploy it to the board. Thanks.

Labels (1)
0 Kudos
Reply
2 Replies

591 Views
Zhiming_Liu
NXP TechSupport
NXP TechSupport

Have you generate a patch and set the patch name in bb file?

0 Kudos
Reply

588 Views
brucezhao
Contributor I

Yes, attachment is the patch file, and it's under optee-os directory.

And I add the patch name in optee-os.imx.inc file.

OPTEE_OS_SRC ?= "git://source.codeaurora.org/external/imx/imx-optee-os.git;protocol=https"
SRC_URI = "${OPTEE_OS_SRC};branch=${SRCBRANCH}"
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI_append = " file://0001.patch"
S = "${WORKDIR}/git"
B = "${WORKDIR}/build.${PLATFORM_FLAVOR}"

Even I miss the patch, I just modify source code under git directory which is  under build directory, and the command bitbake -c compile -f optee-os && bitbake optee-os, does not make any effect.

0 Kudos
Reply