The first time I wrote the driver, the compilation went wrong.

Source: Internet
Author: User
The first time I wrote the driver, there was a problem with compilation-Linux general technology-Linux programming and kernel information. The following is a detailed description. I wrote a module similar to "hello world": mydrive. c.

Makefile content:

Obj-m: = mydrive. o
KDIR: =/lib/modules/$ (shell uname-r)/build
PWD: = $ (shell pwd)
Default:
$ (MAKE)-C $ (KDIR) M = $ (PWD) modules
Clean:
Rm-f *. ko *. o *. mod. c

The following is what I showed up in make. I don't know why the mydrive. o file was not generated. It may be that the makefile is wrong. My kernel is 2.4.20-8.
Who can help?

[Root @ eeko firstdrv] # ls
Makefile mydrive. c
[Root @ eeko firstdrv] # make

Make-C/lib/modules/2.4.20-8/build M =/home/eeko/mydoc/firstdrv modules
Make [1]: Entering directory '/usr/src/linux-2.4.20-8'
Make-r-f tmp_include_depends all
Make [2]: Entering directory '/usr/src/linux-2.4.20-8'
Make [2]: Circular/usr/src/linux-2.4.20-8/include/asm/smplock. h <-/usr/src/linux-2.4.20-8/include/linux/interrupt. h dependency dropped.
Make [2]: Circular/usr/src/linux-2.4.20-8/include/linux/netfilter_ipv4/ip_conntrack.h <-/usr/src/linux-2.4.20-8/include/linux/netfilter_ipv4/ip_conntrack_helper.h dependency dropped.
Make [2]: Nothing to be done for 'all '.
Make [2]: Leaving directory '/usr/src/linux-2.4.20-8'
Make-C kernel CFLAGS = "-d1_kernel _-I/usr/src/linux-2.4.20-8/include-Wall-Wstrict-prototypes-Wno-trigraphs-O2-fno-strict-aliasing- fno-common-fomit-frame-pointer-pipe-mpreferred-stack-boundary = 2-march = i686-DMODULE-DMODVERSIONS-include/usr/src/linux-2.4.20-8/include/linux/ modversions. h "MAKING_MODULES = 1 modules
Make [2]: Entering directory '/usr/src/linux-2.4.20-8/kernel'
Make [2]: Nothing to be done for 'modules '.
Make [2]: Leaving directory '/usr/src/linux-2.4.20-8/kernel'
Make-C drivers CFLAGS = "-d1_kernel _-I/usr/src/linux-2.4.20-8/include-Wall-Wstrict-prototypes-Wno-trigraphs-O2-fno-strict-aliasing- fno-common-fomit-frame-pointer-pipe-mpreferred-stack-boundary = 2-march = i686-DMODULE-DMODVERSIONS-include/usr/src/linux-2.4.20-8/include/linux/ modversions. h "MAKING_MODULES = 1 modules
Make [2]: Entering directory '/usr/src/linux-2.4.20-8/drivers'
Make-C addon modules
Make [3]: Entering directory '/usr/src/linux-2.4.20-8/drivers/addon'
Make [3]: Nothing to be done for 'modules '.
Make [3]: Leaving directory '/usr/src/linux-2.4.20-8/drivers/addon'
Make-C block modules
Make [3]: Entering directory '/usr/src/linux-2.4.20-8/drivers/Block'
Make [3]: Nothing to be done for 'modules '.
Make [3]: Leaving directory '/usr/src/linux-2.4.20-8/drivers/Block'
Make-C cdrom modules
Make [3]: Entering directory '/usr/src/linux-2.4.20-8/drivers/cdrom'
Make [3]: Nothing to be done for 'modules '.
Make [3]: Leaving directory '/usr/src/linux-2.4.20-8/drivers/cdrom'
Make-C char modules
Make [3]: Entering directory '/usr/src/linux-2.4.20-8/drivers/char'
Make-C drm modules
Make [4]: Entering directory '/usr/src/linux-2.4.20-8/drivers/char/drm'
Make [4]: Nothing to be done for 'modules '.
Make [4]: Leaving directory '/usr/src/linux-2.4.20-8/drivers/char/drm'
Make-C pcmcia modules
Make [4]: Entering directory '/usr/src/linux-2.4.20-8/drivers/char/pcmcia'
Make [4]: Nothing to be done for 'modules '.
Make [4]: Leaving directory '/usr/src/linux-2.4.20-8/drivers/char/pcmcia'
Make [3]: Leaving directory '/usr/src/linux-2.4.20-8/drivers/char'
Make-C hotplug modules
Make [3]: Entering directory '/usr/src/linux-2.4.20-8/drivers/hotplug'
Make [3]: Nothing to be done for 'modules '.
Make [3]: Leaving directory '/usr/src/linux-2.4.20-8/drivers/hotplug'
Make-C ide modules
Make [3]: Entering directory '/usr/src/linux-2.4.20-8/drivers/ide'
Make-C arm modules
Make [4]: Entering directory '/usr/src/linux-2.4.20-8/drivers/ide/arm'
Make [4]: Nothing to be done for 'modules '.
Make [4]: Leaving directory '/usr/src/linux-2.4.20-8/drivers/ide/arm'
Make-C legacy modules
Make [4]: Entering directory '/usr/src/linux-2.4.20-8/drivers/ide/legacy'
Make [4]: Nothing to be done for 'modules '.
Make [4]: Leaving directory '/usr/src/linux-2.4.20-8/drivers/ide/legacy'
Make-C pci modules
Make [4]: Entering directory '/usr/src/linux-2.4.20-8/drivers/ide/pci'
Make [4]: Nothing to be done for 'modules '.
Make [4]: Leaving directory '/usr/src/linux-2.4.20-8/drivers/ide/pci'
Make-C ppc modules
Make [4]: Entering directory '/usr/src/linux-2.4.20-8/drivers/ide/ppc'
Make [4]: Nothing to be done for 'modules '.
Make [4]: Leaving directory '/usr/src/linux-2.4.20-8/drivers/ide/ppc'
Make-C raid modules
Make [4]: Entering directory '/usr/src/linux-2.4.20-8/drivers/ide/raid'
Make [4]: Nothing to be done for 'modules '.
Make [4]: Leaving directory '/usr/src/linux-2.4.20-8/drivers/ide/raid'
Make [3]: Leaving directory '/usr/src/linux-2.4.20-8/drivers/ide'
Make-C media modules
Make [3]: Entering directory '/usr/src/linux-2.4.20-8/drivers/media'
Make-C radio modules
Make [4]: Entering directory '/usr/src/linux-2.4.20-8/drivers/media/radio'
Make [4]: Nothing to be done for 'modules '.
Make [4]: Leaving directory '/usr/src/linux-2.4.20-8/drivers/media/radio'
Make-C video modules
Make [4]: Entering directory '/usr/src/linux-2.4.20-8/drivers/media/video'
Make [4]: Nothing to be done for 'modules '.
Make [4]: Leaving directory '/usr/src/linux-2.4.20-8/drivers/media/video'
Make [3]: Leaving directory '/usr/src/linux-2.4.20-8/drivers/media'
Make-C misc modules
Make [3]: Entering directory '/usr/src/linux-2.4.20-8/drivers/misc'
Make [3]: Nothing to be done for 'modules '.
Make [3]: Leaving directory '/usr/src/linux-2.4.20-8/drivers/misc'
Make-C net modules
Make [3]: Entering directory '/usr/src/linux-2.4.20-8/drivers/net'
Make-C pcmcia modules
Make [4]: Entering directory '/usr/src/linux-2.4.20-8/drivers/net/pcmcia'
Make [4]: Nothing to be done for 'modules '.
Make [4]: Leaving directory '/usr/src/linux-2.4.20-8/drivers/net/pcmcia'
Make [3]: Leaving directory '/usr/src/linux-2.4.20-8/drivers/net'
Make-C parport modules
Make [3]: Entering directory '/usr/src/linux-2.4.20-8/drivers/parport'
Make [3]: Nothing to be done for 'modules '.
Make [3]: Leaving directory '/usr/src/linux-2.4.20-8/drivers/parport'
Make-C pnp modules
Make [3]: Entering directory '/usr/src/linux-2.4.20-8/drivers/pnp'
Make [3]: Nothing to be done for 'modules '.
Make [3]: Leaving directory '/usr/src/linux-2.4.20-8/drivers/pnp'
Make-C scsi modules
Make [3]: Entering directory '/usr/src/linux-2.4.20-8/drivers/scsi'
Make-C aic7xxx modules
Make [4]: Entering directory '/usr/src/linux-2.4.20-8/drivers/scsi/aic7xxx'
Make [4]: Nothing to be done for 'modules '.
Make [4]: Leaving directory '/usr/src/linux-2.4.20-8/drivers/scsi/aic7xxx'
Make-C pcmcia modules
Make [4]: Entering directory '/usr/src/linux-2.4.20-8/drivers/scsi/pcmcia'
Make [4]: Nothing to be done for 'modules '.
Make [4]: Leaving directory '/usr/src/linux-2.4.20-8/drivers/scsi/pcmcia'
Make [3]: Leaving directory '/usr/src/linux-2.4.20-8/drivers/scsi'
Make-C sound modules
Make [3]: Entering directory '/usr/src/linux-2.4.20-8/drivers/sound'
Make [3]: Nothing to be done for 'modules '.
Make [3]: Leaving directory '/usr/src/linux-2.4.20-8/drivers/sound'
Make-C usb modules
Make [3]: Entering directory '/usr/src/linux-2.4.20-8/drivers/usb'
Make [3]: Nothing to be done for 'modules '.
Make [3]: Leaving directory '/usr/src/linux-2.4.20-8/drivers/usb'
Make-C video modules
Make [3]: Entering directory '/usr/src/linux-2.4.20-8/drivers/video'
Make [3]: Nothing to be done for 'modules '.
Make [3]: Leaving directory '/usr/src/linux-2.4.20-8/drivers/video'
Make [2]: Leaving directory '/usr/src/linux-2.4.20-8/drivers'
Make-C mm CFLAGS = "-d1_kernel _-I/usr/src/linux-2.4.20-8/include-Wall-Wstrict-prototypes-Wno-trigraphs-O2-fno-strict-aliasing- fno-common-fomit-frame-pointer-pipe-mpreferred-stack-boundary = 2-march = i686-DMODULE-DMODVERSIONS-include/usr/src/linux-2.4.20-8/include/linux/ modversions. h "MAKING_MODULES = 1 modules
Make [2]: Entering directory '/usr/src/linux-2.4.20-8/mm'
Make [2]: Nothing to be done for 'modules '.
Make [2]: Leaving directory '/usr/src/linux-2.4.20-8/mm'
Make-C fs CFLAGS = "-d1_kernel _-I/usr/src/linux-2.4.20-8/include-Wall-Wstrict-prototypes-Wno-trigraphs-O2-fno-strict-aliasing- fno-common-fomit-frame-pointer-pipe-mpreferred-stack-boundary = 2-march = i686-DMODULE-DMODVERSIONS-include/usr/src/linux-2.4.20-8/include/linux/ modversions. h "MAKING_MODULES = 1 modules
Make [2]: Entering directory '/usr/src/linux-2.4.20-8/fs'
Make [2]: Nothing to be done for 'modules '.
Make [2]: Leaving directory '/usr/src/linux-2.4.20-8/fs'
Make-C net CFLAGS = "-d1_kernel _-I/usr/src/linux-2.4.20-8/include-Wall-Wstrict-prototypes-Wno-trigraphs-O2-fno-strict-aliasing- fno-common-fomit-frame-pointer-pipe-mpreferred-stack-boundary = 2-march = i686-DMODULE-DMODVERSIONS-include/usr/src/linux-2.4.20-8/include/linux/ modversions. h "MAKING_MODULES = 1 modules
Make [2]: Entering directory '/usr/src/linux-2.4.20-8/net'
Make-C core modules
Make [3]: Entering directory '/usr/src/linux-2.4.20-8/net/core'
Make [3]: Nothing to be done for 'modules '.
Make [3]: Leaving directory '/usr/src/linux-2.4.20-8/net/core'
Make-C ipv4 modules
Make [3]: Entering directory '/usr/src/linux-2.4.20-8/net/ipv4'
Make [3]: Nothing to be done for 'modules '.
Make [3]: Leaving directory '/usr/src/linux-2.4.20-8/net/ipv4'
Make-C netlink modules
Make [3]: Entering directory '/usr/src/linux-2.4.20-8/net/netlink'
Make [3]: Nothing to be done for 'modules '.
Make [3]: Leaving directory '/usr/src/linux-2.4.20-8/net/netlink'
Make-C sched modules
Make [3]: Entering directory '/usr/src/linux-2.4.20-8/net/sched'
Make [3]: Nothing to be done for 'modules '.
Make [3]: Leaving directory '/usr/src/linux-2.4.20-8/net/sched'
Make [2]: Leaving directory '/usr/src/linux-2.4.20-8/net'
Make-C ipc CFLAGS = "-d1_kernel _-I/usr/src/linux-2.4.20-8/include-Wall-Wstrict-prototypes-Wno-trigraphs-O2-fno-strict-aliasing- fno-common-fomit-frame-pointer-pipe-mpreferred-stack-boundary = 2-march = i686-DMODULE-DMODVERSIONS-include/usr/src/linux-2.4.20-8/include/linux/ modversions. h "MAKING_MODULES = 1 modules
Make [2]: Entering directory '/usr/src/linux-2.4.20-8/ipc'
Make [2]: Nothing to be done for 'modules '.
Make [2]: Leaving directory '/usr/src/linux-2.4.20-8/ipc'
Make-C lib CFLAGS = "-d1_kernel _-I/usr/src/linux-2.4.20-8/include-Wall-Wstrict-prototypes-Wno-trigraphs-O2-fno-strict-aliasing- fno-common-fomit-frame-pointer-pipe-mpreferred-stack-boundary = 2-march = i686-DMODULE-DMODVERSIONS-include/usr/src/linux-2.4.20-8/include/linux/ modversions. h "MAKING_MODULES = 1 modules
Make [2]: Entering directory '/usr/src/linux-2.4.20-8/lib'
Make [2]: Nothing to be done for 'modules '.
Make [2]: Leaving directory '/usr/src/linux-2.4.20-8/lib'
Make-C crypto CFLAGS = "-d1_kernel _-I/usr/src/linux-2.4.20-8/include-Wall-Wstrict-prototypes-Wno-trigraphs-O2-fno-strict-aliasing- fno-common-fomit-frame-pointer-pipe-mpreferred-stack-boundary = 2-march = i686-DMODULE-DMODVERSIONS-include/usr/src/linux-2.4.20-8/include/linux/ modversions. h "MAKING_MODULES = 1 modules
Make [2]: Entering directory '/usr/src/linux-2.4.20-8/crypto'
Make [2]: Nothing to be done for 'modules '.
Make [2]: Leaving directory '/usr/src/linux-2.4.20-8/crypto'
Make-C arch/i386/kernel CFLAGS = "-d1_kernel _-I/usr/src/linux-2.4.20-8/include-Wall-Wstrict-prototypes-Wno-trigraphs-O2-fno- strict-aliasing-fno-common-fomit-frame-pointer-pipe-mpreferred-stack-boundary = 2-march = i686-DMODULE-DMODVERSIONS-include/usr/src/linux-2.4.20-8/ include/linux/modversions. h "MAKING_MODULES = 1 modules
Make [2]: Entering directory '/usr/src/linux-2.4.20-8/arch/i386/kernel'
Make [2]: Nothing to be done for 'modules '.
Make [2]: Leaving directory '/usr/src/linux-2.4.20-8/arch/i386/kernel'
Make-C arch/i386/mm CFLAGS = "-dsf-kernel _-I/usr/src/linux-2.4.20-8/include-Wall-Wstrict-prototypes-Wno-trigraphs-O2-fno- strict-aliasing-fno-common-fomit-frame-pointer-pipe-mpreferred-stack-boundary = 2-march = i686-DMODULE-DMODVERSIONS-include/usr/src/linux-2.4.20-8/ include/linux/modversions. h "MAKING_MODULES = 1 modules
Make [2]: Entering directory '/usr/src/linux-2.4.20-8/arch/i386/mm'
Make [2]: Nothing to be done for 'modules '.
Make [2]: Leaving directory '/usr/src/linux-2.4.20-8/arch/i386/mm'
Make-C arch/i386/lib CFLAGS = "-dsf-kernel _-I/usr/src/linux-2.4.20-8/include-Wall-Wstrict-prototypes-Wno-trigraphs-O2-fno- strict-aliasing-fno-common-fomit-frame-pointer-pipe-mpreferred-stack-boundary = 2-march = i686-DMODULE-DMODVERSIONS-include/usr/src/linux-2.4.20-8/ include/linux/modversions. h "MAKING_MODULES = 1 modules
Make [2]: Entering directory '/usr/src/linux-2.4.20-8/arch/i386/lib'
Make [2]: Nothing to be done for 'modules '.
Make [2]: Leaving directory '/usr/src/linux-2.4.20-8/arch/i386/lib'
Make [1]: Leaving directory '/usr/src/linux-2.4.20-8'
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.