-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
minipack: Add crashdump to receive me log. (#81)
Summary: 1. When BMC receive 0xEB error number, it will send crashdump request to get me log. Pull Request resolved: facebookexternal/openbmc.accton#81 Test Plan: 1. Make a fake error as CATERR_B(0XEB), and check whether "crashdump_scm.tar.gz" file is existing in /mnt/data. Test on Minipack:pass Reviewed By: mikechoifb fbshipit-source-id: 99318c58e
- Loading branch information
1 parent
a67d2cb
commit dcb1830
Showing
12 changed files
with
4,236 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
meta-facebook/meta-minipack/recipes-minipack/crashdump/crashdump_0.1.bb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Copyright 2018-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 | ||
SUMMARY = "Crashdump utility" | ||
DESCRIPTION = "Util for generating crashdumps" | ||
SECTION = "base" | ||
PR = "r1" | ||
LICENSE = "GPLv2" | ||
LIC_FILES_CHKSUM = "file://COPYING;md5=eb723b61539feef013de476e68b5c50a" | ||
|
||
SRC_URI = "file://dump.sh \ | ||
file://crashdump_coreid \ | ||
file://crashdump_msr \ | ||
file://autodump.sh \ | ||
file://COPYING \ | ||
" | ||
|
||
S = "${WORKDIR}" | ||
|
||
binfiles += "dump.sh \ | ||
autodump.sh \ | ||
" | ||
|
||
pkgdir = "crashdump" | ||
RDEPENDS_${PN} += "bash" | ||
|
||
do_install() { | ||
dst="${D}/usr/local/fbpackages/${pkgdir}" | ||
bin="${D}/usr/local/bin" | ||
install -d $dst | ||
install -d $bin | ||
install -m 644 crashdump_coreid ${dst}/crashdump_coreid | ||
install -m 644 crashdump_msr ${dst}/crashdump_msr | ||
for f in ${binfiles}; do | ||
install -m 755 $f ${dst}/$f | ||
ln -snf ../fbpackages/${pkgdir}/$f ${bin}/$f | ||
done | ||
} | ||
|
||
FBPACKAGEDIR = "${prefix}/local/fbpackages" | ||
|
||
FILES_${PN} = "${FBPACKAGEDIR}/crashdump ${prefix}/local/bin " | ||
|
||
INHIBIT_PACKAGE_DEBUG_SPLIT = "1" | ||
INHIBIT_PACKAGE_STRIP = "1" |
340 changes: 340 additions & 0 deletions
340
meta-facebook/meta-minipack/recipes-minipack/crashdump/files/COPYING
Large diffs are not rendered by default.
Oops, something went wrong.
59 changes: 59 additions & 0 deletions
59
meta-facebook/meta-minipack/recipes-minipack/crashdump/files/autodump.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#!/bin/bash | ||
|
||
SLOT_NAME=$1 | ||
|
||
case $SLOT_NAME in | ||
scm) | ||
SLOT_NUM=1 | ||
;; | ||
*) | ||
N=${0##*/} | ||
N=${N#[SK]??} | ||
echo "Usage: $N {scm}" | ||
exit 1 | ||
;; | ||
esac | ||
|
||
# File format autodump<slot_id>.pid (See pal_is_crashdump_ongoing() | ||
# function definition) | ||
PID_FILE="/var/run/autodump$SLOT_NUM.pid" | ||
|
||
# check if auto crashdump is already running | ||
if [ -f $PID_FILE ]; then | ||
echo "Another auto crashdump for $SLOT_NAME is runnung" | ||
exit 1 | ||
else | ||
touch $PID_FILE | ||
fi | ||
|
||
# Set crashdump timestamp | ||
sys_runtime=$(awk '{print $1}' /proc/uptime) | ||
sys_runtime=$(printf "%0.f" $sys_runtime) | ||
echo $((sys_runtime+630)) > /tmp/cache_store/fru${SLOT_NUM}_crashdump | ||
|
||
DUMP_SCRIPT="/usr/local/bin/dump.sh" | ||
CRASHDUMP_FILE="/mnt/data/crashdump_$SLOT_NAME" | ||
CRASHDUMP_LOG_ARCHIVE="/mnt/data/crashdump_$SLOT_NAME.tar.gz" | ||
|
||
echo "Auto Dump for $SLOT_NAME Started" | ||
|
||
#HEADER LINE for the dump | ||
$DUMP_SCRIPT "time" > $CRASHDUMP_FILE | ||
#COREID dump | ||
$DUMP_SCRIPT $SLOT_NAME "coreid" >> $CRASHDUMP_FILE | ||
#MSR dump | ||
$DUMP_SCRIPT $SLOT_NAME "msr" >> $CRASHDUMP_FILE | ||
# Sensors & sensor thresholds | ||
echo "Sensor history at dump:" >> $CRASHDUMP_FILE 2>&1 | ||
$DUMP_SCRIPT $SLOT_NAME "sensors" >> $CRASHDUMP_FILE | ||
echo "Sensor threshold at dump:" >> $CRASHDUMP_FILE 2>&1 | ||
$DUMP_SCRIPT $SLOT_NAME "threshold" >> $CRASHDUMP_FILE | ||
|
||
tar zcf $CRASHDUMP_LOG_ARCHIVE -C `dirname $CRASHDUMP_FILE` `basename $CRASHDUMP_FILE` && \ | ||
rm -rf $CRASHDUMP_FILE && \ | ||
logger -t "ipmid" -p daemon.crit "Crashdump for $SLOT_NAME is generated at $CRASHDUMP_LOG_ARCHIVE" | ||
|
||
echo "Auto Dump for $SLOT_NAME Completed" | ||
|
||
rm $PID_FILE | ||
exit 0 |
18 changes: 18 additions & 0 deletions
18
meta-facebook/meta-minipack/recipes-minipack/crashdump/files/crashdump_coreid
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
echo | ||
echo CPU COREID DUMP: | ||
echo ================ | ||
echo | ||
echo < CPUID Read > | ||
0xb8 0x40 0x57 0x01 0x00 0x30 0x05 0x05 0xa1 0x00 0x00 0x00 0x00 | ||
echo < CPU Microcode Update Revision Read > | ||
0xb8 0x40 0x57 0x01 0x00 0x30 0x05 0x05 0xa1 0x00 0x00 0x04 0x00 | ||
echo < MCA ERROR SOURCE LOG Read -- The socket which MCA_ERR_SRC_LOG[30]=0 is the socket that asserted IERR first > | ||
0xb8 0x40 0x57 0x01 0x00 0x30 0x05 0x05 0xa1 0x00 0x00 0x05 0x00 | ||
echo ******************************************************** | ||
echo * IERRLOGGINGREG * | ||
echo ******************************************************** | ||
0xb8 0x44 0x57 0x01 0x00 0x40 0xa4 0x00 0x04 0x00 0x03 | ||
echo ******************************************************** | ||
echo * MCERRLOGGINGREG * | ||
echo ******************************************************** | ||
0xb8 0x44 0x57 0x01 0x00 0x40 0xa8 0x00 0x04 0x00 0x03 |
Oops, something went wrong.