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,21 @@
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
inherit obmc-phosphor-systemd
RDEPENDS:${PN}:append = " \
bash \
btrfs-tools \
"
SRC_URI += " \
file://emmc-init \
file://emmc-init.service \
"
do_install:append() {
install -d ${D}${libexecdir}/emmc-init
install -m 0755 ${WORKDIR}/emmc-init ${D}${libexecdir}/emmc-init
}
SYSTEMD_SERVICE:${PN} += "emmc-init.service"
@@ -0,0 +1,48 @@
#!/bin/bash -e
DEVICE_NODE="/dev/mmcblk0"
DEFAULT_FS_TYPE="btrfs"
#
# check device node exist
#
if [[ ! -b "${DEVICE_NODE}" ]]; then
echo "${DEVICE_NODE} is not available"
exit 0
fi
#
# check if device mounted correctly
#
if ! (mount || true) | grep "${DEVICE_NODE}"> /dev/null; then
echo "${DEVICE_NODE} is not mounted"
else
echo "${DEVICE_NODE} is mounted"
exit 0
fi
#
# check filesystem
#
FS_TYPE_CHECK="$(blkid "${DEVICE_NODE}" | sed 's/.*TYPE="\([^"]*\).*/\1/' || true)"
if [[ "${FS_TYPE_CHECK}" = "" ]]; then
FS_TYPE="unknown"
else
FS_TYPE="${FS_TYPE_CHECK}"
fi
case "${FS_TYPE}" in
"${DEFAULT_FS_TYPE}")
echo "Filesystem (${FS_TYPE}) found on ${DEVICE_NODE}"
;;
*)
echo "No or unexpected filesystem (${FS_TYPE}) found on ${DEVICE_NODE}"
if ! output=$(mkfs."${DEFAULT_FS_TYPE}" --force "${DEVICE_NODE}" 2>&1); then
echo "failed to create ${DEFAULT_FS_TYPE} on ${DEVICE_NODE}:"
echo "${output}"
exit 1
fi
;;
esac
@@ -0,0 +1,13 @@
[Unit]
Description=eMMC initialize check
Before=mnt-data.mount
Requires=dev-mmcblk0.device
After=dev-mmcblk0.device
[Service]
ExecStart=/usr/libexec/emmc-init/emmc-init
Type=oneshot
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
@@ -0,0 +1,26 @@
FILESEXTRAPATHS:append := "${THISDIR}/files:"
inherit obmc-phosphor-systemd
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=a8328fd2a610bf4527feedcaa3ae3d14"
S = "${WORKDIR}"
SRC_URI = "file://setup_gpio.sh \
file://power-util \
file://host-gpio.service \
file://host-poweroff.service \
file://host-poweron.service \
file://LICENSE"
DEPENDS = "systemd"
RDEPENDS:${PN} = "bash"
SYSTEMD_PACKAGES = "${PN}"
SYSTEMD_SERVICE:${PN} = "host-gpio.service host-poweron.service host-poweroff.service"
do_install() {
install -d ${D}/usr/sbin
install -m 0755 ${S}/setup_gpio.sh ${D}/${sbindir}/
install -m 0755 ${S}/power-util ${D}/${sbindir}/
}
@@ -0,0 +1,13 @@
Copyright 2018 Facebook Inc
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
@@ -0,0 +1,9 @@
[Unit]
Description=Configure GPIOs for Tiogapass
[Service]
Restart=no
RemainAfterExit=true
Type=oneshot
ExecStart=/usr/sbin/setup_gpio.sh
SyslogIdentifier=setup_gpio.sh
@@ -0,0 +1,9 @@
[Unit]
Description=Shutdown Host Server
Requires=host-gpio.service
After=host-gpio.service
[Service]
Type=oneshot
ExecStart=/usr/sbin/power-util mb off
SyslogIdentifier=power-util
@@ -0,0 +1,12 @@
[Unit]
Description=Poweron Host Server
Requires=host-gpio.service
After=host-gpio.service
[Service]
Type=oneshot
ExecStart=/usr/sbin/power-util mb on
SyslogIdentifier=power-util
[Install]
WantedBy=basic.target
+83
View File
@@ -0,0 +1,83 @@
#!/bin/bash
# Usage of this utility
function usage() {
echo "usage: power-util mb [on|off|status|cycle|reset]";
echo " power-util sled-cycle"
}
power_off() {
echo "Shutting down Server"
busctl set-property xyz.openbmc_project.State.Chassis /xyz/openbmc_project/state/chassis0 xyz.openbmc_project.State.Chassis RequestedPowerTransition s xyz.openbmc_project.State.Chassis.Transition.Off
}
power_on() {
echo "Powering on Server"
busctl set-property xyz.openbmc_project.State.Chassis /xyz/openbmc_project/state/chassis0 xyz.openbmc_project.State.Chassis RequestedPowerTransition s xyz.openbmc_project.State.Chassis.Transition.On
}
power_status() {
st=$(busctl get-property xyz.openbmc_project.State.Chassis /xyz/openbmc_project/state/chassis0 xyz.openbmc_project.State.Chassis CurrentPowerState | cut -d"." -f6)
if [ "$st" == "On\"" ]; then
echo "on"
else
echo "off"
fi
}
power_reset() {
echo "Reset on server"
busctl set-property xyz.openbmc_project.State.Chassis /xyz/openbmc_project/state/chassis0 xyz.openbmc_project.State.Chassis RequestedPowerTransition s xyz.openbmc_project.State.Chassis.Transition.Reset
}
sled_cycle() {
i2cset -y 7 0x45 0xd9 c
}
if [ "$1" == "sled-cycle" ]; then
echo "SLED_CYCLE starting at $(date)"
sled_cycle
exit 0;
fi
if [ $# -lt 2 ]; then
echo "Total number of parameter=$#"
echo "Insufficient parameter"
usage;
exit 0;
fi
if [ "$1" != "mb" ]; then
echo "Invalid parameter1=$1"
usage;
exit 0;
fi
if [ "$2" = "on" ]; then
if [ "$(power_status)" == "off" ]; then
power_on
fi
elif [ "$2" = "off" ]; then
if [ "$(power_status)" == "on" ]; then
power_off
fi
elif [ "$2" == "cycle" ]; then
if [ "$(power_status)" == "on" ]; then
power_off
else
echo "WARNING: Powering on server"
fi
power_on
elif [ "$2" == "reset" ]; then
if [ "$(power_status)" == "on" ]; then
power_reset
else
echo "ERROR: Server not powered on"
fi
elif [ "$2" == "status" ]; then
power_status
else
echo "Invalid parameter2=$2"
usage;
fi
exit 0;
+22
View File
@@ -0,0 +1,22 @@
#!/bin/bash
# Set all output GPIOs as such and drive them with reasonable values.
function set_gpio_active_low() {
if [ $# -ne 2 ]; then
echo "set_gpio_active_low: need both GPIO# and initial level";
return;
fi
echo "$1" > /sys/class/gpio/export
echo "$2" > "/sys/class/gpio/gpio$1/direction"
}
GPIO_BASE=$(cat /sys/class/gpio/gpio*/base)
# FM_BMC_READY_N, GPIO S1, active low
set_gpio_active_low $((GPIO_BASE + 144 +1)) low
# FP_PECI_MUX, active low
set_gpio_active_low $((GPIO_BASE + 212)) high
exit 0;
+43
View File
@@ -0,0 +1,43 @@
SUMMARY = "Facebook OEM IPMI commands"
DESCRIPTION = "Facebook OEM IPMI commands"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=9e69ba356fa59848ffd865152a3ccc13"
SRC_URI = "git://github.com/openbmc/fb-ipmi-oem;branch=master;protocol=https"
SRCREV = "7bb4592af71e823991994622042ab380c8a7a125"
S = "${WORKDIR}/git"
PV = "0.1+git${SRCPV}"
DEPENDS = "boost phosphor-ipmi-host phosphor-logging systemd "
inherit meson pkgconfig obmc-phosphor-ipmiprovider-symlink
PACKAGECONFIG ??= ""
PACKAGECONFIG:fb-compute-multihost ??= "bic"
PACKAGECONFIG[bic] = "-Dbic=enabled,-Dbic=disabled"
EXTRA_OEMESON="\
-Dtests=disabled \
-Dmachine='${MACHINE}' \
-Dhost-instances='${OBMC_HOST_INSTANCES}' \
"
LIBRARY_NAMES = "libzfboemcmds.so"
HOSTIPMI_PROVIDER_LIBRARY += "${LIBRARY_NAMES}"
NETIPMI_PROVIDER_LIBRARY += "${LIBRARY_NAMES}"
FILES:${PN}:append = " ${datadir}/lcd-debug/*.json"
FILES:${PN}:append = " ${libdir}/ipmid-providers/lib*${SOLIBS}"
FILES:${PN}:append = " ${libdir}/host-ipmid/lib*${SOLIBS}"
FILES:${PN}:append = " ${libdir}/net-ipmid/lib*${SOLIBS}"
FILES:${PN}-dev:append = " ${libdir}/ipmid-providers/lib*${SOLIBSDEV}"
do_install:append(){
install -d ${D}${includedir}/fb-ipmi-oem
install -m 0644 -D ${S}/include/*.hpp ${D}${includedir}/fb-ipmi-oem
}
@@ -0,0 +1,68 @@
SUMMARY = "OpenBMC for Facebook - Applications"
PR = "r1"
inherit packagegroup
PROVIDES = "${PACKAGES}"
PACKAGES = " \
${PN}-extras \
${PN}-fans \
${PN}-flash \
${PN}-system \
"
PACKAGES:append:fb-withhost = " \
${PN}-chassis \
${PN}-hostmgmt \
"
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}-chassis = "Facebook Chassis"
RDEPENDS:remove:greatlakes:${PN}-chassis = " \
x86-power-control \
"
SUMMARY:${PN}-extras:tiogapass = "Extra features for tiogapass"
RDEPENDS:${PN}-extras:tiogapass = "phosphor-nvme"
SUMMARY:${PN}-fans = "Facebook Fans"
RDEPENDS:${PN}-fans = " \
phosphor-pid-control \
"
SUMMARY:${PN}-flash = "Facebook Flash"
RDEPENDS:${PN}-flash = " \
phosphor-software-manager \
"
RDEPENDS_PN_SYSTEM_EXTRAS = ""
RDEPENDS_PN_SYSTEM_EXTRAS:fb-withhost = " \
fb-powerctrl \
phosphor-ipmi-ipmb \
fb-ipmi-oem \
phosphor-hostlogger \
phosphor-sel-logger \
ipmitool \
phosphor-post-code-manager \
phosphor-host-postd \
phosphor-state-manager \
"
SUMMARY:${PN}-system = "Facebook System"
RDEPENDS:${PN}-system = " \
entity-manager \
dbus-sensors \
phosphor-virtual-sensor \
phosphor-fan-sensor-monitor \
phosphor-gpio-monitor-monitor \
tzdata-core \
${RDEPENDS_PN_SYSTEM_EXTRAS} \
"