Executing Gummiworms The trials and tribulations of a grumpy curmudgeonly old git


Setting up a VM for Raspberry Pi development using Virtualbox, Scratchbox2 & qemu (Part 1)

Last week I released version 0.2 of the Raspberry Pi development VM and I thought that I could safely call it a day because in a few weeks the Raspberry Pi hardware will be available and therefore we will no longer need the VM for software development. So yesterday I announced on this blog and the Raspberry Pi forums  that I had decided to EOL the VM and would no longer be updating it as I didn't see the need and i'm not going to have the time to maintain it for the next few months as it takes about 12 to 14 hours to create, configure and upload, 8 to 10 hours of that is uploading using all my upstream bandwidth which is no longer feasible for me to do again until after June.

However, almost immediately after posting that I started to receive tweets and PM's asking me not to stop working on the VM or to at least write detailed instructions on how to create your own VM for Raspberry Pi (or other ARM based devices) from scratch. Yesterday I also finally managed to get SDL programs working correctly, not that I had actually tried that hard previously as the majority of software I was personally interested in building and porting  to the Raspberry Pi are text based and at most use ncurses. So although I really won't have time to work on upgrading, tweaking and maintaining the VM personally I have decided that it should continue to live in the form of detailed instructions on how to create your own Raspberry Pi development VM, which is almost mostly transferable to other ARM based devices as well, it's actually pretty much transferable to any device that qemu will emulate but that is beyond the scope of this how-to.

  1. If you don't already have Virtualbox and the Extension pack installed then you'll need to download it from https://www.virtualbox.org/wiki/Downloads, choosing the correct one for your platform and also download the Extension Pack from the same page if you haven't already installed it. Once you have downloaded and installed Virtualbox+Extension pack  for your platform move on to step 2.
  2. Now you'll need to decide which Linux distro you want to use for your VM. I suggest Debian, Ubuntu or Fedora. You can use any that you want but those are the only 3 that I have any personal experience with for installing and using Scratchbox2. When you have decided download the installation iso for that distro. I'm going to use ubuntu in this guide as although Fedora and Debian work and works well they do require a bit more setup for Scratchbox2 than Ubuntu. You can download the Ubuntu iso from http://www.ubuntu.com/download/ubuntu/download
  3. Once you have the Ubuntu iso downloaded, start Virtualbox and create a new Virtual machine by clicking the New button. Virtualbox will then start the Virtual Machine Wizard.
  4. Give your VM a name. I suggest something like RaspberryPi Development. Choose Linux & Ubuntu from the dropdowns (or if you are not going to use Ubuntu as the guest os then select whichever distro you are going to use). It should look something like this 
  5. Choose the amount of memory to allocate to the VM. I normally just accept the default. Ubuntu normally asks for 512MB, Fedora 738MB and Debian is normally 384MB 
  6. Create a virtual harddisk.
    choose VDI
    Dynamically allocated
    Make it at least 16GB big
    Click the Create button
    After clicking the Create button another dialog may popup and give a summary of the settings you asked for. if it does click the Create button on that dialog. You will then be returned to the main Virtualbox screen
  7. With the VM you have just created highlighted click the Settings button.
  8. You can leave most of the settings as their default settings. The only setting you MUST change is storage.The storage settings screen may look slightly different to the above as your Virtual harddisk may be on the emulated IDE controller. Personally I prefer it to be on the emulated SATA controller as it seems to be faster and less resource hungry but it's entirely up to you and YMMV but for the basis of this guide it doesn't matter which it is on.Click the little CD icon and add the iso you downloaded earlierClick OKthen click Start
  9. You may now install your choosen Linux distribution as you normally would.

This ends part one. When my copy of Ubuntu has installed i'll post part two which will cover installing guest additions and installing and configuring scratchbox2, qemu and a seed rootfs.