Failed to boot `Bad parameter: eks image not correct`

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:

  1. regenerate eks.img with example.sh
  2. 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.

Hi BenSung,

Are you using a fused board?

Do you use the same key to generate eks image for R36.4?
Please share the full flash command and log for further check.

Hi Kevin,

Are you using a fused board?

No.

Do you use the same key to generate eks image for R36.4?

If the test key used in r36.4 is the same as that in r35.5.0, then they are the same.

Here is the flash_command.log (290.6 KB) and debug serial.log (50.2 KB) in which the flash command is

sudo ./tools/kernel_flash/l4t_initrd_flash.sh --external-device nvme0n1p1 \
  -c tools/kernel_flash/flash_l4t_t234_nvme.xml -p "-c bootloader/generic/cfg/flash_t234_qspi.xml" \
  --showlogs --network usb0 nano-usb-client external

And here is our flash config and device tree

// nano-usb-client.conf
source "${LDK_DIR}/jetson-orin-nano-devkit.conf";

PINMUX_CONFIG="tegra234-mb1-bct-pinmux-p3767-hdmi-a03.dtsi";    # hdmi
PMC_CONFIG="tegra234-mb1-bct-padvoltage-p3767-hdmi-a03.dtsi";   # hdmi
EMMC_CFG="flash_t234_qspi_nvme.xml";

UPHYLANE="c7x2"
if [ "${UPHYLANE}" = "c7x1" ]; then
	UPHYLANE_CONFIG="tegra234-mb1-bct-uphylane-si-c7x1.dtsi";
	EMMC_CFG="flash_t234_qspi_nvme_c7.xml";
elif [ "${UPHYLANE}" = "c7x2" ]; then
	UPHYLANE_CONFIG="tegra234-mb1-bct-uphylane-si-c7x2.dtsi";
	EMMC_CFG="flash_t234_qspi_nvme_c7.xml";
fi


update_flash_args()
{
	# All updates should go into update_flash_args_common to allow
	# for other files to include this file and override variables.
	update_flash_args_common "$@"

	if [ "${board_sku}" = "0001" ]; then
		DTB_FILE="kenexs-v700-usb-client.dtb";
	elif [ "${board_sku}" = "0003" ]; then
		DTB_FILE="kenexs-v700-nano-usb-client.dtb";
	else
		echo "Error: Unrecognized module SKU ${board_sku}";
		exit 1;
	fi
	TBCDTB_FILE="${DTB_FILE}";
}
// kenexs-v700-nano-usb-client.dts
/dts-v1/;

#include "../nv-platform/tegra234-p3768-0000+p3767-0003-nv.dts"

/{
	display@13800000 {
		status = "okay";
		os_gpio_hotplug_a = <&gpio TEGRA234_MAIN_GPIO(M, 0) GPIO_ACTIVE_HIGH>;
	};
};

/ {
	bus@0 {

		/* C1 - PCIe1 GigE RTL8111H */
		pcie@14100000 {
			status = "okay";
		};

		/* C7 - PCIe2 M.2 Key-M */
		pcie@141e0000 {
			status = "okay";

			vddio-pex-ctl-supply = <&vdd_1v8_ao>;

			phys = <&p2u_gbe_0>;
			phy-names = "p2u-0";
		};

		/* C9 - PCIe3 GigE RTL8111H */
		pcie@140c0000 {
			status = "okay";

			vddio-pex-ctl-supply = <&vdd_1v8_ao>;

			phys = <&p2u_gbe_1>;
			phy-names = "p2u-1";
		};

		/* enable usb 3-2: padctl node */
		padctl@3520000 {
		/*
		 * --------------------+--------------------
		 * | USBSS1(USBSS1_xx) | USBSS2(USBSS2_xx) |
		 * | USB1              | USB0              |
		 * |-------------------+-------------------|
		 * | -                 | USBSS0(USBSS_xx)  |
		 * | USB2              | -                 |
		 * --------------------+--------------------
		 */
			pads {
				usb3 {
					lanes {
						usb3-2 {
							nvidia,function = "xusb";
							status = "okay";
						};
					};
				};
			};
			ports {
				usb3-0 {
					nvidia,usb2-companion = <2>;
					status = "okay";
				};
				usb3-1 {
					nvidia,usb2-companion = <1>;
					status = "okay";
				};
				usb3-2 {
					nvidia,usb2-companion = <0>;
					status = "okay";
				};
			};
		};

		/* enable usb 3-2: xHCI Node */
		usb@3610000 {
			status = "okay";

			phys = <&{/bus@0/padctl@3520000/pads/usb2/lanes/usb2-0}>,
			       <&{/bus@0/padctl@3520000/pads/usb2/lanes/usb2-1}>,
			       <&{/bus@0/padctl@3520000/pads/usb2/lanes/usb2-2}>,
			       <&{/bus@0/padctl@3520000/pads/usb3/lanes/usb3-0}>,
			       <&{/bus@0/padctl@3520000/pads/usb3/lanes/usb3-1}>,
			       <&{/bus@0/padctl@3520000/pads/usb3/lanes/usb3-2}>;
			phy-names = "usb2-0", "usb2-1", "usb2-2", "usb3-0",
				    "usb3-1", "usb3-2";
		};
		//xudc@3550000 {
		usb@3550000 {
			status = "okay";
			phys = <&{/bus@0/padctl@3520000/pads/usb2/lanes/usb2-0}>,
				<&{/bus@0/padctl@3520000/pads/usb3/lanes/usb3-2}>;
			phy-names = "usb2-0", "usb3-2";
			nvidia,xusb-padctl = <&xusb_padctl>;
			status = "disabled"; // as otg is disabled in usb2-0, so here disable it
		};
	};
};

/ {
	model = "KENEXS V700 NANO USB UDC flash";

	//tegra_xudc: 
	//xudc@3550000 {
	usb@3550000 {
		status = "okay";
	};

	//xusb_padctl@3520000 {
	padctl@3520000{
		ports {
			usb2-0 {/* Goes to recovery port */
				mode = "otg";
			};
		};
	};


	bus@0 {
		/* C4 - PCIe0 10GigE AQC113-B1-I */
		pcie@14160000 {
			status = "disabled";
		};
	};
};

Hi Kevin,

I used to thing that the following error is related to this problem.

  ERROR:   Exception reason=0 syndrome=0xbe000011
ERROR:   **************************************
ERROR:   RAS Uncorrectable Error in IOB, base=0xe010000:
ERROR:          Status = 0xec000612
ERROR:   SERR = Error response from slave: 0x12
ERROR:          IERR = CBB Interface Error: 0x6
ERROR:          Overflow (there may be more errors) - Uncorrectable
ERROR:          MISC0 = 0xc45a0040
ERROR:          MISC1 = 0xd4c860000000000
ERROR:          MISC2 = 0x0
ERROR:          MISC3 = 0x0
ERROR:          ADDR = 0x8000000003f300c0
ERROR:   **************************************
ERROR:   sdei_dispatch_event returned -1
ERROR:   **************************************
ERROR:   RAS Uncorrectable Error in ACI, base=0xe01a000:
ERROR:          Status = 0xe8000904
ERROR:   SERR = Assertion failure: 0x4
ERROR:          IERR = FillWrite Error: 0x9
ERROR:          Overflow (there may be more errors) - Uncorrectable
ERROR:          ADDR = 0x8000000003f300c0
ERROR:   **************************************
ERROR:   sdei_dispatch_event returned -1
ERROR:   Powering off core

But now I see this log, so is this another problem?

I/TC: Primary CPU switching to normal world boot

Hold on, I copy sources from r36.2 and use source_sync.sh
to sync, but it seems that some repos are not updated. I will do a check.

Sorry for bother. The reason comes from that I did not upgrade the repos under tegra, which will be update by ./source_sync.sh -o -t jetson_36.4. I only updated with -k which means I only update the kernel related things.

As the ekb.img change the format with version 2, which has been mentioned in jetson_user_key_pta.c as following:

The latest EKB layout: version 2
                                                            
-----------------------------------------------------------
|    EKB_size   |      Magic    |    Major   |   Minor    |
|    (4 bytes)  |    (8 bytes)  |  (2 bytes) | (2 bytes)  |
-----------------------------------------------------------
|                         FV (16 bytes)                   |
-----------------------------------------------------------
|                         MAC (16 bytes)                  |
-----------------------------------------------------------
|  Content_size | Content_magic |        Reserved         |
|   (4 bytes)   |   (4 bytes)   |        (8 bytes)        |
-----------------------------------------------------------
|                         IV (16 bytes)                   |
-----------------------------------------------------------
|    Key1_tag   |    Key1_len   |         Key1            |
|   (4 bytes)   |   (4 bytes)   |       (Key1_len)        |
-----------------------------------------------------------
|    Key2_tag   |   Key2_len    |         Key2            |
|   (4 bytes)   |   (4 bytes)   |       (Key2_len)        |
-----------------------------------------------------------
|                              ...                        |
-----------------------------------------------------------
|   End_tag1(\0\0\0\0)          |    End_tag2 (\0\0\0\0)  |
-----------------------------------------------------------

for example my eks.img:

00000000: 0004 0000 4e56 454b 4250 0000 0200 0000  ....NVEKBP......
00000010: 3bc1 817b ba9b f5ba 5331 d358 c9da 2f9a  ;..{....S1.X../.
00000020: 3d8a d692 cf57 1a8e c8ae 6fae c4fb 6405  =....W....o...d.
00000030: 1000 0000 4545 4b42 0000 0000 0000 0000  ....EEKB........
00000040: c975 d9c1 39bd 15e9 c190 d674 d4ce 1767  .u..9......t...g
00000050: 908a 3fed 85a1 fd73 dcde 0e38 9211 d21c  ..?....s...8....
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.