So, What's a Toolchain Then?
The toolchain is nothing more than the suite of software components that have to be in place on your machine to allow you to write and compile native ARM applications for the iPhone and iTouch. The ARM processor is what these lovely little gadgets use for brains, and the target environment is the same for both devices - for the most part any code written for one will run on the other, though of course there are always exceptions. I'm writing for the iTouch, which has none of the iPhone telephony hardware built into it, so it's pretty obvious that any application designed for - or needing - that hardware will only run on an iPhone, and not the iTouch. However, aside from obvious differences arising from inherent primary purpose, the two devices are largely identical from a software-engineering point of view. Whenever I refer to the iTouch, you can substitute 'iPhone' if that's your target device.
When I first sat down and started looking for some information on what tools I needed to write native (i.e. not browser-based) code for the iTouch in Windows, I spent many hours scouring the 'net. There's a lot of information out there, but I spent a great deal of time just trying to figure-out what I needed to know, what I didn't need to know, and what some of the terminology meant. This is my attempt at distilling some of that, and hopefully making the process of building the development environment a bit easier for you so you can get down to writing your code sooner.
First of all, I'd better come clean - there is currently NO native iTouch toolchain for Windows. You can't compile your killer app in the Windows environment, although there's nothing to stop you writing the code there and shipping it somewhere else for compilation. You simply won't be able to turn your source files into anything the iTouch will understand, because the tools to do it in Windows don't exist. At least, not as I'm writing this - so if you know different it's because some bright spark has constructed those tools in what is your past, but my future. If that's the case, the rest of this will probably be irrelevant to you, because it's actually about setting-up a Linux virtual machine in Windows and using tools there to achieve the desired result.
Still with me? Good - that means you've got a Windows machine humming quietly under the desk, and haven't been scared-off by my mention of the L-word. Don't feel bad if it makes you a bit nervous, though - when I started this, my experience of Linux was restricted to knowing how to spell it. By the time we finish, you'll know a bit about Linux - specifically the Ubuntu distribution of it - and maybe have an interest in knowing more. But you can also just read this as a step-by-step series of instructions to get something working, and then consider it a black box afterwards - it'll work, you don't need to care how or why, just as long as your code gets to the iTouch.
Getting The Virtual Machine Software
If you already have Ubuntu Linux running on your box, you can skip this bit. Equally, if you have some other distribution running (other 'distros' include Red Hat, Fedora, BSD, etc.) you can skip it too - chances are in either case you know a lot more about Linux than I do, and you just want to get to the bit where we install what we need for iTouch development. Bear in mind though that I'm NOT a Linux expert (yet) and so everything I write about it is based on the distro I've chosen, and it might or might not be the same for your Linux version. Caveat Emptor, and all that.
I'm not going to talk about installing Ubuntu from a bare-metal position as a native OS, or as a dual-boot option alongside any other OS. Both of these options are entirely do-able, but beyond the scope of this text - we're coming at this from a working Windows installation that we don't want to mess with, and therefore we're going to use a Virtual Machine (VM) solution. If you want to run Linux as a native OS, then exercise Google and find out how to do it - there's loads of information out there on the subject. Come back when you're happy with your configuration, and pick up from the ARM Compiler section.
I'm assuming you're running some recent flavour of Windows, probably XP or Vista. I'm running Vista x86 32-bit, and if you're running any other version, the basic rule of caution applies - what I say here will probably work on your version, but it might not. To be honest, we're not doing much in Windows aside from installing a VM host application, so we should be on safe ground.
And on that note, let's get the ball rolling.
We need a piece of software that will let us run another OS (i.e. Linux) inside it, secluded from the rest of Windows. Choices include VMWare from VMWare, VirtualPC from Microsoft, and VirtualBox from Sun. We're going to use VirtualBox, just because I'd been using it before this, and it was already installed on my PC. It's free of charge, and the current Windows x86 version (1.6) can be downloaded from here.
If you're running some other version of Windows (e.g. Vista 64-bit) you'll need to go to this page to select your platform and get directed to the right VirtualBox download.
Set that download running, and point your browser at this page because we also need to download the Ubuntu Linux installer. The version we want is the Ubuntu 8.04 LTS Desktop Edition, for either 32-bit ('standard') machines or 64-bit machines - that choice of course depends on your specific machine. What you're requesting is an image (ISO) that you could burn straight on to a CD and install anywhere you like - but as you'll see later, you don't need to burn an actual physical CD in this case. Set the download running, and wait until both it and VBox are done and sitting in your download folder.
Creating the Virtual Machine
All done? Good. Install VBox in your applications directory in the usual way, and then start it up. You'll see a fairly typical Windows app, with a nice big 'New' button in the toolbar. Click it - we're about to configure a VM to host our Ubuntu install.
The configuration wizard will first ask you for a name for the new VM - I'd suggest 'Ubuntu 8.04' or something similar - and what type of OS it's going to be hosting. Select Ubuntu from the OS Type dropdown.
Next you need to specify how much memory (RAM) to devote to the VM when it's active. This depends on how much you've got available in the PC, of course, but the default is 256MB and it's probably not a good idea to go lower. I gave mine 512MB and it's never complained.
After that, we have to tell VBox about Virtual Hard Disks. What this actually means is that a 'pretend' hard disk will be created as a file on your real hard disk - there's no actual access to your real disk by anything running inside a VM, but as far as everything in that VM is concerned it looks like a real disk. Select 'New...', and another wizard window now pops up to help you configure the disk. Choose a dynamically expanding image (so the file stays small to begin with and only grows when things inside the VM write to it), give it a name - I made the disk name the same as the VM name - and an image size. I set it to 15GB, but again you can decide based upon your actual free disk space - and again, don't go below the default of 8GB.
You'll see that the VM wizard now has your new virtual disk selected, so we can proceed and finish on the next panel. Your new VM will now pop into existence in the VBox window, and we can now install the Ubuntu Linux OS into it. Before we do, we need to do a little disk management - so click on 'File / Virtual Disk Manager' to bring the management panel up.
It'll default to the Hard Disks tab, showing you the virtual disk we set up earlier. Click on the next tab to see CD/DVD Images, which is initially empty. Click 'Add', and now browse to that Ubuntu ISO file we downloaded. When you select it, it'll show up in the tab as 'ubuntu-8.04-desktop-i386.iso'. Click OK to close the panel.
Now click the 'Settings' toolbar button and have a look at the various options for your new VM. You can adjust these at any time after creating the VM, although many of them can only be altered when the VM is 'Powered Off'.
Change some of the settings as described here. Don't worry about what we're doing just yet - you can come back and play with all this stuff later if you feel so inclined.
- General / Advanced / Boot Order - change the order so that the CD is first, and the Hard Disk second
- General / Advanced / Extended Features - tick 'Enable ACPI', 'Enable PAE/NX', and 'Enable VT-x/AMD-V' if selectable
- USB - tick 'Enable USB Controller', and 'Enable USB 2.0 Controller' if selectable
- Shared Folders - click the 'Add' button, then browse to (and create) a folder called 'Ubuntu Shared' where-ever you like to keep data in your Windows filesystem
- CD/DVD-ROM - tick 'Mount CD/DVD Drive', select 'ISO Image File', and then select the CD ISO file we added earlier.
Click OK to close the settings panel. The VM is now ready for us to start the Ubuntu install...


2 comments:
The O'Reilly open toolchain book is essential in your journey, and objective-c can be fun. Wanna see a Beta of my game...
j6wbs = jez b.t.w
Post a Comment