LPC day 1

Keynote by gregkh: too hard on Canonical. I think Ubuntu has been great for Linux. The first step to hacking the kernel is to be a Linux user, and Ubuntu has helped make Debian & Linux accessible to a much wider audience.

The second step is for those new users to go beyond apt-get and start playing with upstream code from the git/hg repos. I don’t care a whit if Canonical contributes at all if they encourage a wave of new contributors. Ubuntu still makes hacking the kernel too hard. How about a working /sbin/installkernel so make install works?

Other than that, Audio MC was good (I learned stuff and wish I had time to contribute!) Track 3 talks were good, and git tutorial was long but worthwhile.

Anyone know how to tell git grep to use color, like git diff does?

Now, just time to catch up on work email (btw no probs with wireless at LPC) and start day 2 in 8 hrs.

Cats and headphones

We have a new kitten named Abby whom we love very much but who has turned out to be quite precocious. And she likes to chew things.

I thought this was fine (cute, really) but I noticed today that my headphones were only coming in on one side. Hmm, weird. Hey, what’s this gash in the cord with teeth marks all around it??

Abby!!!!! <Abby makes cute trilling sound>

These headphones are Sony MDR7506s — really nice btw, with a nice long cord. They cost $99, so I really wanted to fix them, not buy a new set just because the cord went bad. I found the service manual online and got the parts number for the cord. I also found the number for the Sony Professional service number. The original part 158079221 would have been $44.95, but it’s no longer available. It forwarded to a new part number 158079213, which costs $82.12. This is a “cord (with plug)”. Isn’t that crazy?

LPC last day for early rate!

Today is the last day to register for the Linux Plumbers Conf and get the lower rate. I highly recommend you do! I’m very excited about the program we’re going to have. I’d like to thank all the microconf runners and the rest of the program committee for their efforts in soliciting and reviewing talk submissions, and putting the program together. Not only do I think we’re going to have an interesting 2.5 days, I think meeting our goal of actually making progress in a number of these areas is almost a sure bet.

What’s that? It was touch-and-go for a bit there? Yes, but now we can laugh about it!

I’d like to extend special thanks to our web guy Brandon Philips, who has borne the brunt of an overly manual submission and review process resulting in extra work for him. Also a big thanks to James Bottomley for his help in many areas of conf organization, and also the Linux Foundation, who has made it possible to ensure all our speakers are able to attend the conference!

MinGW cross-compilation adventure.

I just finished porting a Windows driver (actually 3) to use the MinGW build environment.

Due to the Windows Device Driver Kit (DDK) being under a somewhat opaque license, we could not get legal clearance to release binaries of our GPLed code compiled with the DDK. This was bad because I, being the open-source kinda guy I am, had based my work on a pretty substantial GPLed codebase. *Surely* the DDK license couldn’t be so restrictive to prevent all binaries bsed on GPL source! Well maybe it is and maybe it isn’t. When it’s not clear, legal says no.

Not good. It looked like we were going to have to somehow pull out the work I had done and rewrite the rest of the code from scratch to be GPL-free so we could release binaries legally following the DDK’s EULA.

It was in the process of estimating the work involved that I happened to talk to Jamey Sharp at a local Linux beering. We were each talking about our work and it turned out that he was in the same boat as me, a Linux dev who through some strange quirk was working on Windows drivers. But he wasn’t using the DDK, he was using MinGW, which is a port of GCC to compile Windows binaries.

Sometime later he was kind enough to come over and show me his setup and makefile, and sure enough it worked. So, we *could* use the GPLed code if we just distributed DDK-free binaries.

Once on that path, it still did take me a while to get the driver building. One nice thing about trying to get a different build env going is that you have something that works (although you can’t distribute it 🙂

I got it compiling by modifying the driver to have function definitions etc. that MinGW lacked. But it wouldn’t link. Sigh. I was using functions that were not in MinGW’s import libraries, and could not get around this by fudging it in my driver; I had to fix MinGW. This is a big fear of mine every time I use a piece of open-source software — if your code has a Foo dependency and Foo is broken, you pretty much have to be willing to start hacking Foo if you want it fixed. (Sure you can file a bug, but obviously nobody cares about your bug except you or it would be fixed, right?)

Once I dived into MinGW (actually w32api) it was straightforward to fix. Many of my changes to get the driver compiling actually belonged in the MinGW header. There were also functions omitted from the import libraries. (Import libs tell the linker how to link to the actual shared libraries that will be present at runtime.) These were defined in .DEF files, and all it needed to know was for each function, how many bytes were its arguments? Easy, once I knew what to do. (Nothing hard, just if one doesn’t do this thing regularly, you forget how it all fits together.)

So for anyone who wants to write Windows kernel code without the DDK, it can be done. Some tips:

  • Debian/Ubuntu includes mingw cross-compiler
  • Don’t use KMDF/WDF, MinGW doesn’t support it
  • Sprinkle all callback functions with DDKAPI, so they use stdcall calling method (the compiler will complain, makes it easy.) including DriverEntry().
  • Add -DDBG to enable KdPrint()s
  • Inline asm will need to be rewritten
  • Recent GCC doesn’t have __FUNCTION__, and DDK doesn’t have __func__, so plan on wrapping with your own macros for tracing and handling this difference based on #ifdef __MINGW32__. I’m a big fan of gcc’s preprocessor, the variable-argument macros are pretty nice.
  • WinDBG needs .pdb files to set breakpoints and step through code, MinGW doesn’t generate these, so KdPrint() is your friend
  • You can’t link with libc yet sometimes you need snprintf. I pulled in Linux’s snprintf code to fill this gap, yay GPL!
  • MinGW is 32-bit only right now. For 64-bit binaries, plan on becoming a serious MinGW contributor for a while!
  • Here’s how my makefile build cmd ended up: i586-mingw32msvc-gcc $(CFLAGS) -o $@ -shared -Wl,–entry,_DriverEntry@8 -nostartfiles -nostdlib $^ -lntoskrnl -lhal -lndis
  • For reference, see the Xen GPLPV repo. More help is always welcome.

Hopefully this blog post will contain enough keywords to be helpful to someone in the future 🙂

Linux Plumbers Conf Registration and Call for Papers now open

The Linux Plumbers Conf is September 17-19 in Portland Oregon USA, immediately after the Kernel Summit as it were. It’s focused on getting kernel and userspace developers talking more and addressing issues related to the under-the-covers working of the Linux software universe.

We are running a 3 track, 2.5 day conf with 2 tracks devoted to 10 microconfs, the remaining track being devoted to misc talks, tutorials and other fun stuff. The 10 microconfs are:

  • The future of Linux storage
  • Video input infrastructure and V4L2
  • Power management and tools for efficient resource usage
  • Future displays and input devices
  • Dbus for desktop integration
  • Linux server management
  • XCB and graphics
  • Audio
  • Kernel/userspace interfaces
  • Debugging, tuning, tracing, and profiling

Today is the first day to both register and submit a talk proposal — I encourage both!

stuff’s going on!

The house is on the market! Whew. Exhale.

Also, after listening to an OReilly webcast by the author, I bought his book on open iPhone development and read it. I’ve successfully built the needed toolchain on my Linux laptop (on Gutsy — Hardy doesn’t work.) Due to the first item I haven’t had any time this week to do more, but I’m looking forward to learning more about Objective C and iPhone development, which is basically OSX Cocoa programming. I think I was turned off by ObjC’s funky syntax (what’s with all the @’s and [ ]s?) but like any language, once you get used to it it’s fine. In school I learned the intricacies of C++ partially because it was such an incredibly hard language to get right, and therefore imbued with power and mystique. But now my old attitude seems a little silly — if it’s so hard to use for no good reason, why use it? So I recently sold both Myers books and feel better for it. I’m a C and Python guy, but maybe my brain has room for a little ObjC. It could be a middle ground between the two, we’ll see. I plan to write a native iPhone app that hooks into BandRadar — I think the combination of iPhone’s location-awareness plus presenting the site’s info via the slick iPhone UI could be very cool. I don’t think any of the horde of other events sites have done this yet, although a few may very well be working on it…

Finally, The Bad Trees have a gig this Wednesday at Slabtown, check it out!

Plumbers Conf MC Runners

Of the ten people we need to run microconfs (MC Runners) at the Linux Plumbers Conf, we now have six lined up and leads on the other four slots. Once we have that, we can proceed to generating the invitee list (people we want to make sure have a chance to register) and keep working on searching for a keynote speaker.

Lists, lists, lists. Finishing one seems to mean it’s time to start on another…