Monday, 3 September 2012

Charging Forward and Into the Next Hurdle

Today I started upon trying to virtualise a Raspberry Pi system.

Why would I do that?  Let us recap on where my adventures have lead so far.  I have purchased 2 Raspberry Pi B boards from Element14, plus the necessary HDMI-DVI adapters and power supplies.  Today, the boards arrived.  Woohoo!  Alas the other components are on back-order.  Today I also found a supplier in Poland selling boxes for the boards on eBay - so I bought 2 boxes at just under $26 AUD including postage.  I also have a spare wireless keyboard and mouse with USB dongle ready to go, and the other day I procured 4 x 8GB Class 10 SD memory cards.  Interesting note is that today I found our local supplier - Think Technology - can supply the 8GB Class 10 cards for $15 AUD - awesome.  Note that these are blank SD cards - not cards with a pre-install of Raspbian.

So, whilst I am still in-progress for setting up to develop with the Raspberry Pis, I am not ready yet - hence why I want to create virtual instances - so I can start practicing sooner.

So, this afternoon I started to apply the instructions from Rob Zwetsloot's article, "Virtualise Raspberry Pi" in Issue 14 of Linux User & Developer.  The article and the instructions within are well written and easy to follow.  The problem, as I've found with a number of Linux publishings is that with the speed that the Open Source community runs through change, the changes naturally obfuscate the value of the instructions.  So far, I have not quite hit success.

I'll paraphrase Rob Zwetsloot's instructions to detail where I got to, and where things went differently.  Please note that for the working directory that Rob refers to in his instructions, I created:

'mkdir /qworking/'

The machine I ran this on is a Kubuntu 12.04, 64b installation.

I also ran most of the instructions with 'sudo' at the beginning, to allow for the fact that I did not have full permissions on the working directory.

  1. Download QEMU.  Easy.  At the time of the article, it appears that QEMU 1.0 was the stable version.  QEMU is now up to 1.2, so a small change.
  2. Prepare to compile.  Again, easy.  Went pretty much as per instructions.
  3. Compile QEMU.  Again a smooth operation.
  4. Debian Preparation.  As Rob notes, at the time of his article, the official release of Debian was debian6-19-04-2012, and it was available on the Raspberry Pi website.  Unfortunately on the day of this post, the only download options that I had was for Raspbian "wheezy", Soft-float Debian "wheezy", Arch Linux ARM or QtonPi.  All of these images are pre-rolled for the SD card, where as Rob's article takes more of a Roll your own approach.  Having never compiled a kernel before, I wanted to take Rob's approach. I searched the Debian site for a link to the release Rob mentioned - but could not find it.  So, I decided to try it with the Raspbian "wheezy" image.
  5. Find the rootfs.  This step while differing from that which Rob described, was easy.  I unpacked the wheezy image, the ran 'file 2012-08-16-wheezy-raspbian/2012-08-16-wheezy-raspbian.img', and got the second partition's details.  All good.
  6. Extract the rootfs.  Again, this step went smoothly when adjusted for the difference in the image name.
  7. Starting with the Kernel. Ran 'mkdir /qworking/kernel', no problems.  Attempted to download Soucery Lite from the link Rob gave - 'http://bit.ly/lHvEMv' - or at least I read that to be the link at the time.  That link failed.  But as I write this blog, I've decided to try 'http://bit.ly/IHvEMv' (Upper case 'i' in front of the H - not lower case 'L') - and that works.  At the time I was confused and searched around.  I found the site for Sourcery Tools at Mentor Graphics.  From there I found the closest download that I could to what Rob had specified - Sourcery CodeBench Lite 2012.03-56 for ARM EABI - IA32 GNU/Linux TAR package.
  8. Grab the Kernel.  Downloaded the Linux 3.1.9 kernel - no issues.
  9. Patch up the Kernel.  Downloaded the patch OK.  Went to apply it as per the instructions - found that my Kubuntu was missing the patch directive.  Easily fixed with 'sudo apt-get install patch'.  Then the patching processed worked.
  10. Kernel Configure.  Again, worked as per the instructions
  11. Kernel Settings - part 1.  Here I gave the following path for the toolchain, as per Rob's instructions, '/qworking/kernel/arm-2011.03/bin/arm-none-eabi-'.
  12. Kernel Settings - part 2
  13. Kernel Settings - part 3
  14. Kernel Settings - part 4.  All these steps worked fine - really they are the one step as there is no confirming output in between.
  15. Compile the Kernel.  Doing the last of the kernel settings and then the initial compile.  During the make step, 'sudo make ARCH=arm', I've hit an error 127, as the toolchain was not found.
  16. Using the Kernel.  In this step, Rob describes using the zImage.  Can't find it.  I guess since step 15 failed, there is no zImage.

So where to go now?  I suspect one of two things.  From step 4, perhaps the "wheezy" image requires a different toolchain to be specified in step 11.  Or, I need to use the correct version of Sourcery Lite (arm-2011.03-42-arm-none-eabi-i686-pc-linux-gnu.tar.bz2) in step 7.

In my next post, I hope to be able to give some guidance on what has worked for me.

No comments:

Post a Comment