summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2024-08-11 23:45:46 +0100
committerDaniel Golle <daniel@makrotopia.org>2024-08-12 11:31:37 +0100
commit8cf9a932fa7cebbfad1e9fab0ea633482adb8436 (patch)
treeb9900e837628fa3d6423006c9fe88304c1fdd275
parent1554af4c4380504eb1b37a100e56ecae749a67d5 (diff)
downloadopenwrt-8cf9a932fa7cebbfad1e9fab0ea633482adb8436.tar.gz
openwrt-8cf9a932fa7cebbfad1e9fab0ea633482adb8436.tar.bz2
openwrt-8cf9a932fa7cebbfad1e9fab0ea633482adb8436.zip
mediatek: add script to trigger scrubbing of FIP-in-UBI
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>
-rw-r--r--target/linux/mediatek/base-files/lib/preinit/07_trigger_fip_scrubbing16
1 files changed, 16 insertions, 0 deletions
diff --git a/target/linux/mediatek/base-files/lib/preinit/07_trigger_fip_scrubbing b/target/linux/mediatek/base-files/lib/preinit/07_trigger_fip_scrubbing
new file mode 100644
index 0000000000..74458e075b
--- /dev/null
+++ b/target/linux/mediatek/base-files/lib/preinit/07_trigger_fip_scrubbing
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+trigger_fip_scrubbing() {
+ local vol 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
+}
+
+boot_hook_add preinit_main trigger_fip_scrubbing