Monday, December 17, 2012

Hex-editing Linux kernel modules to support new hardware

This is an old trick but a fun one. The ThinkPad X1 Carbon has no built-in Ethernet port. Instead it comes with a USB to Ethernet adapter. The adapter uses the ASIX AX88772 chip, which Linux has supported since time immemorial. But support for the particular adapter shipped by Lenovo was only added in Linux 3.7.

This was a problem for me, since I wanted to use a Debian installer with a 3.2 kernel. I could set up a build environment for that particular kernel and recompile the module. But this seemed like an annoying yak to shave when I just wanted to get the machine working.

The patch to support the Lenovo adapter just adds a new USB device ID to an existing driver:

 }, {
+       // Lenovo U2L100P 10/100
+       USB_DEVICE (0x17ef, 0x7203),
+       .driver_info = (unsigned long) &ax88772_info,
+}, {
        // ASIX AX88772B 10/100
        USB_DEVICE (0x0b95, 0x772b),
        .driver_info = (unsigned long) &ax88772_info,

As a quick-and-dirty solution, we can edit the compiled kernel module asix.ko, changing that existing device ID (0x0b95, 0x772b) to the Lenovo one (0x17ef, 0x7203). Since x86 CPUs are little-endian, this involves changing the bytes

95 0b 2b 77


ef 17 03 72

I wanted to do this within the Debian installer without rebooting. Busybox sed does not support hex escapes, but printf does:

sed $(printf 's/\x95\x0b\x2b\x77/\xef\x17\x03\x72/') \
    /lib/modules/$(uname -r)/kernel/drivers/net/usb/asix.ko \
    > /tmp/asix.ko

(It's worth checking that none of those bytes have untoward meanings as ASCII characters in a regular expression. As it happens, sed does not recognize + (aka \x2b) as repetition unless preceded by a backslash.)

Then I loaded the patched module along with its dependencies. A simple way is

modprobe asix
rmmod asix
insmod /tmp/asix.ko

And that was enough for me to complete the install over Ethernet. Of course, once everything is set up, it would be better to compile a properly-patched kernel using make-kpkg. I haven't got around to it yet because wireless is working great. :)


  1. I followed the instructions but running into some problems. I did verify I have the proper vendor and product id as the article suggests.

    Get the following

    insmod: error inserting './asix.ko': -1 Unknown symbol in module.

    Any ideas?

  2. This is so great. It's so old school that nobody would think about it anymore. I just tried it and it's great, thanks.

  3. Funny. Did this not too long ago with a NetBSD kernel image. I knew it supported the hardware for a network card I had, it just wasn't compiled with the correct vendor+product ID. So I wrote some simple C code to scan the NetBSD kernel image and find a set of bytes where a similar (but not exact) network vendor+product ID was hard coded and then overwrite them. It worked of course and was very amusing!

  4. Nice article, thanks for the information. It's very complete information. I will bookmark for next reference
    jaring futsal | jaring golf | jaring pengaman proyek |
    jaring pengaman bangunan | jaring pengaman gedung

  5. Nice Post, Thanks for your very useful information...

  6. Your blog has given me that thing which I never expect to get from all over the websites. Nice post guys!

    Melbourne Web Developer


  7. Thank you for sharing in this article
    I can learn a lot and could also be a reference
    I am happy to find your website and can join to comment

    Share and Klick Info Blokwalking. Hammer Of Thor
    => Jual Hammer Of Thor Di Bogor
    => Jual Hammer Of Thor Di Medan
    => Jual Hammer Of Thor Di Semarang
    => Jual Hammer Of Thor Di Bandung
    => Jual Hammer Of Thor Di Bandar Lampung
    Obat Good Man | Obat pembesar penis | Vimax Asli | Vimax Extender

  8. Thedigiexperts is Delhi's leading digital marketing institute with over 10 branches all over Delhi, Covers all the main topics such as how to run instagram ads and facebook ads, with Affordable prices.

  9. Thanks for posting this info., putlocker its is very helpful for all of us.keep update with your blogs.

    A person who feels appreciated will always do more than what is expected.

    If Oscars were given for a job well done, I’d nominate you! Congratulations for your fantastic achievement!

    The highest reward for man’s toil is not what he gets for it, but what he becomes by it.

  13. Not a single effort of yours will go in vain. You will be rewarded for your pain. Your hard work will bring you a lot of gain.

  14. Talent means nothing, while experience, acquired in humility and with hard work, means everything.


  15. Doing a good job is not always about impressive innovation. Sometimes it is only about doing something with plain dedication. Well done.

  16. Your hard work and effort have paid off!
    faisalpc.comA success well deserved, an occasion worth celebrating! Congratulations!

  17. Even the smallest of jobs well done will take you one step closer towards crackpluskey.comthe success that you have always dreamed about. Keep it up.

  18. Your work speaks volumes of the kind of man you are– efficient, organized and result-oriented.

  19. Opportunity comes to those who quit Waiting and start Looking. Success comes to those who quit Thinking and start Doing.
    Congratulations for Looking and Doing.

    A lot of people failed at what you accomplished, simply because they were busy finding problems while you were busy finding solutions. Well done.


    Acronis True Image engines got the user cover from every aspect of data storage and data protection.


    FlixGrab permits downloading the things specifically or in clustered form without making any trouble.


    Apowersoft Video Editor is the best to edit the videos online. Users can launch this in the system or can download it.


    AOMEI Partition Assistant is such a good and efficient software for managing disk-related issues like storage, partitioning, and much more.


    Advanced SystemCare Pro can easily access the systematic progress of your device and even make changes to the different operations on your own.


    Avast Secureline VPN provides real privacy and provides unlimited online content access. The connection is secure at a super-fast rate.


    Express VPN is the best software that provides protection and security to any social media, audio, and video belonging to any location of the world.


    Proxifier in the chain can be enabled or disabled. This basically helps you to operate any network application which does not support working via proxy servers.

  29. This post is really amazing thanks for sharing
    Online Loan

  30. This post is amazing you can also look to Short term loan for the financial need

  31. Nice work is done by admin here. I lvoe the way are you working here.

  32. Thanks for information and keep updating us with valuable content and if possible provide us with

    jibjab alternative|similar to hautelook|lola Iolani Momoa|Sydney Brooke Simpson|

  33. AP 1st, 2nd, 3rd, 4th, 5th Syllabus 2021 Candidates who are Searching for AP 1st, 2nd, 3rd, 4th, 5th Syllabussyllabus, sample questions, exam pattern, and Co-Curricular Subject textbooks can refer to this entire article. APSCERT 1st Class Revised Syllabus Here, we have gathered all subjects Andhra Pradesh Board textbooks for Class 5 students along with the direct download links

  34. This is very educational content and written well for a change. It's nice to see that some people still understand how to write a quality post!
    nordvpn crack

  35. Great Article it its really informative and innovative keep us posted with new updates. its was really valuable. thanks a lot.
    reg organizer crack

  36. naturalreader Crack
    I really enjoy reading and also appreciate your work.

  37. Hi buddies, it is great written piece entirely defined, continue the good work constantly.manga reviews

  38. this is really nice to read..informative post is very good to read..thanks a lot!
    Hey, great blog, but I don’t understand how to add your site in my rss reader. Can you Help me please?
    Best tablet for typing

  39. صباغ الكويت افضل خدمة يحتاجها اهل الكويت فى الوقت الحالي حيث انه من النادر ان تجد صباغ بالكويت محترف ولكن اليوم فى موقع صباغ الكويت سوف تجد افضل صباغين وافضل ديكورات الكويت على احدث صيحه لعام 2021 مثل ورق جدران مودرن بالكويت  ويوجد لدينا تركيب باركية خشب بالكويت ومع ارتفاع الاسعار يمكنك ايضا تركيب بديل الرخام بالكويت وهناك موديلات جديده مثلا استيل الكويت  ناتي الى افضل صباغين بالكويت هنالك جنسيات مختلفة مثل صباغ مصري و صباغ باكستاني وايضا هنالك صباغ هندي جميع الصباغين على اعلى مستوى وبالاخص صباغ عراقي  ونقوم بتقديم الخدمات فى جميع مناطق الكويت مثل صباغ الجهراء  و صباغ مبارك الكبير  و صباغ حولي  و صباغ الفروانية بالاضافة الى صباغ العاصمة  و صباغ الاحمدي  جميع تلك الخدمات نقدمها بالاضافة الى صباغ وايضا صباغ بالكويت بالاضافة الى ارخص صباغ و اشطر صباغ و افضل صباغ ولدينا معلم صباغ يوجد لدينا افضل صباغ بالكويت

  40. Hi, I log on to your new stuff like every week. Your humoristic style is witty, keep it up
    dvdfab crack

  41. its been long since i saw a post that's so educative and informational. i will make sure to share this my facebook group. you can also view contents on our websites below.

    French Bulldog Puppies For Sale

    French Bulldog Breeders

    French Bulldog Puppies For Sale Near Me

    French Bulldog Puppies For adoption

    French Bulldog Puppies

    Blue French Bulldog Puppies

  42. it's so refreshing to see a post that talks straight to the point. thanks so much for writing about this it has really helped me with building my experience. thanks a lot

    siberian husky puppies for sale near me
    Siberian Husky puppies
    Siberian Husky puppies for adoption
      Siberian Husky puppies breeders near me  

      white Siberian Husky puppies  

  43. صباغ الكويت .. هل تبي صباغ شاطر ورخيص بالكويت ؟ هل تريد فني تركيب ورق جدران أو معلم جبس بورد أو تركيب باركيه؟ لا داعي للبحث كثيرا، نحن نوفر لك أفضل الفنيين في الكويت، خدمات صباغة و تركيب ورق جدران وباركيه وجبس بورد علي أعلي مستوي من الحرفية والمهارة، من خلال فنيين متميزين ومدربين، قادرين على تنفيذ أي تصميم يخطر ببالك، لدينا تصميمات بأفكار لا تنتهي، ديكورات مودرن عالمية.

    لدينا أفضل صباغين بالكويت، جنسيات مختلفة، صباغ شاطر ورخيص، نوفر خدمة مميزة جدا بأقل الأسعار, يتميز الفنييون لدينا بالمهارة العالية والسرعة فى التنفيذ، لأننا نحرص على وقتك ونعرف قيمته، وأيضا نهتم جدا بأدق التفاصيل ولا نترك اي ثغرة فى عملنا، كل عمل نقوم به هو لوحة فنية نفتخر بضمها الي سجل أعمالنا.

  44. This does not work since Linux checks the ELF file integrity:
    root@m1:~# modprobe sky2
    modprobe: ERROR: could not insert 'sky2': Key was rejected by service
    root@m1:~# modprobe --force-vermagic sky2
    modprobe: ERROR: could not insert 'sky2': Exec format error

  45. I like viewing web sites which comprehend the price of delivering the excellent useful resource free of charge. I truly adored reading your posting. Thank you!
    best tablet for skype

  46. Always so interesting to visit your site.What a great info, thank you for sharing. this will help me so much in my learning
    Kareena kapoor bra size

  47. This post is very helpful and thanks to share with us.
    To Install AOL Desktop Gold, you can follow the steps provided on the web page or blogs of AOL Email Supports. If you still can’t Download AOL Desktop Gold, you can contact AOL customer service at any time. After you complete the download process, you can restart your computer and check AOL Desktop Gold is working or not. In case you encounter an installation error or software glitch, you can call the AOL Email Supports Toll-Free Number and ask for additional assistance.

  48. I read your post. I appreciate your efforts. Thanks for sharing with us. Keep sharing again.
    Are you looking for Aurora Senior Living with stylish bedrooms and flexible or comfortable furniture? The Gardens Care Homes provides an assisted living standard and essentials things such as cooked meals, transportation, laundry, and medical care. Our staff is always ready to help in any way possible.


  49. this is the one i am searching in google to read, if you wish to oud perfumes online check our website. we are the best perfumes seller and manufacturer in UAE.

  50. I’d really love to be a part of online community where I can get responses from other knowledgeable individuals that share the same interest. If you have any recommendations, please let me know. Appreciate it! Feel free to visit my website;

  51. I came here looking for advice and also discovered a platform that can help me do it too. Thanks
    AAA Logo Crack
    Atomic Email Hunter Crack
    Rekordbox DJ Crack

  52. Great blog. Personal Loan Transfer refers to the transfer of outstanding personal loans from one bank to another. The ability to do this was previously only available for credit cards, but now it is also available for home loans and personal loans. A balance transfer personal loan allows you to transfer a loan balance from one bank to another. Generally, your lender allows you to transfer your personal loan, but don't forget to check before applying. Choosing lower rates and smaller EMIs will help you avoid hefty dues. Choosing this option will make the process of paying the outstanding balance easier. Get in touch with Bhumi Finance Varanasi regarding personal loan balance transfers. You can Personal Loan Balance Transfer at any time via the website.

  53. Nice information, valuable and excellent design, as share good stuff with good ideas.
    ติดต่อสอบถาม igoal88