Anleitung für Kompilierung und Patch für 64bit-Ndiswrapper für den Fritz!WLAN-USB-Stick ohne N ❗ unter Ubuntu 10.04 und 10.10
Aus dem Quellcode wie im Wiki beschrieben (im Terminal geht auch copy/paste 😉 ):
sudo modprobe -rf ndiswrapper
sudo rm -r /etc/ndiswrapper/*
sudo apt-get remove --purge ndiswrapper-common ndiswrapper-utils-1.9 ndisgtk
sudo rm -r /etc/modprobe.d/ndiswrapper #falls er hier meckert, dann noch:
sudo rm -r /etc/modprobe.d/ndiswrapper.conf
sudo apt-get install --reinstall linux-headers-generic build-essential
wget http://sourceforge.net/projects/ndiswrapper/files/stable/1.56/ndiswrapper-1.56.tar.gz/download
tar -xzf ndiswrapper-1.56.tar.gz
Patch für 10.04:
gedit ndiswrapper-1.56/driver/pelinker.c.patch
Inhalt einfügen:
--- ndiswrapper-1.56/driver/pe_linker.c 2009-06-29 04:09:26.000000000 +0200
+++ ndiswrapper-1.56/driver/pe_linker.c 2009-09-07 12:19:10.000000000 +0200
@@ -450,6 +450,8 @@
" %d bytes", image_size);
return -ENOMEM;
}
+// zero out memory
+memset(image, 0, image_size);
/* Copy all the headers, ie everything before the first section. */
speichern und schliessen. Dann
patch ndiswrapper-1.56/driver/pe_linker.c ndiswrapper-1.56/driver/pelinker.c.patch
Ab hier für 10.10 ebenfalls erforderlich, nicht für 10.04 !
gedit ndiswrapper-1.56/driver/wrapndis.c.patch
Inhalt:
-Index: driver/wrapndis.c
===================================================================
--- driver/wrapndis.c (revision 2723)
+++ driver/wrapndis.c (working copy)
@@ -950,20 +950,34 @@ static void set_multicast_list(struct nd
packet_filter |= NDIS_PACKET_TYPE_PROMISCUOUS |
NDIS_PACKET_TYPE_ALL_LOCAL;
} else if (net_dev->flags & IFF_ALLMULTI ||
- net_dev->mc_count > wnd->multicast_size) {
+ netdev_mc_count(net_dev) > wnd->multicast_size) {
packet_filter |= NDIS_PACKET_TYPE_ALL_MULTICAST;
TRACE2("0x%08x", packet_filter);
- } else if (net_dev->mc_count > 0) {
+ } else if (netdev_mc_count(net_dev) > 0) {
int i, size;
char *buf;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)
+ struct netdev_hw_addr *ha;
+#else
struct dev_mc_list *mclist;
- size = min(wnd->multicast_size, net_dev->mc_count);
- TRACE2("%d, %d", wnd->multicast_size, net_dev->mc_count);
+#endif
+ size = min(wnd->multicast_size, netdev_mc_count(net_dev));
+ TRACE2("%d, %d", wnd->multicast_size, netdev_mc_count(net_dev));
buf = kmalloc(size * ETH_ALEN, GFP_KERNEL);
if (!buf) {
WARNING("couldn't allocate memory");
EXIT2(return);
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)
+ i = 0;
+ netdev_for_each_mc_addr(ha, net_dev) {
+ if (i >= size)
+ break;
+ memcpy(buf + i * ETH_ALEN, ha->addr, ETH_ALEN);
+ TRACE2(MACSTRSEP, MAC2STR(ha->addr));
+ i++;
+ }
+#else
mclist = net_dev->mc_list;
for (i = 0; i < size && mclist; mclist = mclist->next) {
if (mclist->dmi_addrlen != ETH_ALEN)
@@ -972,6 +986,7 @@ static void set_multicast_list(struct nd
TRACE2(MACSTRSEP, MAC2STR(mclist->dmi_addr));
i++;
}
+#endif
res = mp_set(wnd, OID_802_3_MULTICAST_LIST, buf, i * ETH_ALEN);
if (res == NDIS_STATUS_SUCCESS && i > 0)
packet_filter |= NDIS_PACKET_TYPE_MULTICAST;
speichern, schliessen und
patch ndiswrapper-1.56/driver/wrapndis.c ndiswrapper-1.56/driver/wrapndis.c.patch
gedit ndiswrapper-1.56/driver/usb.c.patch
Inhalt:
Index: driver/usb.c
===================================================================
--- driver/usb.c (revision 2723)
+++ driver/usb.c (working copy)
@@ -191,7 +191,7 @@ static void wrap_free_urb(struct urb *ur
if (wrap_urb->flags & WRAP_URB_COPY_BUFFER) {
USBTRACE("freeing DMA buffer for URB: %p %p",
urb, urb->transfer_buffer);
- usb_buffer_free(IRP_WRAP_DEVICE(irp)->usb.udev,
+ usb_free_coherent(IRP_WRAP_DEVICE(irp)->usb.udev,
urb->transfer_buffer_length,
urb->transfer_buffer, urb->transfer_dma);
}
@@ -304,7 +304,7 @@ static struct urb *wrap_alloc_urb(struct
#endif
)) {
urb->transfer_buffer =
- usb_buffer_alloc(wd->usb.udev, buf_len, alloc_flags,
+ usb_alloc_coherent(wd->usb.udev, buf_len, alloc_flags,
&urb->transfer_dma);
if (!urb->transfer_buffer) {
WARNING("couldn't allocate dma buf");
speichern, schliessen und
patch ndiswrapper-1.56/driver/usb.c ndiswrapper-1.56/driver/usb.c.patch
gedit ndiswrapper-1.56/driver/ntoskernel.h.patch
Inhalt:
Index: driver/ntoskernel.h
===================================================================
--- driver/ntoskernel.h (revision 2723)
+++ driver/ntoskernel.h (working copy)
@@ -324,6 +324,12 @@ typedef u32 pm_message_t;
kmem_cache_create(name, size, align, flags, NULL)
#endif
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,34)
+#define netdev_mc_count(dev) ((dev)->mc_count)
+#define usb_alloc_coherent(dev, size, mem_flags, dma) (usb_buffer_alloc((dev), (size), (mem_flags), (dma)))
+#define usb_free_coherent(dev, size, addr, dma) (usb_buffer_free((dev), (size), (addr), (dma)))
+#endif
+
#include "winnt_types.h"
#include "ndiswrapper.h"
#include "pe_linker.h"
speichern, schliessen und:
patch ndiswrapper-1.56/driver/ntoskernel.h ndiswrapper-1.56/driver/ntoskernel.h.patch
Für 10.04 und 10.10:
Danach kann kompiliert werden:
cd ndiswrapper-1.56/
make
sudo make uninstall
sudo make install
Dann den Windows-Treiber und das Modul ndiswrapper einbinden wie gehabt