dm-verity: restructure the veritysetup arg parsing

In making changes to the existing veritysetup arg list, it is harder to
see what the proposed change is since they are are glued together on one
long line.  Break them up so reviewing future unified diffs will be more
easy to visually parse.

This also makes it easier to temp. dump the args to a file for debugging.

In theory this should have no functional change.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
This commit is contained in:
Paul Gortmaker
2023-06-21 10:13:30 -07:00
committed by Armin Kuster
parent b6ec838e8f
commit fc12521b08

View File

@@ -58,6 +58,7 @@ verity_setup() {
local INPUT=${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$TYPE
local SIZE=$(stat --printf="%s" $INPUT)
local OUTPUT=$INPUT.verity
local SETUP_ARGS=""
if [ ${DM_VERITY_IMAGE_DATA_BLOCK_SIZE} -ge ${DM_VERITY_IMAGE_HASH_BLOCK_SIZE} ]; then
align=${DM_VERITY_IMAGE_DATA_BLOCK_SIZE}
@@ -68,9 +69,15 @@ verity_setup() {
cp -a $INPUT $OUTPUT
SETUP_ARGS=" \
--data-block-size=${DM_VERITY_IMAGE_DATA_BLOCK_SIZE} \
--hash-block-size=${DM_VERITY_IMAGE_HASH_BLOCK_SIZE} \
--hash-offset=$SIZE format $OUTPUT $OUTPUT \
"
# Let's drop the first line of output (doesn't contain any useful info)
# and feed the rest to another function.
veritysetup --data-block-size=${DM_VERITY_IMAGE_DATA_BLOCK_SIZE} --hash-block-size=${DM_VERITY_IMAGE_HASH_BLOCK_SIZE} --hash-offset=$SIZE format $OUTPUT $OUTPUT | tail -n +2 | process_verity
veritysetup $SETUP_ARGS | tail -n +2 | process_verity
}
VERITY_TYPES = " \