summaryrefslogtreecommitdiff
path: root/meta-openbmc-mods/meta-ast2500/recipes-phosphor/fru
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openbmc-mods/meta-ast2500/recipes-phosphor/fru')
-rw-r--r--meta-openbmc-mods/meta-ast2500/recipes-phosphor/fru/default-fru.bb39
-rw-r--r--meta-openbmc-mods/meta-ast2500/recipes-phosphor/fru/default-fru/SetBaseboardFru.service9
-rwxr-xr-xmeta-openbmc-mods/meta-ast2500/recipes-phosphor/fru/default-fru/checkFru.sh38
-rwxr-xr-xmeta-openbmc-mods/meta-ast2500/recipes-phosphor/fru/default-fru/create_fru.py154
4 files changed, 0 insertions, 240 deletions
diff --git a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/fru/default-fru.bb b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/fru/default-fru.bb
deleted file mode 100644
index b8b8f7524..000000000
--- a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/fru/default-fru.bb
+++ /dev/null
@@ -1,39 +0,0 @@
-SUMMARY = "Default Fru"
-DESCRIPTION = "Installs a default fru file to image"
-
-inherit systemd
-
-SYSTEMD_SERVICE_${PN} = "SetBaseboardFru.service"
-
-S = "${WORKDIR}"
-SRC_URI = "file://checkFru.sh \
- file://SetBaseboardFru.service \
- file://create_fru.py"
-
-LICENSE = "Apache-2.0"
-LIC_FILES_CHKSUM = "file://${INTELBASE}/COPYING.apache-2.0;md5=34400b68072d710fecd0a2940a0d1658"
-
-RDEPENDS_${PN} = "bash"
-
-python do_compile() {
- import sys
- workdir = d.getVar('WORKDIR', True)
- sys.path.insert(0, workdir)
- from create_fru import create_fru
- create_fru('S2600WFT')
- create_fru('WilsonCity')
- create_fru('WilsonPoint')
- create_fru('M50CYP2SB2U')
- create_fru('D50TNP1SB')
-}
-
-do_install() {
- install -d ${D}${bindir}
- install -m 0755 ${S}/checkFru.sh ${D}/${bindir}/checkFru.sh
-
- install -d ${D}${sysconfdir}/fru
- cp ${S}/*.fru.bin ${D}/${sysconfdir}/fru
-
- install -d ${D}${base_libdir}/systemd/system
- install -m 0644 ${S}/SetBaseboardFru.service ${D}${base_libdir}/systemd/system
-}
diff --git a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/fru/default-fru/SetBaseboardFru.service b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/fru/default-fru/SetBaseboardFru.service
deleted file mode 100644
index dec53725e..000000000
--- a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/fru/default-fru/SetBaseboardFru.service
+++ /dev/null
@@ -1,9 +0,0 @@
-[Unit]
-Description=Reads GPIO and Loads the FRU
-
-[Service]
-ExecStart=/usr/bin/checkFru.sh
-Type=oneshot
-
-[Install]
-WantedBy=basic.target
diff --git a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/fru/default-fru/checkFru.sh b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/fru/default-fru/checkFru.sh
deleted file mode 100755
index 4b7910198..000000000
--- a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/fru/default-fru/checkFru.sh
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/bin/bash
-
-# this script checks the gpio id and loads the correct baseboard fru
-fruFile="/etc/fru/baseboard.fru.bin"
-idGpio=( 8 9 10 11 12 53)
-result=0
-idx=0
-
-if [ -f $fruFile ]; then
- exit 0
-fi
-
-cd /etc/fru
-for gpio in "${idGpio[@]}"
-do
- echo $gpio > /sys/class/gpio/export
- typeset -i value=$(cat /sys/class/gpio/gpio$gpio/value)
- value=$((value << idx))
- result=$((result | value))
- idx=$((idx+1))
-done
-
-# wp
-if (($result == 62)); then
- cat WilsonPoint.fru.bin > $fruFile
-# wc
-elif (($result == 45)); then
- cat WilsonCity.fru.bin > $fruFile
-# cyp
-elif (($result == 60)); then
- cat M50CYP2SB2U.fru.bin > $fruFile
-# tnp
-elif (($result == 12)); then
- cat D50TNP1SB.fru.bin > $fruFile
-# default to wft
-else
- cat S2600WFT.fru.bin > $fruFile
-fi
diff --git a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/fru/default-fru/create_fru.py b/meta-openbmc-mods/meta-ast2500/recipes-phosphor/fru/default-fru/create_fru.py
deleted file mode 100755
index 7f11cbf2d..000000000
--- a/meta-openbmc-mods/meta-ast2500/recipes-phosphor/fru/default-fru/create_fru.py
+++ /dev/null
@@ -1,154 +0,0 @@
-#!/usr/bin/python3
-
-"""
-This script generates a default baseboard fru file.
-"""
-
-
-def create_fru(name):
- if len(name) > 16:
- raise Exception('Product Name Too Large: {}'.format(name))
-
- fill_char = ord('.')
- eof = 0xC1
-
- filename = '{}.fru.bin'.format(name)
- name = name.encode('ascii')
-
- name_len = (0x3 << 6) | len(name)
-
- # internal area
- internal = [0x01] + ([0] * 6) + [0x01]
-
- # chassis area
- chassis = [0x01, # Chassis Info Area Format Version Bit Fields
- 0xFF, # Chassis Info Area Length (in multiples of 8 bytes)
- 0x17] # Chassis Type (Main Server Chassis)
-
- fill_len = 18
-
- # Chassis Part Number
- chassis += [0x3 << 6 | fill_len] + ([fill_char] * fill_len)
-
- # Chassis Serial Number
- chassis += [0x3 << 6 | fill_len] + ([fill_char] * fill_len)
-
- fill_len = 31
- chassis += [0x3 << 6 | fill_len] + ([fill_char] * fill_len) # Info AM1
- chassis += [0x3 << 6 | fill_len] + ([fill_char] * fill_len) # Info AM2
-
- chassis.append(eof)
-
- chassis.append(0) # need room for checksum
-
- while len(chassis) % 8: # pad
- chassis.append(0)
-
- chassis[1] = int(len(chassis) / 8) # populate length
- chassis[-1] = (256 - sum(chassis)) & 0xFF # populate checksum
-
- # board area
- board = [0x1, # Board Info Area Format Version Bit Fields
- 0xFF, # Board Info Area Length (in multiples of 8 bytes)
- 0x0, # Language Code
- 0x0, # Mfg. Date/Time
- 0x0, # Mfg. Date/Time
- 0x0, # Mfg. Date/Time
- 0xD1] # Product Manufacturer Name Len
-
- corp = b'Intel Corporation'
- board += bytearray(corp) # Manufacturer Name
-
- board.append(name_len)
- board += bytearray(name) # Board Product Name
-
- fill_len = 12
- board += [0x3 << 6 | fill_len] + ([fill_char] * fill_len) # board SN
-
- fill_len = 10
- board += [0x3 << 6 | fill_len] + ([fill_char] * fill_len) # board PN
-
- version = b'FRU Ver 0.01'
-
- board += [0x3 << 6 | len(version)] # FRU File version ID string
- board += bytearray(version)
-
- board.append(eof)
-
- board.append(0) # need room for checksum
-
- while len(board) % 8:
- board.append(0)
-
- board[1] = int(len(board) / 8) # populate length
- board[-1] = (256 - sum(board)) & 0xFF # populate checksum
-
- # product area
- product = [1, # Product Info Area Format Version Bit Fields
- 0xFF, # Product Info Area Length (in multiples of 8 bytes)
- 0x0, # Language Code
- 0xD1] # Product Manufacturer Name Len
-
- product += bytearray(corp) # Manufacturer Name
-
- product.append(name_len) # Product Name Len
- product += bytearray(name) # Product Name
-
- fill_len = 10
-
- # Product Part Number
- product += [0x3 << 6 | fill_len] + ([fill_char] * fill_len)
-
- # Product Version
- fill_len = 20
- product += [0x3 << 6 | fill_len] + ([fill_char] * fill_len)
-
- # Product Serial Number
- fill_len = 12
- product += [0x3 << 6 | fill_len] + ([fill_char] * fill_len)
-
- # Asset Tag
- fill_len = 20
- product += [0x3 << 6 | fill_len] + ([fill_char] * fill_len)
-
- product.append(0xC0) # FRU File ID (Not used)
- product.append(eof)
-
- product.append(0) # need room for checksum
-
- while len(product) % 8:
- product.append(0)
-
- product[1] = int(len(product) / 8)
- product[-1] = (256 - sum(product)) & 0xFF
-
- header = [0x1]
- length = 1 # internal
- header.append(length)
- length += int(len(internal) / 8)
- header.append(length)
- length += int(len(chassis) / 8)
- header.append(length)
- length += int(len(board) / 8)
- header.append(length)
- header.append(0)
- header.append(0)
- header.append((256 - sum(header)) & 0xFF)
-
- result = header + internal + chassis + board + product
-
- while len(result) < 0x1FF:
- result.append(0)
-
- result = bytearray(result)
-
- # print(result)
-
- with open(filename, 'wb') as out:
- out.write(result)
-
-
-if __name__ == '__main__':
- product_name = input('Enter Product Name: ')
- create_fru(product_name)
-