diff --git a/recipes-core/initrdscripts/initramfs-framework-dm/dmverity b/recipes-core/initrdscripts/initramfs-framework-dm/dmverity
index 1923490..4b29af4 100644
--- a/recipes-core/initrdscripts/initramfs-framework-dm/dmverity
+++ b/recipes-core/initrdscripts/initramfs-framework-dm/dmverity
@@ -4,6 +4,31 @@ dmverity_enabled() {
     return 0
 }
 
+dmverity_root_device() {
+    case "${bootparam_root}" in
+        ID=*)
+            realpath /dev/disk/by-id/${bootparam_root#ID=} 2>/dev/null
+            ;;
+        LABEL=*)
+            realpath /dev/disk/by-label/${bootparam_root#LABEL=} 2>/dev/null
+            ;;
+        PARTLABEL=*)
+            realpath /dev/disk/by-partlabel/${bootparam_root#PARTLABEL=} 2>/dev/null
+            ;;
+        PARTUUID=*)
+            realpath /dev/disk/by-partuuid/${bootparam_root#PARTUUID=} 2>/dev/null
+            ;;
+        PATH=*)
+            realpath /dev/disk/by-path/${bootparam_root#PATH=} 2>/dev/null
+            ;;
+        UUID=*)
+            realpath /dev/disk/by-uuid/${bootparam_root#UUID=} 2>/dev/null
+            ;;
+        *)
+            echo "${bootparam_root}"
+    esac
+}
+
 dmverity_run() {
     DATA_SIZE="__not_set__"
     DATA_BLOCK_SIZE="__not_set__"
@@ -43,39 +68,17 @@ dmverity_run() {
 	    return
     fi
 
-    RDEV="$(realpath /dev/disk/by-partuuid/${bootparam_root#PARTUUID=} 2>/dev/null)"
+    RDEV="$(dmverity_root_device)"
     while [ ! -b "${RDEV}" ]; do
         if [ $(( $C * $delay )) -gt $timeout ]; then
             fatal "Root device resolution failed"
             exit 1
         fi
 
-        case "${bootparam_root}" in
-            ID=*)
-                RDEV="$(realpath /dev/disk/by-id/${bootparam_root#ID=} 2>/dev/null)"
-                ;;
-            LABEL=*)
-                RDEV="$(realpath /dev/disk/by-label/${bootparam_root#LABEL=} 2>/dev/null)"
-                ;;
-            PARTLABEL=*)
-                RDEV="$(realpath /dev/disk/by-partlabel/${bootparam_root#PARTLABEL=} 2>/dev/null)"
-                ;;
-            PARTUUID=*)
-                RDEV="$(realpath /dev/disk/by-partuuid/${bootparam_root#PARTUUID=} 2>/dev/null)"
-                ;;
-            PATH=*)
-                RDEV="$(realpath /dev/disk/by-path/${bootparam_root#PATH=} 2>/dev/null)"
-                ;;
-            UUID=*)
-                RDEV="$(realpath /dev/disk/by-uuid/${bootparam_root#UUID=} 2>/dev/null)"
-                ;;
-            *)
-                RDEV="${bootparam_root}"
-        esac
         debug "Sleeping for $delay second(s) to wait root to settle..."
         sleep $delay
         C=$(( $C + 1 ))
-
+        RDEV="$(dmverity_root_device)"
     done
 
     veritysetup \
