diff options
Diffstat (limited to 'meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru/checkFru.sh')
-rwxr-xr-x | meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru/checkFru.sh | 44 |
1 files changed, 39 insertions, 5 deletions
diff --git a/meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru/checkFru.sh b/meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru/checkFru.sh index 9227beb20..0ba6e132f 100755 --- a/meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru/checkFru.sh +++ b/meta-openbmc-mods/meta-common/recipes-phosphor/fru/default-fru/checkFru.sh @@ -5,10 +5,7 @@ FRUPATH="/etc/fru" PRODIDPATH="/var/cache/private" fruFile="$FRUPATH/baseboard.fru.bin" prodIDFile="$PRODIDPATH/prodID" - -if [ -f $fruFile -a -f $prodIDFile ]; then - exit 0 -fi +eepromFru=false read_id() { local idx=0 @@ -23,9 +20,33 @@ read_id() { echo $result } +# Check 'Chassis Info Area' exists or not by checking its offset value in the +# FRU Common Header. If exists, return 0 (success). +chassis_area_found(){ + local eepromBus="3" + local eepromAddr="0x56" + local eepromReadOffset="0x02" + local chassisAreaOffset="0" + + chassisAreaOffset=$(eeprog /dev/i2c-$eepromBus $eepromAddr -f -q -r $eepromReadOffset -x | awk '{print $2}') + if [ $chassisAreaOffset != "00" ]; then + return 0 + fi + return 1 +} + +if [ -f $fruFile -a -f $prodIDFile ] && + grep -q 'CPU part\s*: 0xc07' /proc/cpuinfo; then + exit 0 +fi + BOARD_ID=$(read_id) if grep -q 'CPU part\s*: 0xb76' /proc/cpuinfo; then # AST2500 + if [ -f $fruFile -a -f $prodIDFile -a $BOARD_ID -ne 0 ]; then + exit 0 + fi + case $BOARD_ID in 12) NAME="D50TNP1SB" PRODID="0x99";; @@ -41,6 +62,13 @@ if grep -q 'CPU part\s*: 0xb76' /proc/cpuinfo; then PRODID="0x98";; 62) NAME="WilsonPoint" PRODID="0x9a";; + 0) PRODID="0x00" + eepromFru=true + rm -f $fruFile + if ! chassis_area_found || [ -f /etc/bc_fru_write_fails ]; then + nohup rewriteFru.sh & + fi + ;; *) NAME="S2600WFT" PRODID="0x7b";; esac @@ -65,6 +93,13 @@ then echo $PRODID >$prodIDFile fi +if $eepromFru; +then + # Wait for rewriteFru.sh child process to finish. + wait + exit 0 +fi + if [ ! -f $fruFile ] then cd /tmp @@ -73,4 +108,3 @@ then mv $NAME.fru.bin $fruFile fi - |