Bug 38017 - first stab at a ndiswrapper ebuild
Bug#: 38017 Product:  Gentoo Linux Version: unspecified Platform: All
OS/Version: Linux Status: RESOLVED Severity: enhancement Priority: P2
Resolution: FIXED Assigned To: mobile@gentoo.org Reported By: jbooth@uiuc.edu
Component: Ebuilds
URL: 
Summary: first stab at a ndiswrapper ebuild
Keywords:  
Status Whiteboard: 
Opened: 2004-01-12 17:11 0000
Description:   Opened: 2004-01-12 17:11 0000
Works fine, except doesn't play nice with sandbox. Nobody wanted to talk to me
to give me any hints how to work around it, so I guess someone else gets to fix
it, then maybe I can learn from what they did.

No other ebuilds that did kernel installs were enlightening unfortunatly.

Reproducible: Always
Steps to Reproduce:
1.
2.
3.

------- Comment #1 From jbooth@uiuc.edu 2004-01-12 17:12:57 0000 -------
Created an attachment (id=23709) [details]
ebuild for ndiswrapper

------- Comment #2 From scootersmk 2004-01-17 18:50:08 0000 -------
Just finished making an install doc for this in the forums.

Link:http://forums.gentoo.org/viewtopic.php?p=786853#786853

I was getting ready to make an ebuild myself before i came apon this one.  I'll test out the ebuild in a minute.  

Is there anyway we could incorperate some more of the install process into the ebuild.  I do not know if that would be possible with all the different card dependent drivers.  Or maybe we could just put an einfo line in the ebuild with the forum link to the doc?  Just some suggestions.

Also, could someone please post on here if this gets into portage so I can update my doc.

------- Comment #3 From Matthew Taylor 2004-01-20 10:53:20 0000 -------
Created an attachment (id=24140) [details]
Another ebuild

Dose a bit more setup. Have tested it only on 2.4 so far.

------- Comment #4 From scootersmk 2004-01-20 19:12:45 0000 -------
Towards the end of your ebuild you started typing ndiswapper instead of
ndiswrapper.  So needless to say it failed.  I will fix it if I get a chance
tonight.

------- Comment #5 From scootersmk 2004-01-20 19:36:43 0000 -------
OK I think I see the reason you did this, because there is already a
ndiswrapper module.  Hows about we call it ndiswrap.

And another thing, from everyting i read in ndiswrapper's docs all you needed
to do was 
make install (in ndiswrapper directory)

and 

make (in ndiswrapper/utils)

Im not sure why you are doing it differently, I was just going by the doc.

------- Comment #6 From Matthew Taylor 2004-01-20 20:12:34 0000 -------
make install would probably not work with ebuild's sandbox.  The 'ndiswapper'
is just a typo. Should still work though

------- Comment #7 From Matthew Taylor 2004-01-20 20:33:05 0000 -------
Created an attachment (id=24155) [details]
fixes

delete /etc/modules.d/ndiswapper if it exists

------- Comment #8 From scootersmk 2004-01-20 21:10:13 0000 -------
There is still a problem that I cannot seem to figure out.  For some reason
make (in the drivers directory) is failing because it is detecting the wrong
${ARCH}.  If you change the command to make || die you will see the error.

I also am not sure if your recent change is going to work because there is
already   a "ndiswrapper" module.  That is the reason for in the INSTALL and in
my doc, on the forums, there was a module called "wlan0" created.

Are you testing these ebuilds? I am trying to figure out where the problem is
because i can install it by hand with no problem, but it fails in the ebuild.

I'll keep hacking...

------- Comment #9 From scootersmk 2004-01-20 21:13:27 0000 -------
One more thing, it might be a 2.6 kernel problem, because I just noticed you
have tested only on 2.4.  Can anyone else test this on 2.6?

------- Comment #10 From Matthew Taylor 2004-01-20 21:59:26 0000 -------
I don't have a problem compiling which is probably because I am using 2.4. Try
changing it to    

ARCH="i386" make || die

the ebuild dose the setup for 2.4 but gentoo's modules-update should hopefully
automatically convert the modules.conf to modprobe.conf for 2.6.   


Where dose the other ndiswrapper module come from is it another ebuild. Feel
free to change it dose.  

------- Comment #11 From Matthew Taylor 2004-01-21 15:02:48 0000 -------
Created an attachment (id=24201) [details]
should work for 2.6

------- Comment #12 From Matthew Taylor 2004-01-21 15:33:24 0000 -------
Created an attachment (id=24202) [details]
version that works with 2.6

changed eth1 to wlan0

------- Comment #13 From Matthew Taylor 2004-01-25 10:36:53 0000 -------
Created an attachment (id=24399) [details]
sandbox fix

------- Comment #14 From Steven Wagner 2004-02-21 02:40:32 0000 -------
What is the status of this?  I noticed development has come to a stop.  Can we
get this commited to portage now?  Masked for now seems to make sense.

------- Comment #15 From Peter Johanson (RETIRED) 2004-02-21 03:16:08 0000 -------
Hey,

i finally got this bug on my list a little while ago. I'm away at a con this weekend, but i'll get this in next week. I've had to clean up the ebuild, a few things:

1) perl to do what "sed" was written for == no no. ebuilds are basically bash on speed, so you should try to stick to basic utilities and not bother loading perl if you don't need it.

2) Ebuilds should be "location agnostic." i.e. they should not rely on being on the machine that the ebuild is aimed at. I'll be moving the hardware detection to a config() function and adding some einfo in pkg_postinst so people can run that if they want to.

sorry for the delay. (:

------- Comment #16 From Peter Johanson (RETIRED) 2004-02-28 20:24:19 0000 -------
Okay, so an initial version of this has been added to the ebuild. Most of the
vendor and device ID detection code was moved to a pkg_config() function which
people can run after installing the driver. For now, the 2.6 sandbox issue is
unfixed, pending the major 2.6 module work being done in bug #32737

Thanks for the initial ebuild! Leaving marked NEW til a final version with
better 2.6 support is done.

------- Comment #17 From Serge Canizares 2004-03-06 14:48:02 0000 -------
Hi.

I tried emerging this ebuild, but the compile failed. I'm using the gentoo-sources 2.4.22-r7 kernel. Here's the output:

arachne root # ACCEPT_KEYWORDS="~x86" emerge net-wireless/ndiswrapper
Calculating dependencies ...done!
>>> emerge (1 of 1) net-wireless/ndiswrapper-0.4 to /
>>> md5 src_uri ;-) ndiswrapper-0.4.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.4.22-gentoo-r7 found in /usr/src/linux
>>> Unpacking ndiswrapper-0.4.tar.gz to /var/tmp/portage/ndiswrapper-0.4/work
>>> Source unpacked.
make -C driver
make[1]: Entering directory `/var/tmp/portage/ndiswrapper-0.4/work/ndiswrapper/driver'
make[1]: warning: jobserver unavailable: using -j1.  Add `+' to parent make rule.
gcc -march=pentium3 -O3 -pipe -DTEST_PM -DEXPORT_SYMTAB -DMODVERSIONS -include //usr/src/linux/include/linux/modversions.h -DLINUX -D__KERNEL__ -DMODULE -I//usr/src/linux/include -Wall -Wstrict-prototypes -fomit-frame-pointer -fno-strict-aliasing -pipe -mpreferred-stack-boundary=2 -O2   -c -o wrapper.o wrapper.c
wrapper.c:1126: error: variable `ndis_ethtool_ops' has initializer but incomplete type
wrapper.c:1127: error: unknown field `get_link' specified in initializer
wrapper.c:1127: warning: excess elements in struct initializer
wrapper.c:1127: warning: (near initialization for `ndis_ethtool_ops')
wrapper.c: In function `setup_dev':
wrapper.c:1613: error: structure has no member named `ethtool_ops'
wrapper.c: At top level:
wrapper.c:1126: error: storage size of `ndis_ethtool_ops' isn't known
make[1]: *** [wrapper.o] Error 1
make[1]: Leaving directory `/var/tmp/portage/ndiswrapper-0.4/work/ndiswrapper/driver'
make: *** [all] Error 2
 
!!! ERROR: net-wireless/ndiswrapper-0.4 failed.
!!! Function src_compile, Line 32, Exitcode 2
!!! (no error message)

------- Comment #18 From Peter Johanson (RETIRED) 2004-03-06 15:12:35 0000 -------
It seems the v0.4 ov ndiswrapper requires a linux kernel of at least 2.4.23.
I'll try to get a v0.3 ebuild in to portage, as apparently this works with
slightly older kernels. You can either test with a newer kernel, and report
back, or wait til 0.3 is available and try that.

------- Comment #19 From Peter Johanson (RETIRED) 2004-03-06 15:45:06 0000 -------
Okay, i've just added version 0.3 to portage. Please test that if you've not
upgraded your kernel.

------- Comment #20 From Serge Canizares 2004-03-06 18:37:40 0000 -------
I should have read the INSTALL file in the portage working dir and noticed the
>=2.4.23 requirement!

I migrated to the gs-sources kernel 2.4.25, and now the ebuild compiled nicely
and I'm successfully using the min-pci 54g wireless nic in my Dell Inspiron
8500.
That's pretty darn exciting.

Could I suggest that you mod the ebuild to print out a message pointing that
out? Might help others figure out what to do.

------- Comment #21 From Tim Yamin (RETIRED) 2004-03-07 01:10:53 0000 -------
OK, a few suggestions:

1) ``uname'' should not be used anywhere, use the provided-by-Portage check_kv
   function which uses /usr/src/linux. You can then implement check_KV to
   check for > 2.4.23 kernels - see "get_KV_info()" in nvidia-kernel and
   use ${KV} to install the modules should go.
   
2) The ``lspci'' code won't handle multiple cards. Implent a ``while read''
   instead; so you can then parse each entry. Also; use ``cut'' instead of
   that Perl script. For multiple cards it would be nice to add the manufacturer
   name to the config file as well. Do this by simply ``while read'''ing each
   matching line; storing the whole line in one variable; then filtering it
   separately. Then use ``lspci -s $Bus:$Slot:$Function.$SubFunc'' using
   the original variable to get the device name; use ``cut'' here as well.

3) Might be better to use a ``cat <<EOF > ${D}/etc/modules.d/ndiswrapper''
   for the static configuration areas so you're invoking less echo's.

4) SLOT should be "${KV}"; also please fix up the "DESCRIPTION".

Thanks.

------- Comment #22 From Jake Meier 2004-03-07 08:35:19 0000 -------
Not a huge deal, but if lspci is going to be used in pkg_config, shouldn't
pciutils be listed as a dependency?

------- Comment #23 From Christoph Brill (egore) 2004-03-08 03:45:01 0000 -------
Version 0.5 (released today) seems to work on 2.6 kernels without any patching.
I didn't use an ebuild, i just got the source, typed "make" and "make install"
and could modprobe it.

------- Comment #24 From scootersmk 2004-03-27 19:07:55 0000 -------
FYI there is a new bug report for a new ndiswrapper-0.6 ebuild (bug 45331)
url-> http://bugs.gentoo.org/show_bug.cgi?id=45331

------- Comment #25 From teedog@gmail.com 2004-05-31 18:39:45 0000 -------
Uploaded a new ebuild for NdisWrapper 0.8-rc1 here:
http://bugs.gentoo.org/show_bug.cgi?id=49479

------- Comment #26 From Doug Goldstein 2004-08-17 23:06:37 0000 -------
Marking this as fixed because it's been fixed in later bug reports and newer
versions and newer ebuilds.