Re: Behaviour of kernel makefiles when entering a subdir using a config symbol = m

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Sam,

On 09/12/15 23:32, Sam Ravnborg wrote:

> kbuild may enter a sub directory for two purposes:
> 1) to build object files to be part of the final image
>    Only subdirs specified using obj-y is visited.
> 
> 2) to build object files that will be included in a module
>    Subdirs specified with obj-y and obj-m is visited
> 
> Since you have the following code in your Makefile:
> 
>     obj-m += foo/
> 
> then foo/ is only visited to build modules.
> 
> So bar.o is built but is NOT included in the final image.
> This is also the behaviour you see.

Right.

We have three drivers (one fbdev, two drm), each of which can be built
as a module. But each of them also may require small boot-time setup,
which needs to be built-in.

I can get around the problem by entering the dir with obj-y, or by
creating a new extra config define which is y/n, and using that in the
makefile. The former makes make enter the dir even if the driver is not
enabled, and latter creates a config symbol only to solve this problem.

So I'd rather use the normal obj-$(CONFIG_MYDRIVER), as that's used by
all the fbdev and drm drivers, and (to me) makes most sense.

Is the purpose of the current behaviour to speed up the build when
compiling only the modules? Or why does it behave that way?

 Tomi

Attachment: signature.asc
Description: OpenPGP digital signature


[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux