Skip to content

Commit

Permalink
mediatek: add script to trigger scrubbing of FIP-in-UBI
Browse files Browse the repository at this point in the history
Read the 'fip' static volume in order to trigger scrubbing in case of
detecting flipped bits while reading.
We have to do this in Linux because we never read or touch the 'fip'
volume and the UBISPL implementation in ARM TrustedFirmware-A does NOT
handle scrubbing itself.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
  • Loading branch information
dangowrt committed Aug 11, 2024
1 parent 5149226 commit 47afcb3
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

trigger_static_scrubbing() {
local voltype volname
for vol in /sys/class/ubi/ubi*_*; do
[ -e "$vol" ] || continue
voltype="$(cat "$vol"/type)"
volname="$(cat "$vol"/name)"
if [ "$voltype" = "static" ] && [ "$volname" = "fip" ]; then
cat "/dev/${vol##*/}" > /dev/null
break
fi
done
}

trigger_static_scrubbing &

0 comments on commit 47afcb3

Please sign in to comment.