Regarding the partition, I just changed the name from mmcblk2p2 to mmcblk2p3 for the tdx_enc_storage_location, then rebuilt it with the secure boot configuration, without any eFuse blown yet on the board.
Okay so I did a build with the following configuration:
INHERIT += "tdx-signed"
TDX_IMX_HAB_CST_DIR = "/workdir/torizon/layers/cst"
INHERIT += "tdx-tezi-data-partition tdx-encrypted"
TDX_ENC_STORAGE_LOCATION = "/dev/mmcblk2p3"
I flashed the image to the device and the tdx-enc-handler
fails with the following:
$ journalctl -n 100 -f -u tdx-enc-handler.service
Oct 09 15:18:14 localhost systemd[1]: Starting Encryption handler for Toradex modules...
Oct 09 15:18:14 localhost tdx-enc.sh[494]: caam: Preparing and checking system (generic)...
Oct 09 15:18:14 localhost tdx-enc.sh[508]: blockdev: cannot open /dev/mmcblk2p3: No such file or directory
Oct 09 15:18:14 localhost tdx-enc.sh[494]: caam: Blocks to be encrypted: 0...
Oct 09 15:18:14 localhost tdx-enc.sh[494]: caam: Reserved blocks: 0...
Oct 09 15:18:14 localhost tdx-enc.sh[494]: caam: Preparing and checking system (caam)...
Oct 09 15:18:15 localhost tdx-enc.sh[494]: caam: Setting up encryption key for CAAM backend...
Oct 09 15:18:15 localhost tdx-enc.sh[494]: caam: Configuring key in kernel keyring (type=trusted keyname=tdxenc)...
Oct 09 15:18:15 localhost tdx-enc.sh[494]: caam: Key blob not found. Creating it...
Oct 09 15:18:15 localhost tdx-enc.sh[494]: caam: Data preservation is not enabled
Oct 09 15:18:15 localhost tdx-enc.sh[494]: caam: Setting up partition with dm-crypt...
Oct 09 15:18:15 localhost tdx-enc.sh[519]: device-mapper: reload ioctl on encdata (251:0) failed: Invalid argument
Oct 09 15:18:15 localhost tdx-enc.sh[519]: Command failed.
Oct 09 15:18:15 localhost tdx-enc.sh[494]: caam: ERROR: Error setting up dm-crypt partition!
Oct 09 15:18:15 localhost systemd[1]: tdx-enc-handler.service: Main process exited, code=exited, status=1/FAILURE
Oct 09 15:18:15 localhost systemd[1]: tdx-enc-handler.service: Failed with result 'exit-code'.
Oct 09 15:18:15 localhost systemd[1]: Failed to start Encryption handler for Toradex modules.
I check the partitions on the device and see:
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
mmcblk2 179:0 0 14.8G 0 disk
|-mmcblk2p1 179:1 0 7.4G 0 part /var
| /usr
| /boot
| /
| /sysroot
`-mmcblk2p2 179:2 0 7.4G 0 part /var/rootdirs/media/DATA
mmcblk2boot0 179:32 0 31.5M 1 disk
mmcblk2boot1 179:64 0 31.5M 1 disk
zram0 253:0 0 0B 0 disk
So mmcblk2p3
truly does not exist which is why tdx-enc-handler
fails. But this is the expected behavior in my perspective. When Linux enumerates things it usually goes in order. Since we’re making a new partition on the emmc (mmcblk2
), and there is already a first partition for the main file system (mmcblk2p1
). The expected behavior is that creating a new partition would be mmcblk2p2
, it wouldn’t make sense for Linux to skip p2
and create a p3
.
To double-check this I then did a second build where I had the secure-boot configuration disabled:
#INHERIT += "tdx-signed"
#TDX_IMX_HAB_CST_DIR = "/workdir/torizon/layers/cst"
INHERIT += "tdx-tezi-data-partition tdx-encrypted"
TDX_ENC_STORAGE_LOCATION = "/dev/mmcblk2p3"
I flashed this image and I saw the exact same behavior as with the image where the secure-boot was configuration enabled. The tdx-enc-handler
service fails for the same reason and mmcblk2p3
still does not exist, which is what I would expect.
So unless I’m still not understanding what you did, I don’t see how you got this to “work” with the secure-boot configuration disabled.
In the previous post, I shared the ready-to-use config where the name is changed to mmcblk2p3. After that, I simply flashed the new image onto the board.
Maybe it’s a typo on your configurations, but in none of your previous configurations you’ve shared on this thread did you have TDX_ENC_STORAGE_LOCATION = "/dev/mmcblk2p3"
. All of your configurations I see on this thread you are specifying /dev/mmcblk2p2
.
Please keep in mind TDX_ENC_STORAGE_LOCATION
does not control what data partition gets created. This just controls what location the tdx-enc-handler
will work with. It’s tdx-tezi-data-partition
that is creating the data partition and it will create a partition on the emmc with the next enumeration which would be mmcblk2p2
in this case. There’s no option to tell the tdx-tezi-data-partition
to skip mmcblk2p2
and create mmcblk2p3
instead.
Best Regards,
Jeremias