mirror of
https://git.yoctoproject.org/meta-security
synced 2026-07-27 19:37:12 +00:00
initramfs-framework/dmverity: add retry loop for slow boot devices
Detection of USB devices by the kernel is slow enough. We need to
keep trying for a while (default: 5s seconds, controlled by roottimeout=<seconds>)
and sleep between each attempt (default: one second, rootdelay=<seconds>).
Fix is based on https://git.yoctoproject.org/cgit.cgi/poky/commit/meta/recipes-core/initrdscripts/initramfs-framework/rootfs?id=ee6a6c3461694ce09789bf4d852cea2e22fc95e4
Signed-off-by: Naveen Saini <naveen.kumar.saini@intel.com>
Signed-off-by: Armin Kuster <akuster808@gmail.com>
(cherry picked from commit e23767fc72)
This commit is contained in:
committed by
Armin Kuster
parent
aa5a6f7d12
commit
4aab56bbca
@@ -10,33 +10,43 @@ dmverity_run() {
|
|||||||
|
|
||||||
. /usr/share/misc/dm-verity.env
|
. /usr/share/misc/dm-verity.env
|
||||||
|
|
||||||
case "${bootparam_root}" in
|
C=0
|
||||||
ID=*)
|
delay=${bootparam_rootdelay:-1}
|
||||||
RDEV="$(realpath /dev/disk/by-id/${bootparam_root#ID=})"
|
timeout=${bootparam_roottimeout:-5}
|
||||||
;;
|
RDEV="$(realpath /dev/disk/by-partuuid/${bootparam_root#PARTUUID=})"
|
||||||
LABEL=*)
|
while [ ! -b "${RDEV}" ]; do
|
||||||
RDEV="$(realpath /dev/disk/by-label/${bootparam_root#LABEL=})"
|
if [ $(( $C * $delay )) -gt $timeout ]; then
|
||||||
;;
|
fatal "Root device resolution failed"
|
||||||
PARTLABEL=*)
|
exit 1
|
||||||
RDEV="$(realpath /dev/disk/by-partlabel/${bootparam_root#PARTLABEL=})"
|
fi
|
||||||
;;
|
|
||||||
PARTUUID=*)
|
|
||||||
RDEV="$(realpath /dev/disk/by-partuuid/${bootparam_root#PARTUUID=})"
|
|
||||||
;;
|
|
||||||
PATH=*)
|
|
||||||
RDEV="$(realpath /dev/disk/by-path/${bootparam_root#PATH=})"
|
|
||||||
;;
|
|
||||||
UUID=*)
|
|
||||||
RDEV="$(realpath /dev/disk/by-uuid/${bootparam_root#UUID=})"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
RDEV="${bootparam_root}"
|
|
||||||
esac
|
|
||||||
|
|
||||||
if ! [ -b "${RDEV}" ]; then
|
case "${bootparam_root}" in
|
||||||
echo "Root device resolution failed"
|
ID=*)
|
||||||
exit 1
|
RDEV="$(realpath /dev/disk/by-id/${bootparam_root#ID=})"
|
||||||
fi
|
;;
|
||||||
|
LABEL=*)
|
||||||
|
RDEV="$(realpath /dev/disk/by-label/${bootparam_root#LABEL=})"
|
||||||
|
;;
|
||||||
|
PARTLABEL=*)
|
||||||
|
RDEV="$(realpath /dev/disk/by-partlabel/${bootparam_root#PARTLABEL=})"
|
||||||
|
;;
|
||||||
|
PARTUUID=*)
|
||||||
|
RDEV="$(realpath /dev/disk/by-partuuid/${bootparam_root#PARTUUID=})"
|
||||||
|
;;
|
||||||
|
PATH=*)
|
||||||
|
RDEV="$(realpath /dev/disk/by-path/${bootparam_root#PATH=})"
|
||||||
|
;;
|
||||||
|
UUID=*)
|
||||||
|
RDEV="$(realpath /dev/disk/by-uuid/${bootparam_root#UUID=})"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
RDEV="${bootparam_root}"
|
||||||
|
esac
|
||||||
|
debug "Sleeping for $delay second(s) to wait root to settle..."
|
||||||
|
sleep $delay
|
||||||
|
C=$(( $C + 1 ))
|
||||||
|
|
||||||
|
done
|
||||||
|
|
||||||
veritysetup \
|
veritysetup \
|
||||||
--data-block-size=1024 \
|
--data-block-size=1024 \
|
||||||
|
|||||||
Reference in New Issue
Block a user