Need help creating a Loadable Kernel Modules
I'm trying to create a loadable kernel module for Kubuntu 7.10 which has the 2.6 KDE kernel. The file is a serial speed enhancer for my motherboard. It's name is viahss-0.92 and within the file are thefollowing text files:
file:///home/jacatone/Desktop/Module/viahss-0.92/Makefile file:///home/jacatone/Desktop/Module/viahss-0.92/Makefile-2.6 file:///home/jacatone/Desktop/Module/viahss-0.92/viahss.c The instructions are: If you have a working kernel build environment then you'll need to do following things: 1) Edit viahss.c in viahss-0.92 directory remove following line (15): #include <linux/config.h> 2) Copy Makefile for 2.6 on top of 2.4 for makefile # cp Makefile-2.6 Makefile 3) Compile package with make # make This worked at least with my Ubuntu 8.04 based mythbuntu machine (also with my CentOS4 machine. If this doesn't work most likely you don't have full kernel build environment." Could someone explain this to me in plainer language and maybe walk me through the process? Many thanks. |
Apparently the linux/config.h file has been removed as of 2.6.19. (http://www.linuxquestions.org/questi...kernel-506363/) If you're using a 2.6.19+ kernel (check by running 'uname -r' in a terminal), you'd need to remove that line:
Code:
user@host ~/viahss-0.92 $ mv viahss.c{,.bak} Code:
user@host ~/viahss-0.92 $ diff viahss.c{.bak,} Code:
user@host ~/viahss-0.92 $ cp Makefile{-2.6,} Code:
user@host ~/viahss-0.92 $ make Code:
root@host ~/viahss-0.92 # cp ./viahss.ko /lib/modules/`uname -r`/kernel/drivers/serial Edit - it's the 2.6 kernel, not the 2.6 KDE kernel. KDE runs on top of the OS and is independent of the kernel (i.e. KDE will run on FreeBSD/OpenBSD/NetBSD/etc..., which do NOT use the Linux kernel)...don't mean to nit-pick, but I thought I'd point that out =) |
When I do the "diff viahss.c{.bak,}" command, I get the following:
jacatone@eMax:~/Desktop/Module/viahss-0.92$ diff viahss.c{.bak,} 15d14 < #include <linux/config.h> Does this mean it's still there? If so, how do I remove it? Thanks. |
Quote:
viahss.c{.bak,} to: viahss.c.bak viahss.c "diff" uses greater than/less than signs to show which file the modifications are in, so this line: < #include <linux/config.h> means that viahss.c.bak (the file on the left of the expansion above...notice the "<" at the beginning of the line) still contains the #include directive, but it's absent in the viahss.c file (which is what we want). If that line was still there in viahss.c, it wouldn't show up when diff was run against those two files. Sorry for not making that clear...the line was removed successfully and you can compile it now. |
Not a problem rocket357, I really appreciate your help. Everything went fine until I got to:
root@eMax:/home/jacatone/Desktop/Module/viahss-0.92# modprobe viahss FATAL: Module viahss not found. root@eMax:/home/jacatone/Desktop/Module/viahss-0.92# setserial The program 'setserial' is currently not installed. You can install it by typing: apt-get install setserial When I try installing setserial I get: Media change: please insert the disc labeled 'Kubuntu 7.10 _Gutsy Gibbon_ - Release i386 (20071016.1)' in the drive '/cdrom/' and press enter Which I did, but it keeps repeating this message. I guess the "FATAL: Module viahss not found." is where it went wrong. |
Quote:
Quote:
|
Yeah, I did. I just did a copy/paste of all the commands you gave me. Should I try again from scratch?
|
Quote:
|
I tried it over from scratch and didn't get the error message this time, so I guess I did forget something along the way. It's still hung up on the "setserial" command. Keeps asking for the Kubuntu 7.10 disk, which I inserted, then press Enter, but just keeps repeating it over and over:
Media Change: Please insert the disc labeled 'Kubuntu 7.10 _Gutsy Gibbon_ - Release i386 (20071016.1)' in the drive '/cdrom/' and press [Enter]. Media Change: Please insert the disc labeled 'Kubuntu 7.10 _Gutsy Gibbon_ - Release i386 (20071016.1)' in the drive '/cdrom/' and press [Enter]. Guess, I'll post this snag as another question. |
Good to hear you got it working.
As for setserial, my initial thought is that there's a universe somewhere that's not being picked up that contains that program. I've got the Kubuntu vmware install finished, so I'll check it out heh. If I can determine a fix, I'll let you know. Edit - I used the Adept Package Manager, performed a search for setserial, and installed it from there without a hitch. Again, I'm testing on 8.04, so there could be differences in repositories and the like. |
I tried Adept as well, and still got the message asking for the Kubuntu 7.10 disk. Did you get a message asking for your v8.04 disk? I've got all the repositories checked. Even have Multibuntu included. If you were successful with v8.04 maybe I'll do an upgrade and see if that works. Many thanks for your help. I couldn't have gotten as far as I did without it.
|
The install I did was from Adept on a default install of 8.04. I performed a clean install, updated the packages it brought up as updates (using Adept to update), then installed setserial.
I'm no *buntu guru, so this issue of asking for the CD is likely better served elsewhere. Wish I could help more, but hey...you got the kernel module built and loaded, right? heh |
How do I use this "setserial"? The resulting dialog doesn't really explain how:
root@eMax:/home/jacatone/Desktop/Module/viahss-0.92# setseria l setserial version 2.17, 27-Jan-2000 usage: setserial serial-device -abqvVWz [cmd1 [arg]] ... setserial -g [-abGv] device1 ... Available commands: (* = Takes an argument) (^ = can be preceded by a '^' to turn off the option) * port set the I/O port * irq set the interrupt * uart set UART type (none, 8250, 16450, 165 50, 16550A, 16650, 16650V2, 16750, 16850, 16950, 16954) * baud_base set base baud rate (CLOCK_FREQ / 16) * divisor set the custom divisor (see spd_custo m) * close_delay set the amount of time (in 1/100 of a second) that DTR should be ke pt low while being closed * closing_wait set the amount of time (in 1/100 of a second) that the serial port should wait for data to be drained while bein g closed. ^ fourport configure the port as an AST Fourport autoconfig automatically configure the serial po rt ^ auto_irq try to determine irq during autoconfi guration ^ skip_test skip UART test during autoconfigurati on ^ sak set the break key as the Secure Atten tion Key ^ session_lockout Lock out callout port across differ ent sessions ^ pgrp_lockout Lock out callout port across differen t process groups ^ callout_nohup Don't hangup the tty when carrier det ect drops on the callout device ^ split_termios Use separate termios for callout and dailin lines ^ hup_notify Notify a process blocked on opening a dial in line when a process has finished u sing a callout line by returning EAGAIN to t he open. ^ low_latency Minimize receive latency at the cost of greater CPU utilization. get_multiport Display the multiport configuration set_multiport Set the multiport configuration * rx_trigger Set RX trigger level (ESP-only) * tx_trigger Set TX trigger level (ESP-only) * flow_off Set hardware flow off level (ESP-only ) * flow_on Set hardware flow on level (ESP-only) * rx_timeout Set receive timeout (ESP-only) * dma_channel Set DMA channel (ESP-only) spd_hi use 56kb instead of 38.4kb spd_vhi use 115kb instead of 38.4kb spd_shi use 230kb instead of 38.4kb spd_warp use 460kb instead of 38.4kb spd_cust use the custom divisor to set the spe ed at 38.4kb (baud rate = baud_base / cust om_divisor) spd_normal use 38.4kb when a baud rate of 38.4kb is selected Use a leading '0x' for hex numbers. CAUTION: Using an invalid port can lock up your machine! root@eMax:/home/jacatone/Desktop/Module/viahss-0.92# |
All times are GMT -5. The time now is 03:30 AM. |