summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorTian Fang <tfang@fb.com>2015-03-09 22:53:57 -0700
committerTian Fang <tfang@fb.com>2015-03-09 22:53:57 -0700
commit2a51b7c1c2165ddb188c511e192b75f0aa0fbead (patch)
treebb42aeac00a8b986c325cd70d5cca6c13bc0c23a /common
downloadast2050-yocto-openbmc-2a51b7c1c2165ddb188c511e192b75f0aa0fbead.zip
ast2050-yocto-openbmc-2a51b7c1c2165ddb188c511e192b75f0aa0fbead.tar.gz
Initial open source release of OpenBMC
Diffstat (limited to 'common')
-rw-r--r--common/recipes-connectivity/dhcp/dhcp_%.bbappend3
-rw-r--r--common/recipes-connectivity/dhcp/files/dhclient.conf52
-rw-r--r--common/recipes-connectivity/openssh/files/init160
-rw-r--r--common/recipes-connectivity/openssh/openssh_6.5%.bbappend3
-rw-r--r--common/recipes-core/base-files/base-files_%.bbappend30
-rw-r--r--common/recipes-core/i2c-tools/i2c-tools_3.1.1.bb38
-rw-r--r--common/recipes-core/init-ifupdown/files/init92
-rw-r--r--common/recipes-core/init-ifupdown/files/nfsroot2
-rw-r--r--common/recipes-core/init-ifupdown/init-ifupdown_%.bbappend2
-rw-r--r--common/recipes-core/packagegroups/packagegroup-core-tools-debug.bbappend6
-rw-r--r--common/recipes-core/udev/files/init5
-rw-r--r--common/recipes-core/udev/udev_%.bbappend2
-rwxr-xr-xcommon/recipes-core/watchdog-ctrl/watchdog-ctrl/watchdog_ctrl.sh44
-rw-r--r--common/recipes-core/watchdog-ctrl/watchdog-ctrl_0.1.bb33
-rw-r--r--common/recipes-rest/bottle/bottle_0.12.7.bb19
15 files changed, 491 insertions, 0 deletions
diff --git a/common/recipes-connectivity/dhcp/dhcp_%.bbappend b/common/recipes-connectivity/dhcp/dhcp_%.bbappend
new file mode 100644
index 0000000..6dc6962
--- /dev/null
+++ b/common/recipes-connectivity/dhcp/dhcp_%.bbappend
@@ -0,0 +1,3 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI += "file://dhclient.conf"
diff --git a/common/recipes-connectivity/dhcp/files/dhclient.conf b/common/recipes-connectivity/dhcp/files/dhclient.conf
new file mode 100644
index 0000000..8dea59b
--- /dev/null
+++ b/common/recipes-connectivity/dhcp/files/dhclient.conf
@@ -0,0 +1,52 @@
+# Configuration file for /sbin/dhclient, which is included in Debian's
+# dhcp3-client package.
+#
+# This is a sample configuration file for dhclient. See dhclient.conf's
+# man page for more information about the syntax of this file
+# and a more comprehensive list of the parameters understood by
+# dhclient.
+#
+# Normally, if the DHCP server provides reasonable information and does
+# not leave anything out (like the domain name, for example), then
+# few changes must be made to this file, if any.
+#
+
+#send host-name "andare.fugue.com";
+#send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
+#send dhcp-lease-time 3600;
+#supersede domain-name "fugue.com home.vix.com";
+#prepend domain-name-servers 127.0.0.1;
+request subnet-mask, broadcast-address, time-offset, routers,
+ domain-name, domain-name-servers, host-name,
+ netbios-name-servers, netbios-scope;
+#require subnet-mask, domain-name-servers;
+# 25 seconds (default 300s) to get the lease
+timeout 25;
+# if not, retry in 55 seconds (default 5m)
+retry 55;
+#reboot 10;
+#select-timeout 5;
+#initial-interval 2;
+#script "/etc/dhcp3/dhclient-script";
+#media "-link0 -link1 -link2", "link0 link1";
+#reject 192.33.137.209;
+
+#alias {
+# interface "eth0";
+# fixed-address 192.5.5.213;
+# option subnet-mask 255.255.255.255;
+#}
+
+#lease {
+# interface "eth0";
+# fixed-address 192.33.137.200;
+# medium "link0 link1";
+# option host-name "andare.swiftmedia.com";
+# option subnet-mask 255.255.255.0;
+# option broadcast-address 192.33.137.255;
+# option routers 192.33.137.250;
+# option domain-name-servers 127.0.0.1;
+# renew 2 2000/1/12 00:00:01;
+# rebind 2 2000/1/12 00:00:01;
+# expire 2 2000/1/12 00:00:01;
+#}
diff --git a/common/recipes-connectivity/openssh/files/init b/common/recipes-connectivity/openssh/files/init
new file mode 100644
index 0000000..e7484a7
--- /dev/null
+++ b/common/recipes-connectivity/openssh/files/init
@@ -0,0 +1,160 @@
+#! /bin/sh
+set -e
+
+# source function library
+. /etc/init.d/functions
+
+# /etc/init.d/ssh: start and stop the OpenBSD "secure shell" daemon
+
+test -x /usr/sbin/sshd || exit 0
+( /usr/sbin/sshd -\? 2>&1 | grep -q OpenSSH ) 2>/dev/null || exit 0
+
+# /etc/default/ssh may set SYSCONFDIR and SSHD_OPTS
+if test -f /etc/default/ssh; then
+ . /etc/default/ssh
+fi
+
+[ -z "$SYSCONFDIR" ] && SYSCONFDIR=/etc/ssh
+mkdir -p $SYSCONFDIR
+
+HOST_KEY_RSA=$SYSCONFDIR/ssh_host_rsa_key
+HOST_KEY_DSA=$SYSCONFDIR/ssh_host_dsa_key
+HOST_KEY_ECDSA=$SYSCONFDIR/ssh_host_ecdsa_key
+HOST_KEY_ED25519=$SYSCONFDIR/ssh_host_ed25519_key
+
+check_for_no_start() {
+ # forget it if we're trying to start, and /etc/ssh/sshd_not_to_be_run exists
+ if [ -e $SYSCONFDIR/sshd_not_to_be_run ]; then
+ echo "OpenBSD Secure Shell server not in use ($SYSCONFDIR/sshd_not_to_be_run)"
+ exit 0
+ fi
+}
+
+check_privsep_dir() {
+ # Create the PrivSep empty dir if necessary
+ if [ ! -d /var/run/sshd ]; then
+ mkdir /var/run/sshd
+ chmod 0755 /var/run/sshd
+ fi
+}
+
+check_config() {
+ /usr/sbin/sshd -t || exit 1
+}
+
+KEYFILES_DIR="/mnt/data/etc/ssh"
+
+prepare_keyfiles_dir() {
+ if [ ! -d "$KEYFILES_DIR" ]; then
+ # remove it in case someone create a file with the same name
+ rm -rf "$KEYFILES_DIR" > /dev/null 2>&1
+ mkdir -p "$KEYFILES_DIR"
+ fi
+}
+
+get_keyfile() {
+ filename=$(basename $1)
+ if [ -f "$KEYFILES_DIR/$filename" ]; then
+ rm -rf $1 > /dev/null 2>&1
+ ln -s "$KEYFILES_DIR/$filename" $1
+ fi
+}
+
+save_keyfile() {
+ filename=$(basename $1)
+ if [ -d "$KEYFILES_DIR" ]; then
+ mv -f $1 "$KEYFILES_DIR/$filename" > /dev/null 2>&1
+ ln -s "$KEYFILES_DIR/$filename" $1
+ fi
+}
+
+check_keys() {
+ # prepare for the permanent storage
+ prepare_keyfiles_dir
+ # create keys if necessary
+ get_keyfile $HOST_KEY_RSA
+ get_keyfile $HOST_KEY_RSA.pub
+ if [ ! -f $HOST_KEY_RSA ]; then
+ echo " generating ssh RSA key..."
+ ssh-keygen -q -f $HOST_KEY_RSA -N '' -t rsa
+ save_keyfile $HOST_KEY_RSA
+ save_keyfile $HOST_KEY_RSA.pub
+ fi
+
+ get_keyfile $HOST_KEY_ECDSA
+ get_keyfile $HOST_KEY_ECDSA.pub
+ if [ ! -f $HOST_KEY_ECDSA ]; then
+ echo " generating ssh ECDSA key..."
+ ssh-keygen -q -f $HOST_KEY_ECDSA -N '' -t ecdsa
+ save_keyfile $HOST_KEY_ECDSA
+ save_keyfile $HOST_KEY_ECDSA.pub
+ fi
+
+ get_keyfile $HOST_KEY_DSA
+ get_keyfile $HOST_KEY_DSA.pub
+ if [ ! -f $HOST_KEY_DSA ]; then
+ echo " generating ssh DSA key..."
+ ssh-keygen -q -f $HOST_KEY_DSA -N '' -t dsa
+ save_keyfile $HOST_KEY_DSA
+ save_keyfile $HOST_KEY_DSA.pub
+ fi
+
+ get_keyfile $HOST_KEY_ED25519
+ get_keyfile $HOST_KEY_ED25519.pub
+ if [ ! -f $HOST_KEY_ED25519 ]; then
+ echo " generating ssh ED25519 key..."
+ ssh-keygen -q -f $HOST_KEY_ED25519 -N '' -t ed25519
+ save_keyfile $HOST_KEY_ED25519
+ save_keyfile $HOST_KEY_ED25519.pub
+ fi
+}
+
+export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
+
+case "$1" in
+ start)
+ check_for_no_start
+ echo "Starting OpenBSD Secure Shell server: sshd"
+ check_keys
+ check_privsep_dir
+ start-stop-daemon -S -x /usr/sbin/sshd -- $SSHD_OPTS
+ echo "done."
+ ;;
+ stop)
+ echo -n "Stopping OpenBSD Secure Shell server: sshd"
+ start-stop-daemon -K -x /usr/sbin/sshd
+ echo "."
+ ;;
+
+ reload|force-reload)
+ check_for_no_start
+ check_keys
+ check_config
+ echo -n "Reloading OpenBSD Secure Shell server's configuration"
+ start-stop-daemon -K -s 1 -x /usr/sbin/sshd
+ echo "."
+ ;;
+
+ restart)
+ check_keys
+ check_config
+ echo -n "Restarting OpenBSD Secure Shell server: sshd"
+ start-stop-daemon -K --oknodo -x /usr/sbin/sshd
+ check_for_no_start
+ check_privsep_dir
+ sleep 2
+ start-stop-daemon -S -x /usr/sbin/sshd -- $SSHD_OPTS
+ echo "."
+ ;;
+
+ status)
+ status /usr/sbin/sshd
+ exit $?
+ ;;
+
+ *)
+ echo "Usage: /etc/init.d/ssh {start|stop|status|reload|force-reload|restart}"
+ exit 1
+esac
+
+exit 0
diff --git a/common/recipes-connectivity/openssh/openssh_6.5%.bbappend b/common/recipes-connectivity/openssh/openssh_6.5%.bbappend
new file mode 100644
index 0000000..60b164b
--- /dev/null
+++ b/common/recipes-connectivity/openssh/openssh_6.5%.bbappend
@@ -0,0 +1,3 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI += "file://init"
diff --git a/common/recipes-core/base-files/base-files_%.bbappend b/common/recipes-core/base-files/base-files_%.bbappend
new file mode 100644
index 0000000..340ad2c
--- /dev/null
+++ b/common/recipes-core/base-files/base-files_%.bbappend
@@ -0,0 +1,30 @@
+BASEFILESISSUEINSTALL = "do_install_bmc_issue"
+
+DISTRO_HOSTNAME = "bmc"
+
+do_install_bmc_issue () {
+ if [ "${DISTRO_HOSTNAME}" != "" ]; then
+ echo ${DISTRO_HOSTNAME} > ${D}${sysconfdir}/hostname
+ else
+ echo ${MACHINE} > ${D}${sysconfdir}/hostname
+ fi
+
+ # found out the source dir
+ dir=$(pwd)
+ while [ -n "$dir" -a "$dir" != "/" -a ! -d "$dir/meta-openbmc/.git" ]; do
+ dir=$(dirname $dir)
+ done
+
+ if [ -d "$dir/meta-aspeed/.git" ]; then
+ srcdir="$dir/meta-aspeed"
+ srcdir_git="${srcdir}/.git"
+ version=$(git --git-dir=${srcdir_git} --work-tree=${srcdir} describe --dirty 2> /dev/null)
+ else
+ version=""
+ fi
+
+ echo "Open BMC Release ${version} \\n \\l" > ${D}${sysconfdir}/issue
+ echo >> ${D}${sysconfdir}/issue
+ echo "Open BMC Release ${version} %h" > ${D}${sysconfdir}/issue.net
+ echo >> ${D}${sysconfdir}/issue.net
+}
diff --git a/common/recipes-core/i2c-tools/i2c-tools_3.1.1.bb b/common/recipes-core/i2c-tools/i2c-tools_3.1.1.bb
new file mode 100644
index 0000000..6743e3f
--- /dev/null
+++ b/common/recipes-core/i2c-tools/i2c-tools_3.1.1.bb
@@ -0,0 +1,38 @@
+DESCRIPTION = "i2c tools"
+SECTION = "base"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
+
+SRCREV = "6235"
+SRC_URI = "svn://lm-sensors.org/svn/i2c-tools/branches/;protocol=http;module=i2c-tools-3.1 \
+ "
+
+S = "${WORKDIR}/i2c-tools-3.1"
+
+i2ctools = "i2cdetect \
+ i2cdump \
+ i2cget \
+ i2cset \
+ "
+
+eepromtools = "eepromer \
+ eeprom \
+ eeprog \
+ "
+
+do_compile() {
+ make -C eepromer
+ make
+}
+
+do_install() {
+ mkdir -p ${D}/${bindir}
+ for f in ${i2ctools}; do
+ install -m 755 tools/$f ${D}/${bindir}/$f
+ done
+ for f in ${eepromtools}; do
+ install -m 755 eepromer/$f ${D}/${bindir}/$f
+ done
+}
+
+FILES_${PN} = "${bindir}"
diff --git a/common/recipes-core/init-ifupdown/files/init b/common/recipes-core/init-ifupdown/files/init
new file mode 100644
index 0000000..8e15896
--- /dev/null
+++ b/common/recipes-core/init-ifupdown/files/init
@@ -0,0 +1,92 @@
+#!/bin/sh -e
+### BEGIN INIT INFO
+# Provides: networking
+# Required-Start: mountvirtfs $local_fs
+# Required-Stop: $local_fs
+# Should-Start: ifupdown
+# Should-Stop: ifupdown
+# Default-Start: S
+# Default-Stop: 0 6
+# Short-Description: Raise network interfaces.
+### END INIT INFO
+
+PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
+
+[ -x /sbin/ifup ] || exit 0
+
+check_network_file_systems() {
+ [ -e /proc/mounts ] || return 0
+
+ if [ -e /etc/iscsi/iscsi.initramfs ]; then
+ echo "not deconfiguring network interfaces: iSCSI root is mounted."
+ exit 0
+ fi
+
+ exec 9<&0 < /proc/mounts
+ while read DEV MTPT FSTYPE REST; do
+ case $DEV in
+ /dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*)
+ echo "not deconfiguring network interfaces: network devices still mounted."
+ exit 0
+ ;;
+ esac
+ case $FSTYPE in
+ nfs|nfs4|smbfs|ncp|ncpfs|cifs|coda|ocfs2|gfs|pvfs|pvfs2|fuse.httpfs|fuse.curlftpfs)
+ echo "not deconfiguring network interfaces: network file systems still mounted."
+ exit 0
+ ;;
+ esac
+ done
+ exec 0<&9 9<&-
+}
+
+check_network_swap() {
+ [ -e /proc/swaps ] || return 0
+
+ exec 9<&0 < /proc/swaps
+ while read DEV MTPT FSTYPE REST; do
+ case $DEV in
+ /dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*)
+ echo "not deconfiguring network interfaces: network swap still mounted."
+ exit 0
+ ;;
+ esac
+ done
+ exec 0<&9 9<&-
+}
+
+case "$1" in
+start)
+ echo -n "Configuring network interfaces... "
+ sysctl -e -p /etc/sysctl.conf >/dev/null 2>&1
+ ifup -a
+ echo "done."
+ ;;
+
+stop)
+ # tfang, disabled them because 'exec < /proc/mounts' hangs
+ # could be kernel issue as regular file is ok
+ #check_network_file_systems
+ #check_network_swap
+
+ echo -n "Deconfiguring network interfaces... "
+ ifdown -a
+ echo "done."
+ ;;
+
+force-reload|restart)
+ echo "Running $0 $1 is deprecated because it may not enable again some interfaces"
+ echo "Reconfiguring network interfaces... "
+ ifdown -a || true
+ ifup -a
+ echo "done."
+ ;;
+
+*)
+ echo "Usage: /etc/init.d/networking {start|stop}"
+ exit 1
+ ;;
+esac
+
+exit 0
+
diff --git a/common/recipes-core/init-ifupdown/files/nfsroot b/common/recipes-core/init-ifupdown/files/nfsroot
new file mode 100644
index 0000000..b667cbb
--- /dev/null
+++ b/common/recipes-core/init-ifupdown/files/nfsroot
@@ -0,0 +1,2 @@
+exit 0
+
diff --git a/common/recipes-core/init-ifupdown/init-ifupdown_%.bbappend b/common/recipes-core/init-ifupdown/init-ifupdown_%.bbappend
new file mode 100644
index 0000000..7d74521
--- /dev/null
+++ b/common/recipes-core/init-ifupdown/init-ifupdown_%.bbappend
@@ -0,0 +1,2 @@
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
diff --git a/common/recipes-core/packagegroups/packagegroup-core-tools-debug.bbappend b/common/recipes-core/packagegroups/packagegroup-core-tools-debug.bbappend
new file mode 100644
index 0000000..65f85de
--- /dev/null
+++ b/common/recipes-core/packagegroups/packagegroup-core-tools-debug.bbappend
@@ -0,0 +1,6 @@
+# eglibc-mtrace is a Perl script analyzing the mtrace output data.
+# It is small but depends on perl, which increases image size by 1.35M.
+# Remove it explicitly. When we need to use it, we can always copy the
+# mtrace results out and run mtrace utility outside of BMC.
+MTRACE = ""
+MTRACE_libc-glibc = ""
diff --git a/common/recipes-core/udev/files/init b/common/recipes-core/udev/files/init
new file mode 100644
index 0000000..a428665
--- /dev/null
+++ b/common/recipes-core/udev/files/init
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+echo "UDEV: no devtmpfs support. Skip udev"
+
+exit 0
diff --git a/common/recipes-core/udev/udev_%.bbappend b/common/recipes-core/udev/udev_%.bbappend
new file mode 100644
index 0000000..7d74521
--- /dev/null
+++ b/common/recipes-core/udev/udev_%.bbappend
@@ -0,0 +1,2 @@
+
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
diff --git a/common/recipes-core/watchdog-ctrl/watchdog-ctrl/watchdog_ctrl.sh b/common/recipes-core/watchdog-ctrl/watchdog-ctrl/watchdog_ctrl.sh
new file mode 100755
index 0000000..9c4f2cc
--- /dev/null
+++ b/common/recipes-core/watchdog-ctrl/watchdog-ctrl/watchdog_ctrl.sh
@@ -0,0 +1,44 @@
+#!/bin/sh
+#
+# 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
+#
+usage() {
+ echo "Usage: $0 <on | off>" >&2
+}
+
+set -e
+
+if [ "$#" -ne 1 ]; then
+ usage
+ exit 1
+fi
+
+case "$1" in
+"on")
+ echo "Enabling watchdog. Note: this does not start the watchdog!"
+ echo "x" > /dev/watchdog
+ ;;
+"off")
+ echo "Disabling watchdog."
+ echo "X" > /dev/watchdog
+ ;;
+*)
+ usage
+ exit 1
+ ;;
+esac
diff --git a/common/recipes-core/watchdog-ctrl/watchdog-ctrl_0.1.bb b/common/recipes-core/watchdog-ctrl/watchdog-ctrl_0.1.bb
new file mode 100644
index 0000000..00cf0f9
--- /dev/null
+++ b/common/recipes-core/watchdog-ctrl/watchdog-ctrl_0.1.bb
@@ -0,0 +1,33 @@
+# Copyright 2014-present Facebook. All Rights Reserved.
+SUMMARY = "Watchdog control utilities."
+DESCRIPTION = "The utilities to control system watchdog."
+SECTION = "base"
+PR = "r1"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://watchdog_ctrl.sh;beginline=5;endline=18;md5=0b1ee7d6f844d472fa306b2fee2167e0"
+
+SRC_URI = "file://watchdog_ctrl.sh \
+ "
+
+S = "${WORKDIR}"
+
+binfiles = "watchdog_ctrl.sh"
+
+pkgdir = "watchdog_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 ${dst}/${f}
+ ln -s ../fbpackages/${pkgdir}/${f} ${bin}/${f}
+ done
+}
+
+FBPACKAGEDIR = "${prefix}/local/fbpackages"
+
+FILES_${PN} = "${FBPACKAGEDIR}/watchdog_ctrl ${prefix}/local/bin ${sysconfdir} "
+INHIBIT_PACKAGE_DEBUG_SPLIT = "1"
+INHIBIT_PACKAGE_STRIP = "1"
diff --git a/common/recipes-rest/bottle/bottle_0.12.7.bb b/common/recipes-rest/bottle/bottle_0.12.7.bb
new file mode 100644
index 0000000..25bd547
--- /dev/null
+++ b/common/recipes-rest/bottle/bottle_0.12.7.bb
@@ -0,0 +1,19 @@
+DESCRIPTION = "Bottle Web Framework"
+SECTION = "base"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://bottle.py;beginline=1;endline=14;md5=15d806194a048a43e3a7f1d4c7574fe6"
+
+SRC_URI = "https://pypi.python.org/packages/source/b/bottle/${PN}-${PV}.tar.gz"
+SRC_URI[md5sum] = "ed0b83c9dbbdbde784e7c652d61c59f4"
+SRC_URI[sha256sum] = "e3ea2191f06ca51af45bf6ca41ed2d1b2d809ceda0876466879fe205be7b2073"
+
+S = "${WORKDIR}/${PN}-${PV}"
+
+dst="/usr/lib/python2.7"
+
+do_install() {
+ mkdir -p ${D}/${dst}
+ install -m 755 bottle.py ${D}/${dst}
+}
+
+FILES_${PN} = "${dst}"
OpenPOWER on IntegriCloud