Sunday, September 16, 2012

Booting a PowerBook from a LiveCD image on an USB-Stick

I have an old Apple PowerBook G4 with a broken CD/DVD drive. For most practical purposes, the broken drive is no issue. However, if you're going to re-install the laptop, it becomes one. Luckily, the PowerBook is able to boot from USB...


At first, I tried following the instructions on "LiveUSB on PPC" found in Gentoo's Wiki, but that didn't work out at first. I then found a blog entry titled "Creating a bootable USB Stick with Mac OS X in 10 easy steps". Combining the two lead to success, so here's what I did:


  • I downloaded the latest PowerPC release of Finnix, a " self-contained, bootable Linux CD distribution" from the project's front page.

  • I re-named the ISO image from finnix-ppc-105.iso to finnix-ppc-105.dmg. Also, I displayed the file's information in Finder by right-clicking on the file icon and selecting "Show Information". I doubt that this step is required but it certainly didn't do any harm.

  • From a shell, aka "Terminal Window", I used the command diskutil list to find the device path to my USB drive. In my case, it was /dev/disk6.

  • I then unmounted the drive by running

    $ diskutil unmountDisk /dev/disk6

  • Using good, old dd(1), I wrote the disk image to the USB drive:

    $ sudo dd if=finnix-ppc-105.dmg of=/dev/disk6 bs=1m

  • Finnally, I unmounted the drive by running:

    $ diskutil eject /dev/disk6


In order to boot the PowerBook from the USB drive, I had to drop into Open Firmware. In case you didn't know it, this is done by holding down Cmd+Option+o+f right after the computer is turned on.


The next step was to find the device node of the bootable USB drive. To do this, I browsed the device tree for any USB node that had a disk child node.

> dev /
> ls

In my case, the USB drive was at /pci@f2000000/usb@1b,1/disk@1.


The instruction found on the Gentoo wiki assign the cd alias to that node, so I did that, too, by running:

> devalias cd /pci@f2000000/usb@1b,1/disk@1


This allowed me to finally boot from the USB drive like this:

> boot cd:,\\:tbxi

Tuesday, July 3, 2012

Ubuntu 11.10 on Lenovo W520

At work, I got a new laptop -- a Lenovo W520. It came with Ubuntu 11.10 ("Oneiric Ocelot") pre-installed by the support team. My first impression was that it worked pretty well, but I quickly discovered that I couldn't change the brightness of the display through the Fn+Home/End keys.


The W520 uses this "Optimus" technology with an integrated on-board graphics card plus a separate NVIDIA card, where both cards can be switched on-the-fly -- on Windows. The default installation used the high performance card and I suspected that the video card driver was keeping me from adjusting the brightness. As it turns out, after switching to the on-board Intel card, things worked fine. Here's what I needed to do:


First, I needed to disable the NVIDIA card in "the BIOS" and switch to the on-board card. There's an option somewhere under "Setup", then "Display", if I recall correctly.


Next, I changed the video card section in my /etc/X11/xorg.conf to read this:


Section "Device"
  Identifier "Device0"
  Driver "intel"
  Option "Shadow" "True"
  Option "DRI" "True"
EndSection

In fact, I added the two Option lines later on and only changed the Driver line at first. I then discovered that most of the little try icons in the upper right corner of the Gnome desktop wouldn't show anymore. A look at /var/log/Xorg.0.log turned up some errors and running glxinfo yielded lines like these:


Xlib:  extension "GLX" missing on display ":0.0".

Luckily, someone else ran into the same issues over at http://theiszm.wordpress.com/2010/06/27/glx-missing-on-display/. As indicated there, I also ran these commands:


$ sudo apt-get purge nvidia*
$ sudo apt-get install --reinstall xserver-xorg-video-intel \
    libgl1-mesa-glx libgl1-mesa-dri xserver-xorg-core
$ sudo dpkg-reconfigure xserver-xorg
$ sudo update-alternatives --remove gl_conf /usr/lib/nvidia-current/ld.so.conf

The first command hinted that some "ubuntu-desktop" package would also be removed. I don't know what that is, but I don't miss it, yet. Anyways, after a final reboot, the brightness adjustment now works and all my tray icons are back in place.