diff --git a/fs/squashfs/Config.in b/fs/squashfs/Config.in index cb2f5ec969..9773f5af20 100644 --- a/fs/squashfs/Config.in +++ b/fs/squashfs/Config.in @@ -121,4 +121,27 @@ config BR2_TARGET_ROOTFS_SQUASHFS_COMP_OPTS default "-Xcompression-level 22" if BR2_TARGET_ROOTFS_SQUASHFS4_ZSTD depends on BR2_TARGET_ROOTFS_SQUASHFS_EXTREME_COMP +config BR2_TARGET_ROOTFS_SQUASHFS_VERITY + bool "create verity hash data for root filesystem" + select BR2_PACKAGE_HOST_CRYPTSETUP + help + Create verity hash tree for the root filesystem. This allows + setting up a dm-verity device for the root filesystem, to + ensure data integrity. The root hash must be provided from a + trusted source, or with a kernel-verifiable signature. + + The verity hash image will be called rootfs.squashfs.verity, + with the root hash in rootfs.squashfs.verity.root-hash. + +if BR2_TARGET_ROOTFS_SQUASHFS_VERITY + +config BR2_TARGET_ROOTFS_SQUASHFS_VERITY_EXTRA_ARGS + string "Additional arguments for veritysetup" + help + Additional arguments for the "veritysetup format" call. Use + this if you want to set options, e.g. the hash algorithm, + instead of using defaults. + +endif # BR2_TARGET_ROOTFS_SQUASHFS_VERITY + endif diff --git a/fs/squashfs/squashfs.mk b/fs/squashfs/squashfs.mk index 3b9d0efbbe..bd283a6be5 100644 --- a/fs/squashfs/squashfs.mk +++ b/fs/squashfs/squashfs.mk @@ -32,6 +32,10 @@ else ROOTFS_SQUASHFS_ARGS += -comp gzip endif +ifeq ($(BR2_TARGET_ROOTFS_SQUASHFS_VERITY),y) +ROOTFS_SQUASHFS_VERITY_EXTRA_ARGS = $(call qstrip,$(BR2_TARGET_ROOTFS_SQUASHFS_VERITY_EXTRA_ARGS)) +endif + define ROOTFS_SQUASHFS_CMD $(HOST_DIR)/bin/mksquashfs $(TARGET_DIR) $@ $(ROOTFS_SQUASHFS_ARGS) endef