Zlodei Опубликовано 6 апреля, 2006 Жалоба Поделиться Опубликовано 6 апреля, 2006 Я первый раз с этим сталкиваюсь. Просто возникла необходимость написания драйвера для диплома. Когда я пробую собрать модулю по примерам то че то у меня не получается! Пожайлуста направте на путь истинный. ___________________________ Файл mydrv.c #include <linux/module.h> #include <linux/init.h> MODULE_LICENSE("GPL"); static int __init my_init(void) { printk("<1>Da\n"); return 0; }; static void __exit my_cleanup(void) { printk("<1>Net\n"); return; }; module_init(my_init); module_exit(my_cleanup); Файл makefile obj-m += mydrv.c Команда для компиляции: make -C /lib/modules/`uname -r` SUBDIRS=$PWD makefile После чего не выдается ни каких ошибок и сообщений вообще. И получается какбудто команда выполнена. Хотя объектного файла mydrv.o я не нахожу ни где. makefile и mydrv.c расположены в одной папке /home/Nikolai. Компилирую тоже из этой папки. ОС ASP Linux 2.6.9-1.667 ________________________ Немного сдвинулось. Изменил makefile на: obj-m := mydrv.c KDIR := /lib/modules/$(shell uname -r)/build PWD := $#(shell pwd) default: $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) modules Командная строка (из директории с makefile): make -f makefile Теперь выдает следующее: [root@localhost Nikolai]# make -f makefile make -C /lib/modules/2.6.9-1.667asp/build SUBDIRS= modules make[1]: Entering directory `/lib/modules/2.6.9-1.667asp/build' CHK include/linux/version.h SPLIT include/linux/autoconf.h -> include/config/* CHK include/asm-i386/asm_offsets.h HOSTCC scripts/genksyms/genksyms.o HOSTCC scripts/genksyms/lex.o HOSTCC scripts/genksyms/parse.o HOSTLD scripts/genksyms/genksyms CC scripts/mod/empty.o MKELF scripts/mod/elfconfig.h HOSTCC scripts/mod/file2alias.o HOSTCC scripts/mod/modpost.o HOSTCC scripts/mod/sumversion.o HOSTLD scripts/mod/modpost make[2]: *** Нет правила для сборки цели `arch/i386/kernel/msr.c', требуемой для `arch/i386/kernel/msr.o'. Останов. make[1]: *** [arch/i386/kernel] Ошибка 2 make[1]: Leaving directory `/lib/modules/2.6.9-1.667asp/build' make: *** [default] Ошибка 2 _____________ В чем проблема? _________________________________ Заранее благодарен!!! Цитата Ссылка на комментарий Поделиться на другие сайты Поделиться
Ineu Опубликовано 6 апреля, 2006 Жалоба Поделиться Опубликовано 6 апреля, 2006 Zlodei писал(а) Чтв, 06 Апреля 2006 15:17 HOSTLD scripts/mod/modpost make[2]: *** Нет правила для сборки цели `arch/i386/kernel/msr.c', требуемой для `arch/i386/kernel/msr.o'. Останов. make[1]: *** [arch/i386/kernel] Ошибка 2 make[1]: Leaving directory `/lib/modules/2.6.9-1.667asp/build' make: *** [default] Ошибка 2 _____________ В чем проблема? Имхо - в ядре. Попробуйте другое (лучше всего торвальдовское с kernel.org) Цитата Ссылка на комментарий Поделиться на другие сайты Поделиться
Zlodei Опубликовано 11 апреля, 2006 Автор Жалоба Поделиться Опубликовано 11 апреля, 2006 После компиляции модуля образовался файл mydrv.ko Но при его инсталяции появляется ошибка: [root@localhost Nikolai]# insmod ./mydrv.ko insmod: error inserting './mydrv.ko': -1 Invalid module format Что это значит? Цитата Ссылка на комментарий Поделиться на другие сайты Поделиться
Ineu Опубликовано 11 апреля, 2006 Жалоба Поделиться Опубликовано 11 апреля, 2006 Zlodei писал(а) Втр, 11 Апреля 2006 10:59 После компиляции модуля образовался файл mydrv.ko Но при его инсталяции появляется ошибка: [root@localhost Nikolai]# insmod ./mydrv.ko insmod: error inserting './mydrv.ko': -1 Invalid module format Что это значит? Дайте вывод dmesg Цитата Ссылка на комментарий Поделиться на другие сайты Поделиться
Zlodei Опубликовано 11 апреля, 2006 Автор Жалоба Поделиться Опубликовано 11 апреля, 2006 [root@localhost Nikolai]# dmesg Linux version 2.6.9-1.667asp (build@pylesos.asp-linux.com.ua) (gcc version 3.3.3 20040412 (ASPLinux 3.3.3-7)) #1 Fri Nov 12 22:29:40 EET 2004 BIOS-provided physical RAM map: BIOS-e820: 0000000000000000 - 000000000009fc00 (usable) BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved) BIOS-e820: 00000000000e6000 - 0000000000100000 (reserved) BIOS-e820: 0000000000100000 - 000000000ef2fc00 (usable) BIOS-e820: 000000000ef2fc00 - 000000000ef30000 (ACPI NVS) BIOS-e820: 000000000ef30000 - 000000000ef40000 (ACPI data) BIOS-e820: 000000000ef40000 - 000000000eff0000 (ACPI NVS) BIOS-e820: 000000000eff0000 - 000000000f000000 (reserved) BIOS-e820: 00000000fecf0000 - 00000000fecf1000 (reserved) BIOS-e820: 00000000fed20000 - 00000000feda0000 (reserved) 0MB HIGHMEM available. 239MB LOWMEM available. zapping low mappings. On node 0 totalpages: 61231 DMA zone: 4096 pages, LIFO batch:1 Normal zone: 57135 pages, LIFO batch:13 HighMem zone: 0 pages, LIFO batch:1 DMI 2.3 present. ACPI: RSDP (v000 ACPIAM ) @ 0x000f61b0 ACPI: RSDT (v001 INTEL D865GBF 0x20040622 MSFT 0x00000097) @ 0x0ef30000 ACPI: FADT (v002 INTEL D865GBF 0x20040622 MSFT 0x00000097) @ 0x0ef30200 ACPI: MADT (v001 INTEL D865GBF 0x20040622 MSFT 0x00000097) @ 0x0ef30300 ACPI: ASF! (v016 LEGEND I865PASF 0x00000001 MSFT 0x0100000d) @ 0x0ef345b0 ACPI: TCPA (v001 INTEL TBLOEMID 0x00000001 MSFT 0x00000097) @ 0x0ef34649 ACPI: WDDT (v001 INTEL OEMWDDT 0x00000001 MSFT 0x0100000d) @ 0x0ef3467d ACPI: DSDT (v001 INTEL D865GBF 0x00000001 MSFT 0x0100000d) @ 0x00000000 ACPI: PM-Timer IO Port: 0x408 Built 1 zonelists Kernel command line: root=/dev/hda3 rhgb mapped 4G/4G trampoline to ffff4000. Initializing CPU#0 CPU 0 irqstacks, hard=023e0000 soft=023df000 PID hash table entries: 1024 (order: 10, 16384 bytes) Detected 2794.001 MHz processor. Using tsc for high-res timesource Console: colour VGA+ 80x25 Dentry cache hash table entries: 32768 (order: 5, 131072 bytes) Inode-cache hash table entries: 16384 (order: 4, 65536 bytes) Memory: 238620k/244924k available (2080k kernel code, 5780k reserved, 675k data, 148k init, 0k highmem) Calibrating delay loop... 5521.40 BogoMIPS (lpj=2760704) Security Scaffold v1.0.0 initialized SELinux: Initializing. SELinux: Starting in permissive mode There is already a security framework initialized, register_security failed. selinux_register_security: Registering secondary module capability Capability LSM initialized as secondary Mount-cache hash table entries: 512 (order: 0, 4096 bytes) CPU: After generic identify, caps: bfebfbff 00000000 00000000 00000000 CPU: After vendor identify, caps: bfebfbff 00000000 00000000 00000000 monitor/mwait feature present. using mwait in idle threads. CPU: Trace cache: 12K uops, L1 D cache: 16K CPU: L2 cache: 256K CPU: After all inits, caps: bfebf3ff 00000000 00000000 00000080 Intel machine check architecture supported. Intel machine check reporting enabled on CPU#0. CPU0: Intel P4/Xeon Extended MCE MSRs (12) available CPU: Intel® Celeron® CPU 2.80GHz stepping 04 Enabling fast FPU save and restore... done. Enabling unmasked SIMD FPU exception support... done. Checking 'hlt' instruction... OK. ACPI: IRQ9 SCI: Level Trigger. checking if image is initramfs... it is Freeing initrd memory: 357k freed NET: Registered protocol family 16 PCI: PCI BIOS revision 2.10 entry at 0xf0031, last bus=1 PCI: Using configuration type 1 mtrr: v2.0 (20020519) ACPI: Subsystem revision 20040816 ACPI: Interpreter enabled ACPI: Using PIC for interrupt routing ACPI: PCI Root Bridge [PCI0] (00:00) PCI: Probing PCI hardware (bus 00) PCI: Ignoring BAR0-3 of IDE controller 0000:00:1f.1 PCI: Transparent bridge - 0000:00:1e.0 ACPI: PCI Interrupt Routing Table [\_SB_.PCI0._PRT] ACPI: PCI Interrupt Routing Table [\_SB_.PCI0.P0P3._PRT] ACPI: Power Resource [uRP1] (off) ACPI: Power Resource [FDDP] (off) ACPI: Power Resource [LPTP] (off) ACPI: PCI Interrupt Link [LNKA] (IRQs 3 4 5 6 7 9 10 *11 12 14 15) ACPI: PCI Interrupt Link [LNKB] (IRQs *3 4 5 6 7 9 10 11 12 14 15) ACPI: PCI Interrupt Link [LNKC] (IRQs 3 4 5 6 7 *9 10 11 12 14 15) ACPI: PCI Interrupt Link [LNKD] (IRQs 3 4 *5 6 7 9 10 11 12 14 15) ACPI: PCI Interrupt Link [LNKE] (IRQs 3 4 5 6 7 9 10 *11 12 14 15) ACPI: PCI Interrupt Link [LNKF] (IRQs 3 4 5 6 7 9 10 11 12 14 15) *0, disabled. ACPI: PCI Interrupt Link [LNKG] (IRQs 3 4 5 6 7 9 10 11 12 14 15) *0, disabled. ACPI: PCI Interrupt Link [LNKH] (IRQs 3 4 5 6 7 9 *10 11 12 14 15) Linux Plug and Play Support v0.97 © Adam Belay usbcore: registered new driver usbfs usbcore: registered new driver hub PCI: Using ACPI for IRQ routing ACPI: PCI Interrupt Link [LNKA] enabled at IRQ 11 ACPI: PCI interrupt 0000:00:02.0[A] -> GSI 11 (level, low) -> IRQ 11 ACPI: PCI interrupt 0000:00:1d.0[A] -> GSI 11 (level, low) -> IRQ 11 ACPI: PCI Interrupt Link [LNKD] enabled at IRQ 5 ACPI: PCI interrupt 0000:00:1d.1 -> GSI 5 (level, low) -> IRQ 5 ACPI: PCI Interrupt Link [LNKC] enabled at IRQ 9 ACPI: PCI interrupt 0000:00:1d.2[C] -> GSI 9 (level, low) -> IRQ 9 ACPI: PCI interrupt 0000:00:1d.3[A] -> GSI 11 (level, low) -> IRQ 11 ACPI: PCI Interrupt Link [LNKH] enabled at IRQ 10 ACPI: PCI interrupt 0000:00:1d.7[D] -> GSI 10 (level, low) -> IRQ 10 ACPI: PCI interrupt 0000:00:1f.1[A] -> GSI 9 (level, low) -> IRQ 9 ACPI: PCI Interrupt Link [LNKB] enabled at IRQ 3 ACPI: PCI interrupt 0000:00:1f.3 -> GSI 3 (level, low) -> IRQ 3 ACPI: PCI interrupt 0000:00:1f.5 -> GSI 3 (level, low) -> IRQ 3 ACPI: PCI Interrupt Link [LNKE] enabled at IRQ 11 ACPI: PCI interrupt 0000:01:08.0[A] -> GSI 11 (level, low) -> IRQ 11 apm: BIOS version 1.2 Flags 0x03 (Driver version 1.16ac) apm: overridden by ACPI. audit: initializing netlink socket (disabled) audit(1144766070.556:0): initialized Total HugeTLB memory allocated, 0 VFS: Disk quotas dquot_6.5.1 Dquot-cache hash table entries: 1024 (order 0, 4096 bytes) SELinux: Registering netfilter hooks Initializing Cryptographic API ksign: Installing public key data Loading keyring - Added public key 5B36F29B439C91FB - User ID: Red Hat, Inc. (Kernel Module GPG key) pci_hotplug: PCI Hot Plug PCI Core version: 0.5 vesafb: probe of vesafb0 failed with error -6 ACPI: Processor [CPU1] (supports C1, 8 throttling states) isapnp: Scanning for PnP cards... isapnp: No Plug & Play device found Real Time Clock Driver v1.12 Linux agpgart interface v0.100 © Dave Jones agpgart: Detected an Intel 865 Chipset. agpgart: Maximum main memory to use for agp memory: 189M agpgart: Detected 16252K stolen memory. agpgart: AGP aperture is 128M @ 0xf0000000 serio: i8042 AUX port at 0x60,0x64 irq 12 serio: i8042 KBD port at 0x60,0x64 irq 1 Serial: 8250/16550 driver $Revision: 1.90 $ 8 ports, IRQ sharing enabled ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A RAMDISK driver initialized: 16 RAM disks of 16384K size 1024 blocksize divert: not allocating divert_blk for non-ethernet device lo Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2 ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx ICH5: IDE controller at PCI slot 0000:00:1f.1 PCI: Enabling device 0000:00:1f.1 (0005 -> 0007) ACPI: PCI interrupt 0000:00:1f.1[A] -> GSI 9 (level, low) -> IRQ 9 ICH5: chipset revision 2 ICH5: not 100% native mode: will probe irqs later ide0: BM-DMA at 0xffa0-0xffa7, BIOS settings: hda:DMA, hdb:pio ide1: BM-DMA at 0xffa8-0xffaf, BIOS settings: hdc:DMA, hdd:pio Probing IDE interface ide0... hda: WDC WD800BB-00CAA1, ATA DISK drive Using cfq io scheduler ide0 at 0x1f0-0x1f7,0x3f6 on irq 14 Probing IDE interface ide1... hdc: E5SA CDROM, ATAPI CD/DVD-ROM drive ide1 at 0x170-0x177,0x376 on irq 15 Probing IDE interface ide2... ide2: Wait for ready failed before probe ! Probing IDE interface ide3... ide3: Wait for ready failed before probe ! Probing IDE interface ide4... ide4: Wait for ready failed before probe ! Probing IDE interface ide5... ide5: Wait for ready failed before probe ! hda: max request size: 128KiB hda: 156301488 sectors (80026 MB) w/2048KiB Cache, CHS=65535/16/63, UDMA(100) hda: cache flushes not supported hda: hda1 hda2 < hda5 hda6 > hda3 hda4 hdc: ATAPI CD-ROM drive, 128kB Cache, UDMA(33) Uniform CD-ROM driver Revision: 3.20 ide-floppy driver 0.99.newide usbcore: registered new driver hiddev usbcore: registered new driver usbhid drivers/usb/input/hid-core.c: v2.0:USB HID core driver mice: PS/2 mouse device common for all mice input: AT Translated Set 2 keyboard on isa0060/serio0 input: GenPS/2 Genius Wheel Mouse on isa0060/serio1 md: md driver 0.90.0 MAX_MD_DEVS=256, MD_SB_DISKS=27 NET: Registered protocol family 2 IP: routing cache hash table of 512 buckets, 16Kbytes TCP: Hash tables configured (established 16384 bind 4681) Initializing IPsec netlink socket NET: Registered protocol family 1 NET: Registered protocol family 17 ACPI: (supports S0 S1 S4 S5) ACPI wakeup devices: TANA P0P3 AC97 USB0 USB1 USB2 USB3 USB7 UAR1 SLPB Freeing unused kernel memory: 148k freed kjournald starting. Commit interval 5 seconds EXT3-fs: mounted filesystem with ordered data mode. SELinux: Disabled at runtime. SELinux: Unregistering netfilter hooks inserting floppy driver for 2.6.9-1.667asp Floppy drive(s): fd0 is 1.44M FDC 0 is a National Semiconductor PC87306 e100: Intel® PRO/100 Network Driver, 3.0.27-k2-NAPI e100: Copyright© 1999-2004 Intel Corporation ACPI: PCI interrupt 0000:01:08.0[A] -> GSI 11 (level, low) -> IRQ 11 divert: allocating divert_blk for eth0 e100: eth0: e100_probe: addr 0xff8ff000, irq 11, MAC addr 00:11:11:5E:8F:05 ACPI: PCI interrupt 0000:00:1f.5 -> GSI 3 (level, low) -> IRQ 3 PCI: Setting latency timer of device 0000:00:1f.5 to 64 intel8x0_measure_ac97_clock: measured 49433 usecs intel8x0: clocking to 48000 hw_random hardware driver 1.0.0 loaded ACPI: PCI interrupt 0000:00:1d.7[D] -> GSI 10 (level, low) -> IRQ 10 ehci_hcd 0000:00:1d.7: EHCI Host Controller PCI: Setting latency timer of device 0000:00:1d.7 to 64 ehci_hcd 0000:00:1d.7: irq 10, pci mem 1187ec00 ehci_hcd 0000:00:1d.7: new USB bus registered, assigned bus number 1 PCI: cache line size of 128 is not supported by device 0000:00:1d.7 ehci_hcd 0000:00:1d.7: USB 2.0 enabled, EHCI 1.00, driver 2004-May-10 hub 1-0:1.0: USB hub found hub 1-0:1.0: 8 ports detected USB Universal Host Controller Interface driver v2.2 ACPI: PCI interrupt 0000:00:1d.0[A] -> GSI 11 (level, low) -> IRQ 11 uhci_hcd 0000:00:1d.0: UHCI Host Controller PCI: Setting latency timer of device 0000:00:1d.0 to 64 uhci_hcd 0000:00:1d.0: irq 11, io base 0000dc00 uhci_hcd 0000:00:1d.0: new USB bus registered, assigned bus number 2 hub 2-0:1.0: USB hub found hub 2-0:1.0: 2 ports detected ACPI: PCI interrupt 0000:00:1d.1 -> GSI 5 (level, low) -> IRQ 5 uhci_hcd 0000:00:1d.1: UHCI Host Controller PCI: Setting latency timer of device 0000:00:1d.1 to 64 uhci_hcd 0000:00:1d.1: irq 5, io base 0000e000 uhci_hcd 0000:00:1d.1: new USB bus registered, assigned bus number 3 hub 3-0:1.0: USB hub found hub 3-0:1.0: 2 ports detected ACPI: PCI interrupt 0000:00:1d.2[C] -> GSI 9 (level, low) -> IRQ 9 uhci_hcd 0000:00:1d.2: UHCI Host Controller PCI: Setting latency timer of device 0000:00:1d.2 to 64 uhci_hcd 0000:00:1d.2: irq 9, io base 0000e400 uhci_hcd 0000:00:1d.2: new USB bus registered, assigned bus number 4 hub 4-0:1.0: USB hub found hub 4-0:1.0: 2 ports detected ACPI: PCI interrupt 0000:00:1d.3[A] -> GSI 11 (level, low) -> IRQ 11 uhci_hcd 0000:00:1d.3: UHCI Host Controller PCI: Setting latency timer of device 0000:00:1d.3 to 64 uhci_hcd 0000:00:1d.3: irq 11, io base 0000e800 uhci_hcd 0000:00:1d.3: new USB bus registered, assigned bus number 5 hub 5-0:1.0: USB hub found hub 5-0:1.0: 2 ports detected md: Autodetecting RAID arrays. md: autorun ... md: ... autorun DONE. NET: Registered protocol family 10 Disabled Privacy Extensions on device 02373a00(lo) IPv6 over IPv4 tunneling driver divert: not allocating divert_blk for non-ethernet device sit0 ACPI: Power Button (FF) [PWRF] ACPI: Sleep Button (CM) [sLPB] EXT3 FS on hda3, internal journal device-mapper: 4.1.0-ioctl (2003-12-10) initialised: dm@uk.sistina.com Adding 1027648k swap on /dev/hda4. Priority:-1 extents:1 parport0: PC-style at 0x378 [PCSPP,TRISTATE] Linux Kernel Card Services options: [pci] [cardbus] [pm] ip_tables: © 2000-2002 Netfilter core team ip_tables: © 2000-2002 Netfilter core team e100: eth0: e100_watchdog: link up, 10Mbps, half-duplex i2c /dev entries driver parport0: PC-style at 0x378 [PCSPP,TRISTATE] lp0: using parport0 (polling). lp0: console ready eth0: no IPv6 routers present ACPI: PCI interrupt 0000:00:02.0[A] -> GSI 11 (level, low) -> IRQ 11 [drm] Initialized i915 1.1.0 20040405 on minor 0: mtrr: base(0xf0020000) is not aligned on a size(0x180000) boundary ISO 9660 Extensions: Microsoft Joliet Level 3 ISOFS: changing to secondary root mydrv: no version for "struct_module" found: kernel tainted. mydrv: version magic '2.6.9y PENTIUM4 gcc-3.3' should be '2.6.9-1.667asp 686 REGPARM 4KSTACKS gcc-3.3' Цитата Ссылка на комментарий Поделиться на другие сайты Поделиться
Ineu Опубликовано 11 апреля, 2006 Жалоба Поделиться Опубликовано 11 апреля, 2006 Zlodei писал(а) Втр, 11 Апреля 2006 13:41 mydrv: no version for "struct_module" found: kernel tainted. mydrv: version magic '2.6.9y PENTIUM4 gcc-3.3' should be '2.6.9-1.667asp 686 REGPARM 4KSTACKS gcc-3.3' В принципе, tainted не должно мешать загрузке модуля... буду думать Цитата Ссылка на комментарий Поделиться на другие сайты Поделиться
Рекомендуемые сообщения
Присоединяйтесь к обсуждению
Вы можете написать сейчас и зарегистрироваться позже. Если у вас есть аккаунт, авторизуйтесь, чтобы опубликовать от имени своего аккаунта.