Lines Matching +full:foo +full:- +full:supply
5 This document describes how to build an out-of-tree kernel module.
11 --- 2.1 Command Syntax
12 --- 2.2 Options
13 --- 2.3 Targets
14 --- 2.4 Building Separate Files
16 --- 3.1 Shared Makefile
17 --- 3.2 Separate Kbuild file and Makefile
18 --- 3.3 Binary Blobs
19 --- 3.4 Building Multiple Modules
21 --- 4.1 Kernel Includes
22 --- 4.2 Single Subdirectory
23 --- 4.3 Several Subdirectories
25 --- 5.1 INSTALL_MOD_PATH
26 --- 5.2 INSTALL_MOD_DIR
28 --- 6.1 Symbols From the Kernel (vmlinux + modules)
29 --- 6.2 Symbols and External Modules
30 --- 6.3 Symbols From Another External Module
32 --- 7.1 Testing for CONFIG_FOO_BAR
42 both in-tree and out-of-tree is provided. The method for building
44 out-of-tree.
47 in building out-of-tree (or "external") modules. The author of an
48 external module should supply a makefile that hides most of the
77 $ make -C <path_to_kernel_src> M=$PWD
84 $ make -C /lib/modules/`uname -r`/build M=$PWD
89 $ make -C /lib/modules/`uname -r`/build M=$PWD modules_install
96 make -C $KDIR M=$PWD
98 -C $KDIR
115 make -C $KDIR M=$PWD [target]
147 Example (The module foo.ko, consist of bar.o and baz.o)::
149 make -C $KDIR M=$PWD bar.lst
150 make -C $KDIR M=$PWD baz.o
151 make -C $KDIR M=$PWD foo.ko
152 make -C $KDIR M=$PWD ./
164 obj-m := <module_name>.o
172 <module_name>-y := <src1>.o <src2>.o ...
186 -------------------
197 --> filename: Makefile
200 obj-m := 8123.o
201 8123-y := 8123_if.o 8123_pci.o 8123_bin.o
205 KDIR ?= /lib/modules/`uname -r`/build
208 $(MAKE) -C $(KDIR) M=$$PWD
225 -------------------------------------
234 --> filename: Kbuild
235 obj-m := 8123.o
236 8123-y := 8123_if.o 8123_pci.o 8123_bin.o
238 --> filename: Makefile
239 KDIR ?= /lib/modules/`uname -r`/build
242 $(MAKE) -C $(KDIR) M=$$PWD
257 --> filename: Kbuild
258 obj-m := 8123.o
259 8123-y := 8123_if.o 8123_pci.o 8123_bin.o
261 --> filename: Makefile
268 KDIR ?= /lib/modules/`uname -r`/build
271 $(MAKE) -C $(KDIR) M=$$PWD
285 ----------------
298 8123-y := 8123_if.o 8123_pci.o 8123_bin.o
308 file. For example, if you wanted to build two modules, foo.ko
311 obj-m := foo.o bar.o
312 foo-y := <foo_srcs>
313 bar-y := <bar_srcs>
338 -------------------
349 -----------------------
354 directory, use either ccflags-y or CFLAGS_<filename>.o.
360 --> filename: Kbuild
361 obj-m := 8123.o
363 ccflags-y := -Iinclude
364 8123-y := 8123_if.o 8123_pci.o 8123_bin.o
366 Note that in the assignment there is no space between -I and
371 --------------------------
389 --> filename: Kbuild
390 obj-m := complex.o
391 complex-y := src/complex_main.o
392 complex-y += src/hal/hardwareif.o
394 ccflags-y := -I$(src)/include
395 ccflags-y += -I$(src)/src/hal/include
404 root of the kernel tree (the argument to "-C") and therefore an
423 --------------------
434 calling "make." This has effect when installing both in-tree
435 and out-of-tree modules.
438 -------------------
446 $ make INSTALL_MOD_DIR=gandalf -C $KDIR \
465 -----------------------------------------------
476 0xe1cc2a05 usb_stor_suspend drivers/usb/storage/usb-storage EXPORT_SYMBOL_GPL USB_STORAGE
490 --------------------------------
500 ----------------------------------------
507 NOTE: The method with a top-level kbuild file is recommended
510 Use a top-level kbuild file
511 If you have two modules, foo.ko and bar.ko, where
512 foo.ko needs symbols from bar.ko, you can use a
513 common top-level kbuild file so both modules are
517 ./foo/ <= contains foo.ko
520 The top-level kbuild file would then look like::
523 obj-m := foo/ bar/
527 $ make -C $KDIR M=$PWD
533 If it is impractical to add a top-level kbuild file,
544 ------------------------------
552 obj-$(CONFIG_EXT2_FS) += ext2.o
554 ext2-y := balloc.o bitmap.o dir.o
555 ext2-$(CONFIG_EXT2_FS_XATTR) += xattr.o
561 in-tree modules when testing for `CONFIG_` definitions.