mirror of
https://git.yoctoproject.org/meta-security
synced 2026-07-17 04:07:20 +00:00
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>
This commit is contained in:
committed by
Armin Kuster
parent
fc12521b08
commit
39c69c8b5d
@@ -34,7 +34,6 @@ DM_VERITY_IMAGE_HASH_BLOCK_SIZE ?= "4096"
|
|||||||
# any useful info) and feed the rest to a script.
|
# any useful info) and feed the rest to a script.
|
||||||
process_verity() {
|
process_verity() {
|
||||||
local ENV="${STAGING_VERITY_DIR}/${IMAGE_BASENAME}.$TYPE.verity.env"
|
local ENV="${STAGING_VERITY_DIR}/${IMAGE_BASENAME}.$TYPE.verity.env"
|
||||||
install -d ${STAGING_VERITY_DIR}
|
|
||||||
rm -f $ENV
|
rm -f $ENV
|
||||||
|
|
||||||
# Each line contains a key and a value string delimited by ':'. Read the
|
# Each line contains a key and a value string delimited by ':'. Read the
|
||||||
@@ -59,6 +58,9 @@ verity_setup() {
|
|||||||
local SIZE=$(stat --printf="%s" $INPUT)
|
local SIZE=$(stat --printf="%s" $INPUT)
|
||||||
local OUTPUT=$INPUT.verity
|
local OUTPUT=$INPUT.verity
|
||||||
local SETUP_ARGS=""
|
local SETUP_ARGS=""
|
||||||
|
local SAVED_ARGS="${STAGING_VERITY_DIR}/${IMAGE_BASENAME}.$TYPE.verity.args"
|
||||||
|
|
||||||
|
install -d ${STAGING_VERITY_DIR}
|
||||||
|
|
||||||
if [ ${DM_VERITY_IMAGE_DATA_BLOCK_SIZE} -ge ${DM_VERITY_IMAGE_HASH_BLOCK_SIZE} ]; then
|
if [ ${DM_VERITY_IMAGE_DATA_BLOCK_SIZE} -ge ${DM_VERITY_IMAGE_HASH_BLOCK_SIZE} ]; then
|
||||||
align=${DM_VERITY_IMAGE_DATA_BLOCK_SIZE}
|
align=${DM_VERITY_IMAGE_DATA_BLOCK_SIZE}
|
||||||
@@ -75,6 +77,8 @@ verity_setup() {
|
|||||||
--hash-offset=$SIZE format $OUTPUT $OUTPUT \
|
--hash-offset=$SIZE format $OUTPUT $OUTPUT \
|
||||||
"
|
"
|
||||||
|
|
||||||
|
echo "veritysetup $SETUP_ARGS" > $SAVED_ARGS
|
||||||
|
|
||||||
# Let's drop the first line of output (doesn't contain any useful info)
|
# Let's drop the first line of output (doesn't contain any useful info)
|
||||||
# and feed the rest to another function.
|
# and feed the rest to another function.
|
||||||
veritysetup $SETUP_ARGS | tail -n +2 | process_verity
|
veritysetup $SETUP_ARGS | tail -n +2 | process_verity
|
||||||
|
|||||||
Reference in New Issue
Block a user