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

to

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. :)

87 comments:

  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?

    ReplyDelete
  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.

    ReplyDelete
  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!

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

    ReplyDelete
  5. https://crackedversion.com/
    A person who feels appreciated will always do more than what is expected.

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

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

    ReplyDelete
  8. 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.
    mlicensekey.com

    ReplyDelete
  9. Talent means nothing, while experience, acquired in humility and with hard work, means everything.
    iamactivationcode.com

    ReplyDelete

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

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

    ReplyDelete
  12. 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.

    ReplyDelete
  13. Your work speaks volumes of the kind of man you are crackchkey.com– efficient, organized and result-oriented.

    ReplyDelete
  14. Opportunity comes to those who quit Waiting and start Looking. Success comes to those who quit Thinking and start Doing. chserialnumber.com
    Congratulations for Looking and Doing.

    ReplyDelete
  15. https://chactivekey.com/
    A lot of people failed at what you accomplished, simply because they were busy finding problems while you were busy finding solutions. Well done.

    ReplyDelete
  16. https://cracksray.com/acronis-true-image-crack/

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

    ReplyDelete
  17. https://lpcrack.com/flixgrab-crack/

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

    ReplyDelete
  18. https://crackdad.com/express-vpn-crack/

    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.

    ReplyDelete
  19. This post is really amazing thanks for sharing
    Online Loan

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

    ReplyDelete
  21. Nice work is done by admin here. I lvoe the way are you working here.
    crackprovst
    crackmacvst
    crackprime

    ReplyDelete
  22. 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

    ReplyDelete
  23. 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

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

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

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

    ReplyDelete
  27. 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

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

    ReplyDelete
  29. 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

    ReplyDelete
  30. 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  

    ReplyDelete
  31. 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

    ReplyDelete
  32. 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

    ReplyDelete
  33. 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

    ReplyDelete
  34. 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.

    ReplyDelete
  35. 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.

    ReplyDelete

  36. 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.

    ReplyDelete
  37. 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;
    야설

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

    ReplyDelete
  39. Thanks for the great read.
    We are waiting for more wonderful articles!
    Tibet
    Tibet Travel
    Tibet Tour

    ReplyDelete
  40. Revo Uninstaller Pro Crack is a creative uninstaller driver that origins you to uninstall unessential programming

    ReplyDelete
  41. เล่นสล็อตออนไลน์ ยอดฮิตของคนรุ่นใหม่ ไฟแรงแห่งปี 2022 ที่ต้องการจะมีรายได้เป็นของตัวเอง ต้องยกให้กับ PG SLOT ที่เอาใจเหล่านักพนันทุกเพศทุกวัย ที่เว็บของเรา PG-SLOT.GAME

    ReplyDelete
  42. Zeed Slot168 เป็นเกมสล็อตออนไลน์ที่มีความนิยมอย่างมากในปัจจุบัน โดยเกมนี้มีการออกแบบให้เป็นเกม PG SLOTแบบ 5 วงล้อ และมีการจ่ายเงินแบบ 243

    ReplyDelete
  43. You ought to be a part of a contest for one of the finest blogs online.

    ReplyDelete
  44. I'm going to highly recommend this web site!

    ReplyDelete
  45. I am truly thankful to the holder of this site who has shared this great post.

    ReplyDelete
  46. I blog frequently and i really thank you for your content.

    ReplyDelete
  47. The article has truly peaked my interest.

    ReplyDelete
  48. I do not know who you are but certainly you’re going to a famous blogger,

    ReplyDelete
  49. I am glad that you shared this useful information with us.

    ReplyDelete
  50. Thanks for sharing. Feel free to visit my website;

    ReplyDelete
  51. Nice post thank you Kenneth

    ReplyDelete
  52. i will definitely go ahead and take advantage of this.

    ReplyDelete
  53. You absolutely have wonderful stories.

    ReplyDelete

  54. I have bookmarked your website because this site contains valuable information in it.

    ReplyDelete
  55. Thanks a lot for keeping great stuff.

    ReplyDelete
  56. This is so incredibly liberal with you to propose without limitation all that two or three people would have advanced as a computerized book to bring in some cash for themselves, especially considering the way that you could well have done it if you contemplated fundamental. Edgerunner David jacket

    ReplyDelete
  57. Thanks for sharing the content. best mortgage calculator visit realoq.com

    ReplyDelete
  58. I’m very pleased to discover this site. Thank you!!

    ReplyDelete
  59. Very informative article also check my blog post.

    ReplyDelete
  60. thanks for sharing this type of useful articles to read.

    ReplyDelete
  61. Im glad to have found this post as its such an interesting one!

    ReplyDelete
  62. Great job for publishing such a beneficial web site

    ReplyDelete
  63. Nicee post!!Thanks for sharing this quality information with us.

    ReplyDelete
  64. Goodbye encapsulated. Farewell Cards For Colleagues are the bottled messages of camaraderie, turning partings into timeless reminders of shared laughter and support.

    ReplyDelete
  65. https://crackednow.com/download-diskdigger/

    ReplyDelete
  66. https://crackednow.com/360-total-security-crack-plus-serial-key/

    ReplyDelete
  67. An interesting discussion is definitely worth comment. Write more, All the best!!

    ReplyDelete
  68. Valuable info. Thanks I discovered this awesome website here.

    ReplyDelete
  69. Lot of informative blog are provided here, Happy to read this good post.

    ReplyDelete
  70. Type of fantastic informative web site, Awesomeness! Thanks

    ReplyDelete
  71. It’s really a great and useful piece of information. Keep doing it!

    ReplyDelete


  72. Simplify your messaging experience with download dm whatsapp from MBWhatsKing. Download the latest version securely for an enhanced and personalized journey.

    ReplyDelete
  73. Thank you for this article. [abonnement iptv]

    ReplyDelete