mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-24 10:14:55 +00:00
Add option to dev_debug_vboot to clean up after running
Also provide a bit more output, stop and tell us if it's not running on a Chrome OS BIOS. Change-Id: I0e6a5680ec050b3f4d0a5c7adc87ca2441ba6d06 BUG=chromium-os:8236 TEST=manual From a root shell, run "dev_debug_vboot --cleanup", then look in /tmp/dev_debug/. You should see only the file noisy.log Review URL: http://codereview.chromium.org/4108012
This commit is contained in:
@@ -3,9 +3,26 @@
|
|||||||
# Use of this source code is governed by a BSD-style license that can be
|
# Use of this source code is governed by a BSD-style license that can be
|
||||||
# found in the LICENSE file.
|
# found in the LICENSE file.
|
||||||
#
|
#
|
||||||
|
# Usage: dev_debug_vboot [ --cleanup | DIRECTORY ]
|
||||||
|
#
|
||||||
|
# This extracts some useful debugging information about verified boot. A short
|
||||||
|
# summary is printed on stdout, more detailed information and working files are
|
||||||
|
# left in a log directory.
|
||||||
|
#
|
||||||
|
|
||||||
|
TMPDIR=/tmp/debug_vboot
|
||||||
LOGFILE=noisy.log
|
LOGFILE=noisy.log
|
||||||
|
|
||||||
|
# TODO(wfrichar): Need to support ARM. The hard disk path is likely different.
|
||||||
|
HD=/dev/sda
|
||||||
|
ACPI=/sys/devices/platform/chromeos_acpi
|
||||||
|
|
||||||
|
cleanup() {
|
||||||
|
if [ -n "${CLEANUP}" ]; then
|
||||||
|
find "${TMPDIR}" -type f -not -name "${LOGFILE}" -exec rm {} ";"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
die() {
|
die() {
|
||||||
echo "$*" 1>&2
|
echo "$*" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
@@ -40,17 +57,33 @@ result() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Optional directory name containing "bios.rom" and "*kern*.blob" files. If not
|
require_chromeos_bios() {
|
||||||
# provided, we'll attempt to extract them ourselves.
|
log cgpt show "${HD}"
|
||||||
if [ -d "$1" ]; then
|
log rootdev -s
|
||||||
TMPDIR="$1"
|
if [ ! -e "${ACPI}/HWID" ]; then
|
||||||
[ -d ${TMPDIR} ] || die "${TMPDIR} doesn't exist"
|
info "Not running Chrome OS BIOS, no further information available"
|
||||||
USE_EXISTING=yes
|
exit 0
|
||||||
else
|
fi
|
||||||
TMPDIR=/tmp/debug_vboot
|
# including /dev/null just to get final "\n"
|
||||||
[ -d ${TMPDIR} ] || mkdir -p ${TMPDIR}
|
log head "${ACPI}"/*ID "${ACPI}"/BINF* "${ACPI}"/CHSW /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
# Here we go...
|
||||||
|
umask 022
|
||||||
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
# Parse args
|
||||||
|
if [ -n "$1" ]; then
|
||||||
|
if [ "$1" = "--cleanup" ]; then
|
||||||
|
CLEANUP=1
|
||||||
|
else
|
||||||
|
TMPDIR="$1"
|
||||||
|
[ -d ${TMPDIR} ] || die "${TMPDIR} doesn't exist"
|
||||||
|
USE_EXISTING=yes
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
[ -d ${TMPDIR} ] || mkdir -p ${TMPDIR} || exit 1
|
||||||
cd ${TMPDIR}
|
cd ${TMPDIR}
|
||||||
echo "$0 $*" > "$LOGFILE"
|
echo "$0 $*" > "$LOGFILE"
|
||||||
log date
|
log date
|
||||||
@@ -62,12 +95,12 @@ BIOS=bios.rom
|
|||||||
if [ -n "$USE_EXISTING" ]; then
|
if [ -n "$USE_EXISTING" ]; then
|
||||||
info "Using images in $(pwd)/"
|
info "Using images in $(pwd)/"
|
||||||
else
|
else
|
||||||
|
require_chromeos_bios
|
||||||
info "Extracting BIOS image from flash..."
|
info "Extracting BIOS image from flash..."
|
||||||
log flashrom -r ${BIOS}
|
log flashrom -r ${BIOS}
|
||||||
|
|
||||||
# FIXME: support ARM
|
HD_KERN_A="${HD}2"
|
||||||
HD_KERN_A=/dev/sda2
|
HD_KERN_B="${HD}4"
|
||||||
HD_KERN_B=/dev/sda4
|
|
||||||
tmp=$(rootdev -s -d)2
|
tmp=$(rootdev -s -d)2
|
||||||
if [ "$tmp" != "$HD_KERN_A" ]; then
|
if [ "$tmp" != "$HD_KERN_A" ]; then
|
||||||
USB_KERN_A="$tmp"
|
USB_KERN_A="$tmp"
|
||||||
|
|||||||
Reference in New Issue
Block a user