OpenBSD Journal

Developer blog: kettenis

Contributed by marco on from the dept.

Earlier this year I bought myself a new Mac mini with an Intel processor. It is small, fits nicely on top of my older G4 Mac mini, and was rumoured to have a Marvell sk(4) NIC and Atheros ath(4)wireless. The only problem with it was that Apple had throw away the legacy BIOS and replaced it with EFI, Intel's new firmware implementation. So I started reading Intel's EFI documentation and set of writing an EFI bootloader for OpenBSD. However, a few weeks later, Apple spoiled all the fun by releasing new firmware that included enough BIOS compatibility code to boot straight into OpenBSD. After repartitioning the disk with the Apple Bootcamp beta, the installation started without any problem, but when I tried to configure the network, there were no interfaces. It turned out both the wired and wirless network interfaces were unsupported. I installed OpenBSD on the box using an USB ethernet dongle, and started hacking. Marvell didn't seem to provide any documentation; only binary blobs for FreeBSD and source code for a Linux driver. So since I had never written a network driver before, I started hacking on other things first. I silently hoped brad@ would hack up a driver, but these days it seems only 10GB/s is fast enough for him, so a couple of weeks ago I started looking into things again.

Meanwhile, the Linux people had written a new driver for the Yukon-2, because the driver provided by Marvell was apparently a big piece of poo. That Linux driver is almost readable, but it still took me a few hours of staring at the code before I figured out how the device was supposed to work. But once I grasped things, I realized that the new hardware wasn't radically different from the old stuff; they just replaced the dma engine. Writing the code for that is relatively straightforward once you've figured out how the bus_dma(9) kernel interfaces work. Plugging that into the existing code produced something that could send and receive packets, but would hang after a while. Of course the bug turned out to be caused by a really stupid mistake... which took me several days to find. But yesterday I finally found the problem and it's been working perfectly for me ever since.

The driver definitely needs some more testing, so if you have the hardware, give it a try!

(Comments are closed)


Comments
  1. By gwyllion (134.58.253.131) on

    So ath(4) is next on the list? So Mac users have an alternative to the evil binary atheros driver which can be exploited as shown recently on blackhat ;)

    Do you plan to write an EFI bootloader anyway? Or do you deem it unnecessary because of bootcamp?

    Comments
    1. By Anonymous Coward (68.227.41.220) on

      > So ath(4) is next on the list? So Mac users have an alternative to the evil binary atheros driver which can be exploited as shown recently on blackhat ;)
      >
      openbsd has a binary-only atheros driver?

      Comments
      1. By Anonymous Coward (65.94.57.252) on

        > > So ath(4) is next on the list? So Mac users have an alternative to the evil binary atheros driver which can be exploited as shown recently on blackhat ;)
        > >
        > openbsd has a binary-only atheros driver?
        >
        >

        No, it has a reverse engineered version of the binary blob HAL atheros provides with it's Linux driver, the whole thing in OpenBSD is open source - what he was referring to was getting ath(4) to work on the Intel Mac Mini as an alternative to the driver used in Mac OS X.

    2. By gwyllion (134.58.253.113) on

      > Do you plan to write an EFI bootloader anyway? Or do you deem it unnecessary because of bootcamp?

      The FreeBSD/ia64 EFI bootloader could be a starting point. See src/sys/boot/ia64/efi/ on FreeBSD.

    3. By Anonymous Coward (192.31.106.34) on

      > So ath(4) is next on the list? So Mac users have an alternative to the evil binary atheros driver which can be exploited as shown recently on blackhat ;)

      Not to promote blobs, but don't spread lies, they didn't compromise the evil built in wireless blob, they compromised an evil external USB wireless adapters blob.

      Comments
      1. By Anonymous Coward (199.250.8.220) on

        > > So ath(4) is next on the list? So Mac users have an alternative to the evil binary atheros driver which can be exploited as shown recently on blackhat ;)
        >
        > Not to promote blobs, but don't spread lies, they didn't compromise the evil built in wireless blob, they compromised an evil external USB wireless adapters blob.

        Actually, they also compromised the internal card as well--- see [http://blog.washingtonpost.com/securityfix/response.ppt] Question 6. It's linked from [http://blog.washingtonpost.com/securityfix/2006/08/the_macbook_wireless_exploit_i.html#more]

  2. By Anonymous Coward (87.238.80.64) on

    Hello,

    Sorry, but on which driver this article is?

    Can someone confirm that newer Apple MacBook has wireless based on Broadcom chipset and it is unsupported on OpenBSD? I have concerns and I'm unsure to buy this notebook.

    Comments
    1. By Anonymous Coward (80.60.145.215) on

      > Hello,
      > 
      > Sorry, but on which driver this article is?
      > 
      
      msk(4)

    2. By Anonymous Coward (84.155.106.131) on

      > Can someone confirm that newer Apple MacBook has wireless based on Broadcom chipset and it is unsupported on OpenBSD? I have concerns and I'm unsure to buy this notebook.

      I own a x86 based laptop with this damn broadcom wireless chip. this damn thing doesn't work. Not even linux with this project evil like tool (i forgot the name) supports it.

      Comments
      1. By Anonymous Coward (194.245.32.131) on

        > > Can someone confirm that newer Apple MacBook has wireless based on Broadcom chipset and it is unsupported on OpenBSD? I have concerns and I'm unsure to buy this notebook.
        >
        > I own a x86 based laptop with this damn broadcom wireless chip. this damn thing doesn't work. Not even linux with this project evil like tool (i forgot the name) supports it.

        you mean ndiswrapper with the win-drivers?

        Comments
        1. By Anonymous Coward (84.155.106.131) on

          > > > Can someone confirm that newer Apple MacBook has wireless based on Broadcom chipset and it is unsupported on OpenBSD? I have concerns and I'm unsure to buy this notebook.
          > >
          > > I own a x86 based laptop with this damn broadcom wireless chip. this damn thing doesn't work. Not even linux with this project evil like tool (i forgot the name) supports it.
          >
          > you mean ndiswrapper with the win-drivers?

          exactly.

          someone AFAIR tries to develop a real linux driver for it. since I updated
          to kernel I can see an additional ethN interface (but this doesn't realy
          work (at least von 2.6.15-25)).

      2. By Anonymous Coward (204.244.250.2) on

        > I own a x86 based laptop with this damn broadcom wireless chip. this damn thing doesn't work. Not even linux with this project evil like tool (i forgot the name) supports it.

        You should take a look at the open-sourced linux driver:
        http://bcm43xx.berlios.de/

        It might be a good starting point if anyone wants to do an openbsd driver.

      3. By Anonymous Coward (87.238.80.64) on

        > > Can someone confirm that newer Apple MacBook has wireless based on Broadcom chipset and it is unsupported on OpenBSD? I have concerns and I'm unsure to buy this notebook.
        >
        > I own a x86 based laptop with this damn broadcom wireless chip. this damn thing doesn't work. Not even linux with this project evil like tool (i forgot the name) supports it.

        Can you put somewhere online a dmesg(8) from this box? For example on http://nycbug.org/index.php?NAV=dmesgd if it's not problem for you. Thanks.

    3. By gwyllion (134.58.253.113) on

      > Can someone confirm that newer Apple MacBook has wireless based on Broadcom chipset and it is unsupported on OpenBSD? I have concerns and I'm unsure to buy this notebook.

      It is supposed to have an Atheros ath(4) wireless card, but according to kettenis@ it is not yet supported.

    4. By Kineox (217.109.174.117) on

      > Hello,
      >
      > Sorry, but on which driver this article is?
      >
      > Can someone confirm that newer Apple MacBook has wireless based on Broadcom chipset and it is unsupported on OpenBSD? I have concerns and I'm unsure to buy this notebook.

      I own a 2ghz Macbook, and last time I tried OpenBSD, with a 3.9 snapshot in july I think, I couldn't go through the loader since it seems that the BIOS is sending the key used to boot on CD (C) to the loader, and then I can't edit since the keyboard is USB.

      So IIRC I modified boot.conf in the CD to load the kernel directly, and the kernel started booting but it was full of error messages about USB, and didn't go to the login.

      Comments
      1. By Kineox (82.67.133.98) on

        > > Hello,
        > >
        > > Sorry, but on which driver this article is?
        > >
        > > Can someone confirm that newer Apple MacBook has wireless based on Broadcom chipset and it is unsupported on OpenBSD? I have concerns and I'm unsure to buy this notebook.
        >
        > I own a 2ghz Macbook, and last time I tried OpenBSD, with a 3.9 snapshot in july I think, I couldn't go through the loader since it seems that the BIOS is sending the key used to boot on CD (C) to the loader, and then I can't edit since the keyboard is USB.
        >
        > So IIRC I modified boot.conf in the CD to load the kernel directly, and the kernel started booting but it was full of error messages about USB, and didn't go to the login.

        I tried again today. It is much better than I thought first since errors shown about USB are probably from the built-in keyboard, which doesn't work, but a USB keyboard plugged it works !

        Unfortunately the system hangs when ifconfig tries to assign an address...

  3. By Anonymous Coward (84.44.136.62) on

    Sounds interesting, lets hope the onboard Marvel NIC of my Asus P5AD2-E Premium mainboard works too now.

    Comments
    1. By belenus (84.44.136.245) belenus@gmx.net on

      > Sounds interesting, lets hope the onboard Marvel NIC of my Asus P5AD2-E Premium mainboard works too now.
      It shows in dmesg just fine and even ifconfig shows it but when I try to assign an address the system hangs...

      Comments
      1. By Nate (65.94.57.252) on

        > > Sounds interesting, lets hope the onboard Marvel NIC of my Asus P5AD2-E Premium mainboard works too now.
        > It shows in dmesg just fine and even ifconfig shows it but when I try to assign an address the system hangs...
        >

        It's a start, maybe you could start working with kettenis to fix your problem.

  4. By Craig (70.187.215.74) on

    Works great on my Asus P5LD2.

    mskc0 at pci3 dev 0 function 0 "Marvell Yukon 88E8053" rev 0x19, Marvell Yukon-2 EC rev. A3 (0x2): apic 2 int 19 (irq 10)
    msk0 at mskc0 port A, address 00:17:31:e4:2d:d5
    eephy0 at msk0 phy 0: Marvell 88E1111 Gigabit PHY, rev. 2

    I'll send the dmesg to Mark shortly. Great work!!

Latest Articles

Credits

Copyright © - Daniel Hartmeier. All rights reserved. Articles and comments are copyright their respective authors, submission implies license to publish on this web site. Contents of the archive prior to as well as images and HTML templates were copied from the fabulous original deadly.org with Jose's and Jim's kind permission. This journal runs as CGI with httpd(8) on OpenBSD, the source code is BSD licensed. undeadly \Un*dead"ly\, a. Not subject to death; immortal. [Obs.]