Initial commit
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
require conf/distro/gbmc.conf
|
||||
|
||||
DISTRO = "openbmc-mori"
|
||||
@@ -0,0 +1,11 @@
|
||||
# We have a conf and classes directory, add to BBPATH
|
||||
BBPATH .= ":${LAYERDIR}"
|
||||
|
||||
# We have recipes-* directories, add to BBFILES
|
||||
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
|
||||
${LAYERDIR}/recipes-*/*/*.bbappend"
|
||||
|
||||
BBFILE_COLLECTIONS += "mori-layer"
|
||||
BBFILE_PATTERN_mori-layer = "^${LAYERDIR}/"
|
||||
LAYERSERIES_COMPAT_mori-layer = "langdale mickledore"
|
||||
LAYERDEPENDS_mori-layer = "core phosphor-layer google-layer fii-layer"
|
||||
@@ -0,0 +1,56 @@
|
||||
KMACHINE = "nuvoton"
|
||||
|
||||
require conf/machine/include/npcm7xx.inc
|
||||
require conf/machine/include/obmc-bsp-common.inc
|
||||
|
||||
FLASH_SIZE = "65536"
|
||||
FLASH_UBOOT_OFFSET:flash-65536 = "0"
|
||||
FLASH_UBOOT_ENV_OFFSET:flash-65536 = "1024"
|
||||
FLASH_KERNEL_OFFSET:flash-65536 = "2048"
|
||||
FLASH_ROFS_OFFSET:flash-65536 = "7168"
|
||||
FLASH_RWFS_OFFSET:flash-65536 = "62400"
|
||||
|
||||
UBOOT_MACHINE = "PolegSVB_config"
|
||||
UBOOT_DEVICETREE = "nuvoton-npcm730-mori"
|
||||
IGPS_MACHINE = "EB"
|
||||
|
||||
GBMC_MAC_EEPROM_OF_NAME = "bmcfru"
|
||||
GBMC_NCSI_IF_NAME = "eth0"
|
||||
GBMC_MAC_IF_MAP = "[0]=eth1"
|
||||
|
||||
IMAGE_FSTYPES += " cpio.${INITRAMFS_CTYPE}.u-boot"
|
||||
|
||||
SERIAL_CONSOLES = "115200;ttyS0"
|
||||
|
||||
PREFERRED_PROVIDER_virtual/obmc-host-ipmi-hw = "phosphor-ipmi-ssif"
|
||||
PREFERRED_PROVIDER_virtual/bmc-update = "mori-bmc-update"
|
||||
PREFERRED_PROVIDER_virtual/bios-update = "mori-bios-update"
|
||||
PREFERRED_PROVIDER_virtual/cpld-update = "mori-cpld-update"
|
||||
PREFERRED_PROVIDER_virtual/phosphor-led-manager-config-native = "mori-led-manager-config-native"
|
||||
|
||||
# Remove unneeded binaries from image
|
||||
IMAGE_FEATURES:remove = "obmc-bmcweb"
|
||||
IMAGE_FEATURES:remove = "obmc-console"
|
||||
IMAGE_FEATURES:remove = "obmc-devtools"
|
||||
IMAGE_FEATURES:remove = "obmc-fan-control"
|
||||
IMAGE_FEATURES:remove = "obmc-fan-mgmt"
|
||||
IMAGE_FEATURES:remove = "obmc-flash-mgmt"
|
||||
IMAGE_FEATURES:remove = "obmc-fru-ipmi"
|
||||
IMAGE_FEATURES:remove = "obmc-health-monitor"
|
||||
IMAGE_FEATURES:remove = "obmc-host-ipmi"
|
||||
IMAGE_FEATURES:remove = "obmc-ikvm"
|
||||
IMAGE_FEATURES:remove = "obmc-inventory"
|
||||
IMAGE_FEATURES:remove = "obmc-leds"
|
||||
IMAGE_FEATURES:remove = "obmc-logging-mgmt"
|
||||
IMAGE_FEATURES:remove = "obmc-remote-logging-mgmt"
|
||||
IMAGE_FEATURES:remove = "obmc-rng"
|
||||
IMAGE_FEATURES:remove = "obmc-net-ipmi"
|
||||
IMAGE_FEATURES:remove = "obmc-sensors"
|
||||
IMAGE_FEATURES:remove = "obmc-software"
|
||||
IMAGE_FEATURES:remove = "obmc-telemetry"
|
||||
IMAGE_FEATURES:remove = "obmc-system-mgmt"
|
||||
IMAGE_FEATURES:remove = "obmc-settings-mgmt"
|
||||
IMAGE_FEATURES:remove = "obmc-network-mgmt"
|
||||
IMAGE_FEATURES:remove = "obmc-user-mgmt"
|
||||
IMAGE_FEATURES:remove = "obmc-user-mgmt-ldap"
|
||||
OBMC_IMAGE_BASE_INSTALL:remove = "packagegroup-obmc-apps-extras"
|
||||
@@ -0,0 +1,19 @@
|
||||
# LAYER_CONF_VERSION is increased each time build/conf/bblayers.conf
|
||||
# changes incompatibly
|
||||
LCONF_VERSION = "8"
|
||||
|
||||
BBPATH = "${TOPDIR}"
|
||||
BBFILES ?= ""
|
||||
|
||||
BBLAYERS ?= " \
|
||||
##OEROOT##/meta \
|
||||
##OEROOT##/meta-openembedded/meta-oe \
|
||||
##OEROOT##/meta-openembedded/meta-networking \
|
||||
##OEROOT##/meta-openembedded/meta-python \
|
||||
##OEROOT##/meta-security \
|
||||
##OEROOT##/meta-phosphor \
|
||||
##OEROOT##/meta-nuvoton \
|
||||
##OEROOT##/meta-google \
|
||||
##OEROOT##/meta-fii \
|
||||
##OEROOT##/meta-fii/meta-mori \
|
||||
"
|
||||
@@ -0,0 +1,2 @@
|
||||
Common targets are:
|
||||
obmc-phosphor-image
|
||||
@@ -0,0 +1,18 @@
|
||||
MACHINE ??= "mori"
|
||||
DISTRO ?= "openbmc-mori"
|
||||
PACKAGE_CLASSES ?= "package_ipk"
|
||||
SANITY_TESTED_DISTROS:append ?= " *"
|
||||
EXTRA_IMAGE_FEATURES ?= "debug-tweaks"
|
||||
USER_CLASSES ?= "buildstats"
|
||||
PATCHRESOLVE = "noop"
|
||||
BB_DISKMON_DIRS ??= "\
|
||||
STOPTASKS,${TMPDIR},1G,100K \
|
||||
STOPTASKS,${DL_DIR},1G,100K \
|
||||
STOPTASKS,${SSTATE_DIR},1G,100K \
|
||||
STOPTASKS,/tmp,100M,100K \
|
||||
HALT,${TMPDIR},100M,1K \
|
||||
HALT,${DL_DIR},100M,1K \
|
||||
HALT,${SSTATE_DIR},100M,1K \
|
||||
HALT,/tmp,10M,1K"
|
||||
CONF_VERSION = "2"
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
# Configuration file for fw_(printenv/setenv) utility.
|
||||
# Up to two entries are valid, in this case the redundant
|
||||
# environment sector is assumed present.
|
||||
# Notice, that the "Number of sectors" is not required on NOR and SPI-dataflash.
|
||||
# Futhermore, if the Flash sector size is ommitted, this value is assumed to
|
||||
# be the same as the Environment size, which is valid for NOR and SPI-dataflash
|
||||
|
||||
# NOR example
|
||||
# MTD device name Device offset Env. size Flash sector size Number of sectors
|
||||
/dev/mtd2 0x0000 0x40000 0x4000
|
||||
|
||||
# MTD SPI-dataflash example
|
||||
# MTD device name Device offset Env. size Flash sector size Number of sectors
|
||||
#/dev/mtd5 0x4200 0x4200
|
||||
#/dev/mtd6 0x4200 0x4200
|
||||
|
||||
# NAND example
|
||||
#/dev/mtd0 0x4000 0x4000 0x20000 2
|
||||
|
||||
# Block device example
|
||||
#/dev/mmcblk0 0xc0000 0x20000
|
||||
|
||||
# VFAT example
|
||||
#/boot/uboot.env 0x0000 0x4000
|
||||
@@ -0,0 +1,7 @@
|
||||
FILESEXTRAPATHS:prepend:mori := "${THISDIR}/${PN}:"
|
||||
|
||||
SRC_URI:append:mori = " file://fw_env.config"
|
||||
|
||||
do_install:append:mori () {
|
||||
install -m 644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
CONFIG_PHY_FIXED=y
|
||||
CONFIG_CMD_MII=y
|
||||
CONFIG_NET_RANDOM_ETHADDR=y
|
||||
@@ -0,0 +1,3 @@
|
||||
FILESEXTRAPATHS:prepend:mori := "${THISDIR}/${PN}:"
|
||||
|
||||
SRC_URI:append:mori = " file://mori.cfg"
|
||||
@@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Rotate the event logs
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/bin/rotate-event-logs.sh
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
while true; do
|
||||
sleep 60
|
||||
/usr/sbin/logrotate /etc/logrotate.d/logrotate.rsyslog
|
||||
ec=$?
|
||||
if [ $ec -ne 0 ] ; then
|
||||
echo "logrotate failed ($ec)"
|
||||
fi
|
||||
done
|
||||
@@ -0,0 +1,2 @@
|
||||
[Service]
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
@@ -0,0 +1,79 @@
|
||||
# if you experience problems, check
|
||||
# http://www.rsyslog.com/troubleshoot for assistance
|
||||
|
||||
# rsyslog v3: load input modules
|
||||
# If you do not load inputs, nothing happens!
|
||||
# You may need to set the module load path if modules are not found.
|
||||
#
|
||||
# Ported from debian's sysklogd.conf
|
||||
|
||||
# Journal-style logging
|
||||
# Limit to no more than 4000 entries in one minute and enable the
|
||||
# journal workaround to avoid duplicate entries
|
||||
module(load="imjournal" StateFile="/var/log/state"
|
||||
RateLimit.Interval="60"
|
||||
RateLimit.Burst="4000")
|
||||
|
||||
# Template for IPMI SEL messages
|
||||
# "<timestamp> <ID>,<Type>,<EventData>,[<Generator ID>,<Path>,<Direction>]"
|
||||
template(name="IPMISELTemplate" type="list") {
|
||||
property(name="timereported" dateFormat="rfc3339")
|
||||
constant(value=" ")
|
||||
property(name="$!IPMI_SEL_RECORD_ID")
|
||||
constant(value=",")
|
||||
property(name="$!IPMI_SEL_RECORD_TYPE")
|
||||
constant(value=",")
|
||||
property(name="$!IPMI_SEL_DATA")
|
||||
constant(value=",")
|
||||
property(name="$!IPMI_SEL_GENERATOR_ID")
|
||||
constant(value=",")
|
||||
property(name="$!IPMI_SEL_SENSOR_PATH")
|
||||
constant(value=",")
|
||||
property(name="$!IPMI_SEL_EVENT_DIR")
|
||||
constant(value="\n")
|
||||
}
|
||||
|
||||
# Template for Redfish messages
|
||||
# "<timestamp> <MessageId>,<MessageArgs>"
|
||||
template(name="RedfishTemplate" type="list") {
|
||||
property(name="timereported" dateFormat="rfc3339")
|
||||
constant(value=" ")
|
||||
property(name="$!REDFISH_MESSAGE_ID")
|
||||
constant(value=",")
|
||||
property(name="$!REDFISH_MESSAGE_ARGS")
|
||||
constant(value="\n")
|
||||
}
|
||||
|
||||
# Template for Application Crashes
|
||||
# "<timestamp> <MessageId>,<MessageArgs>"
|
||||
template(name="CrashTemplate" type="list") {
|
||||
property(name="timereported" dateFormat="rfc3339")
|
||||
constant(value=" ")
|
||||
constant(value="OpenBMC.0.1.ServiceFailure")
|
||||
constant(value=",")
|
||||
property(name="$!UNIT")
|
||||
constant(value="\n")
|
||||
}
|
||||
|
||||
|
||||
# If the journal entry has the IPMI SEL MESSAGE_ID, save as IPMI SEL
|
||||
# The MESSAGE_ID string is generated using journalctl and must match the
|
||||
# MESSAGE_ID used in IPMI to correctly find the SEL entries.
|
||||
if ($!MESSAGE_ID == "b370836ccf2f4850ac5bee185b77893a") then {
|
||||
action(type="omfile" file="/var/log/ipmi_sel" template="IPMISELTemplate")
|
||||
}
|
||||
|
||||
# If the journal entry has a Redfish MessageId, save as a Redfish event
|
||||
if ($!REDFISH_MESSAGE_ID != "") then {
|
||||
action(type="omfile" file="/var/log/redfish" template="RedfishTemplate")
|
||||
}
|
||||
|
||||
# If the journal entry has a Exit Code, save as a Redfish event
|
||||
if ($!EXIT_STATUS != "" and $!EXIT_STATUS != "0") then {
|
||||
action(type="omfile" file="/var/log/redfish" template="CrashTemplate")
|
||||
}
|
||||
|
||||
#
|
||||
# Include all config files in /etc/rsyslog.d/
|
||||
#
|
||||
$IncludeConfig /etc/rsyslog.d/*.conf
|
||||
@@ -0,0 +1,32 @@
|
||||
# /etc/logrotate.d/rsyslog - Ported from Debian
|
||||
|
||||
# Keep up to four 64k files for ipmi_sel (256k total)
|
||||
/var/log/ipmi_sel
|
||||
{
|
||||
rotate 3
|
||||
size 64k
|
||||
missingok
|
||||
postrotate
|
||||
systemctl reload rsyslog 2> /dev/null || true
|
||||
endscript
|
||||
}
|
||||
# Keep up to four 64k files for redfish (256k total)
|
||||
/var/log/redfish
|
||||
{
|
||||
rotate 3
|
||||
size 64k
|
||||
missingok
|
||||
postrotate
|
||||
systemctl reload rsyslog 2> /dev/null || true
|
||||
endscript
|
||||
}
|
||||
# Keep up to two 2k files for gpio log (4k total)
|
||||
/usr/share/mori-vrlog/gpio.log
|
||||
{
|
||||
rotate 1
|
||||
size 2k
|
||||
missingok
|
||||
postrotate
|
||||
systemctl reload rsyslog 2> /dev/null || true
|
||||
endscript
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
FILESEXTRAPATHS:prepend:mori := "${THISDIR}/${PN}:"
|
||||
|
||||
SRC_URI:append:mori = " \
|
||||
file://rsyslog.conf \
|
||||
file://rsyslog.logrotate \
|
||||
file://rotate-event-logs.service \
|
||||
file://rotate-event-logs.sh \
|
||||
file://rsyslog-override.conf \
|
||||
"
|
||||
|
||||
FILES:${PN}:append:mori = " ${systemd_system_unitdir}/rsyslog.service.d/rsyslog-override.conf"
|
||||
|
||||
PACKAGECONFIG:append:mori = " imjournal"
|
||||
|
||||
do_install:append:mori() {
|
||||
install -m 0644 ${WORKDIR}/rotate-event-logs.service ${D}${systemd_system_unitdir}
|
||||
install -d ${D}${systemd_system_unitdir}/rsyslog.service.d
|
||||
install -m 0644 ${WORKDIR}/rsyslog-override.conf \
|
||||
${D}${systemd_system_unitdir}/rsyslog.service.d/rsyslog-override.conf
|
||||
install -d ${D}${bindir}
|
||||
install -m 0755 ${WORKDIR}/rotate-event-logs.sh ${D}/${bindir}/rotate-event-logs.sh
|
||||
rm ${D}${sysconfdir}/rsyslog.d/imjournal.conf
|
||||
}
|
||||
|
||||
SYSTEMD_SERVICE:${PN}:append:mori = " rotate-event-logs.service"
|
||||
@@ -0,0 +1,108 @@
|
||||
# Sensors Configuration
|
||||
CONFIG_SENSORS_NPCM7XX=y
|
||||
CONFIG_SENSORS_TMP100=y
|
||||
CONFIG_SENSORS_LM75=y
|
||||
CONFIG_SENSORS_PWM_FAN=y
|
||||
CONFIG_SENSORS_ADC128D818=y
|
||||
CONFIG_SENSORS_ADM1275=y
|
||||
CONFIG_SENSORS_TMP102=y
|
||||
CONFIG_SENSORS_TMP421=y
|
||||
CONFIG_SENSORS_MAX31790=y
|
||||
CONFIG_SENSORS_MAX34440=y
|
||||
CONFIG_SENSORS_ADM1266=y
|
||||
CONFIG_PMBUS=y
|
||||
CONFIG_SENSORS_PMBUS=y
|
||||
CONFIG_SENSORS_INA2XX=y
|
||||
|
||||
# IIO Configuration
|
||||
CONFIG_IIO=y
|
||||
CONFIG_IIO_MUX=y
|
||||
CONFIG_NPCM_ADC=y
|
||||
CONFIG_SENSORS_IIO_HWMON=y
|
||||
|
||||
# LEDs Configuration
|
||||
CONFIG_NEW_LEDS=y
|
||||
CONFIG_LEDS_CLASS=y
|
||||
CONFIG_LEDS_GPIO=y
|
||||
CONFIG_LEDS_TRIGGERS=y
|
||||
CONFIG_LEDS_TRIGGER_TIMER=y
|
||||
CONFIG_LEDS_TRIGGER_HEARTBEAT=y
|
||||
CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
|
||||
|
||||
# FS Configuration
|
||||
CONFIG_OVERLAY_FS=y
|
||||
CONFIG_SQUASHFS=y
|
||||
CONFIG_SQUASHFS_XZ=y
|
||||
CONFIG_JFFS2_FS=y
|
||||
CONFIG_EXT4_FS=y
|
||||
|
||||
# SPI Configuration
|
||||
CONFIG_SPI=y
|
||||
CONFIG_SPI_NPCM_FIU=y
|
||||
CONFIG_MTD_M25P80=y
|
||||
CONFIG_SPI_NPCM_PSPI=y
|
||||
|
||||
# Network Configuration
|
||||
CONFIG_NET_VENDOR_NUVOTON=y
|
||||
CONFIG_NPCM7XX_EMC_ETH=y
|
||||
CONFIG_NET_NCSI=y
|
||||
CONFIG_PHYLINK=y
|
||||
CONFIG_STMMAC_ETH=y
|
||||
CONFIG_BROADCOM_PHY=y
|
||||
CONFIG_BCM_NET_PHYLIB=y
|
||||
|
||||
# I2C Configuration
|
||||
CONFIG_I2C=y
|
||||
CONFIG_I2C_NPCM7XX=y
|
||||
CONFIG_I2C_MUX=y
|
||||
CONFIG_I2C_MUX_PCA954x=y
|
||||
CONFIG_I2C_SLAVE_EEPROM=y
|
||||
CONFIG_EEPROM_AT24=y
|
||||
CONFIG_I2C_SLAVE=y
|
||||
CONFIG_I2C_SLAVE_MQUEUE=y
|
||||
CONFIG_IPMB_DEVICE_INTERFACE=y
|
||||
CONFIG_GPIO_PCA953X=y
|
||||
CONFIG_GPIO_PCA953X_IRQ=y
|
||||
CONFIG_GPIO_PCF857X=y
|
||||
CONFIG_MUX_MMIO=y
|
||||
|
||||
# RTC device
|
||||
CONFIG_RTC_CLASS=y
|
||||
CONFIG_RTC_DRV_PCF85063=y
|
||||
|
||||
# JATG Configuration
|
||||
CONFIG_NUVOTON_JTAG=y
|
||||
CONFIG_NPCM7XX_JTAG_MASTER=y
|
||||
|
||||
# Core Netfilter Configuration
|
||||
CONFIG_NET_INGRESS=y
|
||||
CONFIG_NETFILTER=y
|
||||
CONFIG_NETFILTER_ADVANCED=y
|
||||
CONFIG_NETFILTER_INGRESS=y
|
||||
CONFIG_NETFILTER_NETLINK=y
|
||||
CONFIG_NF_CONNTRACK=y
|
||||
CONFIG_NF_CONNTRACK_PROCFS=y
|
||||
CONFIG_NF_CT_PROTO_DCCP=y
|
||||
CONFIG_NF_CT_PROTO_SCTP=y
|
||||
CONFIG_NF_CT_PROTO_UDPLITE=y
|
||||
CONFIG_NF_CT_NETLINK=y
|
||||
CONFIG_NETFILTER_XTABLES=y
|
||||
|
||||
# IP: Netfilter Configuration
|
||||
CONFIG_NF_DEFRAG_IPV4=y
|
||||
CONFIG_NF_REJECT_IPV4=y
|
||||
CONFIG_IP_NF_IPTABLES=y
|
||||
CONFIG_IP_NF_FILTER=y
|
||||
CONFIG_IP_NF_TARGET_REJECT=y
|
||||
CONFIG_NF_DEFRAG_IPV6=y
|
||||
CONFIG_TCG_TPM=y
|
||||
CONFIG_TCG_TIS_I2C_INFINEON=y
|
||||
|
||||
# Misc Configuration
|
||||
CONFIG_MEDIA_SUPPORT=y
|
||||
CONFIG_VIDEO_NUVOTON=y
|
||||
CONFIG_NPCM750_VCD=y
|
||||
CONFIG_NPCM750_ECE=y
|
||||
CONFIG_FORCE_MAX_ZONEORDER=12
|
||||
CONFIG_NPCM7XX_PCI_MBOX=y
|
||||
CONFIG_RESET_NPCM=y
|
||||
@@ -0,0 +1,5 @@
|
||||
FILESEXTRAPATHS:prepend:mori := "${THISDIR}/linux-nuvoton:"
|
||||
|
||||
SRC_URI:append:mori = " file://mori.cfg \
|
||||
"
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=Boot Status LED Manager
|
||||
After=xyz.openbmc_project.LED.GroupManager.service
|
||||
Wants=xyz.openbmc_project.LED.GroupManager.service
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/boot-status-led.sh
|
||||
Type=simple
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
|
||||
BOOT_SERVICE_NAME="xyz.openbmc_project.State.Host"
|
||||
BOOT_STATUS_OBJPATH="/xyz/openbmc_project/state/host0"
|
||||
BOOT_INTERFACE_NAME="xyz.openbmc_project.State.OperatingSystem.Status"
|
||||
BOOT_Property="OperatingSystemState"
|
||||
|
||||
LED_SERVICE_NAME="xyz.openbmc_project.LED.GroupManager"
|
||||
LED_INACTIVE_OBJPATH="/xyz/openbmc_project/led/groups/boot_status_inactive"
|
||||
LED_STANDBY_OBJPATH="/xyz/openbmc_project/led/groups/boot_status_standby"
|
||||
LED_INTERFACE_NAME="xyz.openbmc_project.Led.Group"
|
||||
LED_Property="Asserted"
|
||||
|
||||
boot_status=""
|
||||
led_status=""
|
||||
|
||||
while true; do
|
||||
boot_status="$(busctl get-property $BOOT_SERVICE_NAME $BOOT_STATUS_OBJPATH $BOOT_INTERFACE_NAME $BOOT_Property | awk '{print $2}')"
|
||||
|
||||
if [[ $boot_status != "\"xyz.openbmc_project.State.OperatingSystem.Status.OSStatus.Standby\"" ]] && [[ $led_status != "BLINKING" ]];then
|
||||
busctl set-property $LED_SERVICE_NAME $LED_INACTIVE_OBJPATH $LED_INTERFACE_NAME $LED_Property b true
|
||||
busctl set-property $LED_SERVICE_NAME $LED_STANDBY_OBJPATH $LED_INTERFACE_NAME $LED_Property b false
|
||||
led_status="BLINKING"
|
||||
elif [[ $boot_status == "\"xyz.openbmc_project.State.OperatingSystem.Status.OSStatus.Standby\"" ]] && [[ $led_status != "ON" ]];then
|
||||
busctl set-property $LED_SERVICE_NAME $LED_INACTIVE_OBJPATH $LED_INTERFACE_NAME $LED_Property b false
|
||||
busctl set-property $LED_SERVICE_NAME $LED_STANDBY_OBJPATH $LED_INTERFACE_NAME $LED_Property b true
|
||||
led_status="ON"
|
||||
fi
|
||||
|
||||
sleep 10
|
||||
|
||||
done
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,25 @@
|
||||
SUMMARY = "OpenBMC Mori Boot Status LED Service"
|
||||
DESCRIPTION = "OpenBMC Mori Boot Status LED Daemon."
|
||||
LICENSE = "Apache-2.0"
|
||||
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
|
||||
DEPENDS:append = " systemd"
|
||||
PR = "r1"
|
||||
|
||||
SRC_URI = " \
|
||||
file://boot-status-led.sh \
|
||||
file://boot-status-led.service \
|
||||
"
|
||||
|
||||
SYSTEMD_SERVICE:${PN} = "boot-status-led.service"
|
||||
|
||||
inherit systemd
|
||||
|
||||
do_install() {
|
||||
install -d ${D}${bindir}
|
||||
install -m 0755 ${WORKDIR}/boot-status-led.sh ${D}${bindir}/
|
||||
install -d ${D}${systemd_system_unitdir}
|
||||
install -m 0644 ${WORKDIR}/boot-status-led.service \
|
||||
${D}${systemd_system_unitdir}
|
||||
}
|
||||
|
||||
RDEPENDS:${PN}:append = " bash"
|
||||
@@ -0,0 +1,31 @@
|
||||
SUMMARY = "Phosphor OpenBMC Mori BIOS Firmware Upgrade Command"
|
||||
DESCRIPTION = "Phosphor OpenBMC Mori BIOS Firmware Upgrade Comman Daemon"
|
||||
LICENSE = "Apache-2.0"
|
||||
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
|
||||
DEPENDS:append = " systemd phosphor-ipmi-flash"
|
||||
PROVIDES:append = " virtual/bios-update"
|
||||
PR = "r1"
|
||||
|
||||
SRC_URI = " \
|
||||
file://phosphor-ipmi-flash-bios-update.service \
|
||||
file://config-bios.json \
|
||||
"
|
||||
|
||||
SYSTEMD_SERVICE:${PN} = "phosphor-ipmi-flash-bios-update.service"
|
||||
|
||||
inherit systemd obmc-phosphor-systemd
|
||||
|
||||
do_install () {
|
||||
install -d ${D}${datadir}/phosphor-ipmi-flash
|
||||
install -m 0644 ${WORKDIR}/config-bios.json \
|
||||
${D}${datadir}/phosphor-ipmi-flash
|
||||
install -d ${D}${systemd_system_unitdir}
|
||||
install -m 0644 ${WORKDIR}/phosphor-ipmi-flash-bios-update.service \
|
||||
${D}${systemd_system_unitdir}
|
||||
}
|
||||
|
||||
RDEPENDS:${PN}:append = " libsystemd mori-fw"
|
||||
|
||||
RPROVIDES:${PN}:append = " virtual/bios-update"
|
||||
|
||||
FILES:${PN}:append = " ${datadir}/phosphor-ipmi-flash/config-bios.json"
|
||||
@@ -0,0 +1,19 @@
|
||||
[{
|
||||
"blob": "/flash/bios",
|
||||
"handler": {
|
||||
"type": "file",
|
||||
"path": "/run/initramfs/bios-image"
|
||||
},
|
||||
"actions": {
|
||||
"preparation": {
|
||||
"type": "skip"
|
||||
},
|
||||
"verification": {
|
||||
"type": "skip"
|
||||
},
|
||||
"update": {
|
||||
"type": "systemd",
|
||||
"unit": "phosphor-ipmi-flash-bios-update.service"
|
||||
}
|
||||
}
|
||||
}]
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
[Unit]
|
||||
Description=Phosphor-ipmi-flash update BIOS firmware service
|
||||
|
||||
[Service]
|
||||
ExecStart=mori-fw.sh bios /run/initramfs/bios-image
|
||||
Type=oneshot
|
||||
@@ -0,0 +1,21 @@
|
||||
SUMMARY = "Phosphor OpenBMC Mori BMC Firmware Upgrade Command"
|
||||
DESCRIPTION = "Phosphor OpenBMC Mori BMC Firmware Upgrade Comman Daemon"
|
||||
LICENSE = "Apache-2.0"
|
||||
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
|
||||
DEPENDS:append = " phosphor-ipmi-flash"
|
||||
PROVIDES:append = " virtual/bmc-update"
|
||||
PR = "r1"
|
||||
|
||||
SRC_URI = "file://config-bmc.json"
|
||||
|
||||
do_install () {
|
||||
install -d ${D}${datadir}/phosphor-ipmi-flash
|
||||
install -m 0644 ${WORKDIR}/config-bmc.json \
|
||||
${D}${datadir}/phosphor-ipmi-flash
|
||||
}
|
||||
|
||||
RDEPENDS:${PN}:append = " mori-fw"
|
||||
|
||||
RPROVIDES:${PN}:append = " virtual/bmc-update"
|
||||
|
||||
FILES:${PN}:append = " ${datadir}/phosphor-ipmi-flash/config-bmc.json"
|
||||
@@ -0,0 +1,20 @@
|
||||
[{
|
||||
"blob": "/flash/image",
|
||||
"handler": {
|
||||
"type": "file",
|
||||
"path": "/run/initramfs/image-bmc"
|
||||
},
|
||||
"actions": {
|
||||
"preparation": {
|
||||
"type": "skip"
|
||||
},
|
||||
"verification": {
|
||||
"type": "skip"
|
||||
},
|
||||
"update": {
|
||||
"type": "systemd",
|
||||
"unit": "reboot.target",
|
||||
"mode": "replace-irreversibly"
|
||||
}
|
||||
}
|
||||
}]
|
||||
@@ -0,0 +1,43 @@
|
||||
SUMMARY = "Phosphor OpenBMC Mori CPLD Firmware Upgrade Command"
|
||||
DESCRIPTION = "Phosphor OpenBMC Mori CPLD Firmware Upgrade Comman Daemon"
|
||||
LICENSE = "Apache-2.0"
|
||||
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
|
||||
DEPENDS:append = " systemd phosphor-ipmi-flash"
|
||||
PROVIDES:append = " virtual/cpld-update"
|
||||
PR = "r1"
|
||||
|
||||
SRC_URI = " \
|
||||
file://phosphor-ipmi-flash-bmccpld-update.service \
|
||||
file://phosphor-ipmi-flash-mbcpld-update.service \
|
||||
file://config-bmccpld.json \
|
||||
file://config-mbcpld.json \
|
||||
"
|
||||
|
||||
SYSTEMD_SERVICE:${PN} = " \
|
||||
phosphor-ipmi-flash-bmccpld-update.service \
|
||||
phosphor-ipmi-flash-mbcpld-update.service \
|
||||
"
|
||||
|
||||
inherit systemd obmc-phosphor-systemd
|
||||
|
||||
do_install () {
|
||||
install -d ${D}${datadir}/phosphor-ipmi-flash
|
||||
install -m 0644 ${WORKDIR}/config-bmccpld.json \
|
||||
${D}${datadir}/phosphor-ipmi-flash
|
||||
install -m 0644 ${WORKDIR}/config-mbcpld.json \
|
||||
${D}${datadir}/phosphor-ipmi-flash
|
||||
install -d ${D}${systemd_system_unitdir}
|
||||
install -m 0644 ${WORKDIR}/phosphor-ipmi-flash-bmccpld-update.service \
|
||||
${D}${systemd_system_unitdir}
|
||||
install -m 0644 ${WORKDIR}/phosphor-ipmi-flash-mbcpld-update.service \
|
||||
${D}${systemd_system_unitdir}
|
||||
}
|
||||
|
||||
RDEPENDS:${PN}:append = " libsystemd mori-fw"
|
||||
|
||||
RPROVIDES:${PN}:append = " virtual/cpld-update"
|
||||
|
||||
FILES:${PN}:append = " \
|
||||
${datadir}/phosphor-ipmi-flash/config-bmccpld.json \
|
||||
${datadir}/phosphor-ipmi-flash/config-mbcpld.json \
|
||||
"
|
||||
@@ -0,0 +1,19 @@
|
||||
[{
|
||||
"blob": "/flash/bmccpld",
|
||||
"handler": {
|
||||
"type": "file",
|
||||
"path": "/run/initramfs/bmc-cpld.svf"
|
||||
},
|
||||
"actions": {
|
||||
"preparation": {
|
||||
"type": "skip"
|
||||
},
|
||||
"verification": {
|
||||
"type": "skip"
|
||||
},
|
||||
"update": {
|
||||
"type": "systemd",
|
||||
"unit": "phosphor-ipmi-flash-bmccpld-update.service"
|
||||
}
|
||||
}
|
||||
}]
|
||||
@@ -0,0 +1,20 @@
|
||||
[{
|
||||
"blob": "/flash/mbcpld",
|
||||
"handler": {
|
||||
"type": "file",
|
||||
"path": "/run/initramfs/mb-cpld.svf"
|
||||
},
|
||||
"actions": {
|
||||
"preparation": {
|
||||
"type": "skip"
|
||||
},
|
||||
"verification": {
|
||||
"type": "skip"
|
||||
},
|
||||
"update": {
|
||||
"type": "systemd",
|
||||
"unit": "phosphor-ipmi-flash-mbcpld-update.service"
|
||||
}
|
||||
}
|
||||
}]
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Phosphor-ipmi-flash update BMC CPLD firmware service
|
||||
|
||||
[Service]
|
||||
ExecStart=mori-fw.sh bmccpld /run/initramfs/bmc-cpld.svf
|
||||
Type=oneshot
|
||||
|
||||
[Install]
|
||||
WantedBy=phosphor-ipmi-flash-bmccpld-update.target
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
[Unit]
|
||||
Description=Phosphor-ipmi-flash update MB CPLD firmware service
|
||||
|
||||
[Service]
|
||||
ExecStart=mori-fw.sh mbcpld /run/initramfs/mb-cpld.svf
|
||||
Type=oneshot
|
||||
|
||||
[Install]
|
||||
WantedBy=phosphor-ipmi-flash-mbcpld-update.target
|
||||
@@ -0,0 +1,30 @@
|
||||
SUMMARY = "Phosphor OpenBMC mori Firmware Upgrade Command"
|
||||
DESCRIPTION = "Phosphor OpenBMC mori Firmware Upgrade Comman Daemon"
|
||||
LICENSE = "Apache-2.0"
|
||||
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
|
||||
DEPENDS:append = " systemd phosphor-ipmi-flash"
|
||||
PR = "r1"
|
||||
|
||||
SRC_URI = " \
|
||||
file://mori-fw.sh \
|
||||
file://mori-fw-ver.service \
|
||||
file://mori-fw-ver.sh \
|
||||
file://mori-lib.sh \
|
||||
"
|
||||
|
||||
SYSTEMD_SERVICE:${PN} = "mori-fw-ver.service"
|
||||
|
||||
inherit systemd obmc-phosphor-systemd
|
||||
|
||||
do_install () {
|
||||
install -d ${D}${sbindir}
|
||||
install -d ${D}${libexecdir}/${PN}
|
||||
install -m 0755 ${WORKDIR}/mori-fw.sh ${D}${sbindir}/mori-fw.sh
|
||||
install -m 0755 ${WORKDIR}/mori-fw-ver.sh \
|
||||
${D}${libexecdir}/${PN}/mori-fw-ver.sh
|
||||
install -m 0755 ${WORKDIR}/mori-lib.sh ${D}${libexecdir}/${PN}/mori-lib.sh
|
||||
install -d ${D}${systemd_system_unitdir}
|
||||
install -m 0644 ${WORKDIR}/mori-fw-ver.service ${D}${systemd_system_unitdir}
|
||||
}
|
||||
|
||||
RDEPENDS:${PN}:append = " libsystemd bash"
|
||||
@@ -0,0 +1,12 @@
|
||||
[Unit]
|
||||
Description=Firmware Version Daemon
|
||||
Wants=host-powerctrl.service
|
||||
After=host-powerctrl.service
|
||||
|
||||
[Service]
|
||||
RemainAfterExit=yes
|
||||
Type=oneshot
|
||||
ExecStart=/usr/libexec/mori-fw/mori-fw-ver.sh
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Disable check for splitting
|
||||
# shellcheck disable=SC2207
|
||||
# Provide source directive to shellcheck.
|
||||
# shellcheck source=meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-fw/mori-lib.sh
|
||||
source /usr/libexec/mori-fw/mori-lib.sh
|
||||
|
||||
BMC_CPLD_VER_FILE="/run/cpld0.version"
|
||||
MB_CPLD_VER_FILE="/run/cpld1.version"
|
||||
ver=''
|
||||
|
||||
function fw_rev() {
|
||||
case $1 in
|
||||
cpldb)
|
||||
rsp=($(i2cget -y -f -a "${I2C_BMC_CPLD[0]}" 0x"${I2C_BMC_CPLD[1]}" 0x00 i 5))
|
||||
ver=$(printf '%d.%d.%d.%d' "${rsp[4]}" "${rsp[3]}" "${rsp[2]}" "${rsp[1]}")
|
||||
;;
|
||||
cpldm)
|
||||
rsp=($(i2cget -y -f -a "${I2C_MB_CPLD[0]}" 0x"${I2C_MB_CPLD[1]}" 0x00 i 5))
|
||||
ver=$(printf '%d.%d.%d.%d' "${rsp[4]}" "${rsp[3]}" "${rsp[2]}" "${rsp[1]}")
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
fw_rev cpldb
|
||||
echo "BMC CPLD version : ${ver}"
|
||||
echo "${ver}" > "${BMC_CPLD_VER_FILE}"
|
||||
fw_rev cpldm
|
||||
echo "MB CPLD version : ${ver}"
|
||||
echo "${ver}" > "${MB_CPLD_VER_FILE}"
|
||||
@@ -0,0 +1,184 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Provide source directive to shellcheck.
|
||||
# shellcheck source=meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-fw/mori-lib.sh
|
||||
# Disable check for globbing and word splitting within double quotes
|
||||
# shellcheck disable=SC2086
|
||||
source /usr/libexec/mori-fw/mori-lib.sh
|
||||
|
||||
function fwbios() {
|
||||
ret=0
|
||||
if [ ! -f "$1" ]; then
|
||||
echo " Cannot find the" "$1" "image file"
|
||||
return 1
|
||||
fi
|
||||
|
||||
setup_bios_access
|
||||
|
||||
# write to the mtd device
|
||||
BIOS_MTD=$(grep "hnor" /proc/mtd | sed -n 's/^\(.*\):.*/\1/p')
|
||||
{
|
||||
flock -x 200
|
||||
echo "Flashing BIOS @/dev/${BIOS_MTD}"
|
||||
if ! flashcp -v $1 /dev/${BIOS_MTD} ; then
|
||||
echo "Flashing the bios failed " >&2
|
||||
ret=1
|
||||
fi
|
||||
} 200>$RST_LOCK_FILE
|
||||
|
||||
cleanup_bios_access
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
||||
function fwbmccpld() {
|
||||
ret=0
|
||||
if [ ! -s "$1" ]; then
|
||||
echo "Image file" "$1" "is empty or nonexistent, BMC CPLD update failed"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# MB_JTAG_MUX 0:CPU 1:MB
|
||||
# BMC_JTAG_MUX 0:GF/MB 1:BMC
|
||||
set_gpio_ctrl MB_JTAG_MUX_SEL 0
|
||||
set_gpio_ctrl BMC_JTAG_MUX_SEL 1
|
||||
|
||||
{
|
||||
flock -x 200
|
||||
# 1st condition checks if the svf file is valid
|
||||
# 2nd condition checks flashing logs for flash errors
|
||||
if ! mesg=$(loadsvf -d /dev/jtag0 -s $1 -m 0 2>&1) \
|
||||
|| echo "$mesg" | grep -i -e error -e fail ; then
|
||||
echo "$mesg" | grep -i -e error -e fail
|
||||
echo "BMC CPLD update failed"
|
||||
ret=1
|
||||
else
|
||||
echo "BMC CPLD update successful"
|
||||
fi
|
||||
} 200>$RST_LOCK_FILE
|
||||
return $ret
|
||||
}
|
||||
|
||||
function fwmbcpld() {
|
||||
ret=0
|
||||
if [ ! -s "$1" ]; then
|
||||
echo "Image file" "$1" "is empty or nonexistent, MB CPLD update failed"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# MB_JTAG_MUX 0:CPU 1:MB
|
||||
# BMC_JTAG_MUX 0:GF/MB 1:BMC
|
||||
set_gpio_ctrl MB_JTAG_MUX_SEL 1
|
||||
set_gpio_ctrl BMC_JTAG_MUX_SEL 0
|
||||
|
||||
{
|
||||
flock -x 200
|
||||
# 1st condition checks if the svf file is valid
|
||||
# 2nd condition checks flashing logs for flash errors
|
||||
if ! mesg=$(loadsvf -d /dev/jtag0 -s $1 -m 0 2>&1) \
|
||||
|| echo "$mesg" | grep -i -e error -e fail ; then
|
||||
echo "MB CPLD update failed"
|
||||
ret=1
|
||||
else
|
||||
echo "MB CPLD update successful"
|
||||
fi
|
||||
} 200>$RST_LOCK_FILE
|
||||
set_gpio_ctrl MB_JTAG_MUX_SEL 0
|
||||
echo "MB CPLD update successful"
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
||||
function fwbootstrap() {
|
||||
# to flash the CPU EEPROM
|
||||
#unbind bootstrap EEPROM
|
||||
echo ${I2C_CPU_EEPROM[0]}-00${I2C_CPU_EEPROM[1]} > /sys/bus/i2c/drivers/at24/unbind
|
||||
|
||||
#switch access to BMC
|
||||
set_gpio_ctrl CPU_EEPROM_SEL 0
|
||||
|
||||
if [ "$(bootstrap_flash -b ${I2C_CPU_EEPROM[0]} -s 0x${I2C_CPU_EEPROM[1]} -p -f $1)" -ne 0 ]; then
|
||||
echo "CPU bootstrap EEPROM update failed" >&2
|
||||
return 1
|
||||
fi
|
||||
wait
|
||||
|
||||
#bind bootstrap EEPROM
|
||||
echo ${I2C_CPU_EEPROM[0]}-00${I2C_CPU_EEPROM[1]} > /sys/bus/i2c/drivers/at24/bind
|
||||
|
||||
#switch back access to CPU
|
||||
set_gpio_ctrl CPU_EEPROM_SEL 1
|
||||
return 0
|
||||
|
||||
}
|
||||
|
||||
function fwmb_pwr_seq(){
|
||||
#$1 PS seq config file
|
||||
ret=0
|
||||
if [[ ! -e "$1" ]]; then
|
||||
echo "The file $1 does not exist"
|
||||
return 1
|
||||
fi
|
||||
echo "${I2C_MB_PWRSEQ[0]}"-00"${I2C_MB_PWRSEQ[1]}" > /sys/bus/i2c/drivers/adm1266/unbind
|
||||
{
|
||||
flock -x 200
|
||||
#Parameters passed to adm1266_fw_fx to be used to flash PS
|
||||
#1st I2C bus number of PS's
|
||||
#2nd PS seq config file
|
||||
if [ "$(mb_power_sequencer_flash ${I2C_MB_PWRSEQ[0]} $1)" -ne 0 ]; then
|
||||
|
||||
echo "The power seq flash failed" >&2
|
||||
ret=1
|
||||
else
|
||||
echo "${I2C_MB_PWRSEQ[0]}"-00"${I2C_MB_PWRSEQ[1]}" > /sys/bus/i2c/drivers/adm1266/bind
|
||||
fi
|
||||
} 200>$RST_LOCK_FILE
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
||||
if [[ ! $(which flashcp) ]]; then
|
||||
echo "flashcp utility not installed"
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! $(which loadsvf) ]]; then
|
||||
echo "loadsvf utility not installed"
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! $(which mb_power_sequencer_flash) ]]; then
|
||||
echo "mb_power_sequencer_flash utility not installed"
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! $(which bootstrap_flash) ]]; then
|
||||
echo "bootstrap_flash utility not installed"
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -e /dev/jtag0 ]]; then
|
||||
echo "Jtag device driver not functional"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
bios)
|
||||
fwbios "$2"
|
||||
;;
|
||||
bmccpld)
|
||||
fwbmccpld "$2"
|
||||
;;
|
||||
mbcpld)
|
||||
fwmbcpld "$2"
|
||||
;;
|
||||
bootstrap)
|
||||
fwbootstrap "$2"
|
||||
;;
|
||||
mbseq)
|
||||
fwmb_pwr_seq "$2"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
ret=$?
|
||||
|
||||
rm -f "$2"
|
||||
|
||||
exit $ret
|
||||
@@ -0,0 +1,139 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Disable check for usage of the definitions within mori-lib.sh
|
||||
#shellcheck disable=SC2034
|
||||
|
||||
# get_gpio_num
|
||||
# Dynamically obtains GPIO number from chip base and I2C expanders
|
||||
# line-name
|
||||
function get_gpio_num() {
|
||||
#shellcheck disable=SC2207
|
||||
CHIP_PIN=($(gpiofind "$1" | awk '{print substr ($1, 9 ), $2 }'))
|
||||
#shellcheck disable=SC2128
|
||||
if [ -z "$CHIP_PIN" ]; then
|
||||
echo "Could not find GPIO with name: $1"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ "${CHIP_PIN[0]}" -gt 7 ]; then
|
||||
BUS_ADDR=$(gpiodetect | grep gpiochip"${CHIP_PIN[0]}" | \
|
||||
grep -o '\[.*]' | tr -d ' \[\]')
|
||||
GPIO_BASE_DIR=$(cd /sys/bus/i2c/devices/"$BUS_ADDR"/gpio/ || \
|
||||
exit; ls -1 -v)
|
||||
# Check that there is a single gpiobank per i2c device
|
||||
GPIO_BANKS=$(cd /sys/bus/i2c/devices/"$BUS_ADDR"/ || \
|
||||
exit ; ls -1 -d -v gpiochip*)
|
||||
# Determine which GPIO_BASE to use based on the place of the GPIO_BANK
|
||||
# in comparision to GPIO_BANKS
|
||||
# gpiochip# is set in reverse order of numbering for location of
|
||||
# GPIO_BASE_DIR
|
||||
count=$(echo "$GPIO_BANKS" | wc -w)
|
||||
for X in ${GPIO_BANKS}
|
||||
do
|
||||
if [[ $(gpiofind "$1" | cut -d " " -f 1) == "$X" ]]; then
|
||||
# Used to select the correct GPIO_BASE value
|
||||
#shellcheck disable=SC2086
|
||||
GPIO_BASE_DIR=("$(echo ${GPIO_BASE_DIR} | cut -d " " -f $count)")
|
||||
break
|
||||
fi
|
||||
count=$((count-1))
|
||||
done
|
||||
tmp="/sys/bus/i2c/devices/$BUS_ADDR/gpio/${GPIO_BASE_DIR[0]}/base"
|
||||
GPIO_BASE=$(cat "$tmp")
|
||||
echo "$((GPIO_BASE+CHIP_PIN[1]))"
|
||||
else
|
||||
echo "$((CHIP_PIN[0]*32+CHIP_PIN[1]))"
|
||||
fi
|
||||
}
|
||||
|
||||
# set_gpio_ctrl
|
||||
# line-name, high(1)/low(0)
|
||||
function set_gpio_ctrl() {
|
||||
#shellcheck disable=SC2046
|
||||
gpioset $(gpiofind "$1")="$2"
|
||||
}
|
||||
|
||||
# get_gpio_ctrl
|
||||
# line-name
|
||||
function get_gpio_ctrl() {
|
||||
GPIO_NUM=$(get_gpio_num "$1")
|
||||
echo "$GPIO_NUM" > /sys/class/gpio/export
|
||||
# GPIOs added by drivers use different path for value most but not all
|
||||
# drivers follow this trend
|
||||
# Try reading like traditional GPIO, if fails, try reading in driver format
|
||||
if ! cat /sys/class/gpio/gpio"$GPIO_NUM"/value 2> /dev/null ; then
|
||||
cat /sys/class/gpio/"$1"/value
|
||||
fi
|
||||
echo "$GPIO_NUM" > /sys/class/gpio/unexport
|
||||
}
|
||||
|
||||
|
||||
function Does_File_Exist() {
|
||||
local FILE=$1
|
||||
|
||||
if [[ ! -f "${FILE}" ]]; then
|
||||
echo "${FILE} file does not exist" >&2
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function cleanup_bios_access() {
|
||||
# Run only if setup_bios_access was previously ran
|
||||
if Does_File_Exist /run/bios_access &> /dev/null ; then
|
||||
# switch the SPI mux from BMC to Host
|
||||
if [ -d "${KERNEL_SYSFS_FIU}/${KERNEL_FIU_ID}" ]; then
|
||||
echo "${KERNEL_FIU_ID}" > "${KERNEL_SYSFS_FIU}"/unbind
|
||||
fi
|
||||
set_gpio_ctrl FM_BIOS_FLASH_SPI_MUX_R_SEL 0
|
||||
|
||||
# Indicate to host that BMC is finished accessing SPI
|
||||
set_gpio_ctrl S0_BMC_SPI_NOR_ACCESS 0
|
||||
|
||||
rm /run/bios_access
|
||||
fi
|
||||
}
|
||||
|
||||
function setup_bios_access() {
|
||||
# Run only if setup_bios_access was not previously ran without cleanup
|
||||
if ! Does_File_Exist /run/bios_access &> /dev/null ; then
|
||||
echo "BMC is accessing BIOS" > /run/bios_access
|
||||
|
||||
# rescan the spi bus
|
||||
if [ -d "${KERNEL_SYSFS_FIU}/${KERNEL_FIU_ID}" ]; then
|
||||
echo "${KERNEL_FIU_ID}" > "${KERNEL_SYSFS_FIU}"/unbind
|
||||
usleep 100
|
||||
fi
|
||||
|
||||
# Wait until the host is finished accessing the SPI
|
||||
while [[ $(get_gpio_ctrl S0_SOC_SPI_NOR_ACCESS) == 1 ]]
|
||||
do
|
||||
sleep 1
|
||||
done
|
||||
# Indicate to host that BMC is accessing SPI
|
||||
set_gpio_ctrl S0_BMC_SPI_NOR_ACCESS 1
|
||||
|
||||
# switch the SPI mux from Host to BMC
|
||||
set_gpio_ctrl FM_BIOS_FLASH_SPI_MUX_R_SEL 1
|
||||
|
||||
echo "${KERNEL_FIU_ID}" > "${KERNEL_SYSFS_FIU}"/bind
|
||||
fi
|
||||
}
|
||||
|
||||
# Start definitions
|
||||
|
||||
# I2C Definitions
|
||||
# The array is (<bus> <address>), where address is in hexadecimal.
|
||||
I2C_BMC_CPLD=(13 76)
|
||||
I2C_MB_CPLD=(0 76)
|
||||
I2C_FANCTRL=(35 2c)
|
||||
I2C_BMC_PWRSEQ=(48 59)
|
||||
I2C_MB_PWRSEQ=(40 40)
|
||||
I2C_CPU_EEPROM=(19 50)
|
||||
|
||||
# File Path Definition
|
||||
# File path used to prevent hotswapping
|
||||
RST_LOCK_FILE="/etc/FW_FLASH_ONGOING"
|
||||
|
||||
# Device name and driver path used for BIOS SPI
|
||||
KERNEL_FIU_ID="c0000000.spi"
|
||||
KERNEL_SYSFS_FIU="/sys/bus/platform/drivers/NPCM-FIU"
|
||||
@@ -0,0 +1,25 @@
|
||||
SUMMARY = "Phosphor OpenBMC Mori System Power Control Service"
|
||||
DESCRIPTION = "Phosphor OpenBMC Mori System Power Control Daemon"
|
||||
LICENSE = "Apache-2.0"
|
||||
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
|
||||
DEPENDS:append = " systemd"
|
||||
PR = "r1"
|
||||
|
||||
SRC_URI = " \
|
||||
file://init_once.sh \
|
||||
file://host-powerctrl.service \
|
||||
"
|
||||
|
||||
SYSTEMD_SERVICE:${PN} = "host-powerctrl.service"
|
||||
|
||||
inherit systemd obmc-phosphor-systemd
|
||||
|
||||
do_install () {
|
||||
install -d ${D}${libexecdir}/${PN}
|
||||
install -m 0755 ${WORKDIR}/init_once.sh ${D}${libexecdir}/${PN}
|
||||
install -d ${D}${systemd_unitdir}/system/
|
||||
install -m 0644 ${WORKDIR}/host-powerctrl.service \
|
||||
${D}${systemd_unitdir}/system
|
||||
}
|
||||
|
||||
RDEPENDS:${PN}:append = " libsystemd bash"
|
||||
@@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description = Host Power Control Sequence
|
||||
Wants=ssifbridge.service
|
||||
After=ssifbridge.service
|
||||
|
||||
[Service]
|
||||
Restart=no
|
||||
RemainAfterExit=true
|
||||
Type=oneshot
|
||||
ExecStart=/usr/libexec/mori-boot/init_once.sh
|
||||
StandardOutput=syslog
|
||||
|
||||
[Install]
|
||||
WantedBy=sysinit.target
|
||||
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Provide source directive to shellcheck.
|
||||
# shellcheck source=meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-fw/mori-lib.sh
|
||||
source /usr/libexec/mori-fw/mori-lib.sh
|
||||
|
||||
function set_mux_default(){
|
||||
# set all mux route to CPU before power on host
|
||||
# BMC_CPU_DDR_I2C_SEL
|
||||
set_gpio_ctrl CPU_DDR_SEL 1
|
||||
# BMC_CPU_EEPROM_I2C_SEL
|
||||
set_gpio_ctrl CPU_EEPROM_SEL 1
|
||||
# BMC_CPU_PMBUS_SEL
|
||||
set_gpio_ctrl CPU_VRD_SEL 1
|
||||
}
|
||||
|
||||
set_mux_default
|
||||
|
||||
sleep 5
|
||||
set_gpio_ctrl S0_BMC_OK 1
|
||||
|
||||
# Create /run/openbmc for system power files
|
||||
if [[ ! -d "/run/openbmc" ]]; then
|
||||
mkdir "/run/openbmc"
|
||||
fi
|
||||
|
||||
echo "BMC initialization complete"
|
||||
@@ -0,0 +1,14 @@
|
||||
SUMMARY = "Phosphor OpenBMC Mori System Command"
|
||||
DESCRIPTION = "Phosphor OpenBMC Mori System Command Daemon"
|
||||
LICENSE = "Apache-2.0"
|
||||
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
|
||||
PR = "r1"
|
||||
|
||||
SRC_URI = "file://mori.sh"
|
||||
|
||||
do_install () {
|
||||
install -d ${D}${sbindir}
|
||||
install -m 0755 ${WORKDIR}/mori.sh ${D}${sbindir}/mori.sh
|
||||
}
|
||||
|
||||
RDEPENDS:${PN}:append = " bash"
|
||||
@@ -0,0 +1,333 @@
|
||||
#!/bin/bash
|
||||
# help information
|
||||
|
||||
# Provide source directive to shellcheck.
|
||||
# shellcheck source=meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-fw/mori-lib.sh
|
||||
source /usr/libexec/mori-fw/mori-lib.sh
|
||||
|
||||
function usage_rst() {
|
||||
echo " mori rst [parameter]"
|
||||
echo " system --> reset the host"
|
||||
echo " btn --> trigger a power button event"
|
||||
echo " shutdown --> send out shutdown signal to CPU"
|
||||
echo " display --> "
|
||||
}
|
||||
|
||||
function usage_led() {
|
||||
echo " mori led 'attn'/'boot' [parameter]"
|
||||
echo " on --> turn led on"
|
||||
echo " off --> turn led off"
|
||||
echo " toggle --> toggle led"
|
||||
echo " status --> get status of led"
|
||||
}
|
||||
|
||||
function usage_uart() {
|
||||
echo " mori uart [parameter]"
|
||||
echo " host --> show CPU console"
|
||||
echo " mpro --> show Mpro console"
|
||||
echo " swhost --> change to CPU console to ttyS1"
|
||||
echo " swmpro --> change to CPU 0 Mpro console to ttyS3"
|
||||
echo " swhosthr --> change CPU console to header"
|
||||
echo " swmprohr --> change Mpro console to header"
|
||||
echo " display --> "
|
||||
}
|
||||
|
||||
function usage_rtc() {
|
||||
echo " mori rtc [parameter]"
|
||||
echo " lock --> disable host access to rtc"
|
||||
echo " unlock --> enable host access to rtc"
|
||||
echo " status --> get status of host accessibility to rtc"
|
||||
}
|
||||
|
||||
function usage_gpio() {
|
||||
echo " mori gpio [parameter]"
|
||||
echo " get [GPIO_LINE_NAME] --> get the gpio value of GPIO_LINE_NAME"
|
||||
echo " set [GPIO_LINE_NAME] [GPIO_VALUE] --> set the gpio of GPIO_LINE_NAME to the value of GPIO_VALUE"
|
||||
}
|
||||
|
||||
function usage() {
|
||||
echo " mori BMC console system utilities"
|
||||
echo " mori [optional] [parameter]"
|
||||
echo " rst --> reset target device"
|
||||
echo " fw --> get version"
|
||||
echo " uart --> control the uart mux"
|
||||
echo " led --> control the leds"
|
||||
echo " rtc --> control host access to rtc"
|
||||
echo " gpio --> control the gpios"
|
||||
}
|
||||
|
||||
function reset() {
|
||||
case $1 in
|
||||
system)
|
||||
# S0 system reset
|
||||
echo "System has been reset, host will start booting in a few minutes"
|
||||
ipmitool chassis power reset
|
||||
;;
|
||||
btn)
|
||||
# virtual power button on
|
||||
set_gpio_ctrl POWER_OUT 0
|
||||
sleep 1
|
||||
set_gpio_ctrl POWER_OUT 1
|
||||
;;
|
||||
shutdown)
|
||||
# request host shutdown
|
||||
set_gpio_ctrl S0_SHD_REQ 0
|
||||
sleep 3
|
||||
set_gpio_ctrl S0_SHD_REQ 1
|
||||
;;
|
||||
forceOff)
|
||||
# virtual power button off
|
||||
set_gpio_ctrl POWER_OUT 0
|
||||
sleep 6
|
||||
set_gpio_ctrl POWER_OUT 1
|
||||
;;
|
||||
display)
|
||||
echo "Virtual AC Reset: GPIO$(get_gpio_num HOTSWAP)" "State:$(get_gpio_ctrl HOTSWAP)"
|
||||
echo "Virtual Power Button: GPIO$(get_gpio_num POWER_OUT)" "State:$(get_gpio_ctrl POWER_OUT)"
|
||||
echo "S0 System Reset: GPIO$(get_gpio_num S0_SYSRESET)" "State:$(get_gpio_ctrl S0_SYSRESET)"
|
||||
echo "S0 Shutdown Request: GPIO$(get_gpio_num S0_SHD_REQ)" "State:$(get_gpio_ctrl S0_SHD_REQ)"
|
||||
;;
|
||||
*)
|
||||
usage_rst
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function fw_rev() {
|
||||
BMC_CPLD_VER_FILE="/run/cpld0.version"
|
||||
MB_CPLD_VER_FILE="/run/cpld1.version"
|
||||
|
||||
cmd=$(cat ${BMC_CPLD_VER_FILE})
|
||||
echo " BMC_CPLD: " "${cmd}"
|
||||
cmd=$(cat ${MB_CPLD_VER_FILE})
|
||||
echo " MB_CPLD: " "${cmd}"
|
||||
|
||||
# BMC Version
|
||||
|
||||
# Save VERSION_ID line in string "VERSION_ID=*-Major.Submajor.Minor.Subminor" and
|
||||
# extract the substring after - sign "Major.Submajor.Minor.Subminor"
|
||||
BMCVersion=$(awk '/VERSION_ID/' /etc/os-release | sed "s/.*-//g")
|
||||
# BMCVersion="Major.Submajor.Minor"
|
||||
echo " BMC: ${BMCVersion%.*}"
|
||||
|
||||
#BMC PWR Sequencer
|
||||
i2cset -y -f -a "${I2C_BMC_PWRSEQ[0]}" 0x"${I2C_BMC_PWRSEQ[1]}" 0xfe 0x0000 w
|
||||
cmd=$(i2cget -y -f -a "${I2C_BMC_PWRSEQ[0]}" 0x"${I2C_BMC_PWRSEQ[1]}" 0xfe i 2 | awk '{print substr($0,3)}')
|
||||
echo " BMC PowerSequencer : ${cmd}"
|
||||
#only display with smbios exists
|
||||
if [[ -e /var/lib/smbios/smbios2 ]]; then
|
||||
cmd=$(busctl get-property xyz.openbmc_project.Smbios.MDR_V2 \
|
||||
/xyz/openbmc_project/inventory/system/chassis/motherboard/bios\
|
||||
xyz.openbmc_project.Inventory.Decorator.Revision Version | awk '{print $2}')
|
||||
echo " Bios: $cmd"
|
||||
fi
|
||||
|
||||
if [[ ! $(which mb_power_sequencer_version) ]]; then
|
||||
echo "mb_power_sequencer_version utility not installed"
|
||||
return
|
||||
fi
|
||||
|
||||
mb_power_sequencer_version "${I2C_MB_PWRSEQ[0]}" | grep REVISION
|
||||
}
|
||||
|
||||
function uartmux() {
|
||||
case $1 in
|
||||
host)
|
||||
if [ "$(tty)" == "/dev/ttyS0" ]; then
|
||||
echo "Couldn't redirect to the host console within BMC local console"
|
||||
else
|
||||
echo "Entering Console use 'shift ~~..' to quit"
|
||||
obmc-console-client -c /etc/obmc-console/server.ttyS1.conf
|
||||
fi
|
||||
;;
|
||||
mpro)
|
||||
if [ "$(tty)" == "/dev/ttyS0" ]; then
|
||||
echo "Couldn't redirect to the Mpro console within BMC local console"
|
||||
else
|
||||
echo "Entering Console use 'shift ~~..' to quit"
|
||||
obmc-console-client -c /etc/obmc-console/server.ttyS3.conf
|
||||
fi
|
||||
;;
|
||||
swhost)
|
||||
set_gpio_ctrl S0_UART0_BMC_SEL 1
|
||||
;;
|
||||
swmpro)
|
||||
set_gpio_ctrl S0_UART1_BMC_SEL 1
|
||||
;;
|
||||
swhosthr)
|
||||
set_gpio_ctrl S0_UART0_BMC_SEL 0
|
||||
;;
|
||||
swmprohr)
|
||||
set_gpio_ctrl S0_UART1_BMC_SEL 0
|
||||
;;
|
||||
display)
|
||||
if [ "$(get_gpio_ctrl S0_UART0_BMC_SEL)" -eq 1 ]; then
|
||||
echo " CPU host to BMC console"
|
||||
else
|
||||
echo " CPU host to header"
|
||||
fi
|
||||
|
||||
if [ "$(get_gpio_ctrl S0_UART1_BMC_SEL)" -eq 1 ]; then
|
||||
echo " Mpro host to BMC console"
|
||||
else
|
||||
echo " Mpro host to header"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
usage_uart
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function ledtoggle() {
|
||||
case $1 in
|
||||
boot)
|
||||
cmd=$(get_gpio_ctrl SYS_BOOT_STATUS_LED)
|
||||
case $2 in
|
||||
on)
|
||||
#turn on LED
|
||||
set_gpio_ctrl SYS_BOOT_STATUS_LED 1
|
||||
;;
|
||||
off)
|
||||
#turn off LED
|
||||
set_gpio_ctrl SYS_BOOT_STATUS_LED 0
|
||||
;;
|
||||
toggle)
|
||||
#toggle off LED
|
||||
if [[ $cmd -eq 1 ]]; then
|
||||
set_gpio_ctrl SYS_BOOT_STATUS_LED 0
|
||||
fi
|
||||
|
||||
#toggle on LED
|
||||
if [[ $cmd -eq 0 ]]; then
|
||||
set_gpio_ctrl SYS_BOOT_STATUS_LED 1
|
||||
fi
|
||||
;;
|
||||
status)
|
||||
#displayLED status
|
||||
if [[ $cmd -eq 1 ]]; then
|
||||
echo "on"
|
||||
else
|
||||
echo "off"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
usage_led
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
attn)
|
||||
cmd=$(get_gpio_ctrl SYS_ERROR_LED)
|
||||
case $2 in
|
||||
on)
|
||||
#turn on LED
|
||||
set_gpio_ctrl SYS_ERROR_LED 1
|
||||
;;
|
||||
off)
|
||||
#turn off LED
|
||||
set_gpio_ctrl SYS_ERROR_LED 0
|
||||
;;
|
||||
toggle)
|
||||
#toggle off LED
|
||||
if [[ $cmd -eq 1 ]]; then
|
||||
set_gpio_ctrl SYS_ERROR_LED 0
|
||||
fi
|
||||
|
||||
#toggle on LED
|
||||
if [[ $cmd -eq 0 ]]; then
|
||||
set_gpio_ctrl SYS_ERROR_LED 1
|
||||
fi
|
||||
;;
|
||||
status)
|
||||
#displayLED status
|
||||
if [[ $cmd -eq 1 ]]; then
|
||||
echo "on"
|
||||
else
|
||||
echo "off"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
usage_led
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
usage_led
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function usblist() {
|
||||
for i in {5..9}
|
||||
do
|
||||
cmd=$(devmem 0xf083"${i}"154)
|
||||
printf "udc%d : 0xF083%d154-" "${i}" "${i}"
|
||||
echo "$cmd"
|
||||
done
|
||||
}
|
||||
|
||||
function rtcctrl() {
|
||||
case $1 in
|
||||
lock)
|
||||
# Disable host access to rtc
|
||||
set_gpio_ctrl S0_RTC_LOCK 1
|
||||
;;
|
||||
unlock)
|
||||
# Enable host access to rtc
|
||||
set_gpio_ctrl S0_RTC_LOCK 0
|
||||
;;
|
||||
status)
|
||||
cmd=$(get_gpio_ctrl S0_RTC_LOCK)
|
||||
if [[ $cmd -eq 1 ]]; then
|
||||
echo "locked"
|
||||
else
|
||||
echo "unlocked"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
usage_rtc
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
function gpioctrl() {
|
||||
case $1 in
|
||||
get)
|
||||
get_gpio_ctrl "$2"
|
||||
;;
|
||||
set)
|
||||
set_gpio_ctrl "$2" "$3"
|
||||
;;
|
||||
*)
|
||||
usage_gpio
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
case $1 in
|
||||
rst)
|
||||
reset "$2"
|
||||
;;
|
||||
fw)
|
||||
fw_rev
|
||||
;;
|
||||
uart)
|
||||
uartmux "$2"
|
||||
;;
|
||||
usb)
|
||||
usblist
|
||||
;;
|
||||
led)
|
||||
ledtoggle "$2" "$3"
|
||||
;;
|
||||
rtc)
|
||||
rtcctrl "$2"
|
||||
;;
|
||||
gpio)
|
||||
gpioctrl "$2" "$3" "$4"
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
[Unit]
|
||||
Description = UART Activation Sequence
|
||||
Before=host-powerctrl.service
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/libexec/obmc-console/mori_uart_mux_ctrl.sh
|
||||
Type=oneshot
|
||||
|
||||
[Install]
|
||||
RequiredBy=multi-user.target
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
# Provide source directive to shellcheck.
|
||||
# shellcheck source=meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-fw/mori-lib.sh
|
||||
source /usr/libexec/mori-fw/mori-lib.sh
|
||||
|
||||
set_gpio_ctrl S0_UART0_BMC_SEL 1
|
||||
set_gpio_ctrl S0_UART1_BMC_SEL 1
|
||||
echo "UART initialization complete"
|
||||
@@ -0,0 +1,17 @@
|
||||
[Unit]
|
||||
Description=Phosphor Console Muxer listening on device /dev/%I
|
||||
BindsTo=dev-%i.device
|
||||
After=dev-%i.device
|
||||
StartLimitBurst=3
|
||||
StartLimitIntervalSec=300
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/sbin/obmc-console-server --config /etc/obmc-console/server.%i.conf %i
|
||||
SyslogIdentifier=obmc-console-server
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
TimeoutStartSec=60
|
||||
TimeoutStopSec=60
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,3 @@
|
||||
baud = 115200
|
||||
logfile = /var/log/obmc-console-cpu.log
|
||||
logsize = 1M
|
||||
@@ -0,0 +1,4 @@
|
||||
baud = 115200
|
||||
console-id = ttyS3
|
||||
logfile = /var/log/obmc-console-mpro.log
|
||||
logsize = 1M
|
||||
@@ -0,0 +1,34 @@
|
||||
FILESEXTRAPATHS:prepend:mori := "${THISDIR}/${PN}:"
|
||||
|
||||
SRC_URI:append:mori = " \
|
||||
file://${BPN}@.service \
|
||||
file://host_console_uart_config.service \
|
||||
file://mori_uart_mux_ctrl.sh \
|
||||
file://server.ttyS1.conf \
|
||||
file://server.ttyS3.conf \
|
||||
"
|
||||
|
||||
SYSTEMD_SERVICE:${PN}:append:mori = " \
|
||||
${BPN}@.service \
|
||||
host_console_uart_config.service \
|
||||
"
|
||||
|
||||
do_install:append:mori() {
|
||||
install -d ${D}${libexecdir}/${PN}
|
||||
install -m 0755 ${WORKDIR}/mori_uart_mux_ctrl.sh \
|
||||
${D}${libexecdir}/${PN}/mori_uart_mux_ctrl.sh
|
||||
install -m 0644 ${WORKDIR}/host_console_uart_config.service \
|
||||
${D}${systemd_unitdir}/system
|
||||
# Overwrite base package's obmc-console@.service with our own
|
||||
install -m 0644 ${WORKDIR}/${BPN}@.service \
|
||||
${D}${systemd_unitdir}/system/${BPN}@.service
|
||||
}
|
||||
|
||||
RDEPENDS:${PN}:append:mori = " bash"
|
||||
|
||||
pkg_postinst:${PN}:append:mori () {
|
||||
systemctl --root=$D enable obmc-console@ttyS1.service
|
||||
systemctl --root=$D enable obmc-console@ttyS3.service
|
||||
}
|
||||
|
||||
OBMC_CONSOLE_TTYS:mori = "ttyS1 ttyS3"
|
||||
@@ -0,0 +1,27 @@
|
||||
SUMMARY = "Initialize PWM sensors"
|
||||
DESCRIPTION = "Initialize PWM sensors"
|
||||
LICENSE = "CLOSED"
|
||||
DEPENDS:append = " systemd"
|
||||
PR = "r1"
|
||||
|
||||
SRC_URI = " \
|
||||
file://pwm_init.service \
|
||||
file://bin/pwm_init.sh \
|
||||
"
|
||||
|
||||
S = "${WORKDIR}"
|
||||
SYSTEMD_AUTO_ENABLE = "enable"
|
||||
SYSTEMD_SERVICE:${PN} = " pwm_init.service"
|
||||
|
||||
inherit systemd
|
||||
|
||||
do_install() {
|
||||
install -d ${D}${libexecdir}/${PN}
|
||||
install -m 0755 ${S}/bin/* ${D}${libexecdir}/${PN}/
|
||||
install -d ${D}${systemd_system_unitdir}
|
||||
install -m 0644 ${S}/*.service ${D}${systemd_system_unitdir}
|
||||
}
|
||||
|
||||
RDEPENDS:${PN}:append = " bash"
|
||||
|
||||
FILES:${PN}:append = " ${bindir}/* ${systemd_system_unitdir}/*"
|
||||
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
|
||||
# Provide source directive to shellcheck.
|
||||
# shellcheck source=meta-fii/meta-mori/recipes-mori/mori-fw-utility/mori-fw/mori-lib.sh
|
||||
source /usr/libexec/mori-fw/mori-lib.sh
|
||||
|
||||
|
||||
# Set all pwm to 50%
|
||||
find /sys/class/hwmon/hwmon*/ -name 'pwm[1-6]' -exec bash -c 'echo "$1" && echo 127 > "$1" && cat "$1"' -- {} \;
|
||||
|
||||
|
||||
# Set all fans to pwm mode.
|
||||
find /sys/class/hwmon/hwmon*/ -name 'pwm*_enable' -exec bash -c 'echo "$1" && echo 1 > "$1" && cat "$1"' -- {} \;
|
||||
|
||||
|
||||
for i in {0..5}
|
||||
do
|
||||
fan_pwm_rate_of_change=0x$(printf '%02x' $((8 + i)) | \
|
||||
awk '{print $1}')
|
||||
# Set Fan PWM Rate-of-Change Bits(bits 4:2) to 000b
|
||||
# Register 08h to 0Dh
|
||||
oriRegVal=$(i2cget -y -f "${I2C_FANCTRL[0]}" 0x"${I2C_FANCTRL[1]}" \
|
||||
"$fan_pwm_rate_of_change")
|
||||
updateVal=$((oriRegVal & 0xe3))
|
||||
updateVal=0x$(printf "%x" $updateVal)
|
||||
i2cset -y -f "${I2C_FANCTRL[0]}" 0x"${I2C_FANCTRL[1]}" \
|
||||
"$fan_pwm_rate_of_change" "$updateVal"
|
||||
done
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=Init PWM sensors
|
||||
Before=xyz.openbmc_project.fansensor.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/libexec/pwm-init/pwm_init.sh
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
WantedBy=xyz.openbmc_project.fansensor.service
|
||||
@@ -0,0 +1,58 @@
|
||||
# Required for IPMI
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " phosphor-ipmi-blobs"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " phosphor-ipmi-blobs-binarystore"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " phosphor-ipmi-ethstats"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " phosphor-ipmi-net"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " phosphor-ipmi-host"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " google-ipmi-sys"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " google-ipmi-i2c"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " phosphor-sel-logger"
|
||||
|
||||
# Required tools and utilities
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " loadsvf"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " memtester"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " openssl-bin"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " ipmitool"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " ethtool"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " bash"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " i2c-tools"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " libgpiod-tools"
|
||||
|
||||
# Required for obmc-bmcweb
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " bmcweb"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " phosphor-certificate-manager"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " phosphor-user-manager"
|
||||
|
||||
# Required for the front port. Part of obmc-console
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " obmc-console"
|
||||
|
||||
# Required from packagegroup-mori-apps
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " obmc-phosphor-buttons-signals"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " obmc-phosphor-buttons-handler"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " phosphor-skeleton-control-power"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " ncsid"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " gbmc-mac-config"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " entity-manager"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " fru-device"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " dbus-sensors"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " estoraged"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " pwm-init"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " phosphor-pid-control"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " phosphor-logging"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " mori-cmd"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " mori-boot"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " mori-fw"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " virtual/bmc-update"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " virtual/bios-update"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " virtual/cpld-update"
|
||||
|
||||
# Required for phosphor-ipmi-ssif
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " virtual-obmc-host-ipmi-hw"
|
||||
|
||||
# Required for some services
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " phosphor-software-manager-download-mgr"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " phosphor-software-manager-version"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " phosphor-software-manager-updater"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " mori-boot-status-led"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " phosphor-led-manager"
|
||||
OBMC_IMAGE_EXTRA_INSTALL:append:mori = " phosphor-led-sysfs"
|
||||
@@ -0,0 +1,4 @@
|
||||
EXTRA_OEMESON:append:mori = " \
|
||||
-Dredfish-dump-log=enabled \
|
||||
-Dredfish-bmc-journal=enabled \
|
||||
"
|
||||
@@ -0,0 +1,11 @@
|
||||
[{
|
||||
"blobBaseId": "/skm/hss/",
|
||||
"sysFilePath": "/sys/bus/i2c/devices/42-0055/eeprom",
|
||||
"offsetBytes": 0
|
||||
},
|
||||
{
|
||||
"blobBaseId": "/skm/hss-backup/",
|
||||
"sysFilePath": "/sys/bus/i2c/devices/4-0050/eeprom",
|
||||
"offsetBytes": 256,
|
||||
"maxSizeBytes": 512
|
||||
}]
|
||||
@@ -0,0 +1,10 @@
|
||||
FILESEXTRAPATHS:prepend:mori := "${THISDIR}/${PN}:"
|
||||
|
||||
SRC_URI:append:mori = " file://config.json"
|
||||
|
||||
do_install:append:mori() {
|
||||
install -d ${D}${datadir}/binaryblob/
|
||||
install ${WORKDIR}/config.json ${D}${datadir}/binaryblob/config.json
|
||||
}
|
||||
|
||||
FILES:${PN}:append:mori = " ${datadir}/binaryblob/config.json"
|
||||
@@ -0,0 +1 @@
|
||||
FILESEXTRAPATHS:prepend:mori := "${THISDIR}/${PN}:"
|
||||
@@ -0,0 +1,2 @@
|
||||
{"id": 0, "revision": 1, "addn_dev_support": 133,
|
||||
"manuf_id": 17084, "prod_id": 1, "aux": 0}
|
||||
@@ -0,0 +1,2 @@
|
||||
PACKAGECONFIG:append:mori = " nuvoton-p2a-mbox net-bridge"
|
||||
IPMI_FLASH_BMC_ADDRESS:mori = "0xF0848000"
|
||||
@@ -0,0 +1,21 @@
|
||||
SUMMARY = "Phosphor LED Group Management for mori"
|
||||
LICENSE = "Apache-2.0"
|
||||
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
|
||||
PROVIDES:append = " virtual/phosphor-led-manager-config-native"
|
||||
PR = "r1"
|
||||
|
||||
SRC_URI = "file://led.yaml"
|
||||
|
||||
S = "${WORKDIR}"
|
||||
|
||||
inherit native
|
||||
|
||||
# Overwrite the example led layout yaml file prior
|
||||
# to building the phosphor-led-manager package
|
||||
do_install() {
|
||||
SRC=${S}
|
||||
DEST=${D}${datadir}/phosphor-led-manager
|
||||
install -D ${SRC}/led.yaml ${DEST}/led.yaml
|
||||
}
|
||||
|
||||
FILES:${PN}:append = " ${datadir}/phosphor-led-manager/led.yaml"
|
||||
@@ -0,0 +1,13 @@
|
||||
bmc_booted:
|
||||
BMC_ALIVE:
|
||||
Action: 'On'
|
||||
|
||||
boot_status_inactive:
|
||||
boot_status_led:
|
||||
Action: 'Blink'
|
||||
DutyOn: 50
|
||||
Period: 1000
|
||||
|
||||
boot_status_standby:
|
||||
boot_status_led:
|
||||
Action: 'On'
|
||||
@@ -0,0 +1 @@
|
||||
CHASSIS_TARGETS:mori = ""
|
||||
@@ -0,0 +1,4 @@
|
||||
# Enable threshold, pulse, and watchdog monitoring
|
||||
PACKAGECONFIG:append:mori = " \
|
||||
log-threshold log-alarm log-pulse log-watchdog clears-sel \
|
||||
"
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/xyz/openbmc_project/control/chassis0/chassiscapabilities:
|
||||
- Interface: xyz.openbmc_project.Control.ChassisCapabilities
|
||||
Properties:
|
||||
CapabilitiesFlags:
|
||||
Default: 32
|
||||
ChassisIntrusionEnabled:
|
||||
Default: 'true'
|
||||
ChassisFrontPanelLockoutEnabled:
|
||||
Default: 'true'
|
||||
ChassisNMIEnabled:
|
||||
Default: 'true'
|
||||
ChassisPowerInterlockEnabled:
|
||||
Default: 'true'
|
||||
FRUDeviceAddress:
|
||||
Default: 32
|
||||
SDRDeviceAddress:
|
||||
Default: 32
|
||||
SELDeviceAddress:
|
||||
Default: 32
|
||||
SMDeviceAddress:
|
||||
Default: 32
|
||||
BridgeDeviceAddress:
|
||||
Default: 32
|
||||
|
||||
/xyz/openbmc_project/control/host0/power_restore_policy:
|
||||
- Interface: xyz.openbmc_project.Control.Power.RestorePolicy
|
||||
Properties:
|
||||
PowerRestorePolicy:
|
||||
Default: RestorePolicy::Policy::AlwaysOn
|
||||
@@ -0,0 +1,3 @@
|
||||
FILESEXTRAPATHS:append:mori := ":${THISDIR}/${PN}"
|
||||
|
||||
SRC_URI:append:mori = " file://chassis_capabilities.override.yml"
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"gpio_configs": {
|
||||
|
||||
"power_config": {
|
||||
"power_good_in": "PGOOD",
|
||||
"power_up_outs": [
|
||||
],
|
||||
"reset_outs": [
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
"gpio_definitions": [
|
||||
{
|
||||
"name": "PGOOD",
|
||||
"num": 71,
|
||||
"direction": "in"
|
||||
},
|
||||
{
|
||||
"name": "POWER_BUTTON",
|
||||
"num": 64,
|
||||
"direction": "both"
|
||||
},
|
||||
{
|
||||
"name": "RESET_BUTTON",
|
||||
"num": 65,
|
||||
"direction": "both"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
FILESEXTRAPATHS:append:mori := ":${THISDIR}/${PN}"
|
||||
|
||||
SRC_URI:append:mori = " file://gpio_defs.json"
|
||||
@@ -0,0 +1,2 @@
|
||||
PACKAGECONFIG:append:mori = " smbios-ipmi-blob"
|
||||
PACKAGECONFIG:remove:mori = " cpuinfo"
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
[Unit]
|
||||
Description=Phosphor Chassis%i State Manager
|
||||
Before=mapper-wait@-xyz-openbmc_project-state-chassis%i.service
|
||||
After=org.openbmc.control.Power@%i.service
|
||||
After=host-powerctrl.service
|
||||
|
||||
[Service]
|
||||
ExecStartPre=/bin/sleep 5
|
||||
ExecStart=/usr/bin/phosphor-chassis-state-manager --chassis %i
|
||||
Restart=always
|
||||
Type=dbus
|
||||
BusName=xyz.openbmc_project.State.Chassis%i
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
[Unit]
|
||||
Description=Phosphor Host%i State Manager
|
||||
Wants=mapper-wait@-xyz-openbmc_project-control-host%i-auto_reboot.service
|
||||
After=mapper-wait@-xyz-openbmc_project-control-host%i-auto_reboot.service
|
||||
Wants=mapper-wait@-xyz-openbmc_project-state-chassis%i.service
|
||||
After=mapper-wait@-xyz-openbmc_project-state-chassis%i.service
|
||||
After=phosphor-ipmi-host.service
|
||||
Before=obmc-host-reset@%i.target
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/bin/phosphor-host-state-manager --host %i
|
||||
Restart=always
|
||||
Type=dbus
|
||||
BusName=xyz.openbmc_project.State.Host%i
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,42 @@
|
||||
FILESEXTRAPATHS:prepend:mori := "${THISDIR}/${PN}:"
|
||||
DEPENDS:append:mori = " gpioplus"
|
||||
|
||||
SRC_URI:append:mori = " \
|
||||
file://xyz.openbmc_project.State.Chassis@.service \
|
||||
file://xyz.openbmc_project.State.Host@.service \
|
||||
"
|
||||
|
||||
SYSTEMD_SERVICE:${PN}-host:append:mori = " phosphor-host-condition-gpio@.service"
|
||||
|
||||
EXTRA_OEMESON:append:mori = " -Dhost-gpios=enabled"
|
||||
|
||||
do_install:append:mori() {
|
||||
install -d ${D}${systemd_system_unitdir}
|
||||
install -m 0644 ${WORKDIR}/xyz.openbmc_project.State.Chassis@.service \
|
||||
${D}${systemd_system_unitdir}/xyz.openbmc_project.State.Chassis@.service
|
||||
install -m 0644 ${WORKDIR}/xyz.openbmc_project.State.Host@.service \
|
||||
${D}${systemd_system_unitdir}/xyz.openbmc_project.State.Host@.service
|
||||
}
|
||||
|
||||
FILES:${PN}:append:mori = " ${systemd_system_unitdir}/*"
|
||||
FILES:${PN}-host:append:mori = " ${bindir}/phosphor-host-condition-gpio"
|
||||
|
||||
pkg_prerm:${PN}-obmc-targets:prepend:mori() {
|
||||
LINK="$D$systemd_system_unitdir/multi-user.target.requires/phosphor-host-condition-gpio@0.service"
|
||||
rm $LINK
|
||||
}
|
||||
pkg_postinst:${PN}-obmc-targets:prepend:mori() {
|
||||
mkdir -p $D$systemd_system_unitdir/multi-user.target.requires
|
||||
LINK="$D$systemd_system_unitdir/multi-user.target.requires/phosphor-host-condition-gpio@0.service"
|
||||
TARGET="../phosphor-host-condition-gpio@.service"
|
||||
ln -s $TARGET $LINK
|
||||
}
|
||||
pkg_postinst:${PN}-obmc-targets:append:mori() {
|
||||
rm "$D$systemd_system_unitdir/obmc-host-reboot@0.target.requires/obmc-host-shutdown@0.target"
|
||||
rm "$D$systemd_system_unitdir/obmc-host-reboot@0.target.requires/phosphor-reboot-host@0.service"
|
||||
rm "$D$systemd_system_unitdir/obmc-host-shutdown@0.target.requires/obmc-chassis-poweroff@0.target"
|
||||
rm "$D$systemd_system_unitdir/obmc-host-warm-reboot@0.target.requires/obmc-host-force-warm-reboot@0.target"
|
||||
rm "$D$systemd_system_unitdir/obmc-host-warm-reboot@0.target.requires/xyz.openbmc_project.Ipmi.Internal.SoftPowerOff.service"
|
||||
rm "$D$systemd_system_unitdir/obmc-host-force-warm-reboot@0.target.requires/obmc-host-stop@0.target"
|
||||
rm "$D$systemd_system_unitdir/obmc-host-force-warm-reboot@0.target.requires/phosphor-reboot-host@0.service"
|
||||
}
|
||||
Reference in New Issue
Block a user