Trying out NetBSD on our Vaio

NetBSD 10.0 is out!! This is very exciting; they’ve poured a ton of work into making that happen. I figured in celebration I needed to install NetBSD on something around the house, and the vaio vgn-p (prev featured in Life at 800MHz) seemed fun to try it on.

So I put an installation stick in, but bad luck. Got an error where it timed out waiting for EHCI (the USB controller) to reset. I turned on some extra debug statements and added a few of my own, and learned that all the EHCI hardware registers were returning garbage data. Strange. Same problem on NetBSD 9, 8, 7- though 7.2 actually catches the problem earlier, saying “can’t map memory space”. Best I can tell, it’s just not mapping the EHCI registers properly.

Anyways the problem seems to be ACPI related. Disabling ACPI makes the problem go away, and USB works fine- though at the cost of losing all the ACPI-provided features. That’s not too big of a deal on this device, especially since I never use sleep mode or anything.

This isn’t super surprising. There is a long and extensive history of weird or buggy ACPI implementations, especially in laptops, and it’s basically whack-a-mole for OS devs to deal with all the quirks. Now I get to learn how to do that sort of debugging too. Some folks in chat have told me to cross reference the PCI descriptors with the ACPI tables, so once I go learn how to check the ACPI tables I guess that’s what I’ll be doing.

Nearly everything else seems to work after working around this problem though. I’ve got ctwm running in X. Firefox runs, though as sluggishly as I’ve come to expect on this hardware (which is why I love netsurf). I’ve got wifi and ethernet too without any problem! And the keyboard and trackpoint work. It’s a computer, wouldn’t you know it, and it runs about as well as you’d expect.

Unfortunately the external VGA output doesn’t seem to be doing anything. That one, I haven’t figured out yet where I’d start to try and fix. I also can’t seem to set custom video modes on the internal display the way I can from linux, and these problems might be related.

I mentioned the last time I wrote about this laptop that hardware-accelerated graphics on this thing requires blobbed drivers that I’ve never been able to get working. But what I didn’t mention is that, despite that, there is still a specific open source driver in the linux kernel (gma500) for this hardware. It doesn’t give you GPU-accelerated OpenGL, but it does handle things like setting up graphics modes, mapping a framebuffer into memory, and probably setting up the external VGA port as well.

I don’t know yet how pixels are even getting onto the display on this thing in NetBSD, so I have some more learning about the graphics stack to do. Maybe I can get this stuff working if I sit down with it, maybe not. Beyond technical, I think there are licensing problems if I just ported the gma500 driver from Linux, because it’s GPL2. Maybe I could ask Intel to dual-license it? They already license i915 as MIT, which is how NetBSD can support modern intel chipsets, so I guess maybe there’d be a chance. Of course nothing stops me from trying to port it anyway, but without dealing with the licensing I couldn’t share it, and that’d be a bit disappointing.

This kernel hacking stuff though, this is to me one of the appeals of NetBSD. I consider myself kind of an aspirational NetBSD user right now, because I don’t use it regularly on anything. But I keep coming back to it now and then because every time I interact with it I have such a great time reading the documentation, looking through the source code, using the compilation tools (with AMAZING cross-compilation support), and so on. It’s all very comprehensible. NetBSD really feels like it’s inviting me to work on it, in a way that a lot of OSes don’t to me. And I’ve been hoping for a problem the right size that I can do that with what energy I actually have for this sort of thing.

I think the average person probably has much better luck installing NetBSD than me though. If you install it on a normal computer, it will usually just work. Indeed that’s been my experience every time I’ve installed it on a desktop computer, or one of my thinkpads. At worst, maybe you have too new a GPU, and it’s not supported by the current version of the graphics stack. Unfortunately, I’m often cursed with weird hardware that makes me feel lucky that even linux works on it (and sometimes only works with vendor kernels, ugh).