Re: External compilation

From: Kai Germaschewski (kai@tp1.ruhr-uni-bochum.de)
Date: Mon Jun 10 2002 - 10:34:15 EST


On Mon, 10 Jun 2002, John Levon wrote:

> Doesn't work for 2.2. Hopefully I will be able to specify M_OBJS in
> addition.

I think later 2.2 support obj-[ym], though I maybe wrong. It won't hurt to
specify M_OBJS additionally.

> Also, you don't specify O_TARGET ?
>
> Given :
>
> TOPDIR=/usr/src/linux
> THISDIR=/tmp/mod
>
> O_TARGET=lartmod.o
> obj-m := lart.o blah.o
>
> include $(TOPDIR)/Rules.make
>
> all:
> (cd $(TOPDIR) && $(MAKE) SUBDIRS=/tmp/mod modules)

My example was for a single source module. If you have multiple sources,
you can either

        O_TARGET := lartmod.o
        obj-y := lart.o blah.o
        obj-m := $(O_TARGET)

or

        obj-m := lartmod.o

        lartmod-objs := lart.o blah.o

where the later in 2.4 additionally needs

        list-multi := lartmod.o

and a link rule like

        lartmod.o: $(lartmod-objs)
                $(LD) -r -o $@ $(lartmod-objs)

> a) default target for Rules.make doesn't do anything useful

The default target (at least in < current 2.5) only builds built-in code.

> b) lartmod.o is never made (how could I convince it to ?)

See first example above.

> c) is this going to work OK for modversions...

Yup.

> d) the above seems to disallow a lart.c forming only part of a final lart.o target

If you only have one source, see my first mail.

> e) there seems something is going horribly wrong :
>
> moz mod 317 make all
> make: execvp: /usr/src/linux/scripts/pathdown.sh: Permission denied
> ˆ¶@ˆ¶@re/locale/en_US/LC_MESSAGES/make.mo(cd /usr/src/linux && make SUBDIRS=/tmp/mod modules)
> make[1]: Entering directory `/usr/src/linux-2.4.0'

That I suppose is due to the fact that during the "make all"
$(CONFIG_SHELL) is not set, thus the

        MOD_DESTDIR := $(shell $(CONFIG_SHELL) $(TOPDIR)/scripts/pathdown.sh)

in Rules.make fails. Try doing the "cd $(TOPDIR) && ..." by hand, it
should work then.

--Kai

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Jun 15 2002 - 22:00:18 EST