Secure Boot on Jetson Xavier AGX

From where can I download fuseblob.tbz2 I counldn’t find fusecmd.sh in Linux_for_Tegra/booloader but there is odmfuse_pkc.xml in Linux_for_Tegra/booloader.

Hi there I am using this
~/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra$ sudo ./odmfuse.sh --noburn -i 0x19 -c PKC -k ../pri.pem --KEK0 ../KEK.txt -S ../SBK.txt jetson-agx-xavier-devkit

and my logs are

Board ID() version() sku() revision()
copying sdram_config(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/t186ref/BCT/tegra194-mb1-bct-memcfg-p2888.cfg)... done.
copying sdram_config1(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/t186ref/BCT/tegra194-memcfg-sw-override.cfg)... done.
copying misc_config(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/t186ref/BCT/tegra194-mb1-bct-misc-flash.cfg)... done.
copying pinmux_config(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/t186ref/BCT/tegra19x-mb1-pinmux-p2888-0000-a04-p2822-0000-b01.cfg)... done.
copying scr_config(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/t186ref/BCT/tegra194-mb1-bct-scr-cbb-mini.cfg)... done.
copying scr_cold_boot_config(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/t186ref/BCT/tegra194-mb1-bct-scr-cbb-mini.cfg)... done.
copying pmc_config(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/t186ref/BCT/tegra19x-mb1-padvoltage-p2888-0000-a00-p2822-0000-a00.cfg)... done.
copying pmic_config(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/t186ref/BCT/tegra194-mb1-bct-pmic-p2888-0001-a01-p2822-0000.cfg)... done.
copying br_cmd_config(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/t186ref/BCT/tegra194-mb1-bct-reset-p2888-0000-p2822-0000.cfg)... done.
copying prod_config(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/t186ref/BCT/tegra19x-mb1-prod-p2888-0000-p2822-0000.cfg)... done.
copying dev_params(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/t186ref/BCT/tegra194-br-bct-sdmmc.cfg)... done.
copying misc_cold_boot_config(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/t186ref/BCT/tegra194-mb1-bct-misc-l4t.cfg)... done.
copying device_config(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/t186ref/BCT/tegra19x-mb1-bct-device-sdmmc.cfg)... done.
copying uphy_config(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/t186ref/BCT/tegra194-mb1-uphy-lane-p2888-0000-p2822-0000.cfg)... done.
copying gpioint_config(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/t186ref/BCT/tegra194-mb1-bct-gpioint-p2888-0000-p2822-0000.cfg)... done.
copying soft_fuses(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/t186ref/BCT/tegra194-mb1-soft-fuses-l4t.cfg)... done.
Existing mb2_bootloader(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/nvtboot_recovery_t194.bin) reused.
Existing mts_preboot(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/preboot_c10_prod_cr.bin) reused.
Existing mts_mce(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/mce_c10_prod_cr.bin) reused.
Existing mts_proper(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/mts_c10_prod_cr.bin) reused.
copying bootloader_dtb(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/kernel/dtb/tegra194-p2888-0001-p2822-0000.dtb)... done.
Existing bpmp_fw(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/bpmp_t194.bin) reused.
copying bpmp_fw_dtb(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/t186ref/tegra194-a02-bpmp-p2888-a01.dtb)... done.
Existing tlk(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/tos-trusty_t194.img) reused.
Existing eks(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/eks.img) reused.
Existing spe_fw(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/spe_t194.bin) reused.
Existing mb1file(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/mb1_t194_prod.bin) reused.
Existing spefile(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/spe_t194.bin) reused.
Existing tegraboot(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/nvtboot_t194.bin) reused.
Existing tbcfile(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/cboot_t194.bin) reused.
Existing scefile(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/camera-rtcpu-sce.img) reused.
Existing camerafw(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/camera-rtcpu-rce.img) reused.
Existing wb0boot(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/warmboot_t194_prod.bin) reused.
done.
Existing cfg(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/flash.xml) reused.
Existing bl(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/nvtboot_recovery_cpu_t194.bin) reused.
Existing applet(/home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/Linux_for_Tegra/bootloader/mb1_t194_prod.bin) reused.
*** Calculating HASH from keyfile /home/cowlar/xavier/Tegra186_Linux_R32.5.1_aarch64/pri.pem ... done
PKC HASH: 0x49b488783ecf8d626ffd1eba2e7341544f5752b2b3a5de082456398ba8aa3ce2
*** Generating fuse configuration ... done.
done.
*** Start preparing fuse configuration ... 
*** done.

and my odmfuse_pkc.xml is after this commad is

<genericfuse MagicId="0x45535546" version="1.0.0">
<fuse name="JtagDisable" size="4" value="0x1" />
<fuse name="SecureBootKey" size="16" value="0x123456789abcdef0fedcba9876543210" />
<fuse name="Kek0" size="16" value="0x112233445566778899aabbccddeeff00" />
<fuse name="PublicKeyHash" size="32" value="0xe23caaa88b39562408dea5b3b252574f5441732eba1efd6f628dcf3e7888b449" />
<fuse name="BootSecurityInfo" size="4" value="0x5" />
</genericfuse>

kindly tell me should I add -p and remove --noburn and burn this configuration on my jetson xavier agx

I am following guide instruction

To fuse PKC HASH from the .pem file with JTAG enabled:

For Jetson Xavier NX, Jetson AGX Xavier series, and Jetson TX2 series:

$ sudo ./odmfuse.sh -i <chip_id> -p -k <key.pem> --KEK[0-2] <KEK file> -S <SBK_file> > <device_name>

hello AbdulWasey,

so, you’ll see fuseblob generated after the odmfuse return success.

yes, please add -p fuse options to write all fuse at once.
it’s still suggest to keep the --noburn options, and perform generated command to program the fuse.
thanks

Yes I can see fuseblob.tbz2 generated so what will be the next step
I will untar this and run flash?
Kindly guide me about flash command which command should I use for xavier agx
Thanks

fuseblob.tbz2 (8.5 MB)

fuseblob.tbz2 has bootlooder directroy so should I untar fuseblob.tbz2 in Linux_for_Tegra/bootloader
or like this Linux_for_Tegra/fuseblob/bootloader and after

so there is no need to run flash.sh

hello AbdulWasey,

you’ll see fuse commands,fusecmd.sh. after un-tar the fuse blob.
for your reference, here’s thread we had confirmed fuse and flashing works on Xavier NX,
thanks

Thanks I will go through this and let you if I have any other question thanks again

hello AbdulWasey,

to clarify, it’s odmfuse to enable secureBoot, which fuse the keys to the target.
once you enable Jetson security, you’ll need to assign keys into flash script to flash the board.

Hi @JerryChang I have a question what will happen if I will reflash my board afterwards. Do I have to assign Keys on every flash?

hello AbdulWasey,

yes, you’ll need to assign keys to your target once the board is fused.

note.
partially flash the partition is not supported with the fused platform. (i.e. -k options),
please perform a whole flash if you need to re-flash the target.
thanks

Hi @JerryChang
I want to implement the disk encryption as well

I have gone through that but haven’t fused the board yet. I was wondering what will be further if I want to encrypt the Xavier as well.
My Commands are as follow
To genrate fuseblob.tbz2
Sudo BOARDID=3668 BOARDSKU=0001 FAB=100 BOARDREV=H.0 ./odmfuse.sh --noburn -j -i 0x19 -c PKC -p -k <pkc_file> -S <sbk_file> --KEK2 <kek2_file> jetson-agx-xavier-devkit
To sign the boot files
Sudo BOARDID=3668 BOARDSKU=0001 FAB=100 BOARDREV=H.0 ./flash.sh --no-flash -u <pkc_file> -v <sbk_file> jetson-agx-xavier-devkit

Kindly guide me what should I add to implement disk encryption of Xavier at this stage.
Thanks

hello AbdulWasey,

if you wish to encrypt bootloader and TOS, you must prepare SBK fuse bits, and it’s -S <sbk_file> you’d done.
thanks

Hi @JerryChang
I was asking about

In documentation the disk encryption implementation is some thing like that

# the disk encryption key in the EKB partition
$ echo "00000000000000000000000000000000" > ekb.key
$ sudo ROOTFS_ENC=1 ./flash.sh -i "./ekb.key" <board> <rootdev>

so is there anything else that I have to add in sign boot files command

Sudo ROOTFS_ENC=1 BOARDID=3668 BOARDSKU=0001 FAB=100 BOARDREV=H.0 ./flash.sh --no-flash -i <ekb.key> -u <pkc_file> -v <sbk_file> jetson-agx-xavier-devkit mmcblk0p1

Thanks

hello AbdulWasey,

KEKs were Key Encryption Keys, they’re using as key seed to encode keys.
for example, KEK2 can be used as a key seed to encrypt and decrypted the Encrypted Key Blob (EKB) when TOS is enabled.

there’s user key stored in the Encrypted Key Blob (EKB), the Secure Engine (SE) retrieves the user key from the EKB and uses it to decrypt the kernel image files.
please also refer to below two topics, they’re supported by default on r32.5.

note,
here’s a bug fix in decrypting buffer, Black Screen after enable SecureBOOT and disk encryption - #3 by JerryChang
you should also apply this patch for the cboot sources.
thanks

Hi @JerryChang

$ python3 gen_ekb.py -kek2_key <kek2_fuse_key_file> \
    -fv <fv_for_ekb_ek> \
    -in_sym_key <sym_key_file> \
    -in sym_key2 <sym2_key_file> \
    -out <eks_image_file>

In EKB Generation

  • <sym_key_file> This is user key right?
  • <sym2_key_file> how to create this not clear kindly guide.

Thanks

hello AbdulWasey,

as you can see in the developer guide, sym_key_file is the kernel encryption key, KEKs.

Hi @JerryChang where is gen_ekb.py I could not find it in Linux_for_Tegra/source/
thanks

hello AbdulWasey,

assume you’d download r32.5.1 L4T Driver Package (BSP) Sources,
please un-tar trusty_src.tbz2 package, and you’ll see gen_ekb.py as following,
for example,
$L4T_Sources/r32.5.1/Linux_for_Tegra/source/public/trusty/app/nvidia-sample/hwkey-agent/CA_sample/tool/gen_ekb/gen_ekb.py

Hi @JerryChang

kindly guide me from where I can get trusty_src.tbz2
Thanks

please download L4T Driver Package (BSP) Sources package. you’ll see trusty package included.