Initial commit

This commit is contained in:
Your Name
2026-04-23 17:07:55 +08:00
commit b7e39e063b
16725 changed files with 1625565 additions and 0 deletions
@@ -0,0 +1,10 @@
[Unit]
Description=Write Bios Version to File
Wants=phosphor-ipmi-host.service
After=phosphor-ipmi-host.service
[Service]
Type=oneshot
Restart=no
ExecStart=/usr/bin/write-bios-version.sh
@@ -0,0 +1,39 @@
#!/bin/bash
bus=14
address=0x53
offset=0x08
biosversion=$(busctl get-property xyz.openbmc_project.Software.BMC.Updater /xyz/openbmc_project/software/bios_active xyz.openbmc_project.Software.Version Version)
ret=$?
if [ $ret != 0 ]; then
echo "Failed to get BIOS version from dbus"
exit 1
fi
biosversion=$(echo "$biosversion" |cut -d "\"" -f2)
echo "BIOS version got from dbus:$biosversion"
if [ "$biosversion" == "null" ]; then
echo "BIOS version is null, skip"
else
tmp=$(i2ctransfer -y -f $bus w2@$address $offset 0x00 r32)
for str in $tmp;do
if [[ $str != 0x00 ]]; then
str=$(printf "%d" "$str")
version=$(echo "$str" | awk '{printf("%c", $str)}')
version_str="$version_str$version"
fi
done
echo "BIOS version got from epprom:$version_str"
if [ "$biosversion" != "$version_str" ]; then
for ((j=0;j < 32;j++));do
hexArr[$j]=0
done
for ((i=0;i < 14;i++));do
ver=${biosversion:$i:1}
hexArr[$i]=$(printf "%d" "'$ver")
done
i2ctransfer -y -f $bus w34@$address $offset 0x00 "${hexArr[@]}"
echo "Write BIOS version to epprom:${biosversion}"
else
echo "BIOS version same, skip writing BIOS version"
fi
fi