Oh Radeon..to patch or not to patch


As it has been well documented if you are using a radeon video card while running Linux on your PowerPC then you are in for a few hurdles. Things now are a lot more complicated with the changes from Wheezy to Jessie. In the past you really did not need KMS or accelerated hardware graphics to have a good, working, stable machine. Now with Jessie you at the least need KMS enabled if you want to have a usable desktop. If you are running a G4 following the boot parameters I laid out previously should get you going. However if you running a G3, Dan has a great walk through over here. Now that you have KMS enabled the next question is do you want accelerated graphics. It may not be important to most but there are some open source games in repositories that you can still play as long as you have 3D graphics enabled. You could set your default depth to 16 in xorg.conf, or you can install an already patched mesa package, or you could be more adventurous and try to patch the source and recompile yourself. I chose to patch and recompile the source. I wanted to see if I could do it and also I did not want to wait on others to produce a new patch version every time there is a new version on mesa. There are no plans to produce a final fix for this on PowerPC anytime soon. The current patch available is not suitable for final inclusion into upstream but it does get 3D working. So here is what you do.

First there are two resources you should read closely to understand patching and compiling deb build in Debian. The first is a great walk though on building packages which can be found in the Debian Forums. The second is a tutorial on apply patches in Linux, which can be found here. The next thing to obtain the patch files. These files can be found here. Jessie uses mesa version 10.3.2, which requires an additional patch to prevent the build from crashing during compile time. Now you will need to install the following packages that will allow you to compile into .deb packages:

sudo apt-get install build-essential fakeroot devscripts

The next step is to install the dependencies needed to build mesa and the source code of mesa itself. This is done by running the following commands (note from the install of the build dependencies till the time the .deb file are to be installed all the commands need to be done as regular user and not root):

sudo apt-get build-dep mesa
apt-get source mesa

Now to proceed to applying the patches. The patch file 08_packed_RGB_formats.diff patches the following, dri_drawable.c and dri2.c. You will need to be in the directory where the files to be patch are located. See below:

cd mesa-10.4.2/src/gallium/state_trackers/dri/
patch -p6 --dry-run < ~/Public/08_packed_RGB_formats.diff
checking file dri_drawable.c
checking file dri2.c
Hunk #1 succeeded at 163 (offset 34 lines).
Hunk #2 succeeded at 289 (offset -114 lines).
Hunk #3 succeeded at 699 (offset 150 lines).
Hunk #4 succeeded at 820 (offset 150 lines).


patch -p6 < ~/Public/08_packed_RGB_formats.diff
patching file dri_drawable.c
patching file dri2.c
Hunk #1 succeeded at 163 (offset 34 lines).
Hunk #2 succeeded at 289 (offset -114 lines).
Hunk #3 succeeded at 699 (offset 150 lines).
Hunk #4 succeeded at 820 (offset 150 lines).

The first time I ran the patch command I used the --dry-run option. This verifies the patch is good before actually applying it. This is a good habit to get into since messing up patch means deleting the source code and starting over. If you do not get the output shown above and instead are asked for the location of the file needing then patch, then this usually means you have the incorrect -p option. Please read the tutorial linked about for more detail on how to properly use it. The next patch file 09_r300g_big_endian_fixes.diff patches the following, r300_blit.c, r300_texture,c, r300_texture.h, r300_transfer.c, r300_context.h, r300_state.c, r300_state_dervied.c. This is how I applied this patch:

patch -p5 --dry-run < ~/Public/09_r300g_big_endian_fixes.diff
checking file r300_blit.c
checking file r300_context.h
checking file r300_state.c
Hunk #4 succeeded at 1659 (offset -7 lines).
Hunk #5 succeeded at 1675 (offset -7 lines).
checking file r300_state_derived.c
checking file r300_texture.c
checking file r300_texture.h
checking file r300_transfer.c


patch -p5 < ~/Public/09_r300g_big_endian_fixes.diff
patching file r300_blit.c
patching file r300_context.h
patching file r300_state.c
Hunk #4 succeeded at 1659 (offset -7 lines).
Hunk #5 succeeded at 1675 (offset -7 lines).
patching file r300_state_derived.c
patching file r300_texture.c
patching file r300_texture.h
patching file r300_transfer.c

If you are running Jessie then you are using mesa 10.3.2 with requires an additional patch to keep the compiler from crashing during build. Below are the commands:

cd mesa-10.3.2/src/mesa/main
patch -p4 --dry-run < ~/Public/dbc2d81d2ba12354876eb67c79e8a71e57e97f3c..cfeb394224f2daeb2139cf4ec489a4dd8297a44d.patch
patch -p4 < ~/Public/dbc2d81d2ba12354876eb67c79e8a71e57e97f3c..cfeb394224f2daeb2139cf4ec489a4dd8297a44d.patch

Now that the patches are applied the next was to change the version number of mesa to preserve the upgrade path. Since the current version of mesa for Stretch is 10.4.2-2, this how I changed it:

debchange -b -v 10.4.2-2a~patch1

The takes you to the changelog in a nano session. There edit the log if you want then save and exit. Now you are ready to compile your .deb packages! Just run the following:

dpkg-buildpackage -rfakeroot -us -uc

This will take a few hours to complete. So go have a drink and watch a movie while the packages are building. Then when it is completed you will see in the directory above all the .deb files. The build make the install, dev, and debug packages. I normal move them to a separate directory then segregate them into separate folders. So I then just install the packages like this:

sudo dpkg -i *.deb

Finally reboot and test! You should run the command LIBGL_DEBUG=verbose glxinfo |grep render and see this output "OpenGL renderer string: Gallium 0.4 on ATI RV350". If you do then congrats you just successfully installed a patch!

UPDATE I: It looks like starting with Mesa 10.5.5 the patches above are starting to fail. I am seeing this on Stretch. This should be expected since these patches are just really 'workarounds' and were never going to implemented upstream. You could still set the DefaultDisplay to 16 in xorg.conf to get 3D if you run into this.

These are exciting times


The title says it all friends. We are living in very exciting times.

The first reason for my excitement is the wildly talented team I have the honor and pleasure to work with. We truly have a phenomenal team of writers here. I have learned and am learning so much from all of you.

My second reason for excitement is that Jessie has gone stable (I know I'm late to the party) and has presented some challenges. Sure, installing wheezy and having sound just work on my PowerBook was nice. Challenges are good, they are opportunities to learn. They make you a better power user or driver. If you are never challenged you do not grow. I have also learned that, in the face of a challenge, things are rarely hopeless. The PowerBook sound issue is no exception. I have been given two patches to test on my PowerBook. At the time of writing this I do not know how to patch or compile a kernel. That's whats exciting, I get to learn how. In addition to learning some new skills, I get to actually help in the development process.

I know this post is rather abstract, I just wanted to drop in and share my excitement. Now I'm off to go dive into manuals and or Google.

Debian Testing for my iBook G4


I was thinking about which OS to install on iBook yesterday. I just got over a pretty frustrating experience in that department and was looking for something not too easy but more enjoyable. So Jessie is now stable and since my iBook is my "testing" machine why not install Stretch on it? The freeze is probably lifted for testing so I want to see how long I can ride before my sudo apt-get update && sudo apt-get upgrade results in me getting hit with a serious bug. This is what a "testing" machine is for right? ;-) So I went and got the netinst iso from Debian and began the install. When the cd boots it asks how you want to install and I chose the options install desktop=xfce. I really like XFCE, it is not as lightweight as LXDE but it has some more features that I prefer on my DE. The rest is pretty much what you would expect on a Debian install. It just worked. Once your system reboots remember you need to enable KMS if you have any desire for a good DE experience. I use the following setting on my iBook:

Linux radeon.modeset=1 video=offb:off video=1024x768-32 video=radeonfb:off radeon.agpmode=-1

Then when your login to the desktop you will need to make the changes permanent. Sudo does not come installed you can su to root and install it or you could just run nano -w /etc/yaboot.conf as root and add those parameters like below:

image=/boot/vmlinux
label=Linux
read-only
initrd=/boot/initrd.img
append="quiet splash radeon.modeset=1 video=radeonfb:off video=offb:off video=1024x768-32 radeon.agpmode=-1"

image=/boot/vmlinux.old
label=old
read-only
initrd=/boot/initrd.img.old
append="quiet splash radeon.modeset=1 video=radeonfb:off video=offb:off video=1024x768-32 radeon.agpmode=-1"

If you want to find out what screen resolution you need to set for your machine it can be fount at the everymac website. Remember to run this command after you finish editing to apply your changes sudo ybin -v. Setting up wireless was pretty straight forward. You will need to add contrib and non-free to the /etc/apt/sources.list file and run sudo apt-get update. Since I have Broadcom BCM4318 chip I just need to install the firmware-b43-installer package and reload the b43 module. On G4 iBooks and PowerBooks to get sound to work you will need to manually load the snd-aoa-i2sbus module and add it to the /etc/modules file. Then run the command alsamixer to set the PCM channel to 80. You need to install the pauvcontrol package as well. I also added the pmu_battery module so I can have a working battery indicator. This basically what I did to get a working system. The only issue I ran across was the xfdesktop4 service was consuming 100% cpu when I would right click on the desktop. There was already a related bug that I added my comments. I spent the rest of the evening theming my desktop. I am huge fan of Numix themes and icons so below are some screenshots. BTW does anyone want to take a guess as to how long I can ride in testing before an upgrade really hurts me?


Hello from Texas!


Thanks zen for the intro. Here is a brief summary about me and how I got here.

I am a network engineer in the Dallas/Ft. Worth area. I have been doing networking since about 2008 mostly on Cisco routers, switches, and firewall appliances. I have ventured to other network/security platforms since my start. I administer Big-IP F5 appliances, Check Point and  Juniper firewalls. I really love being a network engineer. I find the whole field fascinating.

I really got into working with PowerPC just because I wanted to get PowerBook G4 working again. It was my first computer I bought in 2006. I just loved it, then Apple moved on to Intel and you saw support for it just go away. I bought a MacBook Pro in 2009 but I never could get rid of my PowerBook. So fast forward to 2014, I pulled it out again and decided to try to see what could I use it for. Leopard was unsupported so I wanted a modern OS hence Linux. I got Xubuntu installed and working pretty easy, but there were still some issues I was working through. The biggest was video playback. Then someone on the Ubuntu forms recommended Dan's site PPC Luddite. I was blown away with what I found there. Talk about a wealth of information! Then I discovered that there was a whole community of people out there keeping this platform (which contrary to Apple is NOT dead) going. Through Dan I found PowerPC Liberation where I came accross Zen's post,  "Claim your computing freedom". It is probably one of my favorite posts on what Linux offers, freedom on your computer! So this is where how I got to where I am on PowerPC.

My blog  covers my exploring other distros and how they work on PowerPC. I do not really consider myself an expert, I like to say I am an adventurous noob :-) So far I have dealt with Debian, the Ubuntu flavors, and just recently Gentoo. I plan to cover OpenSUSE and the BSDs as well in the future. I will also eventually cover networking and security related issues as well since that what I mostly do at my job.

My main machine was a PowerBook G4 1.67Ghz running Debian, but it just died this morning. So time to look for another. I have an iBook G4 that i use for testing and a PowerMac G4 that needs some work to get going, I hoping in time to get a G5 and possibly a mac mini to add to my collection.

I am looking forward to contributing and learning from everyone here.

Yet another author, and a new view on images


As I have said before...  we will always be adding new authors here.  The author of IT musings on Linux, PowerPC, Networking, and Security, rican-linux, is the latest to join the fold, so please help me welcome him.

He is a Network Engineer, and has been a very fast learner with Linux.  Seems like the type that just gets Linux from the start.  He recently successfully installed Gentoo on his iBook, which if you've tried that you know is no small feat.

Debian Jessie becomes the new stable


Yesterday (Apr. 25), Debian released Jessie (version 8) as the new stable edition of their Linux OS.  I have yet to try it as a stable release, but plan on installing soon.

Being that this is a Linux-heavy blog, you can expect a lot of new content about the Jessie stable release from our authors here - when we have time of course - so keep checking back in to catch it.  Once I give it a thorough once over, I will be sure to share my thoughts on it.

For now - try it and share any findings.

By the way...  the new testing release is named "Stretch".  I wonder if that name has a deeper meaning?  As in to really "stretch" the time it spends in testing.