Lines Matching +full:foo +full:- +full:supply

5 This document describes how to build an out-of-tree kernel module.
13 both in-tree and out-of-tree is provided. The method for building
15 out-of-tree.
18 in building out-of-tree (or "external") modules. The author of an
19 external module should supply a makefile that hides most of the
44 --------------
48 $ make -C <path_to_kernel_dir> M=$PWD
55 $ make -C /lib/modules/`uname -r`/build M=$PWD
60 $ make -C /lib/modules/`uname -r`/build M=$PWD modules_install
62 Starting from Linux 6.13, you can use the -f option instead of -C. This
66 $ make -f /lib/modules/`uname -r`/build/Makefile M=$PWD
69 -------
78 make -C $KDIR M=$PWD [MO=$BUILD_DIR]
80 -C $KDIR
96 -------
101 make -C $KDIR M=$PWD [target]
128 -----------------------
134 Example (The module foo.ko, consist of bar.o and baz.o)::
136 make -C $KDIR M=$PWD bar.lst
137 make -C $KDIR M=$PWD baz.o
138 make -C $KDIR M=$PWD foo.ko
139 make -C $KDIR M=$PWD ./
151 obj-m := <module_name>.o
159 <module_name>-y := <src1>.o <src2>.o ...
172 ---------------
183 --> filename: Makefile
186 obj-m := 8123.o
187 8123-y := 8123_if.o 8123_pci.o
191 KDIR ?= /lib/modules/`uname -r`/build
194 $(MAKE) -C $(KDIR) M=$$PWD
207 ---------------------------------
215 --> filename: Kbuild
216 obj-m := 8123.o
217 8123-y := 8123_if.o 8123_pci.o
219 --> filename: Makefile
220 KDIR ?= /lib/modules/`uname -r`/build
223 $(MAKE) -C $(KDIR) M=$$PWD
235 --> filename: Kbuild
236 obj-m := 8123.o
237 8123-y := 8123_if.o 8123_pci.o
239 --> filename: Makefile
240 KDIR ?= /lib/modules/$(shell uname -r)/build
246 -------------------------
249 file. For example, if you wanted to build two modules, foo.ko
252 obj-m := foo.o bar.o
253 foo-y := <foo_srcs>
254 bar-y := <bar_srcs>
279 ---------------
290 -------------------
295 directory, use either ccflags-y or CFLAGS_<filename>.o.
301 --> filename: Kbuild
302 obj-m := 8123.o
304 ccflags-y := -I $(src)/include
305 8123-y := 8123_if.o 8123_pci.o
308 ----------------------
326 --> filename: Kbuild
327 obj-m := complex.o
328 complex-y := src/complex_main.o
329 complex-y += src/hal/hardwareif.o
331 ccflags-y := -I$(src)/include
332 ccflags-y += -I$(src)/src/hal/include
341 root of the kernel tree (the argument to "-C") and therefore an
360 ----------------
371 calling "make." This has effect when installing both in-tree
372 and out-of-tree modules.
375 ---------------
383 $ make INSTALL_MOD_DIR=gandalf -C $KDIR \
402 -------------------------------------------
413 0xe1cc2a05 usb_stor_suspend drivers/usb/storage/usb-storage EXPORT_SYMBOL_GPL USB_STORAGE
427 ---------------------------
443 section as a series of concatenated, null-terminated strings. CRCs for
447 ----------------------------
457 ------------------------------------
464 NOTE: The method with a top-level kbuild file is recommended
467 Use a top-level kbuild file
468 If you have two modules, foo.ko and bar.ko, where
469 foo.ko needs symbols from bar.ko, you can use a
470 common top-level kbuild file so both modules are
474 ./foo/ <= contains foo.ko
477 The top-level kbuild file would then look like::
480 obj-m := foo/ bar/
484 $ make -C $KDIR M=$PWD
490 If it is impractical to add a top-level kbuild file,
501 --------------------------
509 obj-$(CONFIG_EXT2_FS) += ext2.o
511 ext2-y := balloc.o bitmap.o dir.o
512 ext2-$(CONFIG_EXT2_FS_XATTR) += xattr.o