Where should I run make when building OP-TEE for disk encryption on Jetson AGX Orin?

Hi,
I am trying to enable disk encryption on Jetson AGX Orin Developer Kit 64GB(R36.5) using OP-TEE, referring to the following documents:

My current understanding is:

  1. Generate disk_enc.key using OP-TEE
  2. Flash the Jetson with encryption enabled

First, I followed the steps up to Step 2 in the following guide:
Quick Start — NVIDIA Jetson Linux Developer Guide

After that, in order to proceed with disk encryption, I prepared a separate working directory and downloaded the Driver Package (BSP) Sources and Bootlin Toolchain gcc 11.3.

So far, I have successfully followed atf_and_optee_README.txt and built tos.img.
I then replaced the default TOS image in the Quick Start environment with the newly built one.

However, I have a question about the following build command in the documentation:

make -C <source directory> \

    CROSS_COMPILE="<jetson-toolchain>/bin/aarch64-buildroot-linux-gnu-" \

    TA_DEV_KIT_DIR="<jetson-optee-srcs>/optee/build/t234/export-ta_arm64/" \

    OPTEE_CLIENT_EXPORT="<jetson-optee-srcs>/optee/install/t234/usr" \

    TEEC_EXPORT="<jetson-optee-srcs>/optee/install/t234/usr" \

    -j"$(nproc)"

I checked the following directories:

  • jetson-public-srcs/Linux_for_Tegra/source

  • jetson-public-srcs/Linux_for_Tegra/source/jetson-optee-srcs

However, neither of them contains a Makefile.

My questions are:
What exactly does <source directory> refer to in this command?
Which repository or directory is expected to contain the Makefile for this step?

Thank you.

please see also similar topic to enable disk encryption. Disk Encryption on Orin NX NVMe Not working - #22 by JerryChang

Thank you very much for providing this helpful topic.

I tried the suggested method; however, when I ran the flash encryption command, I encountered the following error:

Debug: Error: The external storage device (/dev/nvme0n1) may be unavailable or not functioning properly. Please disconnect the power cable and reconnect the external storage.

However, my Jetson device does not have any NVMe storage attached.

Does anyone have information or guidance on how to encrypt the internal storage (eMMC) on a Jetson AGX Orin?

hello shimizke,

may I know what’s your flash command-line, especially the last option to specify your rootdev.
you should execute flash commands as below to enable disk encryption for AGX Orin.
for instance, $ sudo ROOTFS_ENC=1 ./flash.sh -i "./disk_enc.key" jetson-agx-orin-devkit internal

I followed the commands below:

$ sudo ./tools/kernel_flash/l4t_initrd_flash.sh --showlogs -p "-c bootloader/generic/cfg/flash_t234_qspi.xml" --no-flash --network usb0 jetson-agx-orin-devkit internal
$ echo "f0e0d0c0b0a001020304050607080900" > ekb.key
$ sudo ROOTFS_ENC=1 ./tools/kernel_flash/l4t_initrd_flash.sh --showlogs --no-flash --external-device nvme0n1p1 -i ./ekb.key -c ./tools/kernel_flash/flash_l4t_t234_nvme_rootfs_enc.xml --external-only --append --network usb0 jetson-agx-orin-devkit external
$ sudo ./tools/kernel_flash/l4t_initrd_flash.sh --showlogs --network usb0 --flash-only

It says to run the following command; however, I am currently stuck at the previous step, as I have not been able to generate the disk_enc.key due to issues with OP-TEE.
$ sudo ROOTFS_ENC=1 ./flash.sh -i "./disk_enc.key" jetson-agx-orin-devkit internal

hello shimizke,

this is the disk encryption key you should used.

I tried several approaches, but none of them worked.

I recreated the environment from scratch and tested the following steps.
First, I followed the process up to Step 2 in this guide:
Quick Start — NVIDIA Jetson Linux Developer Guide

Then I ran the following commands:

$ echo “f0e0d0c0b0a001020304050607080900” > disk_enc.key
$ sudo ROOTFS_ENC=1 ./flash.sh -i “./disk_enc.key” jetson-agx-orin-devkit internal

The flashing process completed successfully. However, after the NVIDIA logo appears, the screen stays completely black and does not proceed further.
I confirmed that without encryption, using ./flash.sh, the setup screen appears correctly.

Next, I checked the documentation:
Disk Encryption — NVIDIA Jetson Linux Developer Guide

It states that

Flashing the encrypted rootfs on the host with flash.sh for the Jetson AGX Orin requires an update of the .Linux_for_Tegra/bootloader/eks_<platform>.img

So I attempted to generate eks_t234.img.

After building OP-TEE, I followed the instructions to create tos.img and copied it into Linux_for_Tegra.
Then I ran the sample script to generate eks_t234.img, but encountered the following error:

$ ./example.sh
WARNING: You must provided your own UEFI variable authentication key
when OEM key1 fuse is burned. Missing the UEFI variable authenticaton
key will cause the system to fail to boot up.
NOTE: If the board you are using is not fuse burned, you can ignore ths message.
Enter ‘Ctrl + C’ to break, otherwise continue to generate EKB:
Traceback (most recent call last):
File “/home/ubuntu/jetson-toolchain/jetson-public-srcs/Linux_for_Tegra/source/jetson_optee-srcs/optee/samples/hwkey-agent/host/tool/gen_ekb/gen_ekb.py”, line 310, in
main()
File “/home/ubuntu/jetson-toolchain/jetson-public-srcs/Linux_for_Tegra/source/jetson_optee-srcs/optee/samples/hwkey-agent/host/tool/gen_ekb/gen_ekb.py”, line 249, in main
raise Exception(“oem_k1_key or oem_k2_key file cannot be openned”)
Exception: oem_k1_key or oem_k2_key file cannot be openned

To resolve this, I generated the required keys:

openssl rand -hex 32 > sym_t234.key
openssl rand -hex 16 > sym2_t234.key
openssl rand -hex 16 > auth_t234.key
openssl rand -hex 32 > oem_k1.key

After that, I ran the sample script again and successfully generated eks_t234.img, which I copied into Linux_for_Tegra.

Then I retried flashing:

$ echo “f0e0d0c0b0a001020304050607080900” > disk_enc.key
$ sudo ROOTFS_ENC=1 ./flash.sh -i “./disk_enc.key” jetson-agx-orin-devkit internal

The flash process again completed successfully, but the result was the same: after the NVIDIA logo appears, the screen remains black.

For now, I plan to proceed without encryption.

Hi @shimizke have you previously burned any fuses on the board you are using? If that is the case, the board will not boot unless the keys you use to generate the eks_t234.img and flash the board, match what was burned to the board.

Can you connect a monitor to the board when trying to boot? If you can see something similar to this:

ERROR: failed to unlock the encrypted dev /dev/mmcblk0p2

It means the key you used when flashing is different than the one used to generate the eks_t234.img

Regards
Carlos Jiménez
Embedded SW Engineer at RidgeRun

Contact us: support@ridgerun.com
Developers wiki: https://developer.ridgerun.com/
Website: www.ridgerun.com