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

From: AmÃrico Wang
Date: Mon Jan 25 2010 - 22:06:01 EST


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.
>
> 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 | Â 71
> ++++++++++++++++++++++++++++++++++++++++++-------
> 1 file changed, 61 insertions(+), 10 deletions(-)
>
> --- a/scripts/markup_oops.pl
> +++ b/scripts/markup_oops.pl
> @@ -15,8 +15,46 @@ use Math::BigInt;
> # Â Â Â Arjan van de Ven <arjan@xxxxxxxxxxxxxxx>
>
>
> -my $vmlinux_name = $ARGV[0];
> -if (!defined($vmlinux_name)) {
> +my $cross_compile = "";
> +my $vmlinux_name = "";
> +my $modulefile = "";
> +
> +# Get options
> +my $option = 0;
> +for (my $i = 0; $i <= $#ARGV; $i++) {
> + Â Â Â if ($option == 0) {
> + Â Â Â Â Â Â Â if ($ARGV[$i] eq "-c") {
> + Â Â Â Â Â Â Â Â Â Â Â $option = 1;
> + Â Â Â Â Â Â Â }
> + Â Â Â Â Â Â Â elsif ($ARGV[$i] eq "-m") {
> + Â Â Â Â Â Â Â Â Â Â Â $option = 2;
> + Â Â Â Â Â Â Â }
> + Â Â Â Â Â Â Â elsif ($ARGV[$i] eq "-h") {
> + Â Â Â Â Â Â Â Â Â Â Â usage();
> + Â Â Â Â Â Â Â Â Â Â Â exit;
> + Â Â Â Â Â Â Â }
> + Â Â Â Â Â Â Â elsif ($i == $#ARGV) {
> + Â Â Â Â Â Â Â Â Â Â Â $vmlinux_name = $ARGV[$i];
> + Â Â Â Â Â Â Â }
> + Â Â Â Â Â Â Â else {
> + Â Â Â Â Â Â Â Â Â Â Â usage();
> + Â Â Â Â Â Â Â Â Â Â Â exit;
> + Â Â Â Â Â Â Â }
> + Â Â Â }
> + Â Â Â elsif ($option == 1) {
> + Â Â Â Â Â Â Â $cross_compile = $ARGV[$i];
> + Â Â Â Â Â Â Â $option = 0;
> + Â Â Â }
> + Â Â Â elsif ($option == 2) {
> + Â Â Â Â Â Â Â $modulefile = $ARGV[$i];
> + Â Â Â Â Â Â Â $option = 0;
> + Â Â Â }
> +}
> +
> +if ($vmlinux_name ne "") {
> + Â Â Â $vmlinux_name = $ARGV[$#ARGV];
> +}

Why not using the Perl module 'Getopt' to do this?
--
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/