diff options
author | Paul Gortmaker <paul.gortmaker@windriver.com> | 2023-06-21 10:13:31 -0700 |
---|---|---|
committer | Armin Kuster <akuster808@gmail.com> | 2023-06-25 15:05:28 -0400 |
commit | 39c69c8b5dd56730c469c90e934f8b0606331d3b (patch) | |
tree | 50da47df3243f2b44f03c830cfa6d2570459b603 | |
parent | fc12521b08071a56d03e3c95ea0ae3bb00f77259 (diff) | |
download | meta-security-39c69c8b5dd56730c469c90e934f8b0606331d3b.tar.gz |
dm-verity: save veritysetup args beside runtime environment
We already have this directory to save the environment variable settings
so they can be copied into the initramfs for runtime setup.
There are quite a few veritysetup args, and the nature of storing the
hash data after the filesystem data in an "oversized" partition can be
error prone due to rounding, fencepost errors, etc.
Save a copy of what we used for ease of debug inspection, and for basic
cut and paste use in experimentation and tweaking.
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r-- | classes/dm-verity-img.bbclass | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/classes/dm-verity-img.bbclass b/classes/dm-verity-img.bbclass index b279fa8..e190c87 100644 --- a/classes/dm-verity-img.bbclass +++ b/classes/dm-verity-img.bbclass | |||
@@ -34,7 +34,6 @@ DM_VERITY_IMAGE_HASH_BLOCK_SIZE ?= "4096" | |||
34 | # any useful info) and feed the rest to a script. | 34 | # any useful info) and feed the rest to a script. |
35 | process_verity() { | 35 | process_verity() { |
36 | local ENV="${STAGING_VERITY_DIR}/${IMAGE_BASENAME}.$TYPE.verity.env" | 36 | local ENV="${STAGING_VERITY_DIR}/${IMAGE_BASENAME}.$TYPE.verity.env" |
37 | install -d ${STAGING_VERITY_DIR} | ||
38 | rm -f $ENV | 37 | rm -f $ENV |
39 | 38 | ||
40 | # Each line contains a key and a value string delimited by ':'. Read the | 39 | # Each line contains a key and a value string delimited by ':'. Read the |
@@ -59,6 +58,9 @@ verity_setup() { | |||
59 | local SIZE=$(stat --printf="%s" $INPUT) | 58 | local SIZE=$(stat --printf="%s" $INPUT) |
60 | local OUTPUT=$INPUT.verity | 59 | local OUTPUT=$INPUT.verity |
61 | local SETUP_ARGS="" | 60 | local SETUP_ARGS="" |
61 | local SAVED_ARGS="${STAGING_VERITY_DIR}/${IMAGE_BASENAME}.$TYPE.verity.args" | ||
62 | |||
63 | install -d ${STAGING_VERITY_DIR} | ||
62 | 64 | ||
63 | if [ ${DM_VERITY_IMAGE_DATA_BLOCK_SIZE} -ge ${DM_VERITY_IMAGE_HASH_BLOCK_SIZE} ]; then | 65 | if [ ${DM_VERITY_IMAGE_DATA_BLOCK_SIZE} -ge ${DM_VERITY_IMAGE_HASH_BLOCK_SIZE} ]; then |
64 | align=${DM_VERITY_IMAGE_DATA_BLOCK_SIZE} | 66 | align=${DM_VERITY_IMAGE_DATA_BLOCK_SIZE} |
@@ -75,6 +77,8 @@ verity_setup() { | |||
75 | --hash-offset=$SIZE format $OUTPUT $OUTPUT \ | 77 | --hash-offset=$SIZE format $OUTPUT $OUTPUT \ |
76 | " | 78 | " |
77 | 79 | ||
80 | echo "veritysetup $SETUP_ARGS" > $SAVED_ARGS | ||
81 | |||
78 | # Let's drop the first line of output (doesn't contain any useful info) | 82 | # Let's drop the first line of output (doesn't contain any useful info) |
79 | # and feed the rest to another function. | 83 | # and feed the rest to another function. |
80 | veritysetup $SETUP_ARGS | tail -n +2 | process_verity | 84 | veritysetup $SETUP_ARGS | tail -n +2 | process_verity |