Re: [PATCH] markup_oops.pl: add options to improve cross-sompilation environments

From: AmÃrico Wang
Date: Tue Jan 26 2010 - 02:53:39 EST


On Tue, Jan 26, 2010 at 3:38 PM, Hui Zhu <hui.zhu@xxxxxxxxxxxxx> wrote:
> AmÃrico Wang:
>>
>> On Tue, Jan 26, 2010 at 11:11 AM, Hui Zhu <hui.zhu@xxxxxxxxxxxxx> wrote:
>>>
>>> Sorry guys, the prev mail still have some format trouble. ÂI send a new
>>> mail
>>> for it.
>>> +}
>>> +
>>> +if ($vmlinux_name ne "") {
>>> + Â Â Â $vmlinux_name = $ARGV[$#ARGV];
>>> +}
>>
>> Why not using the Perl module 'Getopt' to do this?
>>
> Hi AmÃrico,
>
> Thanks for remind me about it. ÂThe following patch use Getopt.
>
> The markup_oops.pl have 3 troubles to support cross-compiler environment:
> 1. ÂIt use objdump directly.
> 2. ÂIt use modinfo to get the message of module.
> 3. ÂIt use hex function that cannot support 64-bit number in 32-bit arch.
>
> This patch add 3 options to markup_oops.pl:
> 1. -c CROSS_COMPILE Â Â Specify the prefix used for toolchain.
> 2. -m MODULE_DIRNAME Â ÂSpecify the module directory name.
> 3. Change hex function to Math::BigInt->from_hex.
>
> After this patch, parse the x8664 oops in x86, we can:
> cat amd64m | perl ~/kernel/tmp/m.pl -c /home/teawater/kernel/bin/x8664- -m
> ./e.ko vmlinux
>
> Thanks,
> Hui
>
> Signed-off-by: Hui Zhu <teawater@xxxxxxxxx>
> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Cc: Arjan van de Ven <arjan@xxxxxxxxxxxxxxx>
> Cc: Sam Ravnborg <sam@xxxxxxxxxxxx>
> Cc: ozan@xxxxxxxxxxxxx
> Cc: Matthew Wilcox <willy@xxxxxxxxxxxxxxx>
>
> ---
> scripts/markup_oops.pl | Â 45 +++++++++++++++++++++++++++++++++++----------
> 1 file changed, 35 insertions(+), 10 deletions(-)
>
> --- a/scripts/markup_oops.pl
> +++ b/scripts/markup_oops.pl
> @@ -2,6 +2,7 @@
>
> use File::Basename;
> use Math::BigInt;
> +use Getopt::Long;
>
> # Copyright 2008, Intel Corporation
> #
> @@ -15,7 +16,17 @@ use Math::BigInt;
> # Â Â Â Arjan van de Ven <arjan@xxxxxxxxxxxxxxx>
>
>
> -my $vmlinux_name = $ARGV[0];
> +my $cross_compile = "";
> +my $vmlinux_name = "";
> +my $modulefile = "";
> +
> +# Get options
> +Getopt::Long::GetOptions(
> + Â Â Â 'cross_compile|c=s' Â Â => \$cross_compile,


Please make it "cross-compile", because underline is not common
in command line, so "--cross_compile" is worse than "--cross-compile".


> + Â Â Â 'modulefile|m=s' Â Â Â Â=> \$modulefile,


"module" should be enough to express the meaning, I think.


> + Â Â Â 'help|h' Â Â Â Â Â Â Â Â=> \&usage,
> +);
> +my $vmlinux_name = $ARGV[$#ARGV];
> if (!defined($vmlinux_name)) {
> Â Â Â Âmy $kerver = `uname -r`;
> Â Â Â Âchomp($kerver);
> @@ -23,6 +34,7 @@ if (!defined($vmlinux_name)) {
> Â Â Â Âprint "No vmlinux specified, assuming $vmlinux_name\n";
> }
> my $filename = $vmlinux_name;
> +


Adding this empty line probably is not what you really want.

> #
> # Step 1: Parse the oops to find the EIP value
> #

{snip}

>
> +sub usage {
> + Â Â Â print <<EOT;
> +Usage:
> + Âdmesg | perl $0 [OPTION] [VMLINUX]
> +
> +OPTION:
> + Â-c, -cross_compile CROSS_COMPILE Â Â Specify the prefix used for
> toolchain.
> + Â-m, -modulefile MODULE_DIRNAME Â Â Â Specify the module directory name.
> + Â-h, -help              ÂHelp.
> +EOT
> + Â Â Â exit;
> +}
> +

GNU style is preferred here, please use "--foo" instead of "-foo".

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/