[PATCH 3/6] utilities: kernelscan.sh: scan various directories for kernel error messages
Keng-Yu Lin
kengyu at canonical.com
Wed Nov 7 02:13:24 UTC 2012
On Sat, Nov 3, 2012 at 12:58 AM, Colin King <colin.king at canonical.com> wrote:
> From: Colin Ian King <colin.king at canonical.com>
>
> This is the initial script to scrap for ACPI related error messages in the
> kernel.
>
> Signed-off-by: Colin Ian King <colin.king at canonical.com>
> ---
> 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
> --
> 1.7.10.4
>
Acked-by: Keng-Yu Lin <kengyu at canonical.com>
More information about the fwts-devel
mailing list