09-05
03
ndiswrapper-1.54无法在2.6.29以上内核编译
本文适合所有2.6.29或以上内核的linux用户。
今天将系统升级到了fedora11-Preview,结果ndiswrapper-1.54无法编译成功。
[marco.chan@fedora /]$ uname -r
2.6.29.1-111.fc11.i586
编译时候的错误如下:
[marco.chan@fedora ndiswrapper-1.54]$ sudo make
make -C driver
make[1]: Entering directory `/data/software/ndiswarapper/ndiswrapper-1.54/driver’
make -C /usr/src/kernels/2.6.29.1-111.fc11.i586 M=/data/software/ndiswarapper/ndiswrapper-1.54/driver
make[2]: Entering directory `/usr/src/kernels/2.6.29.1-111.fc11.i586′
LD /data/software/ndiswarapper/ndiswrapper-1.54/driver/built-in.o
MKEXPORT /data/software/ndiswarapper/ndiswrapper-1.54/driver/crt_exports.h
CC [M] /data/software/ndiswarapper/ndiswrapper-1.54/driver/crt.o
MKEXPORT /data/software/ndiswarapper/ndiswrapper-1.54/driver/hal_exports.h
CC [M] /data/software/ndiswarapper/ndiswrapper-1.54/driver/hal.o
CC [M] /data/software/ndiswarapper/ndiswrapper-1.54/driver/iw_ndis.o
CC [M] /data/software/ndiswarapper/ndiswrapper-1.54/driver/loader.o
MKEXPORT /data/software/ndiswarapper/ndiswrapper-1.54/driver/ndis_exports.h
CC [M] /data/software/ndiswarapper/ndiswrapper-1.54/driver/ndis.o
MKEXPORT /data/software/ndiswarapper/ndiswrapper-1.54/driver/ntoskernel_exports.h
CC [M] /data/software/ndiswarapper/ndiswrapper-1.54/driver/ntoskernel.o
MKEXPORT /data/software/ndiswarapper/ndiswrapper-1.54/driver/ntoskernel_io_exports.h
CC [M] /data/software/ndiswarapper/ndiswrapper-1.54/driver/ntoskernel_io.o
CC [M] /data/software/ndiswarapper/ndiswrapper-1.54/driver/pe_linker.o
CC [M] /data/software/ndiswarapper/ndiswrapper-1.54/driver/pnp.o
CC [M] /data/software/ndiswarapper/ndiswrapper-1.54/driver/proc.o
MKEXPORT /data/software/ndiswarapper/ndiswrapper-1.54/driver/rtl_exports.h
CC [M] /data/software/ndiswarapper/ndiswrapper-1.54/driver/rtl.o
CC [M] /data/software/ndiswarapper/ndiswrapper-1.54/driver/wrapmem.o
CC [M] /data/software/ndiswarapper/ndiswrapper-1.54/driver/wrapndis.o
[b]/data/software/ndiswarapper/ndiswrapper-1.54/driver/wrapndis.c:1747:3: error: invalid preprocessing directive #.
/data/software/ndiswarapper/ndiswrapper-1.54/driver/wrapndis.c:1748: error: expected ‘}’ before ‘;’ token
make[3]: *** [/data/software/ndiswarapper/ndiswrapper-1.54/driver/wrapndis.o] Error 1
make[2]: *** [_module_/data/software/ndiswarapper/ndiswrapper-1.54/driver] Error 2
make[2]: Leaving directory `/usr/src/kernels/2.6.29.1-111.fc11.i586′
make[1]: *** [modules] Error 2
make[1]: Leaving directory `/data/software/ndiswarapper/ndiswrapper-1.54/driver’
make: *** [all] Error 2[/b]
查寻了ndiswrapper的Tracker Bugs,找到了问题所在,原来是个BUG。
Mistake in code (1.54) prevents compiling with kernel 2.6.29 – ID: 2697201
in the file driver/wrapndis.c, the line 1747 is wrong. It should be
.ndo_poll_controller = ndis_poll_controller
(adding ndo_ after the dot and remove the semicolon at the end, see also
the include file netdevice.h, line 583).
Changing this made it possible for me to compile version 1.54 on ubuntu
9.04 Alpha 6, Kernel 2.6.29 rc6 (Vanilla), 32 Bit.
既然找了问题,就容易多了。
[marco.chan@fedora ndiswrapper-1.54]$ sudo vi driver/wrapndis.c
在其中的1747位置:
#ifdef CONFIG_NET_POLL_CONTROLLER
.poll_controller = ndis_poll_controller; #删除这一行。
.ndo_poll_controller = ndis_poll_controller #增加这一行,最后是没有分号的。

修改后保存,重新编译安装即可。
之前写过一篇关于ndiswrapper的LINUX下安装无线网卡驱动:原文请移驾这里,今天就“老事重提”一下,将这些步骤重新贴一遍。
为了防止刚才编译时候可能遗留的错误,先清理一下:
[marco.chan@fedora ndiswrapper-1.54]$ sudo make clean
make -C driver clean
make[1]: Entering directory `/data/software/ndiswarapper/ndiswrapper-1.54/driver’
rm -f *.o *.ko .*.cmd *.mod.c *.symvers modules.order *~ .\#*
rm -f *_exports.h win2lin_stubs.h
rm -rf .tmp_versions
make[1]: Leaving directory `/data/software/ndiswarapper/ndiswrapper-1.54/driver’
make -C utils clean
make[1]: Entering directory `/data/software/ndiswarapper/ndiswrapper-1.54/utils’
rm -f *~ *.o loadndisdriver
make[1]: Leaving directory `/data/software/ndiswarapper/ndiswrapper-1.54/utils’
rm -f *~
rm -fr ndiswrapper-1.54 ndiswrapper-1.54.tar.gz patch-stamp
垃圾清理完毕,重新编译…
[marco.chan@fedora ndiswrapper-1.54]$ sudo make
make -C driver
make[1]: Entering directory `/data/software/ndiswarapper/ndiswrapper-1.54/driver’
make -C /usr/src/kernels/2.6.29.1-111.fc11.i586 M=/data/software/ndiswarapper/ndiswrapper-1.54/driver
make[2]: Entering directory `/usr/src/kernels/2.6.29.1-111.fc11.i586′
LD /data/software/ndiswarapper/ndiswrapper-1.54/driver/built-in.o
MKEXPORT /data/software/ndiswarapper/ndiswrapper-1.54/driver/crt_exports.h
CC [M] /data/software/ndiswarapper/ndiswrapper-1.54/driver/crt.o
MKEXPORT /data/software/ndiswarapper/ndiswrapper-1.54/driver/hal_exports.h
CC [M] /data/software/ndiswarapper/ndiswrapper-1.54/driver/hal.o
CC [M] /data/software/ndiswarapper/ndiswrapper-1.54/driver/iw_ndis.o
CC [M] /data/software/ndiswarapper/ndiswrapper-1.54/driver/loader.o
MKEXPORT /data/software/ndiswarapper/ndiswrapper-1.54/driver/ndis_exports.h
CC [M] /data/software/ndiswarapper/ndiswrapper-1.54/driver/ndis.o
MKEXPORT /data/software/ndiswarapper/ndiswrapper-1.54/driver/ntoskernel_exports.h
CC [M] /data/software/ndiswarapper/ndiswrapper-1.54/driver/ntoskernel.o
MKEXPORT /data/software/ndiswarapper/ndiswrapper-1.54/driver/ntoskernel_io_exports.h
CC [M] /data/software/ndiswarapper/ndiswrapper-1.54/driver/ntoskernel_io.o
CC [M] /data/software/ndiswarapper/ndiswrapper-1.54/driver/pe_linker.o
CC [M] /data/software/ndiswarapper/ndiswrapper-1.54/driver/pnp.o
CC [M] /data/software/ndiswarapper/ndiswrapper-1.54/driver/proc.o
MKEXPORT /data/software/ndiswarapper/ndiswrapper-1.54/driver/rtl_exports.h
CC [M] /data/software/ndiswarapper/ndiswrapper-1.54/driver/rtl.o
CC [M] /data/software/ndiswarapper/ndiswrapper-1.54/driver/wrapmem.o
CC [M] /data/software/ndiswarapper/ndiswrapper-1.54/driver/wrapndis.o
CC [M] /data/software/ndiswarapper/ndiswrapper-1.54/driver/wrapper.o
MKEXPORT /data/software/ndiswarapper/ndiswrapper-1.54/driver/usb_exports.h
CC [M] /data/software/ndiswarapper/ndiswrapper-1.54/driver/usb.o
CC [M] /data/software/ndiswarapper/ndiswrapper-1.54/driver/divdi3.o
LD [M] /data/software/ndiswarapper/ndiswrapper-1.54/driver/ndiswrapper.o
Building modules, stage 2.
MODPOST 1 modules
CC /data/software/ndiswarapper/ndiswrapper-1.54/driver/ndiswrapper.mod.o
LD [M] /data/software/ndiswarapper/ndiswrapper-1.54/driver/ndiswrapper.ko
make[2]: Leaving directory `/usr/src/kernels/2.6.29.1-111.fc11.i586′
make[1]: Leaving directory `/data/software/ndiswarapper/ndiswrapper-1.54/driver’
make -C utils
make[1]: Entering directory `/data/software/ndiswarapper/ndiswrapper-1.54/utils’
gcc -g -Wall -I../driver -o loadndisdriver loadndisdriver.c
make[1]: Leaving directory `/data/software/ndiswarapper/ndiswrapper-1.54/utils’

顺利编译完毕,开始安装。
[marco.chan@fedora ndiswrapper-1.54]$ sudo make install
make -C utils install
make[1]: Entering directory `/data/software/ndiswarapper/ndiswrapper-1.54/utils’
install -D -m 755 loadndisdriver /sbin/loadndisdriver
install -D -m 755 ndiswrapper /usr/sbin/ndiswrapper
install -D -m 755 ndiswrapper-buginfo /usr/sbin/ndiswrapper-buginfo
NOTE: Windows driver configuration file format has changed since 1.5. You must re-install Windows drivers if they were installed before.
make[1]: Leaving directory `/data/software/ndiswarapper/ndiswrapper-1.54/utils’
mkdir -p -m 0755 /usr/share/man/man8
install -m 644 ndiswrapper.8 /usr/share/man/man8
install -m 644 loadndisdriver.8 /usr/share/man/man8
安装也相当顺利^o^~
我在最开始的时候已经将原先的驱动删除了,所以要重新安装一下。ndiswrapper的参数不多,就8个而已。
[marco.chan@fedora ndiswrapper-1.54]$ sudo ndiswrapper -h
install/manage Windows drivers for ndiswrapper
usage: ndiswrapper OPTION
-i inffile install driver described by ‘inffile’
-a devid driver use installed ‘driver’ for ‘devid’ (dangerous)
-r driver remove ‘driver’
-l list installed drivers
-m write configuration for modprobe
-ma write module alias configuration for all devices
-mi write module install configuration for all devices
-v report version information
用ndiswrapper安装从windows xp下提取的驱动,参数-i
[marco.chan@fedora ndiswrapper-1.54]$ sudo ndiswrapper -i ../sp33008a/bcmwl5.inf installing bcmwl5 …
forcing parameter IBSSGMode from 0 to 2
forcing parameter IBSSGMode from 0 to 2
forcing parameter IBSSGMode from 0 to 2
forcing parameter IBSSGMode from 0 to 2
forcing parameter IBSSGMode from 0 to 2
forcing parameter IBSSGMode from 0 to 2
forcing parameter IBSSGMode from 0 to 2
forcing parameter IBSSGMode from 0 to 2
forcing parameter IBSSGMode from 0 to 2
forcing parameter IBSSGMode from 0 to 2
forcing parameter IBSSGMode from 0 to 2
forcing parameter IBSSGMode from 0 to 2
forcing parameter IBSSGMode from 0 to 2
forcing parameter IBSSGMode from 0 to 2
forcing parameter IBSSGMode from 0 to 2
forcing parameter IBSSGMode from 0 to 2
forcing parameter IBSSGMode from 0 to 2
forcing parameter IBSSGMode from 0 to 2
forcing parameter IBSSGMode from 0 to 2
forcing parameter IBSSGMode from 0 to 2
驱动安装完毕…^o^
如果你不放心,就确定一下是否真的安装,参数-l
[marco.chan@fedora ndiswrapper-1.54]$ sudo ndiswrapper -l
WARNING: All config files need .conf: /etc/modprobe.d/anaconda, it will be ignored in a future release.
bcmwl5 : driver installed #这就是你已安装的驱动…
device (14E4:4312) present (alternate driver: ssb)
后面依次执行三个ndiswrapper,参数分别为 -m,-ma,-mi,
[marco.chan@fedora ndiswrapper-1.54]$ sudo ndiswrapper -m
adding “alias wlan0 ndiswrapper” to /etc/modprobe.d/ndiswrapper …
[marco.chan@fedora ndiswrapper-1.54]$ sudo ndiswrapper -ma
module configuration information is stored in /etc/modprobe.d/ndiswrapper
[marco.chan@fedora ndiswrapper-1.54]$ sudo ndiswrapper -mi
module configuration information is stored in /etc/modprobe.d/ndiswrapper
载入这个驱动模块,使用的命令工具是modprobe,不熟悉这个指令工具的作用,请自行google,baidu。
[marco.chan@fedora ndiswrapper-1.54]$ sudo modprobe ndiswrapper
无线网络可以用了,又可以拔掉烦人的网线了…

有问题可以留言或者发邮件给我~
转载请注明出处:麦麦的不老阁 » 《ndiswrapper-1.54无法在2.6.29以上内核编译》










Leave a comment