summaryrefslogtreecommitdiffstats
path: root/meta-facebook/meta-wedge100/recipes-core
diff options
context:
space:
mode:
Diffstat (limited to 'meta-facebook/meta-wedge100/recipes-core')
-rwxr-xr-xmeta-facebook/meta-wedge100/recipes-core/fan-ctrl/fan-ctrl/get_fan_speed.sh59
-rwxr-xr-xmeta-facebook/meta-wedge100/recipes-core/fan-ctrl/fan-ctrl/set_fan_speed.sh46
-rw-r--r--meta-facebook/meta-wedge100/recipes-core/fan-ctrl/fan-ctrl/setup-fan.sh33
-rw-r--r--meta-facebook/meta-wedge100/recipes-core/fan-ctrl/fan-ctrl_0.1.bbappend46
-rw-r--r--meta-facebook/meta-wedge100/recipes-core/images/wedge100-image.bb82
-rw-r--r--meta-facebook/meta-wedge100/recipes-core/sysvinit/sysvinit-inittab_%.bbappend5
6 files changed, 271 insertions, 0 deletions
diff --git a/meta-facebook/meta-wedge100/recipes-core/fan-ctrl/fan-ctrl/get_fan_speed.sh b/meta-facebook/meta-wedge100/recipes-core/fan-ctrl/fan-ctrl/get_fan_speed.sh
new file mode 100755
index 0000000..042a72f
--- /dev/null
+++ b/meta-facebook/meta-wedge100/recipes-core/fan-ctrl/fan-ctrl/get_fan_speed.sh
@@ -0,0 +1,59 @@
+#!/bin/sh
+#
+# Copyright 2015-present Facebook. All Rights Reserved.
+#
+# This program file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program in a file named COPYING; if not, write to the
+# Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301 USA
+#
+usage() {
+ echo "Usage: $0 [Fan Unit (1..5)]" >&2
+}
+
+FAN_DIR=/sys/class/i2c-adapter/i2c-8/8-0033
+
+show_pwm()
+{
+ pwm="${FAN_DIR}/fantray${1}_pwm"
+ val=$(cat $pwm | head -n 1)
+ echo "$((val * 100 / 31))%"
+}
+
+show_rpm()
+{
+ front_rpm="${FAN_DIR}/fan$((($1 * 2 - 1)))_input"
+ rear_rpm="${FAN_DIR}/fan$((($1 * 2)))_input"
+ echo "$(cat $front_rpm), $(cat $rear_rpm)"
+}
+
+set -e
+
+# refer to the comments in init_pwn.sh regarding
+# the fan unit and tacho mapping
+if [ "$#" -eq 0 ]; then
+ FANS="1 2 3 4 5"
+elif [ "$#" -eq 1 ]; then
+ if [ $1 -gt 5 ]; then
+ usage
+ exit 1
+ fi
+ FANS="$1"
+else
+ usage
+ exit 1
+fi
+
+for fan in $FANS; do
+ echo "Fan $fan RPMs: $(show_rpm $fan), ($(show_pwm $fan))"
+done
diff --git a/meta-facebook/meta-wedge100/recipes-core/fan-ctrl/fan-ctrl/set_fan_speed.sh b/meta-facebook/meta-wedge100/recipes-core/fan-ctrl/fan-ctrl/set_fan_speed.sh
new file mode 100755
index 0000000..ff5a584
--- /dev/null
+++ b/meta-facebook/meta-wedge100/recipes-core/fan-ctrl/fan-ctrl/set_fan_speed.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+#
+# Copyright 2015-present Facebook. All Rights Reserved.
+#
+# This program file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program in a file named COPYING; if not, write to the
+# Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301 USA
+#
+usage() {
+ echo "Usage: $0 <PERCENT (0..100)> <Fan Unit (1..5)> " >&2
+}
+
+FAN_DIR=/sys/class/i2c-adapter/i2c-8/8-0033
+
+set -e
+
+if [ "$#" -ne 2 ] && [ "$#" -ne 1 ]; then
+ usage
+ exit 1
+fi
+
+if [ "$#" -eq 1 ]; then
+ FANS="1 2 3 4 5"
+else
+ FANS="$2"
+fi
+
+# Convert the percentage to our 1/32th unit (0-31).
+unit=$(( ( $1 * 31 ) / 100 ))
+
+for fan in $FANS; do
+ pwm="${FAN_DIR}/fantray${fan}_pwm"
+ echo "$unit" > $pwm
+ echo "Successfully set fan ${fan} speed to $1%"
+done
diff --git a/meta-facebook/meta-wedge100/recipes-core/fan-ctrl/fan-ctrl/setup-fan.sh b/meta-facebook/meta-wedge100/recipes-core/fan-ctrl/fan-ctrl/setup-fan.sh
new file mode 100644
index 0000000..26691dc
--- /dev/null
+++ b/meta-facebook/meta-wedge100/recipes-core/fan-ctrl/fan-ctrl/setup-fan.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# Copyright 2014-present Facebook. All Rights Reserved.
+#
+# This program file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program in a file named COPYING; if not, write to the
+# Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301 USA
+#
+
+### BEGIN INIT INFO
+# Provides: setup-fan
+# Required-Start: board-id
+# Required-Stop:
+# Default-Start: S
+# Default-Stop:
+# Short-Description: Set fan speed
+### END INIT INFO
+
+echo -n "Setup fan speed... "
+/usr/local/bin/set_fan_speed.sh 50
+/usr/local/bin/fand
+echo "done."
diff --git a/meta-facebook/meta-wedge100/recipes-core/fan-ctrl/fan-ctrl_0.1.bbappend b/meta-facebook/meta-wedge100/recipes-core/fan-ctrl/fan-ctrl_0.1.bbappend
new file mode 100644
index 0000000..ff5f2d5
--- /dev/null
+++ b/meta-facebook/meta-wedge100/recipes-core/fan-ctrl/fan-ctrl_0.1.bbappend
@@ -0,0 +1,46 @@
+# Copyright 2015-present Facebook. All Rights Reserved.
+#
+# This program file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program in a file named COPYING; if not, write to the
+# Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor,
+# Boston, MA 02110-1301 USA
+
+DEPENDS_append = " update-rc.d-native"
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+SRC_URI += "file://get_fan_speed.sh \
+ file://set_fan_speed.sh \
+ file://setup-fan.sh \
+ "
+
+S = "${WORKDIR}"
+
+binfiles = " \
+ get_fan_speed.sh \
+ set_fan_speed.sh \
+ fand \
+ "
+
+CXXFLAGS_prepend = "-DCONFIG_WEDGE100 "
+
+do_install() {
+ bin="${D}/usr/local/bin"
+ install -d $bin
+ for f in ${binfiles}; do
+ install -m 755 $f ${bin}/$f
+ done
+ install -d ${D}${sysconfdir}/init.d
+ install -d ${D}${sysconfdir}/rcS.d
+ install -m 755 setup-fan.sh ${D}${sysconfdir}/init.d/setup-fan.sh
+ update-rc.d -r ${D} setup-fan.sh start 91 S .
+}
diff --git a/meta-facebook/meta-wedge100/recipes-core/images/wedge100-image.bb b/meta-facebook/meta-wedge100/recipes-core/images/wedge100-image.bb
new file mode 100644
index 0000000..291ebf0
--- /dev/null
+++ b/meta-facebook/meta-wedge100/recipes-core/images/wedge100-image.bb
@@ -0,0 +1,82 @@
+inherit aspeed_uboot_image
+
+# /dev
+require recipes-core/images/aspeed-dev.inc
+
+# Base this image on core-image-minimal
+include recipes-core/images/core-image-minimal.bb
+
+# Changing the image compression from gz to lzma achieves 30% saving (~3M).
+# However, the current u-boot does not have lzma enabled. Stick to gz
+# until we generate a new u-boot image.
+IMAGE_FSTYPES += "cpio.lzma.u-boot"
+UBOOT_IMAGE_ENTRYPOINT = "0x40800000"
+
+PYTHON_PKGS = " \
+ python-core \
+ python-io \
+ python-json \
+ python-shell \
+ python-subprocess \
+ python-argparse \
+ python-ctypes \
+ python-datetime \
+ python-email \
+ python-threading \
+ python-mime \
+ python-pickle \
+ python-misc \
+ python-netserver \
+ "
+
+NTP_PKGS = " \
+ ntp \
+ ntp-utils \
+ sntp \
+ ntpdate \
+ "
+
+# Include modules in rootfs
+IMAGE_INSTALL += " \
+ kernel-modules \
+ u-boot \
+ u-boot-fw-utils \
+ openbmc-utils \
+ openbmc-gpio \
+ fan-ctrl \
+ rackmon \
+ watchdog-ctrl \
+ i2c-tools \
+ sensor-setup \
+ usb-console \
+ oob-nic \
+ lldp-util \
+ lmsensors-sensors \
+ wedge-eeprom \
+ sms-kcsd \
+ rest-api \
+ bottle \
+ ipmid \
+ po-eeprom \
+ bitbang \
+ ${PYTHON_PKGS} \
+ ${NTP_PKGS} \
+ iproute2 \
+ dhcp-client \
+ jbi \
+ flashrom \
+ cherryPy \
+ "
+
+IMAGE_FEATURES += " \
+ ssh-server-openssh \
+ tools-debug \
+ "
+
+DISTRO_FEATURES += " \
+ ext2 \
+ ipv6 \
+ nfs \
+ usbgadget \
+ usbhost \
+ "
diff --git a/meta-facebook/meta-wedge100/recipes-core/sysvinit/sysvinit-inittab_%.bbappend b/meta-facebook/meta-wedge100/recipes-core/sysvinit/sysvinit-inittab_%.bbappend
new file mode 100644
index 0000000..6d4deb3
--- /dev/null
+++ b/meta-facebook/meta-wedge100/recipes-core/sysvinit/sysvinit-inittab_%.bbappend
@@ -0,0 +1,5 @@
+# ttyS0 is UART5, connected through SYSCPLD, to debug board, if GPIOE0 is 1
+# ttyS1 is UART1, connected through SYSCPLD, to micro-server console, if GPIOE0 is 1
+# ttyS2 is UART3, connected to the front panel Console port
+# ttyS3 is UART4, connected through SYSCPLD, to rackmon RS485
+SERIAL_CONSOLES = "57600;ttyS0 9600;ttyS2"
OpenPOWER on IntegriCloud