ATMelICE signed dummy kext for MacOS X High Sierra

Go To Last Post
23 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

The AtmelICE calls itself a USB HID device for better or (mostly) worse. This causes heartburn on MacOS X because the OS claims it and you can't get at it via libusb, so avrdude doesn't work. In the past, the workaround has been a dummy kext that keeps the OS from binding it to the HID stack. High Sierra broke that because it now insists on signed kexts and all of the workarounds to date have dried up.

 

So I've ponied up for a year of the Apple developer program and asked Apple nicely to allow me KEXT signing privileges with my developer ID. And thus, behold! Here attached is a properly signed dummy kext that you can use to let avrdude see your AtmelICE with High Sierra.

 

Unpack the zip and move the file to /Library/Extensions, then do a "kextload /Library/Extensions/AtmelICE.kext". You'll get a complaint that some bozo named Nicholas Sayer wants you to approve a kernel extension. Go into system preferences, in the "Security & Privacy" section under "General" you'll see where you can approve that. You can then repeat the kextload command and avrdude should work after that (you may need to disconnect and reconnect your AtmelICE).

 

 

Attachment(s): 

Last Edited: Wed. Nov 1, 2017 - 11:54 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Wow!

 

Is there an AVRDUDE bug report?  (I couldn't find one in a quick search)

http://savannah.nongnu.org/bugs/?group=avrdude

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't know why there would be - it's not a bug in avrdude.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

One could consider a non-functional AVRDUDE as a defect.

Similar issue occurred for LUFA AVRISP where a signed Windows driver solved it.

The intention is to get your effort recognition and visibility such that your solution gets some legs.

Could also, or alternatively, announce in the AVRDUDE mailing list :

http://savannah.nongnu.org/mail/?group=avrdude

 

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sounds reasonable. I'll post it to the mailing list. Thanks!

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

FWIW, one of the replies from the mailing list says that support has been checked in (but not yet released) to link avrdude against libhidapi instead of libusb, which also solves the problem.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

I moved file to extension folder, but it told me that I installed it wrong and I can not use it.
Nonetheless, I tried terminal command:
 

-  kextload /Library/Extensions/AtmelICE.kext
 

On which, I got this error :(

 

-  /Library/Extensions/AtmelICE.kext failed to load - (libkern/kext) not privileged; check the system/kernel logs for errors or try kextutil(8)

Also, in security and privacy settings nothing appears to be approved.
 

Would much appreciate your help, my university project is based on ATmega644m.

 

 

 

Last Edited: Wed. Nov 8, 2017 - 10:35 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Pull up a terminal window and "chown -R root:wheel /Library/Extensions/AtmelICE.kext"

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

it does not give me permission 

 

chown: /Library/Extensions/AtmelICE.kext/Contents/_CodeSignature/CodeDirectory: Operation not permitted

chown: /Library/Extensions/AtmelICE.kext/Contents/_CodeSignature/CodeRequirements: Operation not permitted

chown: /Library/Extensions/AtmelICE.kext/Contents/_CodeSignature/CodeRequirements-1: Operation not permitted

chown: /Library/Extensions/AtmelICE.kext/Contents/_CodeSignature/CodeResources: Operation not permitted

chown: /Library/Extensions/AtmelICE.kext/Contents/_CodeSignature/CodeSignature: Operation not permitted

chown: /Library/Extensions/AtmelICE.kext/Contents/_CodeSignature: Operation not permitted

chown: /Library/Extensions/AtmelICE.kext/Contents/Info.plist: Operation not permitted

chown: /Library/Extensions/AtmelICE.kext/Contents: Operation not permitted

chown: /Library/Extensions/AtmelICE.kext: Operation not permitted

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry... "sudo chown...."

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

thanks, sudo chown worked, but I still got "not privileged" error for kextload :((

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Also, I have Mac OS Sierra, not High Sierra. Does it make any difference?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Are you doing kextload as root ("sudo kextload...")?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yeah, it worked with sudo, thanks you a lot, I'm new to this.

However, I still have my initial error when I try:  

- avrdude -c usbasp -p m644

Error is:

-  avrdude: error: could not find USB device with vid=0x16c0 pid=0x5dc vendor='www.fischl.de' product='USBasp'

Also, in university from their PC I successfully uploaded .hex to ATmega with c232hm cable.

But, on my Mac when I try:  
- avrdude -c c232hm -p m644p

It gives me this:

-  Can't find programmer id "c232hm"

Despite I installed c232hm drivers and even additional thing for OS X El Capitan an up.

 

Last Edited: Wed. Nov 8, 2017 - 11:12 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This kext only works for the AtmelICE. I don't know about other programmers.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have an AtmelICE device. I have placed the kext file in the extensions folder.

And I have entered the following in terminal:

 

sudo chown -R root:wheel /Library/Extensions/AtmelICE.kext

sudo kextload /Library/Extensions/AtmelICE.kext

 

But I am still getting the "not privileged" error.

Has Apple further restricted the Kext loading with the latest security update? 

 

Last Edited: Mon. Dec 11, 2017 - 05:46 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

After doing kextload, do you see a new thing show up in the security page of system preferences? You have to “allow” there before it will actually load. But it doesn’t show up there before you try once.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The first time I loaded it, it did give me the warning and and I clicked approve in the System Preferences. But after a restart the extension was still not working. So decided to give it another try. So I reinstalled the kext, and with every subsequent install I get the "not privileged" error, and it does not ask me to approve anything in the system prefs.

 

EDIT: I decided to give it another try and I reinstalled the kext (for the Nth time) and this time it went through without error. I did the exact same steps that failed last time.

However its till not actually loaded in the system as it does not appear in the list when I run kextstat. And avrdude shows this error:

jtag3_open_common(): Did not find any device matching VID 0x03eb and PID list: 0x2141

 

EDIT2: Following this article: https://www.synack.com/2017/09/0...

I have checked the KextPolicy SQLite database located at /private/var/db/SystemPolicyConfiguration/KextPolicy

And I can see that com.kfu.AtmelICE comes up as Allowed (1). So the Approval part seems to have worked. At least. Still not loading though :(

 

 

 

Last Edited: Wed. Dec 13, 2017 - 12:52 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I’m all out of ideas, unfortunately. If you reboot the system itself should load it at startup and it should work.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Does anyone have anymore information on this? I'm also getting the permissions error after attempting a kextload. 

 

Alternatively, are there any other debuggers that are known to work with High Sierra?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

@ wespiard : Still no luck here.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I don't understand. If the permissions are set right, and it's installed in the right place, there's no other trick to it.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

When you download the driver, modify the permissions in the folder you downloaded the file in, because when you copy it over to /Library/Extensions the OS immediately stages it to be loaded on the next restart.

  1. sudo chown -R root:wheel AtmelICE.kext
  2. mv AtmelICE.kext /Library/Extensions/AtmelICE.kext
    
  3. sudo kextload /Library/Extensions/AtmelICE.kext

 

So if you get a permissions error here's what you have to do.

  1. Delete AtmelICE.kext from /Library/Extensions
    sudo rm -rf /Library/Extensions/AtmelICE.kext

     

  2. Restart the Mac and get into recovery mode (hold down CMD + R while booting)
  3. Mount the OS drive by choosing the Disk Utility, select the drive and mount it from the menu.
  4. Open a terminal by going to the Utilities menu at the top of the screen and then Terminal
  5. Remove the driver from /Volumes/your volume/Library/StagedExtensions/Library/Extensions
    rm -rf /Volumes/your volume/Library/StagedExtensions/Library/Extensions/AtmelICE.kext
    
  6. Close the terminal and restart the computer
  7. Follow the steps in the first part of this post and you should have a working driver
Last Edited: Wed. Feb 14, 2018 - 01:10 PM