wok rev 20394

Add ndiswrapper-driver64
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Jun 25 13:19:27 2018 +0200 (2018-06-25)
parents cda065bfc449
children bb88d5d1c8fb
files ndiswrapper-driver64/receipt ndiswrapper-driver64/stuff/gztazmod.sh ndiswrapper-driver64/stuff/kernel-2.6.35.patch ndiswrapper-driver64/stuff/kernel-2.6.36.patch
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ndiswrapper-driver64/receipt	Mon Jun 25 13:19:27 2018 +0200
     1.3 @@ -0,0 +1,38 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="ndiswrapper-driver64"
     1.7 +VERSION="1.61"
     1.8 +CATEGORY="system-tools"
     1.9 +SHORT_DESC="Add Windows network drivers support to Linux kernel."
    1.10 +MAINTAINER="erjo@slitaz.org"
    1.11 +LICENSE="GPL"
    1.12 +SOURCE="ndiswrapper"
    1.13 +TARBALL="$SOURCE-$VERSION.tar.gz"
    1.14 +WEB_SITE="http://ndiswrapper.sourceforge.net/joomla/"
    1.15 +WGET_URL="$SF_MIRROR/$SOURCE/stable/$TARBALL"
    1.16 +TAGS="windows wireless network"
    1.17 +
    1.18 +DEPENDS="linux"
    1.19 +BUILD_DEPENDS="linux64-module-headers xz uclibc-cross-compiler-x86_64"
    1.20 +
    1.21 +AUFS_NOT_RAMFS="uclibc-cross-compiler-x86_64 is not compatible with aufs+tmpfs 8("
    1.22 +
    1.23 +# Rules to configure and make the package.
    1.24 +compile_rules()
    1.25 +{
    1.26 +	sed -i 's|error Multiple|echo Multiple|' driver/Makefile
    1.27 +	make KBUILD=/usr/src/linux KVER=linux-${kvers}-slitaz64
    1.28 +	xz driver/ndiswrapper.ko
    1.29 +}
    1.30 +
    1.31 +# Rules to gen a SliTaz package suitable for Tazpkg.
    1.32 +genpkg_rules()
    1.33 +{
    1.34 +	EXTRAVERSION=_${kvers}
    1.35 +	mkdir -p $fs/usr/sbin $fs/sbin $fs/lib/modules/${kvers}-slitaz64/kernel/misc
    1.36 +
    1.37 +	# Install utilities
    1.38 +	install -o root -m 0755 $src/utils/loadndisdriver $fs/sbin/
    1.39 +	install -o root -m 0644 $src/driver/ndiswrapper.ko.xz \
    1.40 +		$fs/lib/modules/${kvers}-slitaz64/kernel/misc/ndiswrapper.ko.xz
    1.41 +}
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/ndiswrapper-driver64/stuff/gztazmod.sh	Mon Jun 25 13:19:27 2018 +0200
     2.3 @@ -0,0 +1,64 @@
     2.4 +#!/bin/sh
     2.5 +# gztazmod.sh: Compress Linux kernel modules for SliTaz GNU/Linux.
     2.6 +# 2007/10/04 <pankso@slitaz.org> - GNU General Public License.
     2.7 +#
     2.8 +
     2.9 +# We do our work in the kernel version modules directory.
    2.10 +if [ -z "$1" ] ; then
    2.11 +  echo ""
    2.12 +  echo -e "\033[1musage:\033[0m `basename $0` path/to/kernel-version"
    2.13 +  echo ""
    2.14 +  exit 1
    2.15 +fi
    2.16 +
    2.17 +if [ ! -r "$1" ] ; then
    2.18 +  echo ""
    2.19 +  echo -e "Error : $1 does not exist."
    2.20 +  echo ""
    2.21 +  exit 1
    2.22 +fi
    2.23 +
    2.24 +cd $1
    2.25 +
    2.26 +# Status functions.
    2.27 +status()
    2.28 +{
    2.29 +	local CHECK=$?
    2.30 +	echo -en "\\033[70G[ "
    2.31 +	if [ $CHECK = 0 ]; then
    2.32 +		echo -en "\\033[1;33mOK"
    2.33 +	else
    2.34 +		echo -en "\\033[1;31mFailed"
    2.35 +	fi
    2.36 +	echo -e "\\033[0;39m ]"
    2.37 +}
    2.38 +
    2.39 +# Script start.
    2.40 +echo ""
    2.41 +echo "Starting gztazmod.sh to build compressed kernel modules... "
    2.42 +echo ""
    2.43 +
    2.44 +# Find all modules.
    2.45 +echo -n "Searching all modules to gzip them... "
    2.46 +find . -name "*.ko" -exec gzip '{}' \;
    2.47 +status
    2.48 +
    2.49 +# Build a new temporary modules.dep.
    2.50 +echo -n "Building tmp.dep... "
    2.51 +sed 's/\.ko/.ko.gz/g' modules.dep > tmp.dep
    2.52 +status
    2.53 +
    2.54 +# Destroy original modules.dep
    2.55 +echo -n "Destroying modules.dep... "
    2.56 +rm modules.dep
    2.57 +status
    2.58 +
    2.59 +# Remove tmp.dep to modules.dep.
    2.60 +echo -n "Removing tmp.dep to modules.dep... "
    2.61 +mv tmp.dep modules.dep
    2.62 +status
    2.63 +
    2.64 +# Script end.
    2.65 +echo ""
    2.66 +echo "Kernel modules `basename $1` are ready."
    2.67 +echo ""
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/ndiswrapper-driver64/stuff/kernel-2.6.35.patch	Mon Jun 25 13:19:27 2018 +0200
     3.3 @@ -0,0 +1,98 @@
     3.4 +diff -uNr ndiswrapper-1.56.old/driver/usb.c ndiswrapper-1.56/driver/usb.c
     3.5 +--- ndiswrapper-1.56.old/driver/usb.c	2010-02-10 18:09:32.000000000 -0800
     3.6 ++++ ndiswrapper-1.56/driver/usb.c	2010-07-25 02:29:25.442145846 -0700
     3.7 +@@ -191,9 +191,15 @@
     3.8 + 	if (wrap_urb->flags & WRAP_URB_COPY_BUFFER) {
     3.9 + 		USBTRACE("freeing DMA buffer for URB: %p %p",
    3.10 + 			 urb, urb->transfer_buffer);
    3.11 ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35)
    3.12 + 		usb_buffer_free(IRP_WRAP_DEVICE(irp)->usb.udev,
    3.13 ++                                urb->transfer_buffer_length,
    3.14 ++                                urb->transfer_buffer, urb->transfer_dma);
    3.15 ++#else
    3.16 ++		usb_free_coherent(IRP_WRAP_DEVICE(irp)->usb.udev,
    3.17 + 				urb->transfer_buffer_length,
    3.18 + 				urb->transfer_buffer, urb->transfer_dma);
    3.19 ++#endif
    3.20 + 	}
    3.21 + 	if (urb->setup_packet)
    3.22 + 		kfree(urb->setup_packet);
    3.23 +@@ -303,9 +309,16 @@
    3.24 + 			       || PageHighMem(virt_to_page(buf))
    3.25 + #endif
    3.26 + 		    )) {
    3.27 ++
    3.28 ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35)
    3.29 + 		urb->transfer_buffer =
    3.30 +-			usb_buffer_alloc(wd->usb.udev, buf_len, alloc_flags,
    3.31 ++                        usb_buffer_alloc(wd->usb.udev, buf_len, alloc_flags,
    3.32 ++                                         &urb->transfer_dma);
    3.33 ++#else
    3.34 ++		urb->transfer_buffer =
    3.35 ++			usb_alloc_coherent(wd->usb.udev, buf_len, alloc_flags,
    3.36 + 					 &urb->transfer_dma);
    3.37 ++#endif
    3.38 + 		if (!urb->transfer_buffer) {
    3.39 + 			WARNING("couldn't allocate dma buf");
    3.40 + 			IoAcquireCancelSpinLock(&irp->cancel_irql);
    3.41 +diff -uNr ndiswrapper-1.56.old/driver/wrapndis.c ndiswrapper-1.56/driver/wrapndis.c
    3.42 +--- ndiswrapper-1.56.old/driver/wrapndis.c	2010-02-10 18:09:32.000000000 -0800
    3.43 ++++ ndiswrapper-1.56/driver/wrapndis.c	2010-07-25 02:06:13.184631757 -0700
    3.44 +@@ -936,6 +936,10 @@
    3.45 + 	EXIT2(return);
    3.46 + }
    3.47 + 
    3.48 ++#ifndef netdev_mc_count
    3.49 ++#define netdev_mc_count(net_dev) net_dev->mc_count
    3.50 ++#endif
    3.51 ++
    3.52 + static void set_multicast_list(struct ndis_device *wnd)
    3.53 + {
    3.54 + 	struct net_device *net_dev;
    3.55 +@@ -950,20 +954,26 @@
    3.56 + 		packet_filter |= NDIS_PACKET_TYPE_PROMISCUOUS |
    3.57 + 			NDIS_PACKET_TYPE_ALL_LOCAL;
    3.58 + 	} else if (net_dev->flags & IFF_ALLMULTI ||
    3.59 +-		   net_dev->mc_count > wnd->multicast_size) {
    3.60 ++		   netdev_mc_count(net_dev) > wnd->multicast_size) {
    3.61 + 		packet_filter |= NDIS_PACKET_TYPE_ALL_MULTICAST;
    3.62 + 		TRACE2("0x%08x", packet_filter);
    3.63 +-	} else if (net_dev->mc_count > 0) {
    3.64 ++	} else if (netdev_mc_count(net_dev) > 0) {
    3.65 + 		int i, size;
    3.66 + 		char *buf;
    3.67 ++#ifndef netdev_for_each_mc_addr
    3.68 + 		struct dev_mc_list *mclist;
    3.69 +-		size = min(wnd->multicast_size, net_dev->mc_count);
    3.70 +-		TRACE2("%d, %d", wnd->multicast_size, net_dev->mc_count);
    3.71 ++#else
    3.72 ++		struct netdev_hw_addr *mclist;
    3.73 ++#endif
    3.74 ++
    3.75 ++		size = min(wnd->multicast_size, netdev_mc_count(net_dev));
    3.76 ++		TRACE2("%d, %d", wnd->multicast_size, netdev_mc_count(net_dev));
    3.77 + 		buf = kmalloc(size * ETH_ALEN, GFP_KERNEL);
    3.78 + 		if (!buf) {
    3.79 + 			WARNING("couldn't allocate memory");
    3.80 + 			EXIT2(return);
    3.81 + 		}
    3.82 ++#ifndef netdev_for_each_mc_addr
    3.83 + 		mclist = net_dev->mc_list;
    3.84 + 		for (i = 0; i < size && mclist; mclist = mclist->next) {
    3.85 + 			if (mclist->dmi_addrlen != ETH_ALEN)
    3.86 +@@ -972,6 +982,15 @@
    3.87 + 			TRACE2(MACSTRSEP, MAC2STR(mclist->dmi_addr));
    3.88 + 			i++;
    3.89 + 		}
    3.90 ++#else
    3.91 ++		i = 0;
    3.92 ++		netdev_for_each_mc_addr(mclist, net_dev){
    3.93 ++                        memcpy(buf + i++ * ETH_ALEN,
    3.94 ++                               mclist->addr, ETH_ALEN);
    3.95 ++                        TRACE2(MACSTRSEP, MAC2STR(mclist->addr));
    3.96 ++
    3.97 ++		}
    3.98 ++#endif
    3.99 + 		res = mp_set(wnd, OID_802_3_MULTICAST_LIST, buf, i * ETH_ALEN);
   3.100 + 		if (res == NDIS_STATUS_SUCCESS && i > 0)
   3.101 + 			packet_filter |= NDIS_PACKET_TYPE_MULTICAST;
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/ndiswrapper-driver64/stuff/kernel-2.6.36.patch	Mon Jun 25 13:19:27 2018 +0200
     4.3 @@ -0,0 +1,27 @@
     4.4 +--- ndiswrapper-1.56.orig/driver/loader.c	2010-02-11 03:09:32.000000000 +0100
     4.5 ++++ ndiswrapper-1.56/driver/loader.c	2010-10-24 01:38:13.000000000 +0200
     4.6 +@@ -750,13 +750,13 @@
     4.7 + }
     4.8 + 
     4.9 + /* called with loader_mutex is down */
    4.10 +-static int wrapper_ioctl(struct inode *inode, struct file *file,
    4.11 ++static long wrapper_unlocked_ioctl(struct file *file,
    4.12 + 			 unsigned int cmd, unsigned long arg)
    4.13 + {
    4.14 + 	struct load_driver *load_driver;
    4.15 + 	struct load_device load_device;
    4.16 + 	struct load_driver_file load_bin_file;
    4.17 +-	int ret;
    4.18 ++	long ret;
    4.19 + 	void __user *addr = (void __user *)arg;
    4.20 + 
    4.21 + 	ENTER1("cmd: %u", cmd);
    4.22 +@@ -831,7 +831,7 @@
    4.23 + 
    4.24 + static struct file_operations wrapper_fops = {
    4.25 + 	.owner          = THIS_MODULE,
    4.26 +-	.ioctl		= wrapper_ioctl,
    4.27 ++	.unlocked_ioctl	= wrapper_unlocked_ioctl,
    4.28 + 	.release	= wrapper_ioctl_release,
    4.29 + };
    4.30 +