From 2438460503edaed0102bc73e3662367dbab9aabc Mon Sep 17 00:00:00 2001 From: Trammell Hudson Date: Fri, 5 Aug 2016 23:28:20 -0400 Subject: [PATCH] shell script to setup dmverity device --- verity-sign | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/verity-sign b/verity-sign index 1f1e202e..c1e8cbcb 100755 --- a/verity-sign +++ b/verity-sign @@ -76,17 +76,27 @@ my $hash_algorithm = $params{'Hash algorithm'} die "Missing parameter: ", join(', ', @missing), "\n" if @missing; +# Compute the derived parameters my $data_size = $data_blocks * $data_block_size; my $data_size_512b = $data_size / 512; my $first_hash_block = $data_blocks + 1; -print <<""; -0 $data_size_512b verity $hash_type -$dev $dev -$data_block_size $hash_block_size -$data_blocks $first_hash_block -$hash_algorithm -$root_hash -$salt +# The table must be on a single line +my $table = sprintf "0 %d verity %d %s %s %d %d %d %d %s %s %s", + $data_size_512b, + $hash_type, + $dev, + $dev, + $data_block_size, + $hash_block_size, + $data_blocks, + $first_hash_block, + $hash_algorithm, + $root_hash, + $salt, + ; + +print "dmsetup create --readonly boot --table '$table'\n"; +print "dmsetup mknodes boot\n"; __END__