2007-09-05 09:27:52

by Robert P. J. Day

[permalink] [raw]
Subject: building a specific in-tree module is currently a bit broken


i know sam ravnborg has been Cc'ed on a janitors list posting
mentioning this but, just in case this note can get a fix snuck in
there quickly before 2.6.23 (this is on i386, but i'm guessing applies
to all arches):

$ make distclean
$ make defconfig
$ make menuconfig (select visor.ko to be built a module)
$ make drivers/usb/serial/visor.ko
scripts/kconfig/conf -s arch/i386/Kconfig
CHK include/linux/version.h
UPD include/linux/version.h
CHK include/linux/utsrelease.h
UPD include/linux/utsrelease.h
SYMLINK include/asm -> include/asm-i386
CC arch/i386/kernel/asm-offsets.s
GEN include/asm-i386/asm-offsets.h
CALL scripts/checksyscalls.sh
CC scripts/mod/empty.o
HOSTCC scripts/mod/mk_elfconfig
MKELF scripts/mod/elfconfig.h
HOSTCC scripts/mod/file2alias.o
HOSTCC scripts/mod/modpost.o
HOSTCC scripts/mod/sumversion.o
HOSTLD scripts/mod/modpost
HOSTCC scripts/kallsyms
HOSTCC scripts/conmakehash
HOSTCC scripts/bin2c
CC [M] drivers/usb/serial/visor.o
/bin/sh: .tmp_versions/visor.mod: No such file or directory
MODPOST 0 modules
$

whoops. manually creating the directory .tmp_versions first fixes
this, but i'm not conversant enough with the Makefile to want to take
a shot at repairing this.

rday

--
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://crashcourse.ca
========================================================================


2007-09-05 09:37:27

by Michal Piotrowski

[permalink] [raw]
Subject: Re: building a specific in-tree module is currently a bit broken

Hi,

[Adding K{build,config} wizards to CC]

On 05/09/07, Robert P. J. Day <[email protected]> wrote:
>
> i know sam ravnborg has been Cc'ed on a janitors list posting
> mentioning this but, just in case this note can get a fix snuck in
> there quickly before 2.6.23 (this is on i386, but i'm guessing applies
> to all arches):
>
> $ make distclean
> $ make defconfig
> $ make menuconfig (select visor.ko to be built a module)
> $ make drivers/usb/serial/visor.ko
> scripts/kconfig/conf -s arch/i386/Kconfig
> CHK include/linux/version.h
> UPD include/linux/version.h
> CHK include/linux/utsrelease.h
> UPD include/linux/utsrelease.h
> SYMLINK include/asm -> include/asm-i386
> CC arch/i386/kernel/asm-offsets.s
> GEN include/asm-i386/asm-offsets.h
> CALL scripts/checksyscalls.sh
> CC scripts/mod/empty.o
> HOSTCC scripts/mod/mk_elfconfig
> MKELF scripts/mod/elfconfig.h
> HOSTCC scripts/mod/file2alias.o
> HOSTCC scripts/mod/modpost.o
> HOSTCC scripts/mod/sumversion.o
> HOSTLD scripts/mod/modpost
> HOSTCC scripts/kallsyms
> HOSTCC scripts/conmakehash
> HOSTCC scripts/bin2c
> CC [M] drivers/usb/serial/visor.o
> /bin/sh: .tmp_versions/visor.mod: No such file or directory
> MODPOST 0 modules
> $
>
> whoops. manually creating the directory .tmp_versions first fixes
> this, but i'm not conversant enough with the Makefile to want to take
> a shot at repairing this.
>
> rday
>
> --
> ========================================================================
> Robert P. J. Day
> Linux Consulting, Training and Annoying Kernel Pedantry
> Waterloo, Ontario, CANADA
>
> http://crashcourse.ca

Regards,
Michal

--
LOG
http://www.stardust.webpages.pl/log/

2007-09-05 09:43:23

by Jan Engelhardt

[permalink] [raw]
Subject: Re: building a specific in-tree module is currently a bit broken


On Sep 5 2007 11:37, Michal Piotrowski wrote:
>
>Hi,
>
>[Adding K{build,config} wizards to CC]
>
>On 05/09/07, Robert P. J. Day <[email protected]> wrote:
>>
>> $ make distclean
>> $ make defconfig
>> $ make menuconfig (select visor.ko to be built a module)
>> $ make drivers/usb/serial/visor.ko

Beep. Need 'make scripts prepare' between menuconfig and visor.

Also note that visor will not have any symvers until you have
a Module.symvers (which, ironically, is created at the end of "make vmlinux")



Jan
--

2007-09-05 09:55:41

by Robert P. J. Day

[permalink] [raw]
Subject: Re: building a specific in-tree module is currently a bit broken

On Wed, 5 Sep 2007, Jan Engelhardt wrote:

>
> On Sep 5 2007 11:37, Michal Piotrowski wrote:
> >
> >Hi,
> >
> >[Adding K{build,config} wizards to CC]
> >
> >On 05/09/07, Robert P. J. Day <[email protected]> wrote:
> >>
> >> $ make distclean
> >> $ make defconfig
> >> $ make menuconfig (select visor.ko to be built a module)
> >> $ make drivers/usb/serial/visor.ko
>
> Beep. Need 'make scripts prepare' between menuconfig and visor.

that doesn't solve the problem. i should have mentioned that i
already (unnecessarily, i suggest) ran "make modules_prepare", but the
problem persists.

the issue seems to be that running that last make command to build the
module visor.ko doesn't somehow signal the Makefile that this is a
*module* build, and therefore no module-related initialization is
done, such as creating that directory or setting the Makefile variable
MODVERDIR, etc, etc.

once you've build at least one module successfully, then the directory
.tmp_versions exists so future module builds will work fine. it's
only when you do a clean, *immediately* followed by trying to do an
in-tree module build, that this is going to bite you.

rday

--
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://crashcourse.ca
========================================================================

2007-09-05 10:03:14

by Jan Engelhardt

[permalink] [raw]
Subject: Re: building a specific in-tree module is currently a bit broken


On Sep 5 2007 05:42, Robert P. J. Day wrote:
>that doesn't solve the problem. i should have mentioned that i
>already (unnecessarily, i suggest) ran "make modules_prepare", but the
>problem persists.
>
>the issue seems to be that running that last make command to build the
>module visor.ko doesn't somehow signal the Makefile that this is a
>*module* build, and therefore no module-related initialization is
>done, such as creating that directory or setting the Makefile variable
>MODVERDIR, etc, etc.

ah... make M=drivers/foo/bar/
it builds the whole directory, but at least it builds it.


>
>once you've build at least one module successfully, then the directory
>.tmp_versions exists so future module builds will work fine. it's
>only when you do a clean, *immediately* followed by trying to do an
>in-tree module build, that this is going to bite you.

Jan
--

2007-09-05 10:34:54

by Robert P. J. Day

[permalink] [raw]
Subject: Re: building a specific in-tree module is currently a bit broken

On Wed, 5 Sep 2007, Jan Engelhardt wrote:

>
> On Sep 5 2007 05:42, Robert P. J. Day wrote:
> >that doesn't solve the problem. i should have mentioned that i
> >already (unnecessarily, i suggest) ran "make modules_prepare", but
> >the problem persists.
> >
> >the issue seems to be that running that last make command to build
> >the module visor.ko doesn't somehow signal the Makefile that this
> >is a *module* build, and therefore no module-related initialization
> >is done, such as creating that directory or setting the Makefile
> >variable MODVERDIR, etc, etc.
>
> ah... make M=drivers/foo/bar/
> it builds the whole directory, but at least it builds it.

oh, i know *that* works but, as you can see, that make command has
enough info (the "M=" variable) to kick the Makefile into
module-building mode, so things work properly.

the original problem, of course, is still there. but i think i've
flogged this sufficiently. i'll leave someone else to do the fixing.

rday
--
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA

http://crashcourse.ca
========================================================================

2007-09-05 20:10:39

by Sam Ravnborg

[permalink] [raw]
Subject: Re: building a specific in-tree module is currently a bit broken

On Wed, Sep 05, 2007 at 11:43:15AM +0200, Jan Engelhardt wrote:
>
> On Sep 5 2007 11:37, Michal Piotrowski wrote:
> >
> >Hi,
> >
> >[Adding K{build,config} wizards to CC]
> >
> >On 05/09/07, Robert P. J. Day <[email protected]> wrote:
> >>
> >> $ make distclean
> >> $ make defconfig
> >> $ make menuconfig (select visor.ko to be built a module)
> >> $ make drivers/usb/serial/visor.ko
>
> Beep. Need 'make scripts prepare' between menuconfig and visor.
Nope - kbuild does this for you.
See following lines from top-level Makefile:

%.ko: prepare scripts FORCE
$(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
$(build)=$(build-dir) $(@:.ko=.o)
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost

But as pointed out it fails to create MODVERDIR.
I had one take on it some time ago and do not recall why I failed
to fix it. Should be trivial.

But this is a small issue that has been there for a long time
and is not -rc material. I will try to have it fixed for
next merge window.

Sam

2007-09-05 20:11:22

by Sam Ravnborg

[permalink] [raw]
Subject: Re: building a specific in-tree module is currently a bit broken

On Wed, Sep 05, 2007 at 11:43:15AM +0200, Jan Engelhardt wrote:
>
> Also note that visor will not have any symvers until you have
> a Module.symvers (which, ironically, is created at the end of "make vmlinux")

Yeaa - it is hard to create it before we have vmlinux.

Sam