Re: [pp] kbuild: asm-offsets generalized
From: Sam Ravnborg
Date: Sun Apr 01 2007 - 16:41:34 EST
On Fri, Feb 16, 2007 at 04:59:29PM +0100, Oleg Verych wrote:
> > >
> > > Proposition will follow.
> > >
> > []
> >
> > [patch proposition] kbuild: lguest with private asm-offsets
> []
> > * needs "asm-offsets magic demystified, generalized".
> []
>
> [patch proposition] kbuild: asm-offsets generalized
>
> * scripts/mkCconstants:
> - asm-offsets magic demystified, generalized,
>
> * (hopefully) more readable sed scripts,
>
> * top Kbuild may be updated...
>
> * file needs `chmod u+x`, i don't know, how it's done in patch(1).
Can I ask you to provide a complete patch that replaces the current
asm-offset stuff with your more readable script version.
Name the script: mkasm-offset.sh to make a direct connection to
the resulting .h file name.
Thanks,
Sam
>
> pp-by: Oleg Verych
> ---
> scripts/mkCconstants | 50 +++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 50 insertions(+), 0 deletions(-)
>
> Index: linux-2.6.20/scripts/mkCconstants
> ===================================================================
> --- /dev/null 1970-01-01 00:00:00.000000000 +0000
> +++ linux-2.6.20/scripts/mkCconstants 2007-02-16 15:33:51.696900750 +0100
> @@ -0,0 +1,50 @@
> +#!/bin/sh
> +
> +# Input file, where values of interest are stored is produced by
> +# `cmd_cc_s_c'. It yields calculation of constants, needed in
> +# assembler modules. Output is a suitable header file.
> +#
> +# $1 - input filename;
> +# $2 - output filename;
> +# $3 - header file format: "normal" (default), "mips".
> +
> +set -e
> +
> +[ -z "$1" ] || [ -z "$2" ] && exit 1
> +
> +case $3 in
> + mips)
> + SED_SCRIPT='
> +/^@@@/{
> +s/^@@@//;
> +s/ \#.*\$//;
> +p;
> +}'
> + ;;
> + normal | *)
> + SED_SCRIPT='
> +/^->/{
> +s:^->\([^ ]*\) [\$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:;
> +s:->::;
> +p;
> +}'
> + ;;
> +esac
> +
> +cat << "EOF" > $2
> +#ifndef __ASM_OFFSETS_H__
> +#define __ASM_OFFSETS_H__
> +
> +/*
> + * This file was generated by scripts/mkCconstants
> + */
> +
> +EOF
> +
> +sed -ne "$SED_SCRIPT" $1 >> $2
> +
> +cat << "EOF" >> $2
> +
> +#endif
> +
> +EOF
>
> --
> -o--=O`C info emacs : not found
> #oo'L O info make : not found
> <___=E M man gcc : not found
-
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/