URL
https://opencores.org/ocsvn/test_project/test_project/trunk
Subversion Repositories test_project
[/] [test_project/] [trunk/] [linux_sd_driver/] [Documentation/] [smart-config.txt] - Rev 62
Compare with Previous | Blame | View Log
Smart CONFIG_* Dependencies1 August 1999Michael Chastain <mec@shout.net>Werner Almesberger <almesber@lrc.di.epfl.ch>Martin von Loewis <martin@mira.isdn.cs.tu-berlin.de>Here is the problem:Suppose that drivers/net/foo.c has the following lines:#include <linux/config.h>...#ifdef CONFIG_FOO_AUTOFROB/* Code for auto-frobbing */#else/* Manual frobbing only */#endif...#ifdef CONFIG_FOO_MODEL_TWO/* Code for model two */#endifNow suppose the user (the person building kernels) reconfigures thekernel to change some unrelated setting. This will regenerate thefile include/linux/autoconf.h, which will cause include/linux/config.hto be out of date, which will cause drivers/net/foo.c to be recompiled.Most kernel sources, perhaps 80% of them, have at least one CONFIG_*dependency somewhere. So changing _any_ CONFIG_* setting requiresalmost _all_ of the kernel to be recompiled.Here is the solution:We've made the dependency generator, mkdep.c, smarter. Instead ofgenerating this dependency:drivers/net/foo.c: include/linux/config.hIt now generates these dependencies:drivers/net/foo.c: \include/config/foo/autofrob.h \include/config/foo/model/two.hSo drivers/net/foo.c depends only on the CONFIG_* lines thatit actually uses.A new program, split-include.c, runs at the beginning ofcompilation (make bzImage or make zImage). split-include readsinclude/linux/autoconf.h and updates the include/config/ tree,writing one file per option. It updates only the files for optionsthat have changed.Flag DependenciesMartin Von Loewis contributed another feature to this patch:'flag dependencies'. The idea is that a .o file depends onthe compilation flags used to build it. The file foo.o hasits flags stored in .flags.foo.o.Suppose the user changes the foo driver from resident to modular.'make' will notice that the current foo.o was not compiled with-DMODULE and will recompile foo.c.All .o files made from C source have flag dependencies. So do .ofiles made with ld, and .a files made with ar. However, .o filesmade from assembly source do not have flag dependencies (nobodyneeds this yet, but it would be good to fix).Per-source-file FlagsFlag dependencies also work with per-source-file flags.You can specify compilation flags for individual source fileslike this:CFLAGS_foo.o = -DSPECIAL_FOO_DEFINEThis helps clean up drivers/net/Makefile, drivers/scsi/Makefile,and several other Makefiles.CreditWerner Almesberger had the original idea and wrote the firstversion of this patch.Michael Chastain picked it up and continued development. He isnow the principal author and maintainer. Please report any bugsto him.Martin von Loewis wrote flag dependencies, with some modificationsby Michael Chastain.Thanks to all of the beta testers.
