Results 1 to 3 of 3

Thread: Patch a driver

  1. #1
    Join Date
    Feb 2011
    Location
    Johannesburg South Africa
    Beans
    11
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Angry Patch a driver

    In order to fix my wireless nic stuck on channel 1 in monitor mode and to inject packets to a specific channel under aircrack-ng I need to patch a driver for my Intel wireless NIC. The patch is source code in a file called cw.fixed.chan.patch. The path to the driver is /lib/modules/2.6.35-27-generic-pae/updates/compat-wireless-2.6.37/iwlagn.ko I think the driver file to be patched is iwlagn.ko but I am not 100% sure there are lots of files in the directory.

    I want to run the patch command but am struggling with the exact syntax and how to do this. I take it I must be logged in as root. Do I put the patch file in the same directory as the driver that need's to be patched? What is the exact patch command?
    Thanks in advance!!

    Windows simpleton

  2. #2
    Join Date
    Feb 2007
    Location
    perdita
    Beans
    1,622
    Distro
    Ubuntu

    Re: Patch a driver

    You can't apply the patch directly to the .ko file.
    It's a "source code patch", not a "binary patch", so you have to apply it to the source code and then compile it and replace the old .ko with the new .ko file.

    I can't give you a full command-line howto without doing more reasearch, but in principle the procedure will be something like this:
    1) Download the source code of your driver
    2) Patch it ("patch [OPTIONS] cw.fixed.chan.patch")
    3) ./configure && make && sudo make install

    Can you point me to where you found the info about this patch? It might help.

    edit: http://forum.aircrack-ng.org/index.php?topic=10222.0 ^^
    Last edited by KIAaze; February 28th, 2011 at 07:58 PM.

  3. #3
    Join Date
    Feb 2007
    Location
    perdita
    Beans
    1,622
    Distro
    Ubuntu

    Re: Patch a driver

    Ok, did a quick test and this seems to work:

    Download compat-wireless-2.6.tar.bz2 from http://wireless.kernel.org/en/users/Download
    and cw.fixed.chan.patch from: http://forum.aircrack-ng.org/index.php?topic=8373.0
    Place them in the same folder and navigate to it.

    Then:
    Code:
    tar -xvf compat-wireless-2.6.tar.bz2
    cd compat-wireless-2011-02-28
    patch -Np1 -i ../cw.fixed.chan.patch
    make
    sudo make install
    I didn't run the install step, but all the rest ran without errors. If you get error during the make process, you probably just need to install some dev packages.

    A new iwlagn.ko will be in ./compat-wireless-2011-02-28/drivers/net/wireless/iwlwifi/iwlagn.ko after compilation, but you should run the make install step to make sure it gets installed correctly.
    Last edited by KIAaze; February 28th, 2011 at 10:51 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •