I have been trying to write an ebuild for the beta slmodem drivers (ones in portage dont compile under 2.6). Unfortunatley i have no experience with writing ebuilds involving kernel modules, and dont know what the 'official' lines on /dev entries and /etc/modules.d files are. Basically, what needs doing: 'make install' creates /dev/slamr[0-3] abd /dev/slusb[0-3] (major nodes 212 and 213), devfs and udev need to handle those need to get .ko and .o for 2.4/2.6 handled, modules go in /lib/modules/*/extra. Also need to patch makefile so it doesnt put the modules directly in there, but puts them in ${D} If alsa support compiled into kernel, dont create modules as snd-intel0x8m is meant to handle it (still havent got thise quite sorted out, read the README in tarball) I will ofc continue to work on this, but some help/experience would be extremely appreciated
Created attachment 29356 [details] half-finished 2.9.6 ebuild based on the slmodem ebuild in portage
To make nodes use "mknod ${D}/dev...." Do a grep on the ebuilds to find if there are udev detection stuff around. (grep -r udev /usr/portage --include "*ebuild"). Same for alsa detection - could assume this from a alsa use flag. To change the install directory see if there is a varable like DESTDIR in the Makefile and do "emake DESTDIR=${D}" to get it to install in $D.
the makefiles does need patching. For the userspace programs it uses ${DESTDIR} but for the kernel modules it uses /lib/modules directly without any ${DESTDIR}'s at all. The alsa support is a strange one, you can use the snd-intel0x8m alsa driver only if you have a motherboard with the sound and modem built into it that uses the snd-intel0x8 driver, so even if they've got alsa support they might still have to use the slamr/slusb modules... The mkaefiles creates nodes by itself, its just recreating them on bootup thats the problem. I'm not sure if devfs, udev or slmodemd will do this, ill need to check I'll also write an init.d script to start the modem daemon (/usr/sbin/slmodemd) sometime
right, done some more work on this. The extra bits needed are commented in the ebuild. Unfortunately i cant test slamr/usb, devfs/udev and the nodes, as slamr cant modprobe (unknown symbols) and I use the alsa driver anyway. Also, using the alsa driver steals the sound device, I'm still looking for a way around this
Created attachment 29623 [details] updated slmodem ebuild comments explain what needs adding
Created attachment 29625 [details] /etc/modules.d/slmodem files
Don't mean to step on any toes here, but--silly me--I made slmodem-2.9.6 ebuild before checking here. I'm attaching the files.
Created attachment 29738 [details] Ebuild
Created attachment 29739 [details, diff] Update makefile patch. Set DESTDIR to D. Don't mknod. Don't use setver; use uname -r instead.
Created attachment 29740 [details] Sample /etc/conf.d file.
Created attachment 29741 [details] Devfs file (udev not used)
Created attachment 29742 [details] Init script.
Created attachment 29743 [details] /etc/modules.d file
I should mention the pecuilar features of my ebuild: It relies the config-kernel(1) system to build the kernel modules. The init script and the modules file use /etc/conf.d/slmodem to to get country and modem type info. There is no support for udev. I use devfs. The patch removes the use of kernel-ver, since it use UTS_RELEASE from <linux/version.h> (which is /usr/include/linux/version.h>, and replaces it with a call to uname -r. I use sys-dev/linux-headers that give a UTS_RELEASE of 2.6.5 in <linux/version.h> but I actually run 2.6.5-mm6 so modules should go in /lib/modules/2.6.5-mm6, not /lib/modules/2.6.5.
*** Bug 48943 has been marked as a duplicate of this bug. ***
*** Bug 50722 has been marked as a duplicate of this bug. ***
I'm in the middle of combining everyone's insightful ideas. Once I get a handle on kernel module building (the gentoo way) there will be an ebuild for all to try.
please add this ebuild to portage ASAP! thanks!
Opps sorry forgot after I couldn't fix some access volations. emerge with FEATURES="-userpriv -sandbox" and tell me if there is any other problems. Version 2.9.7 commited to gentoo now. Find me on #gentoo/#gentoo-embedded/#gentoo-bugs you want to discuss anything or just post a comment here.
There is another issue with the ebuild, concerning the coordination between config file in conf.d, module options in modules.d and init.d script: in /etc/module.d/slmodem, it say's: ## Uncomment one of the two MODEM options. define MODEM `grep MODEM= /etc/conf.d/slmodem | sed 's/MODEM=//'` alias /dev/modem ${MODEM} in /etc/conf.d/slmodem, by default there is no entry for MODEM, just one for DEV. If I change this to MODEM=ttySL, the init.d script starts okay. But I don't know, if the alias above is working with just ttySL (don't know nothing about aliases), I suspect it to create a entry called /dev/modem, but it doesn't. I am running udev Gentoo.
same problem here, with (still) devfs. The conf.d and modules.d configs are not really a problem (can be easily fixed), but the driver itself doesn't create a device-node when modprobe'd. "modprobe slamr" should give you /dev/slamr0 and *not* /dev/ttySL0. /var/log/messages reports no errors, but the device-node isn't there. and w/o device-node, slmodemd can't work. :-/ First, we should make it work at all, then we have to fix the ebuild (configs, etc.). That stupid little driver is unfortunately very important, since many notebooks have such modem-chip on board. Ok, modems are bad at all (ISDN is at least better), but many ppl. out there don't have ISDN and/or DSL, but such a built-in modem.
well, as far as I can see, /sys nodes are created when slamr is modprobe'd (/sys/bus/pci/drivers/slamr) but no /dev nodes are created (udev), and I dont know enough about udev to know why it doesnt create them... manually creating slamr0 (mknod /dev/slamr0 c 212 0) works, at least slmodemd created /dev/ttySL0 symlink ok, but that doesnt really mean anything as I havent got a dialup to test it with most of the cruft out of the modules.d file can be stripped, all except the alias lines
yes, after modprobe, /sys/bus/pci/drivers/slamr is present. but that's all. creating device-node doesn't work. Ok, the node is there after, but slmodem doesn't work at all. can anyone post corrected modules.d and conf.d configs? Also /etc/init.d/slmodem seems to need a rewrite... thanks!
Created attachment 32292 [details] New init script for the slmodem v 2.9.7
Created attachment 32293 [details] And new configuration file for slmodem v 2.9.7
Ok - I had a small break but I'm back now. I haven't totaly read everything here however: devfs can do symlinks with these kind of entries # Manage USB mouse REGISTER ^input/mouse0$ CFUNCTION GLOBAL mksymlink $devname usbmouse UNREGISTER ^input/mouse0$ CFUNCTION GLOBAL unlink usbmouse REGISTER ^input/mice$ CFUNCTION GLOBAL mksymlink $devname usbmouse UNREGISTER ^input/mice$ CFUNCTION GLOBAL unlink usbmouse I've no idea how udev does symlinks however I'll find out if its not listed here somehow or no suggestion is made. Please keep up you input - I don't have the hardware to test this. BTW net-dialup needs devs. if you think your up to it email Heinrich Wendel <lanius@gentoo.org>.
version 2.9.7-r1 commited. Uses slamr0 as the device. Incorporates some changes. I've think I've done the udev stuff right. Not sure about devfs. Thanks for the init/config scripts Miroslaw. I'm not doing symlinks in /dev as udev and devfs support them if done correctly. Stefan try runing devfsd in debug mode on the command line. See if devfs recognises the modprobe action to provide devices. Try finding me on the irc channels if you still have problems. I'm just guessing as I don't have the hardware. /etc/module.d/slmodem is used to help modprobe and *maybe* devfs Looking at udev for the first time here it looks pretty easy compared to devfs. It doesn't do autoloading but the rest seems easy. As usual bug me with any comments or fixes.
thanks for the work so far, but a slight change is needed in the ebuild. When creating the udev permissions and rules files, I get this: /usr/sbin/ebuild.sh: line 56: /var/tmp/portage/slmodem-2.9.7-r1/image//etc/udev/rules.d/55-slmodem.rules: No such file or directory /usr/sbin/ebuild.sh: line 58: /var/tmp/portage/slmodem-2.9.7-r1/image//etc/udev/permissions.d/55-slmodem.permissions: No such file or directory You need to create the /etc/udev/{rules,permissions}.d directories before echoing the stuff to the files
yeah, add: mkdir -p ${D}/etc/udev/{rules,permissions}.d before the echo commands I've tried it with udev, and /dev/slamr0 still isnt created automatically. The module may need patching with udev support or something...
Ok - thanks simon. Try restarting udevd and see if that changes it. It needs the udev files to recognise the device. What /sys entries exist for the device? What is in /proc/modules? Just trying to get the right name for the module in the udev config files. I'm going to be on irc for a few hrs if you want to drop by.
Alsa support is never really compiled into slmodemd, SUPPORT_ALSA=1 is not propogated by make into the modem directory. Also, the config and init files need fairly extensive modification to work with the alsa option.
Tod - Well noted will get the ALSA going - contributions for ALSA config files welcomed. Simon - can you include what sys files exist and what should exist. A reference to what you found yesterday when you google searched. I'd like to get some udev help on this but I need to get the info first.
ok, so far /sys/bus/pci/drivers/slamr/ exists, with a link to the pci bus id of the device and new_id which i cant access, but i havent figured out exactly why/how it creates that /sys/modules/slamr also exists but thats just a generic modules thing afaitc, udev needs /sys/class/<something (probably slamr)>/slamr0/dev to create the node, containing the major:minor numbers of the node (212:0 for slamr0)
Latexer can you please give a digital hand here.
Created attachment 32775 [details] updated slmodem ebuild me and daniel have had a look, and alsa support is only compiled into the slmodemd program (which is done already), just added notice at the end about it. snd-intel8x0m doesnt support udev so the node needs to be created by the init script (mknod /dev/slamr0 c 212 0) if you dont use devfs, i dont know about devfs and snd-intel8x0m, could someone check this?
1. Right now kernel driver for slmodem don't create link in sys filesystem, because of that setting of the udev cannot work now. 2. symbolic link for /dev/modem shouldn't be created to /dev/slamr0. This link should be created to /dev/ttySL0, because /dev/slamr0 is device accesspoint for the program slmodemd, and /dev/ttySL0 is real modem device available for user. 3. Suggestion to start slmodemd with higher priority than 0, because with high cpu load the performance of the modem go down. (start-stop-daemon with parameter -N -6 for example)
1. Yep - was hoping latexer or any udev expert would help here. 2. /dev/modem is just a convience so that modem programs can use it as a lock and less config files to change if the modem mechanism changes. Will link modem to ttySL0 and create ttySL0 as a link to slamr0. How may slmodem devices exist at once? How many should I allow for? 3. Good thinking - will incorporate thanks.
Commited new version - slmodem-2.9.7-r2 - am I getting close? Documenentation with slmodemd seems to suggest that it creates the ttySL0 files linked to a pseudo terminal. As such I don't touch those. I have symlinked modem to ttySL0. All suggestions welcome. udev status unchanged. Can someone please email Linux-support@smlink.com regarding udev support?
Created attachment 32916 [details, diff] sysfs-for-slmodem.patch Adds sysfs support to the 3 slmodem drivers included in the distribution. with this applied, udev will create /dev/slusb0 and /dev/slamr0 style nodes, which should mimic the default devfs behaviour. I've tried to maintain 2.4 compatibility as well, so this should still work on 2.4 even with the sysfs patch applied (it's supposed to do nothing here, as 2.4 does not have /sys). I have tested by compilation, but it would be useful if someone who owns one of these devices could test.
Created attachment 32917 [details, diff] dsd's patch against 2.9.7-r2 ebuild Here's my comments on the ebuild, in diff form :) The udev part could do with testing from someone who owns the hardware and uses udev.
Oh - forgot to mention. If we're not adding any udev rules, but we just want the nodes to appear when the module is loaded, then there is no need to reload udev.
hmm, this patch doesnt create any /dev nodes, or any udevd debug messages, but it does create /sys/slamr directory (well done!) which is empty. It should have a 'dev' file with 212:0 in it. This could be because my hardware is slightly wierd (built-in modem) but the slamr module prints luverly syslog messages about it, so its unlikely: slamr: SmartLink AMRMO modem. slamr: probe 1039:7013 SiS630 card... slamr: mc97 codec is SIL22 slamr: slamr0 is SiS630 card. we're getting there!
anything in /sys/class/slamr/ ?
oh, sorry, typo. s/'/sys/slamr'/'/sys/class/slamr'/. on my last comment
sorry folks, I had some nice days in Mallorca. ;-) I check and test everything tomorrow.
How about using the Linux 2.6 "make O=/dir/to/output target" feature (see "make help" for details) to avoid the sandbox issues?
Anders - fantastic - thanks - will incorporate next change.
actually you should use latexer's kernel (kernel-2) eclass for the kernel modules.. he has the stuff to take care of the sandbox issues. And the init.d is missing the alsa stuff.. I'll try to see if I can so something..
Instead of fiddling with -O you could just make the ebuild depend on kernel 2.6.6 or above which handles the compilation of external modules correctly. Please see the ebuild attached to bug #32737 comment #88.
need to have emake SUPPORT_ALSA=1 DESTDIR=${D} install || die in src_install() or slmodem is rebuilt without alsa support prior to installation, which undoes the work done in src_compile(). Don't ask me why...
Created attachment 33400 [details, diff] sysfs-for-slmodem-v2.patch Please back out the last patch, and apply this one. I'm not sure why the dev file didn't exist, but I've added in some extra printing to hopefully provide some insight. Please apply, load module, and post relevant output from dmesg.
slamr: SmartLink AMRMO modem. slamr: probe 1039:7013 SiS630 card... ACPI: PCI interrupt 0000:00:02.6[C] -> GSI 18 (level, low) -> IRQ 177 slamr: mc97 codec is SIL22 slamr: slamr0 is SiS630 card. slamr: creating sysfs device with major 212 minor 0 slamr: creating simple class
Created attachment 33431 [details, diff] sysfs-for-slmodem-v3.patch Theres the problem. We should be creating the class before adding the devices to it. Try this patch please.
CC [M] /var/tmp/portage/slmodem-2.9.7-r2/work/slmodem-2.9.7/drivers/sysdep_amr.o CC [M] /var/tmp/portage/slmodem-2.9.7-r2/work/slmodem-2.9.7/drivers/st7554.o /var/tmp/portage/slmodem-2.9.7-r2/work/slmodem-2.9.7/drivers/amrmo_init.c: In function `amrmo_vprintf': /var/tmp/portage/slmodem-2.9.7-r2/work/slmodem-2.9.7/drivers/amrmo_init.c:294: warning: use of cast expressions as lvalues is deprecated /var/tmp/portage/slmodem-2.9.7-r2/work/slmodem-2.9.7/drivers/amrmo_init.c: In function `amrmo_init': /var/tmp/portage/slmodem-2.9.7-r2/work/slmodem-2.9.7/drivers/amrmo_init.c:735: error: `err' undeclared (first use in this function) /var/tmp/portage/slmodem-2.9.7-r2/work/slmodem-2.9.7/drivers/amrmo_init.c:735: error: (Each undeclared identifier is reported only once /var/tmp/portage/slmodem-2.9.7-r2/work/slmodem-2.9.7/drivers/amrmo_init.c:735: error: for each function it appears in.) make[4]: *** [/var/tmp/portage/slmodem-2.9.7-r2/work/slmodem-2.9.7/drivers/amrmo_init.o] Error 1 make[4]: *** Waiting for unfinished jobs.... make[3]: *** [_module_/var/tmp/portage/slmodem-2.9.7-r2/work/slmodem-2.9.7/drivers] Error 2 make[3]: Leaving directory `/usr/src/linux-2.6.7-rc3-love2' make[2]: *** [all] Error 2 make[2]: Leaving directory `/var/tmp/portage/slmodem-2.9.7-r2/work/slmodem-2.9.7/drivers' make[1]: *** [all] Error 2 make[1]: Leaving directory `/var/tmp/portage/slmodem-2.9.7-r2/work/slmodem-2.9.7/drivers' make: *** [drivers] Error 2
Created attachment 33432 [details, diff] sysfs-for-slmodem-v4.patch oops.
that did it!! wow...thanks a lot! :D :D :D :D
FYI version 2.9.8 is out now at ftp.smlink.com - the changelog is: - T.35 country codes fixes - Fax Class1 support - Mandrake style startup script 'scripts/mandrake' (contributed by Gaetano Lombardo) - misc improvements - misc fixes
Created attachment 33468 [details, diff] makefile fix for 2.9.8 Heres the makefile fixup patch changed for 2.9.8. Havent got round to changing the sysfs patch for 2.9.8, ill have a look when i can sometime today (unless someone does it before me)
Created attachment 33470 [details, diff] sysfs patch for 2.9.8 updated the sysfs patch for 2.9.8. also noticed a couple of oddities in the ebuild, the MY_P definition can be removed (since MY_P="${P}" is a bit superfulous). Also a bug with using udev, the slmodemd program is started before udev can create the /dev node, so it fails but then the node is created. Adding a sleep of 0.25 after the module is inserted solves this (probably same problem with 2.9.7). Otherwise the 2.9.7 ebuild can be bumped with the new patches
Does anyone own one of the USB devices (slusb) supported by this driver?
Created attachment 33516 [details, diff] sysfs-for-slmodem-v5.patch Updated sysfs patch. Against 2.9.8. Fixes a possible memory leak and fixes a probable bug in my sysfs code for the USB driver. This could do with testing, if anyone has the USB version.
draft version 2.9.8 comited. I'm getting compile errors saying no module support in kernel and I'm hoping its just my setup. Fixes welcome. Still TODO also - propper kernel version usage in ebuild. Let me know if I missed anything else.
I sent off my sysfs patch to smartlink. Got a response today, they will review my work and maybe incorporate it. They also pointed out that 2.9.8 does not work with USB modems under 2.4 (a bug slipped through). The updated release is at: ftp://ftp.smlink.com/linux/unsupported/snapshots/slmodem-2.9.8-19Jun2004.tar.gz
In My box there is variable "KV" instead of "KERNEL_VERSION" slmodem-2.9.8 cannot be compiled
what error? I'm on irc if you want to help be debug there.
Why does net-dialup/slmodem-2.9.8 depend on sys-kernel/config-kernel? config-kernel is not used in the .ebuild at all.
>In My box there is variable "KV" instead of "KERNEL_VERSION" >slmodem-2.9.8 cannot be compiled Sorry I should write "KERNEL_VER" during compilation it write error: Build kernel first then I added in ebuild KERNEL_VER=${KV} and I receive during compilation: >>> emerge (1 of 1) net-dialup/slmodem-2.9.8 to / >>> md5 src_uri ;-) slmodem-2.9.8.tar.gz >>> Unpacking source... * /usr/src/linux is a symbolic link * Determining the real directory of the Linux kernel source code * Building for Linux 2.6.7-gentoo found in /usr/src/linux * which outputs to /usr/src/linux * By not using the kernel's ability to output to an alternative * directory, some external module builds may fail. * See <insert link to user doc here> >>> Unpacking slmodem-2.9.8.tar.gz to /var/tmp/portage/slmodem-2.9.8/work * Applying slmodem-2.9.8-makefile-fixup.patch... [ ok ] * Applying slmodem-2.9.8-udev.patch... [ ok ] >>> Source unpacked. make -C drivers KERNEL_DIR=/lib/modules/2.6.7-gentoo/build make[1]: Entering directory `/tmp/var/portage/slmodem-2.9.8/work/slmodem-2.9.8/drivers' make modules -C /lib/modules/2.6.7-gentoo/build SUBDIRS=/tmp/var/portage/slmodem-2.9.8/work/slmodem-2.9.8/drivers make[2]: Entering directory `/usr/src/linux-2.6.7-gentoo' /usr/src/linux-2.6.7-gentoo/Makefile:434: .config: No such file or directory CC [M] /tmp/var/portage/slmodem-2.9.8/work/slmodem-2.9.8/drivers/amrmo_init.o CC [M] /tmp/var/portage/slmodem-2.9.8/work/slmodem-2.9.8/drivers/sysdep_amr.o /tmp/var/portage/slmodem-2.9.8/work/slmodem-2.9.8/drivers/amrmo_init.c: In function `amrmo_vprintf': /tmp/var/portage/slmodem-2.9.8/work/slmodem-2.9.8/drivers/amrmo_init.c:294: warning: use of cast expressions as lvalues is deprecated /bin/sh: line 1: scripts/basic/fixdep: No such file or directory make[4]: *** [/tmp/var/portage/slmodem-2.9.8/work/slmodem-2.9.8/drivers/sysdep_amr.o] Error 1 make[4]: *** Waiting for unfinished jobs.... /bin/sh: line 1: scripts/basic/fixdep: No such file or directory make[4]: *** [/tmp/var/portage/slmodem-2.9.8/work/slmodem-2.9.8/drivers/amrmo_init.o] Error 1 make[3]: *** [_module_/tmp/var/portage/slmodem-2.9.8/work/slmodem-2.9.8/drivers] Error 2 make[2]: *** [modules] Error 2 make[2]: Leaving directory `/usr/src/linux-2.6.7-gentoo' make[1]: *** [all] Error 2 make[1]: Leaving directory `/tmp/var/portage/slmodem-2.9.8/work/slmodem-2.9.8/drivers' make: *** [drivers] Error 2 !!! ERROR: net-dialup/slmodem-2.9.8 failed. !!! Function src_compile, Line 44, Exitcode 2 !!! Failed to compile driver
damn same errors as I was getting. Bad news is I'm very short of time this week and am off beyond the reach of Gentoo for 2 weeks after that. If someone debugs this post it here and I may get time to commit the change. Any dev here please feel free to modify this package.
I'm using ' net-dialup/slmodem-2.9.7-r2 ' and UDEV. And have not edited /etc/udev/rules.d/55-slmodem.rules But my problem is, no entry is being created in /dev for the modem, and the only way i'm able to use the modem is to create an entry with mknod: mknod --mode=666 /dev/slamr0 c 212 0 Without the device in /dev ' /etc/init.d/slmodem start ' outputs : bash-2.05b# /etc/init.d/slmodem start * Shutting down slmodemd... * Starting slmodemd for /dev/slamr0... * Waiting for driver initialisation * Waiting for driver initialisation * Waiting for driver initialisation * Waiting for driver initialisation * Module - slamr failed to initialise device [ !! ] [ ok ] bash-2.05b# Obviouslly after creating the entry everything works fine.. Does anyone know how i'm able to solve this problem (without manually creating the device) ?
Yes, just use my sysfs patch posted here. slmodem 2.9.9 includes this also.
*** Bug 57823 has been marked as a duplicate of this bug. ***
version 2.9.9 commited for testing. Please report faults and fixes here.
right, two problems. One of them is on bug #58222 (afaicr), dodgy dependancy on the 2.4 headers when it compiles fine under the 2.6 headers. Secondly, I get this: /usr/lib/portage/bin/dodoc: README.1st does not exist.
Thanks Simon. Fixed. Also while your coding minds are going I'm after a src_test function that can test the compile. Basic principles are that its called before the src_install and probably should run modem_test somehow. Constraints are that it is run as the user portage. Possible? Also should modem_test be installed into /usr/sbin?
Peoples with hardware - can you please check the latest init.d scripts in bug #58222. Planning of adding them.
version slmodem-2.9.9-r1 commited - Will fix any bugs however I'll need help. If anyone has a non-x86 arch to test this on please let me know if it works or not.
Any comments on bug #59244?