Skip to content

Commit

Permalink
Preserved Partition Change
Browse files Browse the repository at this point in the history
This commit fixes the problem of corrupted or changed preserved
partitions. If one of the partitions becomes corrupted, or it
the size of the partition needs to be changes, these changes will
allow for the copying of the old partition, forcing the new one
to take its place.

Tested:
When a PRESERVED partition is altered (corrupted or contents
deleted) ensured that the contents was not copied into the
prsv directory and the working partition appeared upon
reboot.

Signed-off-by: Zami Seck <[email protected]>
Change-Id: I473bdef12dd14913c385ccd43693ad7176567313
  • Loading branch information
zamiseck committed May 24, 2022
1 parent f9a72a7 commit 1e01078
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion mmc/obmc-flash-bios
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,26 @@ mmc_init() {
if [ -L "${running_dir}/${prsv}" ]; then
# Preserve the symlink target file
prsv="$(readlink "${running_dir}/${prsv}")"
cp -p ${running_dir}/"${prsv}" ${prsv_dir}
runsize="$(stat -c '%s' "${running_dir}/${prsv}")"
rosize="$(stat -c '%s' "${ro_dir}/${prsv}")"
if [ "$runsize" != "$rosize" ]; then
# Partition size may have changed or became corrupted
# So it will not be copied to the preserved directory
# Log PEL to indicate such
busctl call xyz.openbmc_project.Logging \
/xyz/openbmc_project/logging \
xyz.openbmc_project.Logging.Create Create "ssa{ss}" \
xyz.openbmc_project.Software.Version.Error.HostFile \
xyz.openbmc_project.Logging.Entry.Level.Error 3 "FILE_NAME" \
"${prsv}" "CURRENT_FILE_SIZE" "${runsize}" "EXPECTED_FILE_SIZE" \
"${rosize}"
# Initiate dump
busctl call xyz.openbmc_project.Dump.Manager \
/xyz/openbmc_project/dump/bmc xyz.openbmc_project.Dump.Create \
CreateDump "a{sv}" 0
else
cp -p ${running_dir}/"${prsv}" ${prsv_dir}
fi
fi
done
fi
Expand Down

0 comments on commit 1e01078

Please sign in to comment.