Files
meta-security/recipes-core/images/dm-verity-image-initramfs.bb
Kevin Hao 40ddb9e5ed dm-verity-image-initramfs: Set IMAGE_NAME_SUFFIX to empty
According to the Yocto reference manual [1], the IMAGE_NAME_SUFFIX should
be set to empty for the initramfs image. Otherwise, we may incur a build
error like following due to the initrd check in live-vm-common.bbclass:
  ERROR: core-image-minimal-1.0-r0 do_bootimg: build-test/tmp/deploy/images/genericx86-64/dm-verity-image-initramfs-genericx86-64.cpio.gz is invalid. initrd image creation failed.
  ERROR: core-image-minimal-1.0-r0 do_bootimg: ExecutionError('build-test/tmp/work/genericx86_64-poky-linux/core-image-minimal/1.0/temp/run.build_hddimg.1961965', 1, None, None)
  ERROR: Logfile of failure stored in: build-test/tmp/work/genericx86_64-poky-linux/core-image-minimal/1.0/temp/log.do_bootimg.1961965
  ERROR: Task (poky/meta/recipes-core/images/core-image-minimal.bb:do_bootimg) failed with exit code '1'

[1] https://docs.yoctoproject.org/ref-manual/variables.html#term-IMAGE_NAME_SUFFIX

Signed-off-by: Kevin Hao <kexin.hao@windriver.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
2024-03-27 12:36:58 -04:00

44 lines
1.1 KiB
BlitzBasic

DESCRIPTION = "Simple initramfs image for mounting the rootfs over the verity device mapper."
inherit core-image
PACKAGE_INSTALL = " \
base-files \
base-passwd \
busybox \
cryptsetup \
initramfs-module-dmverity \
initramfs-module-udev \
lvm2-udevrules \
udev \
util-linux-mount \
"
# We want a clean, minimal image.
IMAGE_FEATURES = ""
IMAGE_LINGUAS = ""
IMAGE_NAME_SUFFIX ?= ""
# Can we somehow inspect reverse dependencies to avoid these variables?
python __anonymous() {
verity_image = d.getVar('DM_VERITY_IMAGE')
verity_type = d.getVar('DM_VERITY_IMAGE_TYPE')
if verity_image and verity_type:
dep = ' %s:do_image_%s' % (verity_image, verity_type.replace('-', '_'))
d.appendVarFlag('do_image', 'depends', dep)
}
# Ensure dm-verity.env is updated also when rebuilding DM_VERITY_IMAGE
do_image[nostamp] = "1"
IMAGE_FSTYPES = "${INITRAMFS_FSTYPES}"
deploy_verity_hash() {
install -D -m 0644 \
${STAGING_VERITY_DIR}/${DM_VERITY_IMAGE}.${DM_VERITY_IMAGE_TYPE}.verity.env \
${IMAGE_ROOTFS}${datadir}/misc/dm-verity.env
}
IMAGE_PREPROCESS_COMMAND += "deploy_verity_hash;"