Hello guys, I try to flash my r36.4
to Jetson Orin NANO board, but the debug serial gives me this error Bad parameter: eks image not correct
. The board works for r35.5.0, but when I try to flash with r36.4 it fails.
Environments
- Customized board (we do not have devkit)
- SDK version: r36.4
- Default eks img
What I’ve tried:
- regenerate eks.img with
example.sh
- add debug info in
jetson_user_key_pta.c
.
Regenerating eks.img has no help to this problem
I try to print ekb_content
with the following code in ekb_extraction_process
diff --git a/optee/optee_os/core/pta/tegra/jetson_user_key_pta.c b/optee/optee_os/core/pta/tegra/jetson_user_key_pta.c
index e5207ae..1c655a7 100644
--- a/optee/optee_os/core/pta/tegra/jetson_user_key_pta.c
+++ b/optee/optee_os/core/pta/tegra/jetson_user_key_pta.c
@@ -210,6 +210,43 @@ static TEE_Result ekb_extraction_process(vaddr_t ekb_addr)
struct user_key *ekb_key = NULL;
uint8_t *p = NULL;
int i = 0;
+ uint8_t *ben_test = NULL;
+
+ EMSG("&ekb_content=0x%x", ekb);
+ EMSG("ben:");
+ ben_test=(uint8_t *)ekb;
+ EMSG("ekb:");
+ for (i = 0 ; i < 64 ; i++){
+ if (i%16 == 0){
+ EMSG("\n");
+ }
+ EMSG("%02x ", ben_test[i]);
+ }
+ EMSG("\n");
+ ben_test = (uint8_t *)content_header;
+ EMSG("content_header:");
+ for (i = 0 ; i < 16 ; i++){
+ if (i%16 == 0){
+ EMSG("\n");
+ }
+ EMSG("%02x ", ben_test[i]);
+ }
+ EMSG("\n");
+
+ ben_test = (uint8_t *)magic;
+ EMSG("magic:\n");
+ for (i=0;i<4;i++)
+ EMSG(" ");
+ for (i = 0 ; i < 16 ; i++){
+ if (i%12 == 0 && i!=0){
+ EMSG("\n");
+ }
+ EMSG("%02x ", ben_test[i]);
+ }
+ EMSG("\n");
+ for (i=0; i < 4; i++){
+ EMSG("magic[%d]='%c' (%02x)\n", i, magic[i], magic[i]);
+ }
if (magic[0] != 'E' || magic[1] != 'E' || magic[2] != 'K' || magic[3] != 'B') {
EMSG("Bad parameter: eks image not correct\n");
@@ -866,12 +903,15 @@ static TEE_Result jetson_ekb_dt_init(void)
goto fail;
}
+ EMSG("Ben: pbase=0x%lx", (unsigned long)pbase);
+ EMSG("Ben EKB_MEMORY_AREA_TYPE=0x%x\n", EKB_MEMORY_AREA_TYPE);
reg_addr = (void*)phys_to_virt(pbase, EKB_MEMORY_AREA_TYPE, sz);
if (!reg_addr) {
EMSG("Failed to get VA for PA 0x%"PRIxPA, pbase);
rc = TEE_ERROR_GENERIC;
goto fail;
}
+ EMSG("Ben reg_addr=0x%lx\n", (unsigned long)reg_addr);
tmp_addr = calloc(1, sz);
if (!tmp_addr) {
Here is the formated result:
pbase=0xbe050040
EKB_MEMORY_AREA_TYPE=0x10
reg_addr=0xc2850040
&ekb_content=0xbe21d9f0
ben:
ekb:
00 04 00 00 4e 56 45 4b 42 50 00 00 01 00 00 00
8b e6 c8 c2 03 b2 b8 e2 c7 47 6e 85 05 24 af c9
90 00 00 00 45 45 4b 42 00 00 00 00 00 00 00 00
b2 42 c3 c7 0e 54 5c ad b1 34 92 f5 f9 19 99 f4
content_header:
8b e6 c8 c2 03 b2 b8 e2 c7 47 6e 85 05 24 af c9
magic:
03 b2 b8 e2 c7 47 6e 85 05 24 af c9
90 00 00 00
E/TC:00 00 ekb_extraction_process:246
E/TC:00 00 ekb_extraction_process:248 magic[0]='' (03)
E/TC:00 00 ekb_extraction_process:248 magic[1]='²' (b2)
E/TC:00 00 ekb_extraction_process:248 magic[2]='¸' (b8)
E/TC:00 00 ekb_extraction_process:248 magic[3]='â' (e2)
While the eks_t234.img is has following:
00000000: 0004 0000 4e56 454b 4250 0000 0100 0000 ....NVEKBP......
00000010: 8be6 c8c2 03b2 b8e2 c747 6e85 0524 afc9 .........Gn..$..
00000020: 9000 0000 4545 4b42 0000 0000 0000 0000 ....EEKB........
00000030: b242 c3c7 0e54 5cad b134 92f5 f919 99f4 .B...T\..4......
00000040: a2a5 f3f1 e701 584b ff3b ffac be37 e73c ......XK.;...7.<
00000050: 4d95 1318 9cce 3b9b b6b3 ca6e 904a 7a10 M.....;....n.Jz.
00000060: b94e 0c30 6d0a 1667 14fa db33 4505 5781 .N.0m..g...3E.W.
00000070: 6223 4ad1 ce23 03eb e564 6836 781f 39b6 b#J..#...dh6x.9.
00000080: 71ca 37bb 70c4 b178 f347 bde8 bfb0 02e7 q.7.p..x.G......
00000090: 0b46 8cf5 33e4 ada9 2b00 c529 5ab1 5dc5 .F..3...+..)Z.].
000000a0: 16ba ec52 c1cb 0517 79d2 e822 165e a05e ...R....y..".^.^
000000b0: 7a79 6662 e93a fda2 5563 2f8d fd88 3955 zyfb.:..Uc/...9U
000000c0: 4d31 2aaf c387 12b1 99dd de05 f61a ce9b M1*.............
It seems that the ekb_addr has missed 16 bytes offset, the magick number is at 0x24
but the code gives me 0x14
.