From patchwork Fri Nov 2 16:58:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [3/6] utilities: kernelscan.sh: scan various directories for kernel error messages X-Patchwork-Submitter: Colin King X-Patchwork-Id: 196603 Message-Id: <1351875517-19128-4-git-send-email-colin.king@canonical.com> To: fwts-devel@lists.ubuntu.com Date: Fri, 2 Nov 2012 16:58:34 +0000 From: Colin King List-Id: Firmware Test Suite Development From: Colin Ian King This is the initial script to scrap for ACPI related error messages in the kernel. Signed-off-by: Colin Ian King Acked-by: Keng-Yu Lin Acked-by: Alex Hung --- src/utilities/kernelscan.sh | 57 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 src/utilities/kernelscan.sh diff --git a/src/utilities/kernelscan.sh b/src/utilities/kernelscan.sh new file mode 100644 index 0000000..ed402d9 --- /dev/null +++ b/src/utilities/kernelscan.sh @@ -0,0 +1,57 @@ +#!/bin/bash +# +# Copyright (C) 2010-2012 Canonical +# +# This program 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; either version 2 +# of the License, or (at your option) any later version. +# +# 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; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# + +KERNELSCAN=./kernelscan +TMP=/tmp/kernelscan_$$.txt + +if [ $# -lt 1 ]; then + echo "Usage: $0 path-to-kernel-source" + exit 1 +fi + +src=$1 + +if [ ! -d $1 ]; then + echo "Path '$1' not found" + exit 1 +fi + +scan_source_file() +{ + $KERNELSCAN < $1 -E | gcc -E - | $KERNELSCAN -P > $TMP + if [ $(stat -c%s $TMP) -gt 0 ]; then + echo "Source: $1" + cat $TMP + fi + rm $TMP +} + +scan_source_tree() +{ + tree=$1 + + echo "Scanning $tree" + for I in $(find $tree -name "*.c") + do + scan_source_file $I + done +} + +scan_source_tree $src/drivers/acpi +scan_source_tree $src/arch/x86/kernel/acpi