mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-24 02:05:01 +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
|
||||
# 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
|
||||
|
||||
# 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() {
|
||||
echo "$*" 1>&2
|
||||
exit 1
|
||||
@@ -40,17 +57,33 @@ result() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Optional directory name containing "bios.rom" and "*kern*.blob" files. If not
|
||||
# provided, we'll attempt to extract them ourselves.
|
||||
if [ -d "$1" ]; then
|
||||
TMPDIR="$1"
|
||||
[ -d ${TMPDIR} ] || die "${TMPDIR} doesn't exist"
|
||||
USE_EXISTING=yes
|
||||
else
|
||||
TMPDIR=/tmp/debug_vboot
|
||||
[ -d ${TMPDIR} ] || mkdir -p ${TMPDIR}
|
||||
require_chromeos_bios() {
|
||||
log cgpt show "${HD}"
|
||||
log rootdev -s
|
||||
if [ ! -e "${ACPI}/HWID" ]; then
|
||||
info "Not running Chrome OS BIOS, no further information available"
|
||||
exit 0
|
||||
fi
|
||||
# including /dev/null just to get final "\n"
|
||||
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
|
||||
|
||||
[ -d ${TMPDIR} ] || mkdir -p ${TMPDIR} || exit 1
|
||||
cd ${TMPDIR}
|
||||
echo "$0 $*" > "$LOGFILE"
|
||||
log date
|
||||
@@ -62,12 +95,12 @@ BIOS=bios.rom
|
||||
if [ -n "$USE_EXISTING" ]; then
|
||||
info "Using images in $(pwd)/"
|
||||
else
|
||||
require_chromeos_bios
|
||||
info "Extracting BIOS image from flash..."
|
||||
log flashrom -r ${BIOS}
|
||||
|
||||
# FIXME: support ARM
|
||||
HD_KERN_A=/dev/sda2
|
||||
HD_KERN_B=/dev/sda4
|
||||
HD_KERN_A="${HD}2"
|
||||
HD_KERN_B="${HD}4"
|
||||
tmp=$(rootdev -s -d)2
|
||||
if [ "$tmp" != "$HD_KERN_A" ]; then
|
||||
USB_KERN_A="$tmp"
|
||||
|
||||
Reference in New Issue
Block a user