Re: how do I compile a single file in kernel?

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

 



On Fri, Mar 04, 2005 at 10:56:47AM +0530, Srinivas G. wrote:
> > It's slightly different since linux-2.6.7:
> > 
> > default:
> > 	$(MAKE) -C $(KDIR) M=$(PWD) modules
> > 
> 
> I am using the Fedora Core 3 with 2.6.9-1.667 kernel. I used the same
> make to compile the program in my environment. I tested the make with
> small hello.c program also. Please see the following hello.c file and
> its related make file.

[simple module]

> default:
> 	$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules
                           ^^^^^^^
This is not wrong right now, but it is no longer the preferred way. Use
M instead of SUBDIRS. It works, see output:

  erik@arthur:/tmp/module> make
  make -C /lib/modules/2.6.11-rc4/build M=/tmp/module modules
  make[1]: Entering directory `/home/erik/kernel/linux-2.6.11-rc4'
    CC [M]  /tmp/module/hello.o
    LD [M]  /tmp/module/hello_world.o
    Building modules, stage 2.
    MODPOST
    CC      /tmp/module/hello_world.mod.o
    LD [M]  /tmp/module/hello_world.ko
  make[1]: Leaving directory `/home/erik/kernel/linux-2.6.11-rc4'


Erik

-- 
Erik Mouw
J.A.K.Mouw@xxxxxxxxxxxxxx  mouw@xxxxxxxxxxxx

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux