diff options
Diffstat (limited to 'meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton')
10 files changed, 224 insertions, 0 deletions
diff --git a/meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/hotswap-power-cycle/adm1278-hotswap-power-cycle.bb b/meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/hotswap-power-cycle/adm1278-hotswap-power-cycle.bb new file mode 100644 index 000000000..1a20beec7 --- /dev/null +++ b/meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/hotswap-power-cycle/adm1278-hotswap-power-cycle.bb @@ -0,0 +1,21 @@ +SUMMARY = "Power Cycle by Hotswap Controller" +DESCRIPTION = "Power Cycle by Hotswap Controller Daemon" +PR = "r1" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +inherit systemd + +DEPENDS += "systemd" +RDEPENDS_${PN} += "bash" + +SRC_URI = " file://hotswap-power-cycle.service" + +do_install() { + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/hotswap-power-cycle.service ${D}${systemd_system_unitdir} +} + +SYSTEMD_PACKAGES = "${PN}" +SYSTEMD_SERVICE_${PN} = "hotswap-power-cycle.service" + diff --git a/meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/hotswap-power-cycle/files/hotswap-power-cycle.service b/meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/hotswap-power-cycle/files/hotswap-power-cycle.service new file mode 100644 index 000000000..ccddfba76 --- /dev/null +++ b/meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/hotswap-power-cycle/files/hotswap-power-cycle.service @@ -0,0 +1,14 @@ +[Unit] +Description=Power Cycle by Hotswap Controller + +[Service] +EnvironmentFile=/run/psu_timedelay +ExecStartPre=sleep $PSU_HARDRESET_DELAY +ExecStart= i2cset -f -y 8 0x11 0xd9 +Restart=no +Type=oneshot +RemainAfterExit=true +StandardOutput=syslog + +[Install] +WantedBy=gbmc-psu-hardreset.target diff --git a/meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/network/files/config.txt b/meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/network/files/config.txt new file mode 100644 index 000000000..695356c19 --- /dev/null +++ b/meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/network/files/config.txt @@ -0,0 +1,4 @@ +fruBusNum=13 +fruAddr=0x51 +numberMac=1 +mac1=eth1 diff --git a/meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/network/mac-address_%.bbappend b/meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/network/mac-address_%.bbappend new file mode 100644 index 000000000..a9f0c407a --- /dev/null +++ b/meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/network/mac-address_%.bbappend @@ -0,0 +1,11 @@ +FILESEXTRAPATHS_prepend_olympus-nuvoton := "${THISDIR}/files:" + +SRC_URI_append_olympus-nuvoton = " file://config.txt" + +FILES_${PN}_append_olympus-nuvoton = " ${datadir}/mac-address/config.txt" + +do_install_append_olympus-nuvoton() { + install -d ${D}${datadir}/mac-address + install -m 0644 -D ${WORKDIR}/config.txt \ + ${D}${datadir}/mac-address/config.txt +} diff --git a/meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/network/olympus-nuvoton-iptable-save.bb b/meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/network/olympus-nuvoton-iptable-save.bb new file mode 100644 index 000000000..2416ef932 --- /dev/null +++ b/meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/network/olympus-nuvoton-iptable-save.bb @@ -0,0 +1,17 @@ +SUMMARY = "Iptable Save" +DESCRIPTION = "Save iptable rules" +PR = "r1" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +inherit allarch systemd + +SRC_URI = "file://phosphor-save-iptable-rules.service" +SYSTEMD_SERVICE_${PN} = "phosphor-save-iptable-rules.service" + +S = "${WORKDIR}" +do_install() { + install -d ${D}${systemd_unitdir}/system/ + install -m 0644 ${WORKDIR}/phosphor-save-iptable-rules.service \ + ${D}${systemd_unitdir}/system +} diff --git a/meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/network/olympus-nuvoton-iptable-save/phosphor-save-iptable-rules.service b/meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/network/olympus-nuvoton-iptable-save/phosphor-save-iptable-rules.service new file mode 100644 index 000000000..9c340bd48 --- /dev/null +++ b/meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/network/olympus-nuvoton-iptable-save/phosphor-save-iptable-rules.service @@ -0,0 +1,12 @@ +[Unit] +Description=Save iptable rules +DefaultDependencies=no +After=shutdown.target + +[Service] +Type=oneshot +RemainAfterExit=true +ExecStart=/bin/sh -c "iptables-save > /etc/iptables/iptables.rules" + +[Install] +WantedBy=shutdown.target diff --git a/meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/packagegroups/packagegroup-olympus-nuvoton-apps.bb b/meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/packagegroups/packagegroup-olympus-nuvoton-apps.bb new file mode 100644 index 000000000..6d9c86a76 --- /dev/null +++ b/meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/packagegroups/packagegroup-olympus-nuvoton-apps.bb @@ -0,0 +1,48 @@ +SUMMARY = "OpenBMC for OLYMPUS NUVOTON system - Applications" +PR = "r1" + +inherit packagegroup + +PROVIDES = "${PACKAGES}" +PACKAGES = " \ + ${PN}-chassis \ + ${PN}-fans \ + ${PN}-flash \ + ${PN}-system \ + " + +PROVIDES += "virtual/obmc-chassis-mgmt" +PROVIDES += "virtual/obmc-fan-mgmt" +PROVIDES += "virtual/obmc-flash-mgmt" +PROVIDES += "virtual/obmc-system-mgmt" + +RPROVIDES_${PN}-chassis += "virtual-obmc-chassis-mgmt" +RPROVIDES_${PN}-fans += "virtual-obmc-fan-mgmt" +RPROVIDES_${PN}-flash += "virtual-obmc-flash-mgmt" +RPROVIDES_${PN}-system += "virtual-obmc-system-mgmt" + +SUMMARY_${PN}-fans = "OLYMPUS NUVOTON Fans" +RDEPENDS_${PN}-fans = " \ + phosphor-pid-control \ + " + +SUMMARY_${PN}-system = "OLYMPUS NUVOTON System" +RDEPENDS_${PN}-system = " \ + phosphor-webui \ + obmc-ikvm \ + obmc-console \ + dhcpcd \ + phosphor-ipmi-fru \ + phosphor-ipmi-ipmb \ + ipmitool \ + first-boot-set-psu \ + phosphor-image-signing \ + openssl-bin \ + loadsvf \ + iptables \ + olympus-nuvoton-iptable-save \ + phosphor-post-code-manager \ + adm1278-hotswap-power-cycle \ + google-ipmi-sys \ + mac-address \ + " diff --git a/meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/power/first-boot-set-psu.bb b/meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/power/first-boot-set-psu.bb new file mode 100644 index 000000000..ed9c13687 --- /dev/null +++ b/meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/power/first-boot-set-psu.bb @@ -0,0 +1,22 @@ +SUMMARY = "Init PSU inventory" +DESCRIPTION = "Setup PSU inventory read from PSU" +PR = "r1" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10" + +inherit allarch systemd + +RDEPENDS_${PN} = "${VIRTUAL-RUNTIME_base-utils}" +RDEPENDS_${PN} += "bash" + +SYSTEMD_SERVICE_${PN} = "first-boot-set-psu@.service" +SYSTEMD_SERVICE_${PN} += "first-boot-set-psu@0-2-0x58.service" + +SRC_URI = "file://${BPN}.sh file://${BPN}@.service" + +S = "${WORKDIR}" +do_install() { + install -d ${D}${bindir} ${D}${systemd_system_unitdir} + install ${BPN}.sh ${D}${bindir}/ + install -m 644 ${BPN}@.service ${D}${systemd_system_unitdir}/ +} diff --git a/meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/power/first-boot-set-psu/first-boot-set-psu.sh b/meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/power/first-boot-set-psu/first-boot-set-psu.sh new file mode 100644 index 000000000..04b447615 --- /dev/null +++ b/meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/power/first-boot-set-psu/first-boot-set-psu.sh @@ -0,0 +1,61 @@ +#!/bin/bash + +string='' +pmbus_read() { + data=$(i2cget -f -y $1 $2 $3 i $4) + + if [[ -z "$data" ]]; then + echo "i2c$1 device $2 command $3 error" >&2 + exit 1 + fi + + arry=$(echo ${data} | sed -e "s/$4\: //" | sed -e "s/\0x00//g" | sed -e "s/\0xff//g" | sed -e "s/\0x7f//g" | sed -e "s/\0x0f//g" | sed -e "s/\0x14//g") + + string='' + for d in ${arry} + do + hex=$(echo $d | sed -e "s/0\x//") + string+=$(echo -e "\x${hex}"); + done +} + +update_inventory() { + INVENTORY_SERVICE='xyz.openbmc_project.Inventory.Manager' + INVENTORY_OBJECT='/xyz/openbmc_project/inventory' + INVENTORY_PATH='xyz.openbmc_project.Inventory.Manager' + OBJECT_PATH="/system/chassis/motherboard/powersupply$1" + busctl call \ + ${INVENTORY_SERVICE} \ + ${INVENTORY_OBJECT} \ + ${INVENTORY_PATH} \ + Notify a{oa{sa{sv}}} 1 \ + ${OBJECT_PATH} 1 $2 $3 \ + $4 $5 $6 +} + +if [ $# -eq 0 ]; then + echo 'No PSU device is given' >&2 + exit 1 +fi + +input=$(echo $1 | tr "-" " ") +arr=(${input// / }); + + +pmbus_read ${arr[1]} ${arr[2]} 0x99 11 +update_inventory ${arr[0]} "xyz.openbmc_project.Inventory.Decorator.Asset" 1 "Manufacturer" "s" $string + +pmbus_read ${arr[1]} ${arr[2]} 0x9a 11 +update_inventory ${arr[0]} "xyz.openbmc_project.Inventory.Decorator.Asset" 1 "Model" "s" $string + +pmbus_read ${arr[1]} ${arr[2]} 0xad 21 +update_inventory ${arr[0]} "xyz.openbmc_project.Inventory.Decorator.Asset" 1 "PartNumber" "s" $string + +pmbus_read ${arr[1]} ${arr[2]} 0x9e 18 +update_inventory ${arr[0]} "xyz.openbmc_project.Inventory.Decorator.Asset" 1 "SerialNumber" "s" $string + +update_inventory ${arr[0]} "xyz.openbmc_project.Inventory.Decorator.Cacheable" 1 "Cached" "b" "true" +update_inventory ${arr[0]} "xyz.openbmc_project.Inventory.Decorator.Replaceable" 1 "FieldReplaceable" "b" "true" +update_inventory ${arr[0]} "xyz.openbmc_project.Inventory.Item" 1 "Present" "b" "true" +update_inventory ${arr[0]} "xyz.openbmc_project.Inventory.Item" 1 "PrettyName" "s" "powersupply${arr[0]}" +update_inventory ${arr[0]} "xyz.openbmc_project.Inventory.Item.PowerSupply" 0 diff --git a/meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/power/first-boot-set-psu/first-boot-set-psu@.service b/meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/power/first-boot-set-psu/first-boot-set-psu@.service new file mode 100644 index 000000000..1d414f577 --- /dev/null +++ b/meta-quanta/meta-olympus-nuvoton/recipes-olympus-nuvoton/power/first-boot-set-psu/first-boot-set-psu@.service @@ -0,0 +1,14 @@ +[Unit] +Description=Init PSU Inventory for PSU %I +Wants=mapper-wait@-xyz-openbmc_project-inventory.service +After=mapper-wait@-xyz-openbmc_project-inventory.service + +[Service] +ExecStart=/usr/bin/first-boot-set-psu.sh %i +RemainAfterExit=yes +SyslogIdentifier=first-boot-set-psu +Restart=on-failure +RestartSec=20 + +[Install] +WantedBy=multi-user.target |