Triple Boot iMac with BlitzMax

Archives Forums/MacOS X Discussion/Triple Boot iMac with BlitzMax

ImaginaryHuman(Posted 2008) [#1]
This past weekend I converted my iMac to a triple-boot setup :-)

My iMac is an Intel Core2 Duo from late 2006, with 2 x 2.0 GHz cores. I upgraded the memory first. I originally had 2 x 512MB cards so I added a 2GB card and kept one of the 512's, to give 2.5GB total. It seems like a good idea to have plenty of ram, at least for Vista, and especially if you're planning to run two or more os's at the same time in Parallels Desktop or the like. I am amazed how small and inexpensive ram cards are these days, given that my first 1/2 MB Amiga card was over 100 UK pounds and was many times larger than today's.

My Mac was originally running Tiger and has a 128MB video-ram ATI X1600 graphics card, which is shader model 3 compliant to support aero in Windows Vista. I had previously used DiskUtil from the Terminal to partition my harddrive into 3 partitions - the first one is the EFI partition, then OSX (80GB), then Linux (was FAT32, 22GB), and finally Windows (was FAT32, 40-something GB). There are plenty of tutorials online about triple booting which give you the commands to use to do the partitioning, but I did it under Tiger and I hear that now in Leopard you can dynamically resize the partition in the Disk Utility app non-destructively.

My wife has an older PPC iMac with Panther on, so I'd already backed it up, installed Leopard, and restored various files (I recommend a firewire cable, much faster than over ethernet!). So I could then back up my files to her machine pretty easily, plus backed up some files to my Windows partition to be on the safe side.

Then I performed a fresh install of OSX Leopard onto the OSX partition which was pretty straightforward. I did a full format-and-install and did the whole registering thing within the installer. Of course then you have to install the extra XCode package - there is an option to install files for Panther compatibility - I chose that option and found that it installed an earlier version of the Gnu compiler. Upon reinstalling BlitzMax I had no problems synchronizing modules or compiling them - I didn't have to go and find an earlier copy of the compiler. Everything Blitz-wise worked fine, as usual. Downloaded the latest update, synced modules, rebuild, everything is go. Of course then there are lots of updates to do for Leopard and after also installing some of my older Tiger bundled apps there were several rounds of updates to do before all was said and done, including updating to Leopard 10.5.2. Leopard is very cool in many ways.

In Leopard you don't have to burn a Windows driver disk because all the drivers and stuff are on the Leopard CD ready for installation to Windows. I did not use the Boot Camp setup assistant at all and I did not even print the installation instructions. But perhaps that's because I'd researched how to do the whole triple-boot thing fairly thoroughly beforehand.

From this point I rebooted with the Windows Vista Ultimate 32-bit CD in the drive, holding down C to boot from it. It worked fine. Went through the normal installation process. It reboots several times and the first time I wasn't sure if it wanted to reboot from the CD or the harddisk. Holding down the Option key when the Mac boots you get to choose between os's right off the bat in a nice little menu. It supports Windows and OSX and any CD's that may be present (maybe external drives too?). So it was easy to get it to boot into Windows from the harddrive. I also put in my product key as part of the Windows installation - I figured I wasn't going to bother waiting up to 30 days to fully authenticate it so why wait.

Once Vista was finished installing for the first time, I authenticated it which was pretty easy. I then put the Leopard CD in the drive and it started up automatically to let you run Setup.exe - this very easily ran a little piece of automatic software which proceeded to install all the extra Apple drivers and software, to let you use things like the iSight camera, the wireless card, special keys on the keyboard, etc, plus some neat little additions in various places in Vista to let you do things, like changing brightness/volume and so on.

After a reboot I went back into Vista and ran Windows Update. There were lots of updates to do (still not done Service pack 1 yet), involving several reboots. Once all updates were finally done (for a while), I also ran the Apple software update tool, which Apple kindly installed already. It ran just like on the Mac and proceeded to let me download Safari, iTunes and Quicktime. I know Vista has its own software in these areas but hey.

After that there really wasn't much else to set up in Vista besides installing BlitzMax. That was fairly easy although I bodged up the environmental variables for MingW the first time - made a new variable instead of adding it to the path variable. Seems you gotta add C:\MingW\Bin to the PATH variable, and I also added C:\MingW\ to a new `MingW` variable. Not sure if it's needed. I couldn't get BlitzMax to compile at first, partly due to getting used to the whole security thing in Vista. I had to set the MaxIDE app to run in `Administrator` mode before it would let me do a SyncMods from the IDE, or get compilation working. Editing the Properties for MaxIDE lets you set it permanently as an admin app, but you still gotta remind Vista that you actually did want to run it - all that user protection stuff. Eventually after some reboots and more updates and syncmods and recompiles and so on, everything in BlitzMax is up and running just fine. The steps to install it on the forums are pretty much all you need.

Having Vista and OSX on the same computer now, and being able to boot into each with the Option key held down at reboot, proved to be pretty easy and satisfying. And I used it that way for a while until I had opportunity (time) to do the next part.

The Apple boot menu doesn't support Linux, so various other steps are necessary including a replacement for/addition to the boot menu, which comes in the form of the ReFit application, easily downloadable and simple to install on OSX. After installation it simple required a reboot and to get into the boot screen again to see that the icon for OSX was relabelled as ReFit. Going into what looks like a `ReFit disk` gives you a full menu where you can choose to boot into various os's including Windows and Linux, plus from a CD, and there's also some other options there should you need them. At this point though I just wanted to know it would work okay, and it did - booted just fine into OSX or Vista.

The next step is Linux, and this was arguably the most difficult step, which is a little disappointing. Initially I had downloaded Kubuntu 7.10 which was recommended to me by my cousin. I wanted to be sure it would work correctly on my mac, given maybe the hardware wouldn't work or something, so I burnt the iso image to a CD. Since it's a live CD you can just put it in the drive and reboot into it via the boot menu (standard or ReFit) and it should then boot up. However, it did not work for me. I got various different visual problems and absolutely no sign of a desktop other than a temporary mouse pointer. Depending on which other options or resolutions I tried I would get different disasters after it attempts to boot up. It just didn't work with my machine. My cousin has a newer recent iMac, purchased only weeks ago, and apparently Kubuntu 7.10 booted up fine for him. I don't know why.

So anyway, while looking around online I noticed some people suggesting to try the 7.04 `Feisty Fawn` installation and to upgrade later to the latest version. I also wasn't entirely convinced that the KDE desktop was going to work out, so I went with standard Ubuntu 7.04 (missing the K) and burnt the iso image to a CD. It booted perfectly first time! I have no idea what the issue was with 7.10. I could only get Linux to boot into a 1024x768 resolution, though.

The next thing I tried, and this is really a sidestep, is to get Vista running on Parallels Desktop for Mac. This was actually much easier to achieve than I expected and I was very impressed with the benefits. It is so easy to use the `Spaces` in Leopard to easily switch between full-screen-mode desktops of Vista or OSX. It's also nice trying to run Vista apps in native OSX Windows. The integration is very good and Vista ran at normal (surprisingly quick) speed. Parallels 3 can use the existing Vista partition, which btw had to be reformatted to NTFS before Vista would install. I highly recommend Parallels for productivity purposes and easy of switching between OS's. It almost makes it feel like Windows is just another part of the Mac environment.

Now, where Linux is concerned, I did install try to install the Kubuntu 7.10 disk image as a virtual machine in Parallels. It still did not work. But I figured the 7.04 was going to work perfectly okay, so I had to decide - did I want to run Linux only as a virtual machine in Parallels, or as a native o/s with its own partition? At the moment Parallels doesn't support using a Linux partition directly so you have to make a virtual harddisk - but that would of course mean you can't boot into Linux directly after a reboot. I decided I wanted the `full` Linux experience so was going to go for the full install route and think about how to virtualize it later. See, if I install Linux fully on a partition able to boot by itself Parallels cannot see it, and if I install Linux as a virtual machine in Parallels that means two copies of Linux - ie a Linux virtual installation running within the Linux partition. I am not sure how I feel about that or whether to make a minimal installation virtual Linux to be able to access the Linux partition from OSX. Reason being - Linux did not want to install to FAT32 so I had to reformat it to ext3, which OSX will not even mount.

So anyway, back to Linux, I put the live CD of Ubuntu 7.04 in and booted it up. Someone had said you needed to download and install the Linux debian package for ReFit in order to be able to use the partition table sync tool. Since I did not have an internet connection in Linux (wireless wasnt working) I downloaded it on OSX, stored it on the flash card of my digital camera and then transferred it to the Linux desktop via USB before installing the os. I found instructions on the web someplace, to open up a Terminal window and type in the syncing command but to not execute it until later. You're not actually installing ReFit again, you're just syncing the two types of partition tables (or something) so that everything works.

Then I started the Linux installation process. It's pretty easy to do. There are two parts that you have to get right. When asked about partitioning and whether to use guided partitioning, you must choose to go the`Manual` route, which lets you decide where Linux will be installed. It listed my partitions. You have to choose the partition you want and then set the properties for it, which entails saying that "/" will be installed to the Linux partition. Make sure you choose the Linux partition which in my case is the one inbetween OSX and Windows and is #3 in the list, described at disk0s3 or sda3. I then chose a format for the partition and wanted to install to FAT32 so that OSX could see the disk, but it would not let me - so I chose ext3 format. This then entails that the drive will be reformatted.

As you continue there then the second important option - the `Advanced` button. You must click it to go in and decide where grub (the boot-loader) will be installed. Initially it says "(hd0)", and that word is actually a button. You click on it and remove the (hd0) text, then press Ok. You go back to the previous screen and now the (hd0) button has been replaced with a "/dev/" button. You click the button again and add sda3 to the end of it, so it reads /dev/sda3 - this refers to the third partition on the harddrive. When you click okay it should now show a button with /dev/sda3 on it. You can then proceed - this is the disk to which the grub boot loader will be installed - you do NOT want to install it to the standard (hd0) because that will overwrite your EFI boot loader and may stop your computer booting altogether! I am not sure if that's true but I did not want to risk it so was very careful to make sure it was going to us the /dev/sda3 path.

Finally you can carry on with installation and everything was fairly simple from there, but you have to watch for one thing - the percentage of progress. After the 22% mark, the installer has finished copying some files and you can now go back to the Terminal and press `Return` to execute the partition table resync tool which came with ReFit. This must run no sooner than the 22% install mark otherwise the installer will overwrite the changes. I press return somewhere around the 25% mark just to be sure. You have to press prior to the 92% mark, apparently, but I was well within that ;-) The installation finishes and hey presto. I rebooted, went into the ReFit menu, chose the Linux partition and it booted up. :-)

I still only got a 1024x768 screen, had no wireless network, had unaccelerated OpenGL and no BlitzMax. Avoiding the wireless temporarily I plugged in a normal Ethernet cable which connected to my Router. I didn't have to do anything other than go up to the little icon on the title bar and choose the `wired ethernet` connection. It connected. I didn't have to type in any DNS settings or anything. I was online! Firefox is included so online status is easy to test. The next desired step was to get the ATI hardware acceleration working, and clearly it was running in software mode as seen by testing some Screensavers.

For me I have an ATI Radon X1600 card with 128MB Video Ram. It is Shader Model 3 compliant and has all the necessary gubbins for Vista aero to work - oh, any btw, Parallels currently cannot use Aero while running Vista, you have to use the basic interface, but it's ok. To get the ATI card working fully was easily done by installing the 3 packages mentioned in a couple of threads on the forums here, specific to ATI cards. After installing and rebooting I not only had hardware accelerated OpenGL but also a full plethora of screen resolutions including my Native display res of 1440x900. I downloaded all the packages needed for BlitzMax, also outlined clearly in the Ubuntu installer guides on these forums, and istalled and upgraded BlitzMax. It had no problem syncing mods or rebuilding them or compiling apps, although it does show a few warning from time to time. This doesnt appear to stop compilation or to prevent the compiled app working right. It was nice to see the OpenGL hardware accelerated from within BlitzMax.

The last hurdle in Linux is getting the wireless networking to work. My card is not supported by default and I'm trying the ndiswrapper but I have not been able to get it to work yet, it seems quite a complex process and I did not see the results which were explained in the various places online. So for now my Linux is wired-ethernet only and I've given up on it for now. Other than that, and after doing numerous updates for Ubuntu, I decided not to upgrade to 7.10 yet. I want to see a full desktop running normally from a live CD before I will install or upgrade the OS version and apparently Ubuntu 8 is coming out soon so I will wait for it.

All told, the OSX, Vista and Parallels parts of all this were much easier and nicer and cooler than I expected. The Linux part is cool too but it's just a pity the whole thing wasn't quite as reliable or easy or well-supported as the other two major os's. But still, now I have a triple-booting iMac running BlitzMax on all three platforms, so I can now begin to generate software products for all three from a single computer. And should I need to do a PPC Mac executable I can use my wife's machine and then do the whole universal binary thing. Although, saying that, although universal binaries are easy to use I am not entirely fond of having to download bigger executables than necessary, I'd rather have a single native executable for the CPU I'm using.

So anyway, there you have it. This is all quite fun to do and there were surprisingly few if any hair-raising moments. It is cool to bring in blitz code and compile it on each platform and see it do exactly the same thing, and at a similar speed. I haven't tested anything like frame-rates or whatever yet, but that will come. OpenGL is working on all three platforms with hardware acceleration which was one of my main concerns. I think it's beneficial to be able to see the speed/functional/operational differences of the same software on the same *hardware* under different OS's, because then you can really be sure of which platforms are doing better than others, or what their strong points are, knowing that the hardware is not a variable. I'm excited to start some cross-platform development now that I have the hardware and software to support it.

Of course I went back and downloaded many Blitz Showcase entries, having not been able to see many of the Windows-only apps before. There is some interesting stuff out there, and in greater number than on the Mac side. I have not seen anything for Linux yet, but maybe I didn't look hard enough.

The only thing I am not sure about yet is how to access the various partitions fully from each o/s. Windows seems able to read and write to OSX okay but not to Linux. OSX seems to be able to read the Windows disk but not write to it, and does not see Linux at all. And Linux can see both others but as read-only. So it's really a matter of deciding whether to copy stuff `to` a disk or to read it `from` a disk, depending on what o/s you're in. But I'm sure there's some utilities or drivers out there to make this more seamless, and Parallels has a tool to transfer files between os's. It's all good.

So the big question is, which of the three os's do I like the most? ;-) .... Mac OSX of course! Windows Aero is really quite nice but very copy-cat-not-done-as-well. Linux is of course the young newbie on the scene and I still haven't tried the new KDE4 desktop, but I am sure OSX will stay the best for for foreseeable future. Leopard rocks!!!

Now to get back to writing that next great game.


Winni(Posted 2008) [#2]
Funny. I think I've only found this just now.

Congratulations and thank you for the very detailed report! I'm sure many readers here will find it very useful and will be using it as a reference documentation.

I never went through the hassle of a triple boot installation myself. To be honest, I almost never use my native Vista installation at home and whenever Linux is running, I'm asking myself after one or two minutes what do I want to do with it and why did I install and launch it in the first place? There are literally no applications for it that would attract me to the platform, and the only machine that I know that is supported out of the box by GNU/Linux is an Intel Mac Mini. And when I need a free server OS, I prefer FreeBSD over GNU/Linux anytime.

I also do not care much for multi-platform development anymore - I do not want to support Windows and GNU/Linux is a market for system administrators or employed software developers. I am already the first in a Windows environment and I somehow do not want to become the latter when I'm good and ready to finally quit my current job.

How does your native/BootCamped Windows read and write OS X partitions without third party drivers? The only way I know is to install MediaFour's MacDrive on Windows; only then the OS X filesystems become visible and accessible.

Ubuntu Linux always managed to access the OS X filesystems, but OS X was not able to access the native Linux partitions. However, it does not really matter as long as everybody can access at least the OS X filesystem.

Universal binaries vs native-only binaries: If you want to sell Mac software, Universal binaries are the only way to go. I don't think the regular Mac user will accept anything else, and most of them do not even know or care for what CPU they have in their machine anyway.


ImaginaryHuman(Posted 2008) [#3]
Hey, someone replied :-) Actually I figured it wasn't the kind of thing to discuss as such, just thought I'd put my experience out there in case it might be useful.

My preferred os is still OSX, then Vista then Linux at the moment. It's a pity, I was hoping Linux would be nicer to use but it is very technical and some of the hoops you have to go through are just archaic in this modern world of GUI's and buttons.

I am not entirely sure at this point which os's can see which other os's. I know Linux is pretty good at being able to see OSX and possibly also Windows. OSX itself can normally only access Windows as read only, and it would not show Linux at all. I installed a `thing` that lets me see the Linux partition booted, but again it's mainly read only. I am not sure about Windows but I think it can see at least one of the other two partitions. Either way there is some way to distribute a file to all of the os's in one way or another, either that you copy a file `to` an os or read it `from` an os within another.

Also I am running Parallels Desktop which I highly recommend. Apart from being able to do things like use the clipboard across os's in realtime it also has a file transfer utility which lets you move files between any of the running os's. I haven't tested it out much yet but I'm sure it will come in handy.

I guess you have a point about Universal binaries. Personally I prefer a single binary for my CPU and hopefully when PPC machines are more phased out that will be easy to do, but I can see how the average or basic user wouldn't know what the difference is and would need the Universal Binary.

I don't personally WANT to support windows and linux as target platforms for my software, but the sheer size of the Windows market compared to the Mac market makes it very hard to resist. I have to put aside my continued dislike for Windows and tolerate it for the benefit of being able to provide access to more people and to hopefully therefore enjoy many more sales. As for linux it is almost more of a curiosity than a need as I know the market is fairly small, but I think the market will continue to increase because everyone loves something for free or for little cost. I thought it would be just a good jesjure and also kind of cool to make my software available for it - but that said I haven't tried doing that yet so we'll see how it works out.

It's funny but when you put os's up alongside each other, and especially if you're running them simultaneously in parallel like with Parallels Desktop, it starts to really blur your preference for which one you use. They start to look a feel quite alike and the differences between them start to look less and less. After all, putting personal preference aside, each platform is basically just a target platform - a way to get my software to work on a given piece of hardware, and the whole point of an operating system is to interface between the software and the hardware. So I'm not really being anti patriotic or whatever by wanting to get my stuff to run on more platforms. It's more of a business decision. My loyalty to any given platform is a lot thinner than it used to be in the Amiga days and it doesn't really matter to me so much what the platform is. I just know that BlitzMax is great for cross-platform OpenGL-based development and that's where my focus is. If BRL came out with like a web-based plugin execution system for BlitzMax programs, or maybe to run on some other CPU's devices, I'd probably be interesting in getting those just to widen my audience. After all what's more important, having a bigger audience with greater accessibility to your product, or shutting out a potential audience due to a personal dislike for their choices?

Rant over.