linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* CRC calculation in Module.symvers
@ 2011-09-07  5:58 Shakthi Kannan
  2011-09-07 12:54 ` Michal Marek
  2011-09-07 22:46 ` Paul E. McKenney
  0 siblings, 2 replies; 6+ messages in thread
From: Shakthi Kannan @ 2011-09-07  5:58 UTC (permalink / raw)
  To: linux-kernel

Greetings!

I would like to know as to:

1. How the CRC is computed for an exported symbol present in
Module.symvers file, and
2. Given a kernel .c file, how can I obtain the CRC checksums for a symbol.

For linux-3.0.2 (example), I compiled with CONFIG_MODVERSIONS=y, and
running 'make' built vmlinux, and generated the Module.symvers file. I
believe genksyms is used to create the Module.symvers file?

I had referred the "Kernel Symbols and CONFIG_MODVERSIONS"
documentation [1] written by Mark McLoughlin. I tried the following in
the top-level kernel sources:

 $ gcc -E -D__GENKSYMS__ -DCONFIG_MODVERSIONS -DEXPORT_SYMTAB
crypto/api.c -I/tmp/linux-3.0.2/include
-I/tmp/linux-3.0.2/arch/x86/include | ./scripts/genksyms/genksyms

and I get the following error output:

=== Output ===

/tmp/linux-3.0.2/include/linux/jiffies.h:43:42: error: division by zero in #if
In file included from /tmp/linux-3.0.2/include/linux/tracepoint.h:19:0,
                from /tmp/linux-3.0.2/include/linux/module.h:18,
                from crypto/api.c:22:
/tmp/linux-3.0.2/include/linux/rcupdate.h:160:2: error: #error
"Unknown RCU implementation specified to kernel configuration"
In file included from /tmp/linux-3.0.2/include/linux/module.h:21:0,
                from crypto/api.c:22:
/tmp/linux-3.0.2/arch/x86/include/asm/module.h:59:2: error: #error
unknown processor family

=== End ===

The documentation for genksyms is old, and now there is no -k option?

Appreciate any inputs in this regard,

Thanks!

SK

[1] Kernel Symbols and CONFIG_MODVERSIONS.
http://www.skynet.ie/~mark/pub/symbols.txt

-- 
Shakthi Kannan
http://www.shakthimaan.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: CRC calculation in Module.symvers
  2011-09-07  5:58 CRC calculation in Module.symvers Shakthi Kannan
@ 2011-09-07 12:54 ` Michal Marek
  2011-09-09  4:50   ` Shakthi Kannan
  2011-09-07 22:46 ` Paul E. McKenney
  1 sibling, 1 reply; 6+ messages in thread
From: Michal Marek @ 2011-09-07 12:54 UTC (permalink / raw)
  To: Shakthi Kannan; +Cc: linux-kernel

On 7.9.2011 07:58, Shakthi Kannan wrote:
> 1. How the CRC is computed for an exported symbol present in
> Module.symvers file, and

The symbol type is recursively expanded and a checksum is computed from
the expanded


> 2. Given a kernel .c file, how can I obtain the CRC checksums for a symbol.
> 
> For linux-3.0.2 (example), I compiled with CONFIG_MODVERSIONS=y, and
> running 'make' built vmlinux, and generated the Module.symvers file. I
> believe genksyms is used to create the Module.symvers file?
> 
> I had referred the "Kernel Symbols and CONFIG_MODVERSIONS"
> documentation [1] written by Mark McLoughlin. I tried the following in
> the top-level kernel sources:
> 
>  $ gcc -E -D__GENKSYMS__ -DCONFIG_MODVERSIONS -DEXPORT_SYMTAB
> crypto/api.c -I/tmp/linux-3.0.2/include
> -I/tmp/linux-3.0.2/arch/x86/include | ./scripts/genksyms/genksyms

You need at least -include include/generated/autoconf.h, but the easies
would be

$ make V=1 crypto/api.symtypes

this will generate a file with the symbol expansions. And if you copy
the commandline without the >/dev/null redirection, you'll see the
calculated checksums on standard output.

Michal

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: CRC calculation in Module.symvers
  2011-09-07  5:58 CRC calculation in Module.symvers Shakthi Kannan
  2011-09-07 12:54 ` Michal Marek
@ 2011-09-07 22:46 ` Paul E. McKenney
  1 sibling, 0 replies; 6+ messages in thread
From: Paul E. McKenney @ 2011-09-07 22:46 UTC (permalink / raw)
  To: Shakthi Kannan; +Cc: linux-kernel

On Wed, Sep 07, 2011 at 11:28:46AM +0530, Shakthi Kannan wrote:
> Greetings!
> 
> I would like to know as to:
> 
> 1. How the CRC is computed for an exported symbol present in
> Module.symvers file, and
> 2. Given a kernel .c file, how can I obtain the CRC checksums for a symbol.
> 
> For linux-3.0.2 (example), I compiled with CONFIG_MODVERSIONS=y, and
> running 'make' built vmlinux, and generated the Module.symvers file. I
> believe genksyms is used to create the Module.symvers file?
> 
> I had referred the "Kernel Symbols and CONFIG_MODVERSIONS"
> documentation [1] written by Mark McLoughlin. I tried the following in
> the top-level kernel sources:
> 
>  $ gcc -E -D__GENKSYMS__ -DCONFIG_MODVERSIONS -DEXPORT_SYMTAB
> crypto/api.c -I/tmp/linux-3.0.2/include
> -I/tmp/linux-3.0.2/arch/x86/include | ./scripts/genksyms/genksyms
> 
> and I get the following error output:
> 
> === Output ===
> 
> /tmp/linux-3.0.2/include/linux/jiffies.h:43:42: error: division by zero in #if
> In file included from /tmp/linux-3.0.2/include/linux/tracepoint.h:19:0,
>                 from /tmp/linux-3.0.2/include/linux/module.h:18,
>                 from crypto/api.c:22:
> /tmp/linux-3.0.2/include/linux/rcupdate.h:160:2: error: #error
> "Unknown RCU implementation specified to kernel configuration"

The above error message is emitted if none of CONFIG_TINY_RCU,
CONFIG_TINY_PREEMPT_RCU, CONFIG_TREE_RCU, and CONFIG_TREE_PREEMPT_RCU
is defined.  Given that these four are in a "choice", I suspect that
you have broken the kernel build pretty impressively.

							Thanx, Paul

> In file included from /tmp/linux-3.0.2/include/linux/module.h:21:0,
>                 from crypto/api.c:22:
> /tmp/linux-3.0.2/arch/x86/include/asm/module.h:59:2: error: #error
> unknown processor family
> 
> === End ===
> 
> The documentation for genksyms is old, and now there is no -k option?
> 
> Appreciate any inputs in this regard,
> 
> Thanks!
> 
> SK
> 
> [1] Kernel Symbols and CONFIG_MODVERSIONS.
> http://www.skynet.ie/~mark/pub/symbols.txt
> 
> -- 
> Shakthi Kannan
> http://www.shakthimaan.com
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: CRC calculation in Module.symvers
  2011-09-07 12:54 ` Michal Marek
@ 2011-09-09  4:50   ` Shakthi Kannan
  2011-09-09 13:17     ` Michal Marek
  0 siblings, 1 reply; 6+ messages in thread
From: Shakthi Kannan @ 2011-09-09  4:50 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kernel

Hi Michal,

--- On Wed, Sep 7, 2011 at 6:24 PM, Michal Marek <mmarek@suse.cz> wrote:
| You need at least -include include/generated/autoconf.h
\--

I tried using:

$  gcc -E -D__GENKSYMS__ -DCONFIG_MODVERSIONS -DEXPORT_SYMTAB
crypto/api.c -I/tmp/linux-3.0.2/include
-I/tmp/linux-3.0.2/arch/x86/include -include
include/generated/autoconf.h  | ./scripts/genksyms/genksyms

and it returned the checksums like:

  __crc_crypto_alg_list = 0x86fb488e ;
  __crc_crypto_alg_sem = 0xb7865a4f ;
  __crc_crypto_chain = 0x2f947450 ;
  __crc_crypto_mod_get = 0x67cda209 ;
  ...

But, in Module.symvers there is only crypto_mod_get and its checksum
is 0x3286637f which is different from the one listed above.

---
| $ make V=1 crypto/api.symtypes
|
| this will generate a file with the symbol expansions.
\--

This generated the api.symtypes file.

---
| And if you copy
| the commandline without the >/dev/null redirection, you'll see the
| calculated checksums on standard output.
\--

Sorry, I didn't understand. Can you elaborate on what needs to be done here?

Thanks for your reply,

SK

-- 
Shakthi Kannan
http://www.shakthimaan.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: CRC calculation in Module.symvers
  2011-09-09  4:50   ` Shakthi Kannan
@ 2011-09-09 13:17     ` Michal Marek
  2011-09-10  2:55       ` Shakthi Kannan
  0 siblings, 1 reply; 6+ messages in thread
From: Michal Marek @ 2011-09-09 13:17 UTC (permalink / raw)
  To: Shakthi Kannan; +Cc: linux-kernel

On 9.9.2011 06:50, Shakthi Kannan wrote:
> --- On Wed, Sep 7, 2011 at 6:24 PM, Michal Marek <mmarek@suse.cz> wrote:
> ---
> | And if you copy
> | the commandline without the >/dev/null redirection, you'll see the
> | calculated checksums on standard output.
> \--
> 
> Sorry, I didn't understand. Can you elaborate on what needs to be done here?

Copy the gcc ... | genksyms ... commandline printed by make V=1
crypto/api.symtypes.

Michal

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: CRC calculation in Module.symvers
  2011-09-09 13:17     ` Michal Marek
@ 2011-09-10  2:55       ` Shakthi Kannan
  0 siblings, 0 replies; 6+ messages in thread
From: Shakthi Kannan @ 2011-09-10  2:55 UTC (permalink / raw)
  To: Michal Marek; +Cc: linux-kernel

Hi,

--- On Fri, Sep 9, 2011 at 6:47 PM, Michal Marek <mmarek@suse.cz> wrote:
| Copy the gcc ... | genksyms ... commandline printed by make V=1
| crypto/api.symtypes.
\--

I ran:

$  gcc -E -D__GENKSYMS__ -Wp,-MD,crypto/.api.symtypes.d  -nostdinc
-isystem /usr/lib/gcc/i686-redhat-linux/4.5.1/include
-I/tmp/linux-3.0.2/arch/x86/include -Iarch/x86/include/generated
-Iinclude  -include include/generated/autoconf.h -D__KERNEL__ -Wall
-Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing
-fno-common -Werror-implicit-function-declaration -Wno-format-security
-fno-delete-null-pointer-checks -Os -m32 -msoft-float -mregparm=3
-freg-struct-return -mpreferred-stack-boundary=2 -march=i686
-mtune=generic -Wa,-mtune=generic32 -ffreestanding -fstack-protector
-DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1
-DCONFIG_AS_CFI_SECTIONS=1 -pipe -Wno-sign-compare
-fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow
-Wframe-larger-than=1024 -Wno-unused-but-set-variable
-fno-omit-frame-pointer -fno-optimize-sibling-calls -g -pg
-Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow
-fconserve-stack -DCC_HAVE_ASM_GOTO    -D"KBUILD_STR(s)=#s"
-D"KBUILD_BASENAME=KBUILD_STR(api)"
-D"KBUILD_MODNAME=KBUILD_STR(api)" crypto/api.c |
scripts/genksyms/genksyms

and it printed the checksums.

Thanks for your help!

SK

-- 
Shakthi Kannan
http://www.shakthimaan.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-09-10  2:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-07  5:58 CRC calculation in Module.symvers Shakthi Kannan
2011-09-07 12:54 ` Michal Marek
2011-09-09  4:50   ` Shakthi Kannan
2011-09-09 13:17     ` Michal Marek
2011-09-10  2:55       ` Shakthi Kannan
2011-09-07 22:46 ` Paul E. McKenney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).