diff options
Diffstat (limited to 'meta-raptor/meta-asus/recipes-core')
15 files changed, 458 insertions, 0 deletions
diff --git a/meta-raptor/meta-asus/recipes-core/base-files/base-files/fstab b/meta-raptor/meta-asus/recipes-core/base-files/base-files/fstab new file mode 100644 index 0000000..42787f3 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-core/base-files/base-files/fstab @@ -0,0 +1,7 @@ +/dev/root / auto defaults 1 1 +proc /proc proc defaults 0 0 +devpts /dev/pts devpts mode=0620,gid=5 0 0 +usbdevfs /proc/bus/usb usbdevfs noauto 0 0 +tmpfs /run tmpfs mode=0755,nodev,nosuid,strictatime 0 0 +tmpfs /var/volatile tmpfs defaults 0 0 +tmpfs /tmp tmpfs defaults,size=8M 0 0 diff --git a/meta-raptor/meta-asus/recipes-core/base-files/base-files_3.0.14.bbappend b/meta-raptor/meta-asus/recipes-core/base-files/base-files_3.0.14.bbappend new file mode 100644 index 0000000..72d991c --- /dev/null +++ b/meta-raptor/meta-asus/recipes-core/base-files/base-files_3.0.14.bbappend @@ -0,0 +1 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" diff --git a/meta-raptor/meta-asus/recipes-core/busybox/busybox/busybox.cfg b/meta-raptor/meta-asus/recipes-core/busybox/busybox/busybox.cfg new file mode 100644 index 0000000..66da117 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-core/busybox/busybox/busybox.cfg @@ -0,0 +1,18 @@ +CONFIG_SH_MATH_SUPPORT_64=y +CONFIG_DEVMEM=y +CONFIG_LSUSB=y +CONFIG_FEATURE_PS_ADDITIONAL_COLUMNS=y +CONFIG_RX=y +CONFIG_FLASHCP=y +CONFIG_FLASH_LOCK=y +CONFIG_FLASH_UNLOCK=y +CONFIG_FLASH_ERASEALL=y +CONFIG_TRACEROUTE6=y +CONFIG_VCONFIG=y +# we use the standalone ip util +CONFIG_IP=n +# use dhclient, as udhcpc will flush all v6 link local addresses during renew +CONFIG_FEATURE_IFUPDOWN_EXTERNAL_DHCP=y +CONFIG_UDHCPD=n +CONFIG_UDHCPC=n +CONFIG_UDHCPC6=n diff --git a/meta-raptor/meta-asus/recipes-core/busybox/busybox/syslog-startup.conf b/meta-raptor/meta-asus/recipes-core/busybox/busybox/syslog-startup.conf new file mode 100644 index 0000000..53d7297 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-core/busybox/busybox/syslog-startup.conf @@ -0,0 +1,13 @@ +# This configuration file is used by the busybox syslog init script, +# /etc/init.d/syslog[.busybox] to set syslog configuration at start time. + +DESTINATION=file # log destinations (buffer file remote) +LOGFILE=/var/log/messages # where to log (file) +REMOTE=loghost:514 # where to log (syslog remote) +REDUCE=no # reduce-size logging +DROPDUPLICATES=no # whether to drop duplicate log entries +ROTATESIZE=128 # rotate log if grown beyond X [kByte] +ROTATEGENS=1 # keep X generations of rotated logs +BUFFERSIZE=64 # size of circular buffer [kByte] +FOREGROUND=no # run in foreground (don't use!) +#LOGLEVEL=5 # local log level (between 1 and 8) diff --git a/meta-raptor/meta-asus/recipes-core/busybox/busybox/syslog.conf b/meta-raptor/meta-asus/recipes-core/busybox/busybox/syslog.conf new file mode 100644 index 0000000..817a9a9 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-core/busybox/busybox/syslog.conf @@ -0,0 +1,5 @@ +# /etc/syslog.conf Configuration file for busybox's syslogd utility +# Send emergency messages to the console +*.emerg /dev/console +# Store everything else +*.* /var/log/messages diff --git a/meta-raptor/meta-asus/recipes-core/busybox/busybox_%.bbappend b/meta-raptor/meta-asus/recipes-core/busybox/busybox_%.bbappend new file mode 100644 index 0000000..501d2a1 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-core/busybox/busybox_%.bbappend @@ -0,0 +1,7 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" + +SRC_URI += " \ + file://busybox.cfg \ + file://syslog.conf \ + file://syslog-startup.conf \ + " diff --git a/meta-raptor/meta-asus/recipes-core/fan-ctrl/fan-ctrl/get_fan_speed.sh b/meta-raptor/meta-asus/recipes-core/fan-ctrl/fan-ctrl/get_fan_speed.sh new file mode 100755 index 0000000..4955582 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-core/fan-ctrl/fan-ctrl/get_fan_speed.sh @@ -0,0 +1,60 @@ +#!/bin/sh +# +# Copyright 2017 Raptor Engineering, LLC +# 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..8)]" >&2 +} + +FAN_DIR=/sys/class/i2c-adapter/i2c-1/1-002f + +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 6 7 8" +elif [ "$#" -eq 1 ]; then + if [ $1 -gt 8 ]; 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-raptor/meta-asus/recipes-core/fan-ctrl/fan-ctrl/init_pwm.sh b/meta-raptor/meta-asus/recipes-core/fan-ctrl/fan-ctrl/init_pwm.sh new file mode 100755 index 0000000..5804598 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-core/fan-ctrl/fan-ctrl/init_pwm.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# +# Copyright 2017 Raptor Engineering, LLC +# Copyright 2004-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 +# +PWM_DIR=/sys/class/i2c-adapter/i2c-1/1-002f + +set -e + +# On ASUS boards, there are up to 8 fans connected. +# Each fan has one PWM input and 1 tachometer output. +# For each fan, set the type, and set initial speed to 100% +for pwm in 1 2 3 4 5 6 7 8; do + echo 1 > $PWM_DIR/pwm${pwm}_enable + echo 255 > $PWM_DIR/pwm${pwm} +done diff --git a/meta-raptor/meta-asus/recipes-core/fan-ctrl/fan-ctrl/set_fan_speed.sh b/meta-raptor/meta-asus/recipes-core/fan-ctrl/fan-ctrl/set_fan_speed.sh new file mode 100755 index 0000000..99be901 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-core/fan-ctrl/fan-ctrl/set_fan_speed.sh @@ -0,0 +1,47 @@ +#!/bin/sh +# +# Copyright 2017 Raptor Engineering, LLC +# 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..8)> " >&2 +} + +FAN_DIR=/sys/class/i2c-adapter/i2c-1/1-002f + +set -e + +if [ "$#" -ne 2 ] && [ "$#" -ne 1 ]; then + usage + exit 1 +fi + +if [ "$#" -eq 1 ]; then + FANS="1 2 3 4 5 6 7 8" +else + FANS="$2" +fi + +# Convert the percentage to our 1/256th unit (0-255). +unit=$(( ( $1 * 255 ) / 100 )) + +for fan in $FANS; do + pwm="${FAN_DIR}/pwm${fan}" + echo "$unit" > $pwm + echo "Successfully set fan ${fan} speed to $1%" +done diff --git a/meta-raptor/meta-asus/recipes-core/fan-ctrl/fan-ctrl/setup-fan.sh b/meta-raptor/meta-asus/recipes-core/fan-ctrl/fan-ctrl/setup-fan.sh new file mode 100644 index 0000000..2b2e902 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-core/fan-ctrl/fan-ctrl/setup-fan.sh @@ -0,0 +1,38 @@ +#!/bin/sh +# +# Copyright 2017 Raptor Engineering, LLC +# 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... " +rmmod w83795 || true +/usr/local/bin/platform_sensor_init +modprobe w83795 force_w83795=1,0x2f +/usr/local/bin/init_pwm.sh +/usr/local/bin/set_fan_speed.sh 50 +/usr/local/bin/fand +echo "done." diff --git a/meta-raptor/meta-asus/recipes-core/fan-ctrl/fan-ctrl_0.1.bbappend b/meta-raptor/meta-asus/recipes-core/fan-ctrl/fan-ctrl_0.1.bbappend new file mode 100644 index 0000000..b6f0ae1 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-core/fan-ctrl/fan-ctrl_0.1.bbappend @@ -0,0 +1,65 @@ +# Copyright 2017-present Raptor Engineering. 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://init_pwm.sh \ + file://setup-fan.sh \ + " + +S = "${WORKDIR}" + +binfiles = " \ + get_fan_speed.sh \ + set_fan_speed.sh \ + init_pwm.sh \ + fand \ + platform_sensor_init \ + " + +CXXFLAGS_prepend = "-DCONFIG_ASUS " + +pkgdir = "fan_ctrl" + +do_install() { + dst="${D}/usr/local/fbpackages/${pkgdir}" + bin="${D}/usr/local/bin" + install -d $dst + install -d $bin + for f in ${binfiles}; do + install -m 755 $f ${bin}/$f + done + for f in ${otherfiles}; do + install -m 644 $f ${dst}/$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 . +} + +FBPACKAGEDIR = "${prefix}/local/fbpackages" + +FILES_${PN} = "${FBPACKAGEDIR}/fan_ctrl ${prefix}/local/bin ${sysconfdir} " + +# Inhibit complaints about .debug directories for the fand binary: + +INHIBIT_PACKAGE_DEBUG_SPLIT = "1" +INHIBIT_PACKAGE_STRIP = "1" diff --git a/meta-raptor/meta-asus/recipes-core/images/asus-image.bb b/meta-raptor/meta-asus/recipes-core/images/asus-image.bb new file mode 100644 index 0000000..b623f38 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-core/images/asus-image.bb @@ -0,0 +1,106 @@ +inherit asus_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 += "squashfs" + +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 \ + watchdog-ctrl \ + i2c-tools \ + sensor-setup \ + lldp-util \ + lmsensors-sensors \ + sms-kcsd \ + rest-api \ + bottle \ + ipmid \ + po-eeprom \ + bitbang \ + ${PYTHON_PKGS} \ + ${NTP_PKGS} \ + iproute2 \ + dhcp-client \ + jbi \ + flashrom \ + cherryPy \ + screen \ + " + +IMAGE_FEATURES += " \ + ssh-server-openssh \ + " + +DISTRO_FEATURES += " \ + ext2 \ + nfs \ + usbgadget \ + " + +# IPv6 deactivated due to lack of memory. If you need IPv6 please deactivate IPv4 +# DISTRO_FEATURES += " ipv6" +disable_ipv6() { + rm -f ${IMAGE_ROOTFS}/etc/network/if-up.d/dhcpv6_* +} +ROOTFS_POSTPROCESS_COMMAND += "disable_ipv6;" + +# Flash space is limited and PIP will not be run +# However, it does not appear there is a way to prevent ensurepip from being installed, +# so simply delete it before the rootfs is packaged / compressed... +# Same goes for the various Python module test suites... +# ...and tutorial PDFs... +remove_spurious_files() { + rm -rf ${IMAGE_ROOTFS}/usr/lib/python2.7/ensurepip + rm -rf ${IMAGE_ROOTFS}/usr/lib/python2.7/ctypes/test + rm -rf ${IMAGE_ROOTFS}/usr/lib/python2.7/email/test + rm -rf ${IMAGE_ROOTFS}/usr/lib/python2.7/json/tests + rm -rf ${IMAGE_ROOTFS}/usr/lib/python2.7/site-packages/cherrypy/test + rm -rf ${IMAGE_ROOTFS}/usr/share/cherrypy/tutorial/ +} + +ROOTFS_POSTPROCESS_COMMAND += "remove_spurious_files;" + +# Our root filesystem is read-only, so some directories need to be created before the +# rootfs is flashed onto the system +create_missing_directories() { + mkdir ${IMAGE_ROOTFS}/mnt/data +} + +ROOTFS_POSTPROCESS_COMMAND += "create_missing_directories;" diff --git a/meta-raptor/meta-asus/recipes-core/initscripts/initscripts/mountall.sh b/meta-raptor/meta-asus/recipes-core/initscripts/initscripts/mountall.sh new file mode 100755 index 0000000..68c20ef --- /dev/null +++ b/meta-raptor/meta-asus/recipes-core/initscripts/initscripts/mountall.sh @@ -0,0 +1,57 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: mountall +# Required-Start: mountvirtfs +# Required-Stop: +# Default-Start: S +# Default-Stop: +# Short-Description: Mount all filesystems. +# Description: +### END INIT INFO + +. /etc/default/rcS + +# +# Mount local filesystems in /etc/fstab. For some reason, people +# might want to mount "proc" several times, and mount -v complains +# about this. So we mount "proc" filesystems without -v. +# +test "$VERBOSE" != no && echo "Mounting local filesystems..." +mount -at nonfs,nosmbfs,noncpfs 2>/dev/null +mount /tmp + +# Create unionfs + +mkdir /tmp/unionfs +mkdir /tmp/unionfs/dev +mkdir /tmp/unionfs/etc +mkdir /tmp/unionfs/var +mkdir /tmp/unionfs/media + +umount /dev/pts + +mount -t unionfs -o dirs=/tmp/unionfs/dev=rw:/dev=ro none /dev +mount -t unionfs -o dirs=/tmp/unionfs/etc=rw:/etc=ro none /etc +mount -t unionfs -o dirs=/tmp/unionfs/var=rw:/var=ro none /var +mount -t unionfs -o dirs=/tmp/unionfs/media=rw:/media=ro none /media + +mount -t devpts devpts /dev/pts + +# +# We might have mounted something over /dev, see if /dev/initctl is there. +# +if test ! -p /dev/initctl +then + rm -f /dev/initctl + mknod -m 600 /dev/initctl p +fi +kill -USR1 1 + +# +# Execute swapon command again, in case we want to swap to +# a file on a now mounted filesystem. +# +swapon -a 2> /dev/null + +: exit 0 + diff --git a/meta-raptor/meta-asus/recipes-core/initscripts/initscripts_1.0.bbappend b/meta-raptor/meta-asus/recipes-core/initscripts/initscripts_1.0.bbappend new file mode 100644 index 0000000..9652309 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-core/initscripts/initscripts_1.0.bbappend @@ -0,0 +1 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
\ No newline at end of file diff --git a/meta-raptor/meta-asus/recipes-core/sysvinit/sysvinit-inittab_%.bbappend b/meta-raptor/meta-asus/recipes-core/sysvinit/sysvinit-inittab_%.bbappend new file mode 100644 index 0000000..7d17499 --- /dev/null +++ b/meta-raptor/meta-asus/recipes-core/sysvinit/sysvinit-inittab_%.bbappend @@ -0,0 +1,2 @@ +# ttyS1 is UART1, connected to on-board console debug port +SERIAL_CONSOLES = "38400;ttyS1" |