Thursday, August 13, 2015

Debian Kernel With Sound Fix

(UPDATE: The original version of this post had typos in the symlinks below. They have been corrected.)

Following up on my last post where I mentioned compiling a custom kernel to test sound patches, I can report the patches worked and those of you who have been suffering from that nasty soundcard detection failure will have restored sound in, I believe, the 4.2 kernel. However, if you don't want to wait that long, I'm making available the patched Jessie kernel I compiled on my Sawtooth (download link at bottom).

Actually, the first kernel I compiled was on my G3 iBook, but I compiled it without Altivec instructions, so that would be kind of useless to G4 owners. So I compiled another one on the Sawtooth (I didn't want to risk melting my iBook again), and it works fine on all three systems I've tried it on (G3 iBook, G4 Sawtooth, and G4 Powerbook). It's compiled with all the stock options; the only modifications are the two patches, this one applied on top of this one, that fix the sound bug.

So after you download it, open a terminal and use the cd command to change to your downloads directory:

cd ~/Downloads

Then install the kernel with:

sudo dpkg -i linux-image-3.16.7-ckt11-soundfix_1.0_powerpc.deb

Then to set it as your default kernel, create these two symlinks:

sudo ln -s /boot/initrd.img-linux-image-3.16.7-ckt11-soundfix /boot/initrd.img.soundfix
sudo ln -s /boot/initrd.img-3.16.7-ckt11-soundfix /boot/initrd.img.soundfix


sudo ln -s /boot/vmlinux-linux-image-3.16.7-ckt11-soundfix /boot/vmlinux.soundfix
sudo ln -s /boot/vmlinux-3.16.7-ckt11-soundfix /boot/vmlinux.soundfix


Then edit /etc/yaboot.conf, adding this kernel entry on top of the others:
image=/boot/vmlinux.soundfix
     label=soundfix
     read-only
     initrd=/boot/initrd.img.soundfix
Listing it first will keep it as your default kernel even after a software update installs a newer kernel. Conversely, if you're through with it being your default, list it somewhere other than first. As always when changing yaboot.conf, run sudo ybin -v to update the configuration.

Now using this very unofficial kernel brings up thorny security issues: how can you trust it, how do you know it doesn't have malicious code, etc. However, in the years I've written this blog, I think I've established that

a) I'm reasonably trustworthy.
b) I totally lack the skills to pull something like that off.

So install with no worries :)

Here's the download and sha256 fingerprint:

http://www.mediafire.com/download/cj8h2h4dybg2otm/linux-image-3.16.7-ckt11-soundfix_1.0_powerpc.deb

sha256: f489a9d2c617fa803bbe44c7913a4540b1705ab3e6da6b149559bddcb3b508ff

32 comments:

  1. Why don't you install the Linux headers package and then use dkms? There is already a package with the sound patches on the ubuntu forums.

    ReplyDelete
  2. Replies
    1. Thanks! I've been in a Linux mood lately, messing around with different things. It's easy to get lost in ;)

      Delete
    2. I know the feeling... Linux has a hold on me each time I use it. I always desire to go back to it.

      Juggling 3 OS in my life (OpenBSD, Linux and Mac OS) is hard when one keeps calling me in my nerd brain. I imagine it's because I know Linux the least of the three, and want to correct that.

      Delete
  3. Works great for me on a PowerBook G4. Thanks!

    ReplyDelete
  4. I installed soundfix kernel ok with your instructions,but at the
    yaboot prompt iget,soundfix no such file or directory.
    Many thanks for any info.Imac G4.
    Great site.

    ReplyDelete
    Replies
    1. When you press tab at the second yaboot prompt, does it list soundfix alongside Linux and old?

      What's in your /boot directory? Is

      initrd.img-linux-image-3.16.7-ckt11-soundfix

      and

      vmlinux-linux-image-3.16.7-ckt11-soundfix

      inside it?

      If all those answers are yes, maybe something went wrong with the symlinking. The symlinks aren't required. You could just put the full filenames in your yaboot entry:

      image=/boot/vmlinux-linux-image-3.16.7-ckt11-soundfix
      label=soundfix
      read-only
      initrd=/boot/initrd.img-linux-image-3.16.7-ckt11-soundfix

      Did you remember to run sudo ybin -v after editing yaboot.conf? That's a step I often forget myself.

      If the files mentioned above aren't in your /boot directory, then something went wrong with the dpkg installation.

      If the "soundfix" label doesn't show up when you press tab at the yaboot prompt, then it means something is misconfigured in yaboot.conf or you didn't run ybin again after editing it.

      I hope some of this helps :)

      Delete
    2. Dan ,thank you very much for your help.
      At the yaboot promt after i pressi tab i get
      "soundfix" "old" "Linux" &"Ubuntu-Linux"
      I can boot Debian8 ok,with no sound, with Linux.
      I can boot Lubuntu14.04 ok with no webkit browsers.using Ubuntu-Linux.
      With soundfix or old i get the "vmlinux no such file or directory"
      I can answer yes to all your other points.I will try yaboot.conf again.
      Many thanks for keeping our ppc macs away from the local landfill.

      Delete
    3. There was a typo previously in the symlinks on the post above, which would cause problems if you copy and pasted. I've corrected the post, so you may want to try again and hopefully it will work.

      Delete
  5. Hi Dan,

    I had a problem very simular to that of Anonymous. Thanks to some of your thoughts, I was able to puzzle it out, and now have Debian 8.2 with sound on my Powerbook G4 Titanium!

    Yep, I did suspect a symlink problem, so I tried simply placing the full
    "image=/boot/vmlinux-linux-image-3.16.7-ckt11-soundfix" (and the rest) in my yaboot.conf. No luck. I still got "no such" response when I typed soundfix in at the second yaboot prompt , though "soundfix" was clearly listed.

    Your suggestion to Anonymous to check the /boot directory to make sure that
    "image=/boot/vmlinux-linux-image-3.16.7-ckt11-soundfix" and
    vmlinux-linux-image-3.16.7-ckt11-soundfix
    were present led me to the solution. My eye had fooled me. I ALMOST had those files, but in a slightly different form, in my /boot directory.

    Instead, I had (missing the word "linux"):
    vmlinux-3.16.7-ckt11-soundfix
    initrd.img-3.16.7-ckt11-soundfix

    So, when I copied THOSE full filemanes into my yaboot.conf file, faithfully followed by ybin -v, everything worked.

    Without your suggestion to check the /boot directory, never would have figured it out. Your work has made a major difference for me in getting this old Powerbook up and running, so thank you.

    ReplyDelete
    Replies
    1. Oh, shoot, that's a really bad typo on my part. I've fixed the post. Thanks for pointing it out!

      Delete
  6. I get an odd issue when attempting to boot into the sound fix kernel on an imac G5, it loads the open firmware rom and says to "Release keys to continue"

    ReplyDelete
    Replies
    1. Hmm. Maybe it's because the kernel is compiled as 32 bits? I didn't make a 64 bit kernel because this sound bug only affects older Macs, not newer ones like G5s. If you're unable to get sound on your G5, I'm pretty sure it's for another reason. See here for suggestions:

      https://wiki.debian.org/PowerPC/FAQ#Why_doesn.27t_my_sound_work.3F

      Delete
  7. I had debian 8.2 installed and using this still caused the machine to freeze. Then I went back to Ubuntu Mate 15.10 and it's having the same issue. The only stable install I've found is MINTPPC11. Everything else just freezes after some basic use. For a daily driver MINTPPC11 would be my go to right now.

    ReplyDelete
    Replies
    1. Sounds like a graphics lock up. Did you try the boot parameter "Linux radeon.agpmode=-1"? The "-1" forces PCI mode to make the graphics stable.

      The lockup problems have to do with KMS, which isn't enabled by default on MintPPC11.

      Delete
  8. I installed debian ppc kernel 4.3.0 today - and still no soundcard found on my g4 ibook... what a shame - seems, the fix still did not make it into a newer kernel...

    ReplyDelete
    Replies
    1. The patched code is in the new kernel source according to here:

      http://lxr.free-electrons.com/source/sound/ppc/keywest.c?v=4.2

      Did you try running "sudo modprobe snd-aoa-i2sbus" to get alsamixer to load?

      My iBook's motherboard died (#!$^**$#!!!), so I can't test at the moment.

      Delete
    2. very sad to here that your ibook had died :(

      I tried "sudo modprobe snd-aoa-i2sbus" as you suggested - but nothing happens after enter it..

      when I "aplay -l" I still have no soundcard found. "uname -a" states: "Debian 4.3.3-5 bpo 8+1 (2016-01-07)

      Delete
    3. ok, now I undo some steps, I did before (commenting/uncommenting in blacklist file) and reboot. Now "aplay -l" returns: "Powermac Snapper". Another "sudo modprobe snd-aoa-i2sbus" now returns:"FATAL: module snd-aoa-i2bus not found ... any clues?! best regards

      Delete
    4. If aplay -l returns Powermac Snapper then it's seeing your soundcard and you should be able to open alsamixer and turn up the master volume and PCM level, etc. Loading the snd-aoa-i2sbus module shouldn't be necessary.

      I *believe* (though I'm not certain) Powermac Snapper cards use the snd-powermac module. If alsamixer still won't open, you can confirm the module is loaded by running lsmod and looking for snd-powermac on the list. If it's not there, you can manually load it with the modprobe command or add snd-powermac into /etc/modules to have it load on boot.

      If on the other hand you need all the snd-aoa-* modules, double check they aren't blacklisted.

      In any event, anytime I could see "Powermac Snapper", all I had to do was open alsamixer and turn up the volume and PCM level to 75% because they were muted by default for some reason.

      Delete
    5. hey Dan,

      alsamixer opens all the time, if I type 'alsamixer'. But now it contains Powermac Snapper in the soundcard section and it looks allright to me. Also got headphones, mic, pcm, and so on. Master volume is not muted (it displays some green '00' instead of 'MM'. But I never touched the PCM volume (it it turned down to zero) I´ll give that a try, later on. Thanks for helping me out :)

      Delete
    6. lamod returns snd powermac, snd pcm, snd timer, snd ... are there. when I start alsamixer, it has "PulseAudio" device acitve. I had to go "F6" then choose "snd powermac" from soundcards to get acces to all the dials. Got PCM and Master up to 75% but still no sound. when I close and re-open alsamixer, it states "Pulsaudio" again...

      Delete
    7. Ah! You have pulseaudio! I have that on a spare testing laptop and had the same problem. Try installing pavucontrol (it'll be called PulseAudio Volume Control in your Multimedia menu) and use it to unmute the volume by clicking the little speaker icon. If that doesn't work, you can try fiddling with the settings in the Configuration tab.

      You can also try uninstalling pulseaudio. Oftentimes it gets installed as a "recommended" dependency but it's not really needed. In my experience it's been more trouble than it's worth.

      Delete
    8. Dan, you are the man ;) installing pavucontrol and un-muting worked like a charm :)

      Delete
  9. I need to compile some modules, can i please have the modified source deb???

    ReplyDelete
  10. Hello Dan


    At first, i wanto to congratulate you for this great blog. Help me a lot to learn debian, not just for powerpc machines.

    I have a powerbook g4.
    If i install in it Jessie 8.4 sounds will work just with the "modprobe.. " you advise to do in your instalation guide. But Jessie dont work well in it, mouse go slows, and the laptop go on too hot without any reason. (Any advise for it also would be great)

    Then i install Whezzy, that works much better. Mouse not "laging" and the laptop not so hot.
    Some problem with graphics that i resolved installing your custom kernel. But, not sound!
    Any idea what can be?

    Will thank you a lot if you can help me with this.

    Agustin

    ReplyDelete
    Replies
    1. Hi,

      There's some extra troubleshooting stuff at the Debian PowerPC FAQ. There's an entry for sound, another for cpu frequency scaling which might help with the heat, and one for multi-touch gestures which use the Synaptics driver to improve mouse performance.

      If you have an aluminum Powerbook, you might want to look at the entry "Why are my laptop's fans in overdrive when I have nothing running?" That also deals with heat issues.

      Delete
  11. Hi Dan, Thank you for your work. I tried to install your kernel but get errors:
    sudo dpkg -i linux-image-3.16.7-ckt11-soundfix_1.0_powerpc.deb
    (Lese Datenbank ... 195549 Dateien und Verzeichnisse sind derzeit installiert.)
    Vorbereitung zum Entpacken von linux-image-3.16.7-ckt11-soundfix_1.0_powerpc.deb ...
    Examining /etc/kernel/preinst.d/
    Done.
    Entpacken von linux-image-3.16.7-ckt11-soundfix (1.0) über (1.0) ...
    Examining /etc/kernel/postrm.d .
    run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.16.7-ckt11-soundfix /boot/vmlinux-3.16.7-ckt11-soundfix
    linux-image-3.16.7-ckt11-soundfix (1.0) wird eingerichtet ...

    Hmm. There is a symbolic link /lib/modules/3.16.7-ckt11-soundfix/build
    However, I can not read it: Datei oder Verzeichnis nicht gefunden
    Therefore, I am deleting /lib/modules/3.16.7-ckt11-soundfix/build


    Hmm. The package shipped with a symbolic link /lib/modules/3.16.7-ckt11-soundfix/source
    However, I can not read the target: Datei oder Verzeichnis nicht gefunden
    Therefore, I am deleting /lib/modules/3.16.7-ckt11-soundfix/source

    Running depmod.
    Examining /etc/kernel/postinst.d.
    run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 3.16.7-ckt11-soundfix /boot/vmlinux-3.16.7-ckt11-soundfix
    run-parts: executing /etc/kernel/postinst.d/initramfs-tools 3.16.7-ckt11-soundfix /boot/vmlinux-3.16.7-ckt11-soundfix
    update-initramfs: Generating /boot/initrd.img-3.16.7-ckt11-soundfix
    Consequently my G5 do not boot but runs into open firmware and stops.

    Any suggestions?

    ReplyDelete
    Replies
    1. Hmm, I never saw that error before. The soundfix kernel was compiled for people with certain G3 & G4 models that had a hardware incompatibility. I don't think any G5s had the problem, and the hardware incompatibility was fixed in, I think, kernel 4.4.

      Delete
    2. Hi Dan,

      I installed Jessie and get
      uname -v
      #1 SMP Debian 3.16.7-ckt25-2+deb8u3 (2016-07-02)
      There is no kernel 4.4???

      Delete
  12. Thank you for this series! I have Jessie running on a PowerBook G4 1.25GHZ with 1.25GB RAM, ATI Radeon 9600. I haven't tried to get sound set up. I made some missteps along the way, but was eventually successful. Along the way, I wonder why I find Linux so compelling and why I keep trying after failure on failure. I guess it feels so good to eventually reach success.

    ReplyDelete