Skip to content

Commit ef4a0ca

Browse files
mingzhangqunigorpecovnik
authored andcommitted
bootscript: address review feedback on armbianEnv.txt corruption detection
- Mention ^@ (NUL) corruption for non-eMMC storage in comments - Add WARNING console messages for .bak fallback and rootdev derivation so failures are visible during boot for debugging
1 parent 4904205 commit ef4a0ca

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

config/bootscripts/boot-seeed-rk35xx.cmd

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,24 @@ test -n "${distro_bootpart}" || distro_bootpart=1
2222
echo "Boot script loaded from ${devtype} ${devnum}:${distro_bootpart}"
2323

2424
# Load armbianEnv.txt with corruption detection and .bak fallback.
25-
# Power loss can fill the file with 0xFF (eMMC erased block) which passes
26-
# "env import -t" without error but imports zero variables. Clear rootdev
27-
# before import; if it remains empty, the file was corrupt.
25+
# Power loss can fill the file with 0xFF (eMMC erased block) or ^@ (NUL,
26+
# on other storage media) which passes "env import -t" without error but
27+
# imports zero variables. Clear rootdev before import; if it remains
28+
# empty, the file was corrupt.
2829
setenv rootdev
2930
if load ${devtype} ${devnum}:${distro_bootpart} ${load_addr} ${prefix}armbianEnv.txt; then
3031
env import -t ${load_addr} ${filesize}
3132
fi
3233
if test -z "${rootdev}"; then
3334
if load ${devtype} ${devnum}:${distro_bootpart} ${load_addr} ${prefix}armbianEnv.txt.bak; then
34-
echo "Loading armbianEnv.txt.bak as fallback"
35+
echo "WARNING: armbianEnv.txt corrupt, loading .bak fallback"
3536
setenv rootdev
3637
env import -t ${load_addr} ${filesize}
3738
fi
3839
fi
3940
# Final safety: derive rootdev from boot source if still unset
4041
if test -z "${rootdev}"; then
42+
echo "WARNING: rootdev not set, deriving from boot source ${devnum}:${distro_bootpart}"
4143
setenv rootdev "/dev/mmcblk${devnum}p${distro_bootpart}"
4244
fi
4345

0 commit comments

Comments
 (0)