diff options
-rw-r--r-- | recipes-core/initrdscripts/initramfs-framework/dmverity | 64 |
1 files changed, 37 insertions, 27 deletions
diff --git a/recipes-core/initrdscripts/initramfs-framework/dmverity b/recipes-core/initrdscripts/initramfs-framework/dmverity index bb07aab..888052c 100644 --- a/recipes-core/initrdscripts/initramfs-framework/dmverity +++ b/recipes-core/initrdscripts/initramfs-framework/dmverity | |||
@@ -10,33 +10,43 @@ dmverity_run() { | |||
10 | 10 | ||
11 | . /usr/share/misc/dm-verity.env | 11 | . /usr/share/misc/dm-verity.env |
12 | 12 | ||
13 | case "${bootparam_root}" in | 13 | C=0 |
14 | ID=*) | 14 | delay=${bootparam_rootdelay:-1} |
15 | RDEV="$(realpath /dev/disk/by-id/${bootparam_root#ID=})" | 15 | timeout=${bootparam_roottimeout:-5} |
16 | ;; | 16 | RDEV="$(realpath /dev/disk/by-partuuid/${bootparam_root#PARTUUID=})" |
17 | LABEL=*) | 17 | while [ ! -b "${RDEV}" ]; do |
18 | RDEV="$(realpath /dev/disk/by-label/${bootparam_root#LABEL=})" | 18 | if [ $(( $C * $delay )) -gt $timeout ]; then |
19 | ;; | 19 | fatal "Root device resolution failed" |
20 | PARTLABEL=*) | 20 | exit 1 |
21 | RDEV="$(realpath /dev/disk/by-partlabel/${bootparam_root#PARTLABEL=})" | 21 | fi |
22 | ;; | 22 | |
23 | PARTUUID=*) | 23 | case "${bootparam_root}" in |
24 | RDEV="$(realpath /dev/disk/by-partuuid/${bootparam_root#PARTUUID=})" | 24 | ID=*) |
25 | ;; | 25 | RDEV="$(realpath /dev/disk/by-id/${bootparam_root#ID=})" |
26 | PATH=*) | 26 | ;; |
27 | RDEV="$(realpath /dev/disk/by-path/${bootparam_root#PATH=})" | 27 | LABEL=*) |
28 | ;; | 28 | RDEV="$(realpath /dev/disk/by-label/${bootparam_root#LABEL=})" |
29 | UUID=*) | 29 | ;; |
30 | RDEV="$(realpath /dev/disk/by-uuid/${bootparam_root#UUID=})" | 30 | PARTLABEL=*) |
31 | ;; | 31 | RDEV="$(realpath /dev/disk/by-partlabel/${bootparam_root#PARTLABEL=})" |
32 | *) | 32 | ;; |
33 | RDEV="${bootparam_root}" | 33 | PARTUUID=*) |
34 | esac | 34 | RDEV="$(realpath /dev/disk/by-partuuid/${bootparam_root#PARTUUID=})" |
35 | 35 | ;; | |
36 | if ! [ -b "${RDEV}" ]; then | 36 | PATH=*) |
37 | echo "Root device resolution failed" | 37 | RDEV="$(realpath /dev/disk/by-path/${bootparam_root#PATH=})" |
38 | exit 1 | 38 | ;; |
39 | fi | 39 | UUID=*) |
40 | RDEV="$(realpath /dev/disk/by-uuid/${bootparam_root#UUID=})" | ||
41 | ;; | ||
42 | *) | ||
43 | RDEV="${bootparam_root}" | ||
44 | esac | ||
45 | debug "Sleeping for $delay second(s) to wait root to settle..." | ||
46 | sleep $delay | ||
47 | C=$(( $C + 1 )) | ||
48 | |||
49 | done | ||
40 | 50 | ||
41 | veritysetup \ | 51 | veritysetup \ |
42 | --data-block-size=1024 \ | 52 | --data-block-size=1024 \ |