Category:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
0
1
2
3
4
5
6
7
8
9
Position:IcFull.com » IC Electronic information » Category: k

IC Electronic information

kbuild system - compiled into the kernel and compiled as modules, the difference between

In Electronic Infomation Category: k | on December 13,2010

Code is compiled into the kernel and AD7226KR datasheet and compiled as a module in the code what is the difference?

seen from the modules code is the same. Entry functions are MODULE_init (fun), but the code will compile the macro conditions in the module_init () in compiled into the kernel and AD7226KR price and compiled as modules, replace the case of different code.

include / linux / init.h the shows

# ifndef MODULE

...

# define module_init (x) ; __initcall (x);

...

# else / * MODULE * /

...

/ * Each module must use one module_init (), or one no_module_init * /

# define module_init (initfn) \ < / P>

static inline initcall_t __inittest (void) \

{ return initfn;} \

int init_module (void) __attribute__ ((alias (# initfn)) );

...

# endif

when the code is compiled into a module, MODULE macros are defined, otherwise not. Because in / usr / src / linux / Makefile can see

336 MODFLAGS =-DMODULE

337 CFLAGS_MODULE ; = $ (MODFLAGS)

338 AFLAGS_MODULE = $ (MODFLAGS)

export of these two variables has been a global variable. So now you know, when compiled as a module, the macro will MODULE.

by the following code to know

# define __initcall (fn) device_initcall (fn)

# define device_initcall (fn) __define_initcall ("6", fn)

085 # define __define_initcall (level, fn) \

086 static initcall_t __initcall_ # # fn __attribute_used__ \

087 __attribute__ ((__section__ ( ". initcall" level ". init"))) = fn

the former is actually compiled into the kernel. initcall6.init this section

in < P> arch/i386/kernel/vmlinux.lds.S can know:

083 __initcall_start =.;

084. initcall.init: AT ( ADDR (. initcall.init) - LOAD_OFFSET) {

085 * (. initcall1.init)

086 * (. initcall2.init)

087 * (. initcall3.init )

088 * (. initcall4.init)

089 * (. initcall5.init)

090 * (. initcall6.init)

091 * (. initcall7.init)

092}

093 __initcall_end =.;

arch/i386/kernel/vmlinux.lds.S

. initcall6.init Shi . initcall.init part of the

execution order:

start_kernel-> rest_init

system starts in the rest_init created in the init kernel thread

init-> do_basic_setup-> do_initcalls

do_initcalls in the Council to. initcall.init again in the implementation of the function followed by

for (call = __initcall_start; call

...

( * call )();

...

}

then performed module_init (fn) function

AD7226KR datasheetAD7226KR suppliersAD7226KR Price

Related technical information

All right reserved:icfull.com © 2010-2016 Certificate