# System won't build kernel modules

## bubule

Hello,

I have an issue that has been bothering me for some months and i can't figure out where it comes from.

The system doesn't build kernel modules (.ko).

To get a working kernel i have to hardcode everything i need (i managed to get things working this way but it doesn't satisfy me)

I have this issue with all the kernel i installed the past months, gentoo-sources and vanilla-sources too.

I tried to build some basic hello kernel module and i have the same issue (i get everything excepte the .ko)

emerge --info

http://privatepaste.com/1b1ATvXLNZt

Makefile and hello.c

http://privatepaste.com/000oZVINOb

some logs when i try building the kernel module

http://privatepaste.com/a88bfn2vQm

the config file i used to build the kernel

http://privatepaste.com/download/52wDZFFgQw

Don't hesitate asking me things, i really wish to solve this problem.

Thanks.

----------

## NeddySeagoon

bubule,

What are the timestamps on the *c, *.h and *.o files ?

What time does you clock show ?

If some of the timestamps in the *.o files are in the future, make will decide that there is nothing to do.

To test if its timestamp related, begin a kernel build with 

```
make clean
```

this removed all the binary and intermediate files.

Check that the source files are older than time now, as shown by your clock.

Now build the kernel normally.

What filesystem is /usr/src/linux on ?

----------

## bubule

I don't think this is timestamps related :

(Here i focus on building my test kernel module, but i think it's the same for other kernel modules)

```

<bubu@localhost:~/devel/kernelmod>

zsh/3 35 % ls -laR . 

.:

total 16

drwxr-sr-x  2 bubu portage 4096 nov.   8 12:49 .

drwxr-sr-x 41 bubu portage 4096 nov.   7 21:24 ..

-rw-r--r--  1 bubu portage  185 nov.   8 01:55 Makefile

-rw-r--r--  1 bubu portage  199 nov.   8 02:28 hello.c

<bubu@localhost:~/devel/kernelmod>

zsh/3 36 % date

dim. nov.  8 12:49:51 CET 2009

<bubu@localhost:~/devel/kernelmod>

zsh/3 37 % make

make -C /lib/modules/2.6.31-gentoo/build M=/home/bubu/devel/kernelmod modules

make[1]: entrant dans le répertoire « /usr/src/linux-2.6.31-gentoo »

  CC [M]  /home/bubu/devel/kernelmod/hello.o

  Building modules, stage 2.

  MODPOST 0 modules

make[1]: quittant le répertoire « /usr/src/linux-2.6.31-gentoo »

<bubu@localhost:~/devel/kernelmod>

zsh/3 38 % ls -laR .

.:

total 48

drwxr-sr-x  3 bubu portage  4096 nov.   8 12:49 .

drwxr-sr-x 41 bubu portage  4096 nov.   7 21:24 ..

-rw-r--r--  1 bubu portage 17708 nov.   8 12:49 .hello.o.cmd

drwxr-sr-x  2 bubu portage  4096 nov.   8 12:49 .tmp_versions

-rw-r--r--  1 bubu portage   185 nov.   8 01:55 Makefile

-rw-r--r--  1 bubu portage     0 nov.   8 12:49 Module.symvers

-rw-r--r--  1 bubu portage   199 nov.   8 02:28 hello.c

-rw-r--r--  1 bubu portage   968 nov.   8 12:49 hello.o

-rw-r--r--  1 bubu portage    43 nov.   8 12:49 modules.order

./.tmp_versions:

total 12

drwxr-sr-x 2 bubu portage 4096 nov.   8 12:49 .

drwxr-sr-x 3 bubu portage 4096 nov.   8 12:49 ..

-rw-r--r-- 1 bubu portage   71 nov.   8 12:49 hello.mod

```

The filesystem is ext3, but i got things working with the same system when i built kernel 2.6.27 back in times but it doesn't work anymore (even for the same kernel)

The kernel compiles everything (i have CC [M] somefile.o) if i select modules in the .config

I just don't get the resulting .ko (like for the hello kernel module which is built : CC [M]  /home/bubu/devel/kernelmod/hello.o)

I've also  run make mrproper (clean too), make, make modules , make modules_install etc... plenty of times with default config, importing old ones with make oldconfig or also using genkernel it always fails building kernel modules (and kernels built with genkernel can't be used).

And this with a many kernels 2.6.39, 2.6.30, 2.6.31 and with vanilla-sources too.  :Sad: 

----------

