Re: CRC calculation in Module.symvers

From: Michal Marek
Date: Wed Sep 07 2011 - 12:00:59 EST


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
--
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/