LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   *** No rule to make target `modules'. Stop. (https://www.linuxquestions.org/questions/linux-newbie-8/%2A%2A%2A-no-rule-to-make-target-%60modules-stop-145676/)

kmack2001 02-13-2004 11:34 AM

*** No rule to make target `modules'. Stop.
 
I am trying to build a hello world program for an external linux kernel module. I am getting the following results. Can someone help me??

@linux:~/projects/drivers> make -C /lib/modules/2.4.21-166-default/build SUBDIRS=$PWD modules
make: Entering directory `/usr/src/linux-2.4.21-166-include/default'
make -C /home/mac/projects/drivers CFLAGS="-D__KERNEL__ -I/usr/src/linux-2.4.21-166-include/default/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -fno-unit-at-a-time -pipe -msoft-float -mpreferred-stack-boundary=2 -DMODULE -DMODVERSIONS -include /usr/src/linux-2.4.21-166-include/default/include/linux/modversions.h" MAKING_MODULES=1 modules
make[1]: Entering directory `/home/mac/projects/drivers'
make[1]: *** No rule to make target `modules'. Stop.
make[1]: Leaving directory `/home/mac/projects/drivers'
make: *** [_mod_/home/mac/projects/drivers] Error 2
make: Leaving directory `/usr/src/linux-2.4.21-166-include/default'
@linux:~/projects/drivers>

deloptes 02-13-2004 11:46 AM

it's clear that you are missing a rule in your Makefile in the `/home/mac/projects/drivers' directory, I think you should have a look in your Makefiles

I would put this driver in /usr/src/linux/drivers/misc as this is what the makefile says
#
# Makefile for misc devices that really don't fit anywhere else.
#
# Note! Dependencies are done automagically by 'make dep', which also
# removes any old dependencies. DON'T put your own dependencies here
# unless it's something special (ie not a .c file).
#
# Note 2! The CFLAGS definitions are now inherited from the
# parent makes..
#

O_TARGET := misc.o

include $(TOPDIR)/Rules.make

fastdep:

r3gard5

sirphoenix 02-13-2004 11:48 AM

hi there. no idea about compiling. but i do get this error if i am trying to compile my kernel in a wrong way. for explample if i type "make menuconfigggggg" instead of "make menuconfig"
it will say smth like "no rule to make "menuconfigggggg" (translated into english)

does this help?

kmack2001 02-13-2004 12:02 PM

Could this be an installation problem?? I am using Suse 9.0. It did not come with the kernel source code. (Took me a while to figure that out).

Here is my makefile and hello file included.
makefile:
obj-m: hello.o

hello.c
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>

int hello_init(void) {printk("<1>Hello, world\n"); return 0; }
void hello_exit(void) { printk("<1>Goodbye cruel world\n"); }

module_init(hello_init);
module_exit(hello_exit);


----------------------------------------------------------------------
*** No rule to make target `modules'. Stop. ( post #1)

I am trying to build a hello world program for an external linux kernel module. I am getting the following results. Can someone help me??

@linux:~/projects/drivers> make -C /lib/modules/2.4.21-166-default/build SUBDIRS=$PWD modules
make: Entering directory `/usr/src/linux-2.4.21-166-include/default'
make -C /home/mac/projects/drivers CFLAGS="-D__KERNEL__ -I/usr/src/linux-2.4.21-166-include/default/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fomit-frame-pointer -fno-unit-at-a-time -pipe -msoft-float -mpreferred-stack-boundary=2 -DMODULE -DMODVERSIONS -include /usr/src/linux-2.4.21-166-include/default/include/linux/modversions.h" MAKING_MODULES=1 modules
make[1]: Entering directory `/home/mac/projects/drivers'
make[1]: *** No rule to make target `modules'. Stop.
make[1]: Leaving directory `/home/mac/projects/drivers'
make: *** [_mod_/home/mac/projects/drivers] Error 2
make: Leaving directory `/usr/src/linux-2.4.21-166-include/default'
@linux:~/projects/drivers>

kmack2001 02-14-2004 10:47 AM

The problem ended up being that I was using instructions for build in 2.6 kernel when I was using a 2.4 kernel. I am still having other problems. I am getting "error unknown processor family" error now.

I also had to run
make mrproper
make cloneconfig
make dep

deloptes 02-15-2004 07:05 AM

Great, I think you didn't set this option in the config. Start again make xconfig or menuconfig and look for Processor type and features - you click the first field and set your CPU-type.

you can also look in the .config file and uncomment one option corresponding to you cpu

# Processor type and features
#
# CONFIG_M386 is not set
# CONFIG_M486 is not set
# CONFIG_M586 is not set
# CONFIG_M586TSC is not set
# CONFIG_M586MMX is not set
# CONFIG_M686 is not set
CONFIG_MPENTIUMIII=y
# CONFIG_MPENTIUM4 is not set
# CONFIG_MK6 is not set
# CONFIG_MK7 is not set
# CONFIG_MK8 is not set
# CONFIG_MELAN is not set
# CONFIG_MCRUSOE is not set
# CONFIG_MWINCHIPC6 is not set
# CONFIG_MWINCHIP2 is not set
# CONFIG_MWINCHIP3D is not set
# CONFIG_MCYRIXIII is not set
# CONFIG_MVIAC3_2 is not set

If it doesn't help I suggest you start over.

# cd /usr/src
# cp linux/.config .
# rm -rf linux......
# tar xjvf linux-.......
# ln -s linux-......... linux

# cd linux && make xconfig
(or menuconfig)

# make dep && make bzImage
(or zImage)

kmack2001 02-15-2004 08:24 AM

I started a new thread w/ the following heading:

"question on usr/include/asm/module.h "

Below is the context, to continue this thread. This is what I found.
(Sorry for duplication)

SUSE 9.0 kernel 2.4.21-144 w/2.4.21-166 kernel-source

I am trying to compile a linux kernel module (hello world). I am getting an error unknown processor.

I noticed that in "/usr/src/linux/arch/i386/defconfig"

CONFIG_M586NOCX8=y

is set.

However, in "/usr/inlcude/asm/module.h" as seen below that option
is not available. Does any one know ehich MODULE_PROC_FAMILY to use??
how do I get around this??

#ifdef __KERNEL__

#ifdef CONFIG_M386
#define MODULE_PROC_FAMILY "386 "
#elif defined CONFIG_M486
#define MODULE_PROC_FAMILY "486 "
#elif defined CONFIG_M586
#define MODULE_PROC_FAMILY "586 "
#elif defined CONFIG_M586TSC
#define MODULE_PROC_FAMILY "586TSC "
#elif defined CONFIG_M586MMX
#define MODULE_PROC_FAMILY "586MMX "
#elif defined CONFIG_M686
#define MODULE_PROC_FAMILY "686 "
#elif defined CONFIG_MPENTIUMII
#define MODULE_PROC_FAMILY "PENTIUMII "
#elif defined CONFIG_MPENTIUMIII
#define MODULE_PROC_FAMILY "PENTIUMIII "
#elif defined CONFIG_MPENTIUM4
#define MODULE_PROC_FAMILY "PENTIUM4 "
#elif defined CONFIG_MK6
#define MODULE_PROC_FAMILY "K6 "
#elif defined CONFIG_MK7
#define MODULE_PROC_FAMILY "K7 "
#elif defined CONFIG_MK8
#define MODULE_PROC_FAMILY "K8 "
#elif defined CONFIG_MELAN
#define MODULE_PROC_FAMILY "ELAN "
#elif defined CONFIG_MCRUSOE
#define MODULE_PROC_FAMILY "CRUSOE "
#elif defined CONFIG_MWINCHIPC6
#define MODULE_PROC_FAMILY "WINCHIPC6 "
#elif defined CONFIG_MWINCHIP2
#define MODULE_PROC_FAMILY "WINCHIP2 "
#elif defined CONFIG_MWINCHIP3D
#define MODULE_PROC_FAMILY "WINCHIP3D "
#elif defined CONFIG_MCYRIXIII
#define MODULE_PROC_FAMILY "CYRIXIII "
#elif CONFIG_MVIAC3_2
#define MODULE_PROC_FAMILY "VIAC3-2 "
#else
#error unknown processor family
#endif

deloptes 02-15-2004 09:34 AM

are you willing to replace linus torvald or what?

the asm directory contains system-type specific definitions and a link is made to the directory containing your system definitions i.e. i386 for ibm-pc (386 style)

# root@bendida:/mnt/devel/src/linux# ls -al include/asm
# lrwxrwxrwx 1 root root 8 Feb 15 14:01 include/asm -> asm-i386

Uhh read the kernel docs finally - everything is written there!

first you are not reading the right manuals and now I doubt, you know what you are doing.
What do you need this all stuff for

Include the header files and they will find their way, otherwise I don't think your program will be usable - of course you should check (include) the architecture type but starting let say with standard 386 proccessor type would fit all.

It is in fact enough to
include asm/modules.h
from "YOUR_KERNELSRC_DIR"/include (YOUR_KERNELSRC_DIR is usally /usr/src/linux)

or something like this so your preprocessor knows the system type you are building for.

NB: asm is linked when you save and exit the configure script as you define the system type there. If you dont run make menuconfig or make xconfig than you should link asm yourself

r3gard5

kmack2001 02-15-2004 06:42 PM

I am just a newbie trying to build a "hello world" kernel module before moving on.

From make menuconfig
the cpu type is "(586-w/o-cmpxchg8) Processor family"

It seems that this processor family (CONFIG_M586NOCX8=y) is not supported or is not accounted for. It is not in the if defs in module.h

what processor family do you have??

deloptes 02-16-2004 01:02 PM

What do you need this dummy kernel module before moveing on - where to are you moving - I don't understand, but anyway in my .config it stays CONFIG_MPENTIUMIII=y and that's what I have, but I build a kernel for another machine and it says CONFIG_M586=y and truly it's Pnetium I (585). When are you going to read the kernel doc's finally it's always there. You can find out what processor you have by typing
# less /proc/cpuinfo

optionally less /proc/cpuinfo | grep model

processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 7
model name : Pentium III (Katmai)
stepping : 3
cpu MHz : 501.891
cache size : 512 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 2
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov
pat pse36 mmx fxsr sse
bogomips : 1002.70

r3gard5


All times are GMT -5. The time now is 01:19 AM.