FreeBSD の ndis で Windows のドライバを使う2016年09月03日 12時37分14秒

NDIS 自体はかなり昔から実装されていた機能。Windows のドライバを利用し、コンパイルして作成するので FreeBSD のリリースバージョンに依存する。ドライバを無くさないようにするのが、大切だ。

eMachines eM250-1915 の bwn ドライバが不安定で、ndis を試したら、こちらの方が安定していた。今回 11.0-RELEASE に向けて準備をしようとしたら、ドライバが見付からなくて、手間取った。折角なので、手順も記録。

$ tar xvf Broadcom_BCM43xx_5.100.235.19_win5x.exe
x [wikidrivers.com] Broadcom_BCM43xx_5.100.235.19_win5x/SilentInstall_Driver_Only_XP.bat
x [wikidrivers.com] Broadcom_BCM43xx_5.100.235.19_win5x/Notes.txt
x [wikidrivers.com] Broadcom_BCM43xx_5.100.235.19_win5x/bcm43xx.cat
x [wikidrivers.com] Broadcom_BCM43xx_5.100.235.19_win5x/bcm43xx64.cat
x [wikidrivers.com] Broadcom_BCM43xx_5.100.235.19_win5x/bcmwl5.inf
x [wikidrivers.com] Broadcom_BCM43xx_5.100.235.19_win5x/setup.iss
x [wikidrivers.com] Broadcom_BCM43xx_5.100.235.19_win5x/setup.exe
x [wikidrivers.com] Broadcom_BCM43xx_5.100.235.19_win5x/bcmwlcoi.dll
x [wikidrivers.com] Broadcom_BCM43xx_5.100.235.19_win5x/bcmwlcoi64.dll
x [wikidrivers.com] Broadcom_BCM43xx_5.100.235.19_win5x/bcmwl5.sys
x [wikidrivers.com] Broadcom_BCM43xx_5.100.235.19_win5x/bcmwl564.sys
x [wikidrivers.com] Broadcom_BCM43xx_5.100.235.19_win5x/
$ cd \[wikidrivers.com]\ Broadcom_BCM43xx_5.100.235.19_win5x
ドライバを展開して .inf と .sys ファイルを見付ける。
$ ndisgen bcmwl5.inf bcmwl5.sys
        ==================================================================
        ------------------ Windows(r) driver converter -------------------
        ==================================================================

                        INF file validation

        This .INF file appears to be Unicode.
        Trying to convert to ASCII...
        Done.

        Press return to continue...



        ==================================================================
        ------------------ Windows(r) driver converter -------------------
        ==================================================================

                        Driver file validation

        This .SYS file appears to be in Windows(r) PE format.

        Press return to continue...
リターンキーを押すと次の画面になる。
        ==================================================================
        ------------------ Windows(r) driver converter -------------------
        ==================================================================

                        Driver file conversion

        The script will now try to convert the .INF and .SYS files
        using the ndiscvt(1) utility. This utility can handle most
        .INF files; however, occasionally it can fail to parse some files
        due to subtle syntax issues: the .INF syntax is very complex,
        and the Windows(r) parser will sometimes allow files with small
        syntax errors to be processed correctly which ndiscvt(1) will
        not. If the conversion fails, you may have to edit the .INF
        file by hand to remove the offending lines.

        Press enter to try converting the files now: 

        Conversion was successful.

        Press enter to continue... 
更にリターンキーを押す。
        ==================================================================
        ------------------ Windows(r) driver converter -------------------
        ==================================================================

                        Firmware file conversion

        If your driver uses additional firmware files, please list them
        below. When you're finished, just press enter to continue. (If your
        driver doesn't need any extra firmware files, just press enter
        to move to the next step.)

        > 
他のドライバは要らないので、そのままリターンキー。
        ==================================================================
        ------------------ Windows(r) driver converter -------------------
        ==================================================================


        List of files converted firmware files:


        Press enter to continue... 
次が最後のステージ。コンパイルが始まるので FreeBSD のソースが必要。
        ==================================================================
        ------------------ Windows(r) driver converter -------------------
        ==================================================================

                        Kernel module generation


        The script will now try to generate the kernel driver module.
        This is the last step. Once this module is generated, you should
        be able to load it just like any other FreeBSD driver module.

        Press enter to compile the stub module and generate the driver
        module now:



        Cleaning up... done.

        The file bcmwl5_sys.ko has been successfully generated.
        You can kldload this module to get started.

        Press return to exit.
コンパイルが終ってカーネルモジュールが作成されている。
$ ls *ko
bcmwl5_sys.ko
$ cp bcmwl5_sys.ko /boot/modules
カーネルを再構築しても、なくならない /boot/modules に移動する。