Wanna see this logo while booting your 2.6 kernel? Click here!

23.03.2009 10:39

Upgrading an old iBook G4 to MacOSX Leopard (10.5.6)

A friend of mine bought a used iBook G4 on ebay and asked me if I could "upgrade" it to 10.5.6. I thought this can't be that complicated and said yes, which turned out to be a bad decision after all. He gave me a disk image file of the MacOS X 10.5.6 Install DVD (6.2GB in size) and the first thing I wanted to do is to burn this dmg onto a dual layer DVD+R recordable. Of course, I did not have such a medium at home and after all, they're not really cheap (~€4 for a good quality disc). Burning dmg files directly onto discs is no possible on Windows as it seems and I don't think that k3b allows for burning dual-layer discs currently, well, I haven't really tried though, so if anyone can confirm that this would have worked, please tell me.
I tried several tools to convert the dmg file to a format which is writable with Nero or any other burning tool on windows, like dmg2iso, dmg2img (the successor of dmg2iso), MagicISO, PowerISO, ... None of them worked. dmg2i* complained about a corrupt plist in the dmg file, MagicISO said that the file is damaged and can't be read or cannot be found (that's an oxymoron, if you ask me, how does the tool know that the files is damaged if one of the possible error causes is that it cannot find the file?), PowerISO said quite the same.
I then wanted to verify the dmg file by trying to mount it with MacDrive, which worked out of the box and I could access all the files in the disk image.

I then booted the old Mac, copied the dmg over there and verified that it really works. I then played a bit with "hdiutil" just to find out that it actually is able to convert the dmg to a CD/DVD Master image (.cdr) with the following command:
hdiutil convert /path/to/filename.dmg -format UDTO -o /path/to/savefile.cdr

After I did that, I had an about 6.2GB .cdr file which I then in turn copied back to my windows machine to burn it there to the DVD DL medium (the iBook G4 did not have a DVD writer, that's why).
After burning the disc I verified with MacDrive that the disc is accessible and plugged it into the iBook then. To my surprise, nothing happened. Well, nothing is not correct, it just spat the disc out again as if it would be unable to read it. I know that the drive in the iBook is capable of reading DVD DLs because my friend burned the dmg file onto the disc and tried to boot off of it (which of course didn't work ;) ).
I then tried to tune the settings of my burning tool, created another .cdr file now with Disk Utility instead of hdiutil which resulted in a 7.2GB .cdr file (the dmg was compressed, mhm) but nevertheless, this image also didn't work on the iBook after I burnt it onto the disc.
After having wasted 4 DL discs, I restored the dmg file on the Mac onto my brand new 16GB usb flash disk and tried to boot from it, which didn't work as the firmware of this specific iBook model doesn't seem to support booting from USB devices (firewire would have been possible, but hey, who has firewire??).

OK, as a last resort, I wanted to somehow install the new version from the harddisk, meaning that I'd have to re-partition it but of course, there was just one partition on the 30GB disk and this partition held the system partition and was not resizable. Duh.

OK, reinstalling with the old MacOSX version (10.3, I think), changing the partition layout to have a spare 8GB partition after the system partition and after the installation has finished, I restored the dmg to this partition and from that point on, everything went smoothly.
After the installation has finished, I removed the second partition again and resized the volume on the first one to extend to the maximum physical space and everything was good again.

Time wasted: ~15hrs
Time worth: ~1500€
Revenue gained: 1 DL disc and a breakfast
Perception: Next time, say no.

17.03.2009 21:40

Trying to port the mga driver to Xorg 1.5

As people using the unofficial mga driver already know: It doesn't work with Xorg 1.5 because too many things in the API have been changed.
Currently, the only error message when trying to load the mga module in Xorg 1.5 is:
dlopen: /usr/lib/xorg/modules//drivers/mga_drv.so: undefined symbol: xf86ScreenIndex
(EE) Failed to load /usr/lib/xorg/modules//drivers/mga_drv.so
(EE) Failed to load module "mga" (loader failed, 7)
(EE) No drivers available.

The reason for that is, that the driver doesn't make use of the libpciaccess functions that have been introduced in Xorg 1.5 (strangely, a search for xf86ScreenIndex doesn't point out a single LOC inside the mga driver source, nor is it referenced by any participating module, but it is used by some PCI related functions for unmapping video memory, etc.).

Anyhow, my time at the moment is _VERY_ limited, but I tried to start with some changes that will eventually end in a working driver version some time soon.

Whoever reads this and can code and wants to help out those poor mga driver users: Please help us/me to complete a working driver (if possible at all, I still don't know for now, if things have to be changed in the mgaHal library, we're out of luck anyways).

As a sidenote: There's a great resource on the X.org wiki that deals with how to rework the PCI access functions, here's the link:


And here's what I've come up with so far:
Download Link: mga-xorg-1.5-migration-step1.diff
diff -Nur a/7.0.0/src/mga/src/clientlx.c b/7.0.0/src/mga/src/clientlx.c
--- a/7.0.0/src/mga/src/clientlx.c	2006-11-06 18:32:44.000000000 +0100
+++ b/7.0.0/src/mga/src/clientlx.c	2009-03-17 22:07:01.000000000 +0100
@@ -67,8 +67,11 @@
+    pci_device_cfg_read_u8(pMga->PciInfo, *pucByte, ulOffset);
     *pucByte = pciReadByte(pMga->PciTag,ulOffset);
     return 0;
@@ -95,7 +98,11 @@
+    pci_device_cfg_read_u32(pMga->PciInfo, *pulDword, ulOffset);
     *pulDword = pciReadLong(pMga->PciTag,ulOffset);
     return 0;
diff -Nur a/7.0.0/src/mga/src/mga.h b/7.0.0/src/mga/src/mga.h
--- a/7.0.0/src/mga/src/mga.h	2007-01-23 08:38:09.000000000 +0100
+++ b/7.0.0/src/mga/src/mga.h	2009-03-17 22:12:56.000000000 +0100
@@ -27,6 +27,11 @@
 #include "xf86int10.h"
+#include "xorg-server.h"
+#include <pciaccess.h>
 #ifdef XF86DRI
 #include "xf86drm.h"
@@ -48,6 +53,17 @@
 #include "client.h"
+#define MGA_DEVICE_MATCH(d,i) \
+    { 0x102b, (d), PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0, (i) }
+static const struct pci_id_match mga_device_match[] = {
+    { 0, 0, 0 },
@@ -165,6 +181,22 @@
+#define MGA_MEMBASE(p,n) (p)->regions[(n)].base_addr
+#define VENDOR_ID(p)      (p)->vendor_id
+#define DEVICE_ID(p)      (p)->device_id
+#define SUBVENDOR_ID(p)          (p)->subvendor_id
+#define SUBSYS_ID(p)      (p)->subdevice_id
+#define CHIP_REVISION(p)  (p)->revision
+#define MGA_MEMBASE(p,n) (p)->memBase[n]
+#define VENDOR_ID(p)      (p)->vendor
+#define DEVICE_ID(p)      (p)->chipType
+#define SUBVENDOR_ID(p)          (p)->subsysVendor
+#define SUBSYS_ID(p)      (p)->subsysCard
+#define CHIP_REVISION(p)  (p)->chipRev
 typedef struct {
     unsigned char	ExtVga[6];
     unsigned char 	DacClk[6];
@@ -397,8 +429,15 @@
     EntityInfoPtr	pEnt;
     struct mga_bios_values bios;
     CARD8               BiosOutputMode;
+    struct pci_device *PciInfo;
+    int mmio_bar;
+    int fb_bar;
+    int gtt_bar;
     pciVideoPtr		PciInfo;
     PCITAG		PciTag;
     xf86AccessRec	Access;
     int			Chipset;
     int                 ChipRev;
diff -Nur a/7.0.0/src/mga/src/mga_bios.c b/7.0.0/src/mga/src/mga_bios.c
--- a/7.0.0/src/mga/src/mga_bios.c	2006-11-06 18:35:15.000000000 +0100
+++ b/7.0.0/src/mga/src/mga_bios.c	2009-03-17 22:06:20.000000000 +0100
@@ -451,8 +451,12 @@
     if (pciBIOS) {
+  rlen = pci_device_read_rom(pMga->PciInfo, bios_data);
 	rlen = xf86ReadPciBIOS(0, pMga->PciTag, pMga->FbBaseReg,
 			       bios_data, sizeof(bios_data));
     else {
 	rlen = xf86ReadDomainMemory(pMga->PciTag, pMga->BiosAddress,
diff -Nur a/7.0.0/src/mga/src/mga_dac3026.c b/7.0.0/src/mga/src/mga_dac3026.c
--- a/7.0.0/src/mga/src/mga_dac3026.c	2006-11-06 18:35:33.000000000 +0100
+++ b/7.0.0/src/mga/src/mga_dac3026.c	2009-03-17 22:07:13.000000000 +0100
@@ -865,9 +865,13 @@
 	for (i = 0; i < DACREGSIZE; i++)
 		mgaReg->DacRegs[i]	 = inTi3026(MGADACregs[i]);
+  pci_device_cfg_read_u32(pMga->PciInfo, mgaReg->Option, PCI_OPTION_REG);
 	mgaReg->Option = pciReadLong(pMga->PciTag, PCI_OPTION_REG);
 #ifdef DEBUG		
 	ErrorF("read: %02X %02X %02X	%02X %02X %02X	%08lX\n",
 		mgaReg->DacClk[0], mgaReg->DacClk[1], mgaReg->DacClk[2], mgaReg->DacClk[3], mgaReg->DacClk[4], mgaReg->DacClk[5], mgaReg->Option);
diff -Nur a/7.0.0/src/mga/src/mga_dacG.c b/7.0.0/src/mga/src/mga_dacG.c
--- a/7.0.0/src/mga/src/mga_dacG.c	2006-11-06 18:52:16.000000000 +0100
+++ b/7.0.0/src/mga/src/mga_dacG.c	2009-03-17 22:07:33.000000000 +0100
@@ -962,11 +962,20 @@
         mgaReg->PIXPLLCSaved = TRUE;
+  pci_device_cfg_read_u32(pMga->PciInfo, mgaReg->Option, PCI_OPTION_REG);
+  pci_device_cfg_read_u32(pMga->PciInfo, mgaReg->Option2, PCI_MGA_OPTION2);
 	mgaReg->Option = pciReadLong(pMga->PciTag, PCI_OPTION_REG);
 	mgaReg->Option2 = pciReadLong(pMga->PciTag, PCI_MGA_OPTION2);
 	if (pMga->Chipset == PCI_CHIP_MGAG400 || pMga->Chipset == PCI_CHIP_MGAG550)
+      pci_device_cfg_read_u32(pMga->PciInfo, mgaReg->Option3, PCI_MGA_OPTION3);
 	    mgaReg->Option3 = pciReadLong(pMga->PciTag, PCI_MGA_OPTION3);
 	);	/* MGA_NOT_HAL */
 	for (i = 0; i < 6; i++)
diff -Nur a/7.0.0/src/mga/src/mga_dri.c b/7.0.0/src/mga/src/mga_dri.c
--- a/7.0.0/src/mga/src/mga_dri.c	2006-11-06 18:57:11.000000000 +0100
+++ b/7.0.0/src/mga/src/mga_dri.c	2009-03-17 21:43:01.000000000 +0100
@@ -606,8 +606,8 @@
 	xf86DrvMsg( pScreen->myNum, X_INFO,
 		    "[agp] Mode 0x%08lx [AGP 0x%04x/0x%04x; Card 0x%04x/0x%04x]\n",
 		    mode, vendor, device,
-		    pMga->PciInfo->vendor,
-		    pMga->PciInfo->chipType );
+		    VENDOR_ID(pMga->PciInfo),
+		    DEVICE_ID(pMga->PciInfo));
 	if ( drmAgpEnable( pMga->drmFD, mode ) < 0 ) {
 	    xf86DrvMsg( pScreen->myNum, X_ERROR, "[agp] AGP not enabled\n" );
@@ -858,9 +858,17 @@
    if (!pMga->irq) {
       pMga->irq = drmGetInterruptFromBusID(
+   ((pMga->PciInfo->domain << 8 ) |
+   pMga->PciInfo->bus),
+   pMga->PciInfo->dev,
+   pMga->PciInfo->func
-	 ((pciConfigPtr)pMga->PciInfo->thisCard)->funcnum);
+	 ((pciConfigPtr)pMga->PciInfo->thisCard)->funcnum
+   );
       if((drmCtlInstHandler(pMga->drmFD, pMga->irq)) != 0) {
 	 xf86DrvMsg(pScrn->scrnIndex, X_INFO,
@@ -971,9 +979,15 @@
    } else {
       pDRIInfo->busIdString = xalloc(64);
       sprintf( pDRIInfo->busIdString, "PCI:%d:%d:%d",
+         ((pMga->PciInfo->domain << 8 ) | pMga->PciInfo->bus),
+				 pMga->PciInfo->dev, pMga->PciInfo->func
-	       ((pciConfigPtr)pMga->PciInfo->thisCard)->funcnum );
+	       ((pciConfigPtr)pMga->PciInfo->thisCard)->funcnum
+   );
    pDRIInfo->ddxDriverMajorVersion = MGA_MAJOR_VERSION;
    pDRIInfo->ddxDriverMinorVersion = MGA_MINOR_VERSION;
diff -Nur a/7.0.0/src/mga/src/mga_driver.c b/7.0.0/src/mga/src/mga_driver.c
--- a/7.0.0/src/mga/src/mga_driver.c	2007-01-23 08:52:36.000000000 +0100
+++ b/7.0.0/src/mga/src/mga_driver.c	2009-03-17 22:07:40.000000000 +0100
@@ -180,10 +180,19 @@
+	  NULL,
-    0
+    0,
+    NULL,
+    mga_device_match,
+    mga_pci_probe
 /* Supported chipsets */
@@ -485,7 +494,13 @@
     if (!setupDone) {
 	setupDone = TRUE;
-	xf86AddDriver(&MGA_C_NAME, module, 0);
+	xf86AddDriver(&MGA_C_NAME, module, 
+	HaveDriverFuncs
+	0
+  );
 	 * Modules that this driver always requires may be loaded here
@@ -1093,7 +1108,12 @@
     ErrorF("mga: VgaIOSave: %d:%d:%d\n", sMga->pvp->bus, sMga->pvp->device,
+    sMga->enable = 0;
     sMga->enable = (pciReadLong(tag, PCI_OPTION_REG) & 0x100) != 0;
 static void
@@ -2303,7 +2323,13 @@
  	     (pMga->Chipset != PCI_CHIP_MGA2164_AGP)) 
-        CARD32 option_reg = pciReadLong(pMga->PciTag, PCI_OPTION_REG);
+        CARD32 option_reg;
+  pci_device_cfg_read_u32(pMga->PciInfo, option_reg, PCI_OPTION_REG);
+  option_reg = pciReadLong(pMga->PciTag, PCI_OPTION_REG);
 	if(!(option_reg & (1 << 14))) {
 	    pMga->HasSDRAM = TRUE;
 	    xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Has SDRAM\n");

11.03.2009 23:54

Modifying Crystal Report (.rpt) files

Today I was in the need to modify some text passages in a predefined crystal report file (.rpt) used by a very old application which is still an essential tool for the customer.

Of course, things like cellphone numbers, etc. change over years and that's where the need arose to change some things in the heading of the printouts of this application.
After googling a lot, I found a finally working application to modify these reoprts (the latest version of crystal report viewer didn't support these specific rpt files, because they were too old):


It's a 21-day free trial and works a treat, I have completed this task in two minutes after the download of this tool has completed. Woohoo, bookmarked ;)

11.03.2009 23:49

Analyzing Microsoft Minidumps

This entry is more a virtual, searchable post-it than something I'd like to blog about, but to help me not forget that anymore, here it is (maybe it even helps someone else who asked google about how to analyze a minidump file):

   1. Open a command prompt (Start -> Run -> "cmd")
   2. cd \program files\debugging tools (Or wherever they are installed to)
   3. kd -z C:\WINDOWS\Minidump\Mini???????-??.dmp
   4. kd> .logopen c:\debuglog.txt
   5. kd> .sympath srv*c:\symbols*http://msdl.microsoft.com/download/symbols
   6. kd> .reload;!analyze -v;r;kv;lmnt;.logclose;q
   7. You now have a debuglog.txt in c:\, open it in a text edit (Notepad?). 

Information borrowed from http://www.memecode.com/docs/minidump.php.