REAPPLY: dm-verity-upstream: Add dynamic layer for meta-security dm-verity

NOTE: A mistake on the maintainers part left these files off of the
original commit.  This patch is just adding the missing files.

Add an optional dynamic layer enabling dm-verity block-level integrity
verification of the root filesystem for TI K3 platforms, using
meta-security's stock dm-verity mechanism as-is. Requires meta-security
to be present in bblayers.conf.

dm-verity hashes the rootfs at build time; at boot, a dedicated
initramfs loads the root hash and the kernel checks every block read
against it. Set DM_VERITY_IMAGE to enable all the verity-related
recipes for that image; other images build as usual.

Signed-off-by: Atharv Dubey <a-dubey@ti.com>
Signed-off-by: Ryan Eatmon <reatmon@ti.com>
This commit is contained in:
Atharv Dubey authored and Ryan Eatmon committed 2026-10-22 08:55:08 -05:00
1 parent bf41b0dcd7
commit dab5a7dbc0
4 files changed
+37

No files matched your search

@@ -0,0 +1,21 @@
# Enables dm-verity to check the rootfs for tampering on TI K3 boards.
DM_VERITY_IMAGE_TYPE = "ext4"
IMAGE_CLASSES += "dm-verity-img"
# ti-core-initramfs.bbappend already wires the initramfs into the boot partition once dm-verity is enabled, so we don't need to do it here.
python () {
import uuid
if d.getVar('PN') != d.getVar('DM_VERITY_IMAGE'):
return
# Derive the root partition's UUID from MACHINE so everyone computes the same one.
if not d.getVar('DM_VERITY_ROOT_PARTUUID'):
d.setVar('DM_VERITY_ROOT_PARTUUID',
str(uuid.uuid5(uuid.NAMESPACE_DNS, 'dm-verity-root-%s' % d.getVar('MACHINE'))))
d.setVar('WKS_FILE', 'k3-verity.wks.in')
d.appendVar('EXTRA_IMAGE_FEATURES', ' read-only-rootfs')
d.appendVar('WICVARS', ' DM_VERITY_IMAGE DM_VERITY_IMAGE_TYPE IMAGE_NAME_SUFFIX IMGDEPLOYDIR DM_VERITY_ROOT_PARTUUID')
}
@@ -0,0 +1,5 @@
do_install:append() {
if ${@'true' if d.getVar('DM_VERITY_IMAGE') else 'false'}; then
: > ${D}${libdir}/udev/rules.d/50-arago.rules
fi
}
@@ -0,0 +1,6 @@
# Nothing should ever get auto-mounted under dm-verity, so just kill the automounter.
do_install:append() {
if ${@'true' if d.getVar('DM_VERITY_IMAGE') else 'false'}; then
: > ${D}${sysconfdir}/udev/rules.d/automount.rules
fi
}
+5
View File
@@ -0,0 +1,5 @@
# Disk layout for a board that boots with dm-verity enabled.
bootloader --timeout=3 --append="rootfstype=ext4 root=PARTUUID=${DM_VERITY_ROOT_PARTUUID} ${TI_WKS_BOOTLOADER_APPEND}"
part --source bootimg-efi --sourceparams="loader=${EFI_PROVIDER}${TI_WKS_INITRAMFS}" --fstype=vfat --label boot --active --align 1024 --use-uuid --fixed-size 128M
part / --source rawcopy --sourceparams="file=${IMGDEPLOYDIR}/${DM_VERITY_IMAGE}-${MACHINE}${IMAGE_NAME_SUFFIX}.${DM_VERITY_IMAGE_TYPE}.verity" --align 1024 --uuid ${DM_VERITY_ROOT_PARTUUID}